Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0d205a2

Browse files
committed
add method beginDrag for DragFlowLayout
1 parent bc4cd49 commit 0d205a2

File tree

5 files changed

+278
-252
lines changed

5 files changed

+278
-252
lines changed

‎Drag-FlowLayout/app/src/main/java/com/heaven7/android/drag/demo/DragFlowLayoutTest.java‎

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
import android.os.Bundle;
44
import android.support.annotation.NonNull;
5-
import android.support.v7.widget.RecyclerView;
6-
import android.view.MotionEvent;
75
import android.view.View;
86
import android.view.WindowManager;
97
import android.widget.TextView;
@@ -28,8 +26,6 @@ public class DragFlowLayoutTest extends BaseActivity {
2826

2927
@InjectView(R.id.drag_flowLayout)
3028
DragFlowLayout mDragflowLayout;
31-
@InjectView(R.id.rv)
32-
RecyclerView mRv;
3329

3430
private int mIndex;
3531
@Override
@@ -52,12 +48,6 @@ protected void initView() {
5248
protected void onDeleteSuccess(DragFlowLayout dfl, View child, Object data) {
5349
//删除成功后的处理。
5450
}
55-
56-
@Override
57-
public boolean performClick(DragFlowLayout dragFlowLayout, View child, MotionEvent event, int dragState) {
58-
super.performClick(dragFlowLayout, child, event, dragState);
59-
return true;
60-
}
6151
});
6252
mDragflowLayout.setDragAdapter(new DragAdapter<TestBean>() {
6353
@Override
@@ -102,25 +92,16 @@ public void onRemoveView(View child, int index) {
10292
}
10393
});
10494
}
105-
/*
106-
private void addTestData() {
107-
mRv.setLayoutManager(new LinearLayoutManager(this));
108-
final List<TestBean> list = new ArrayList<>();
109-
for(int i=0 ,size = 50 ; i < size ;i++){
110-
list.add(new TestBean("test ----------> " + i));
111-
}
112-
mRv.setAdapter(new QuickRecycleViewAdapter<TestBean>(android.R.layout.simple_list_item_1, list) {
113-
@Override
114-
protected void onBindData(Context context, int position, TestBean item, int itemLayoutId, ViewHelper helper) {
115-
helper.setText(android.R.id.text1, item.text);
116-
}
117-
});
118-
}*/
11995

12096
@Override
12197
protected void initData(Bundle savedInstanceState) {
12298

12399
}
100+
101+
@OnClick(R.id.bt_begin_drag)
102+
public void onClickBeginDrag(View v){
103+
mDragflowLayout.beginDrag();
104+
}
124105
@OnClick(R.id.bt_done)
125106
public void onClickDone(View v){
126107
//标记拖拽结束, 内部会自动将拖拽状态改为idle

‎Drag-FlowLayout/app/src/main/res/layout/ac_drag_flow_test2.xml‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@
3535
android:id="@+id/bt_done"
3636
/>
3737
</LinearLayout>
38+
<Button
39+
android:id="@+id/bt_begin_drag"
40+
android:layout_width="match_parent"
41+
android:layout_height="wrap_content"
42+
android:textAllCaps="false"
43+
android:text="begin drag directly"
44+
/>
45+
3846

3947
<ScrollView
4048
android:layout_width="match_parent"
@@ -56,14 +64,8 @@
5664
android:layout_width="match_parent"
5765
android:layout_height="wrap_content"
5866
android:textAllCaps="false"
59-
android:text="i am the best!"
67+
android:text="i am the best! (click this will do nothing)"
6068
/>
61-
<android.support.v7.widget.RecyclerView
62-
android:id="@+id/rv"
63-
android:layout_width="match_parent"
64-
android:layout_height="wrap_content"
65-
>
66-
</android.support.v7.widget.RecyclerView>
6769
</LinearLayout>
6870

6971
</ScrollView>

‎Drag-FlowLayout/dragflowlayout/build.gradle‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
defaultConfig {
88
minSdkVersion 11
99
targetSdkVersion 23
10-
versionCode 187
11-
versionName "1.8.7"
10+
versionCode 188
11+
versionName "1.8.8"
1212
}
1313
buildTypes {
1414
release {

‎Drag-FlowLayout/dragflowlayout/src/main/java/com/heaven7/android/dragflowlayout/ClickToDeleteItemListenerImpl.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public boolean performClick(DragFlowLayout dragFlowLayout, View child, MotionEve
3232
if (performed) {
3333
dragFlowLayout.postDelayed(new DeleteRunnable(dragFlowLayout, child), 60);
3434
}
35-
return false;
35+
return true;
3636
}
3737

3838
/**

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /