-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathMultiSelectActivity.java
44 lines (35 loc) · 1.2 KB
/
MultiSelectActivity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.lin.poweradapter.example.select;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import com.lin.poweradapter.example.Analog;
import com.lin.poweradapter.example.DatabaseService;
import com.lin.poweradapter.example.RecyclerViewActivity;
import static com.lin.poweradapter.SelectableAdapter.MODE_MULTI;
/**
* Created by lin18 on 2017/4/27.
*/
public class MultiSelectActivity extends RecyclerViewActivity<Analog, SelectAdapter> {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
configure();
adapter.setItems(DatabaseService.getSampleData(300));
adapter.setMode(MODE_MULTI);
}
@NonNull
@Override
protected SelectAdapter createAdapter() {
return new SelectAdapter(this);
}
@Override
public void onItemClick(View v, int position) {
super.onItemClick(v, position);
adapter.toggleSelection(position);
}
@Override
public boolean onItemLongClick(View v, int position) {
showToast("onItemLongClick-> position : " + position + " value : " + adapter.getItem(position).text);
return true;
}
}