Skip to content

Commit 016184e

Browse files
ATHBKATHBK
authored andcommitted
Fix bug on android 5.0
Fix bug on android 5.0
1 parent 8eec3e4 commit 016184e

File tree

11 files changed

+116
-4
lines changed

11 files changed

+116
-4
lines changed

.idea/compiler.xml

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copyright/profiles_settings.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/athbk/changeavtarliketinder/MainActivity.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ protected void onCreate(Bundle savedInstanceState) {
3737
listString.add("https://tapchianhdep.com/wp-content/uploads/2016/07/girl-xinh-11.jpg");
3838
listString.add("http://sohanews.sohacdn.com/2016/photo-7-1467618024092.jpg");
3939
listString.add("http://cms.kienthuc.net.vn/zoom/1000/uploaded/manhtu/2015_12_21/tl/hot-girl-xinh-dep-khien-ai-ngam-cung-muon-phau-thuat-tham-my-hinh-9.jpg");
40+
listString.add("http://cms.kienthuc.net.vn/zoom/1000/uploaded/manhtu/2015_12_21/tl/hot-girl-xinh-dep-khien-ai-ngam-cung-muon-phau-thuat-tham-my-hinh-9.jpg");
41+
listString.add("http://cms.kienthuc.net.vn/zoom/1000/uploaded/manhtu/2015_12_21/tl/hot-girl-xinh-dep-khien-ai-ngam-cung-muon-phau-thuat-tham-my-hinh-9.jpg");
42+
listString.add("http://cms.kienthuc.net.vn/zoom/1000/uploaded/manhtu/2015_12_21/tl/hot-girl-xinh-dep-khien-ai-ngam-cung-muon-phau-thuat-tham-my-hinh-9.jpg");
43+
listString.add("http://cms.kienthuc.net.vn/zoom/1000/uploaded/manhtu/2015_12_21/tl/hot-girl-xinh-dep-khien-ai-ngam-cung-muon-phau-thuat-tham-my-hinh-9.jpg");
44+
listString.add("http://cms.kienthuc.net.vn/zoom/1000/uploaded/manhtu/2015_12_21/tl/hot-girl-xinh-dep-khien-ai-ngam-cung-muon-phau-thuat-tham-my-hinh-9.jpg");
45+
listString.add("http://cms.kienthuc.net.vn/zoom/1000/uploaded/manhtu/2015_12_21/tl/hot-girl-xinh-dep-khien-ai-ngam-cung-muon-phau-thuat-tham-my-hinh-9.jpg");
46+
listString.add("http://cms.kienthuc.net.vn/zoom/1000/uploaded/manhtu/2015_12_21/tl/hot-girl-xinh-dep-khien-ai-ngam-cung-muon-phau-thuat-tham-my-hinh-9.jpg");
47+
listString.add("http://cms.kienthuc.net.vn/zoom/1000/uploaded/manhtu/2015_12_21/tl/hot-girl-xinh-dep-khien-ai-ngam-cung-muon-phau-thuat-tham-my-hinh-9.jpg");
48+
listString.add("http://cms.kienthuc.net.vn/zoom/1000/uploaded/manhtu/2015_12_21/tl/hot-girl-xinh-dep-khien-ai-ngam-cung-muon-phau-thuat-tham-my-hinh-9.jpg");
4049

4150
AvatarAdapter adapter = new AvatarAdapter(this, listString);
4251
recyclerView.initRecyclerView(this, adapter);

avatarview/src/main/java/com/athbk/avatarview/TinderRecyclerView.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.content.res.TypedArray;
55
import android.support.annotation.Nullable;
66
import android.support.v7.widget.LinearLayoutManager;
7+
import android.support.v7.widget.OrientationHelper;
78
import android.support.v7.widget.RecyclerView;
89
import android.support.v7.widget.helper.ItemTouchHelper;
910
import android.util.AttributeSet;
@@ -35,10 +36,12 @@ public TinderRecyclerView(Context context) {
3536

3637
public TinderRecyclerView(Context context, @Nullable AttributeSet attrs) {
3738
super(context, attrs);
39+
init(context, attrs, 0);
3840
}
3941

4042
public TinderRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
4143
super(context, attrs, defStyle);
44+
init(context, attrs, defStyle);
4245
}
4346

4447
private void init(Context context, AttributeSet attrs, int defStyle){
@@ -60,7 +63,6 @@ public SpannedGridLayoutManager.SpanInfo getSpanInfo(int position) {
6063
}
6164
}
6265
}, column, spectAtio);
63-
spannedGridLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
6466
setLayoutManager(spannedGridLayoutManager);
6567
setAdapter(adapter);
6668

avatarview/src/main/java/com/athbk/avatarview/adapter/TinderRVAdapter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.athbk.avatarview.adapter;
22

33
import android.support.v4.view.MotionEventCompat;
4+
import android.support.v7.widget.OrientationHelper;
45
import android.support.v7.widget.RecyclerView;
56
import android.view.MotionEvent;
67
import android.view.View;
@@ -50,6 +51,7 @@ public boolean onLongClick(View v) {
5051
return false;
5152
}
5253
});
54+
5355
}
5456

5557
@Override

avatarview/src/main/java/com/athbk/avatarview/utils/SimpleItemTouchHelperCallback.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public boolean isItemViewSwipeEnabled() {
5454
@Override
5555
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
5656
// Set movement flags based on the layout manager
57-
if (recyclerView.getLayoutManager() instanceof GridLayoutManager) {
57+
if (recyclerView.getLayoutManager() instanceof GridLayoutManager || recyclerView.getLayoutManager() instanceof SpannedGridLayoutManager) {
5858
final int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT;
5959
final int swipeFlags = 0;
6060
return makeMovementFlags(dragFlags, swipeFlags);

0 commit comments

Comments
 (0)