-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Kaufland/bugfix/restore-position-keyboard-…
…hide # Restore swipe position on Layout
- Loading branch information
Showing
4 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
app/src/main/java/kaufland/com/demo/example/MyItemRecyclerViewAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
swipelibrary/src/main/java/kaufland/com/swipelibrary/LayoutCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package kaufland.com.swipelibrary; | ||
|
||
import android.graphics.PointF; | ||
import android.view.View; | ||
|
||
import org.androidannotations.annotations.EBean; | ||
|
||
import java.util.Collection; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Created by sbra0902 on 21.06.17. | ||
*/ | ||
@EBean | ||
public class LayoutCache { | ||
|
||
|
||
Map<View, PointF> mLayoutCache = new HashMap<>(); | ||
|
||
|
||
public void restoreOnLayout(){ | ||
|
||
for (View child : mLayoutCache.keySet()){ | ||
|
||
PointF restorePoint = mLayoutCache.get(child); | ||
|
||
if(restorePoint != null){ | ||
child.setX(restorePoint.x); | ||
child.setY(restorePoint.y); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
|
||
public void captureChildrenBound(Collection<View> views){ | ||
|
||
for (View child : views) { | ||
PointF point = mLayoutCache.get(child); | ||
if(point==null){ | ||
point = new PointF(); | ||
mLayoutCache.put(child, point); | ||
} | ||
|
||
point.x = child.getX(); | ||
point.y = child.getY(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters