8
8
import android .content .IntentFilter ;
9
9
import android .content .res .Configuration ;
10
10
import android .os .Bundle ;
11
+ import android .util .Log ;
11
12
import android .view .Gravity ;
12
13
import android .view .LayoutInflater ;
13
14
import android .view .View ;
14
15
import android .view .ViewGroup ;
15
16
import android .view .animation .Animation ;
16
17
import android .view .animation .AnimationUtils ;
18
+ import android .widget .ArrayAdapter ;
17
19
import android .widget .Button ;
18
20
import android .widget .FrameLayout ;
19
21
import android .widget .ImageView ;
20
22
import android .widget .LinearLayout ;
23
+ import android .widget .ListView ;
21
24
import android .widget .ProgressBar ;
25
+ import android .widget .SearchView ;
22
26
import android .widget .TextView ;
23
27
import android .widget .Toast ;
24
28
28
32
import androidx .fragment .app .FragmentTransaction ;
29
33
30
34
import com .google .android .material .bottomsheet .BottomSheetBehavior ;
35
+ import com .google .android .material .chip .Chip ;
31
36
import com .google .android .material .floatingactionbutton .FloatingActionButton ;
32
37
import com .google .android .material .snackbar .Snackbar ;
38
+ import com .jakewharton .rxbinding2 .view .RxView ;
39
+ import com .jakewharton .rxbinding2 .widget .RxSearchView ;
33
40
import com .mapbox .mapboxsdk .Mapbox ;
34
41
import com .mapbox .mapboxsdk .annotations .Marker ;
35
42
import com .mapbox .mapboxsdk .camera .CameraPosition ;
39
46
import com .mapbox .mapboxsdk .maps .MapboxMapOptions ;
40
47
import com .mapbox .mapboxsdk .maps .Style ;
41
48
49
+ import java .util .ArrayList ;
50
+ import java .util .concurrent .TimeUnit ;
51
+
42
52
import javax .inject .Inject ;
43
53
import javax .inject .Named ;
44
54
54
64
import fr .free .nrw .commons .di .CommonsDaggerSupportFragment ;
55
65
import fr .free .nrw .commons .kvstore .JsonKvStore ;
56
66
import fr .free .nrw .commons .location .LocationServiceManager ;
67
+ import fr .free .nrw .commons .nearby .Label ;
57
68
import fr .free .nrw .commons .nearby .NearbyController ;
58
69
import fr .free .nrw .commons .nearby .NearbyMarker ;
59
70
import fr .free .nrw .commons .nearby .Place ;
60
71
import fr .free .nrw .commons .nearby .contract .NearbyParentFragmentContract ;
61
72
import fr .free .nrw .commons .nearby .presenter .NearbyParentFragmentPresenter ;
62
73
import fr .free .nrw .commons .utils .FragmentUtils ;
74
+ import fr .free .nrw .commons .utils .LayoutUtils ;
63
75
import fr .free .nrw .commons .utils .NearbyFABUtils ;
64
76
import fr .free .nrw .commons .utils .NetworkUtils ;
65
77
import fr .free .nrw .commons .utils .PermissionUtils ;
73
85
import static fr .free .nrw .commons .location .LocationServiceManager .LocationChangeType .LOCATION_SIGNIFICANTLY_CHANGED ;
74
86
import static fr .free .nrw .commons .contributions .MainActivity .CONTRIBUTIONS_TAB_POSITION ;
75
87
import static fr .free .nrw .commons .location .LocationServiceManager .LocationChangeType .MAP_UPDATED ;
88
+ import static fr .free .nrw .commons .nearby .Label .TEXT_TO_DESCRIPTION ;
76
89
import static fr .free .nrw .commons .wikidata .WikidataConstants .PLACE_OBJECT ;
77
90
78
91
@@ -106,6 +119,17 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
106
119
@ BindView (R .id .container_sheet ) FrameLayout frameLayout ;
107
120
@ BindView (R .id .loading_nearby_list ) ConstraintLayout loadingNearbyLayout ;
108
121
122
+ @ BindView (R .id .choice_chip_exists )
123
+ Chip chipExists ;
124
+ @ BindView (R .id .choice_chip_needs_photo )
125
+ Chip chipNeedsPhoto ;
126
+ @ BindView (R .id .search_view )
127
+ SearchView searchView ;
128
+ @ BindView (R .id .search_list_view )
129
+ ListView searchListView ;
130
+ @ BindView (R .id .nearby_filter_list_layout )
131
+ LinearLayout nearbyFilterListLayout ;
132
+
109
133
@ Inject LocationServiceManager locationManager ;
110
134
@ Inject NearbyController nearbyController ;
111
135
@ Inject @ Named ("default_preferences" ) JsonKvStore applicationKvStore ;
@@ -156,6 +180,7 @@ public void onResume() {
156
180
super .onResume ();
157
181
nearbyMapFragment = getNearbyMapFragment ();
158
182
nearbyListFragment = getListFragment ();
183
+ initNearbyFilter ();
159
184
}
160
185
161
186
@@ -178,6 +203,26 @@ private void initBottomSheets() {
178
203
bottomSheetDetails .setVisibility (View .VISIBLE );
179
204
}
180
205
206
+ public void initNearbyFilter () {
207
+
208
+ ArrayList <String > stringArrayList = new ArrayList <>();
209
+ for (Label label : TEXT_TO_DESCRIPTION .values ())
210
+ stringArrayList .add (label .toString ());
211
+
212
+ ArrayAdapter adapter = new ArrayAdapter <>(getContext (),android .R .layout .simple_list_item_1 ,stringArrayList );
213
+ searchListView .setAdapter (adapter );
214
+ LayoutUtils .setLayoutHeightAllignedToWidth (1 , nearbyFilterListLayout );
215
+
216
+ compositeDisposable .add (RxSearchView .queryTextChanges (searchView )
217
+ .takeUntil (RxView .detaches (searchView ))
218
+ .debounce (500 , TimeUnit .MILLISECONDS )
219
+ .observeOn (AndroidSchedulers .mainThread ())
220
+ .subscribe ( query -> {
221
+ Log .d ("deneme4" ,"query:" +query );
222
+ }
223
+ ));
224
+ }
225
+
181
226
/**
182
227
* Defines how bottom sheets will act on click
183
228
*/
0 commit comments