From 1677a4bd52fe9459f827b27b255ae39ab276e2c9 Mon Sep 17 00:00:00 2001 From: neslihanturan Date: Sun, 15 Sep 2019 15:31:18 +0300 Subject: [PATCH] Code cleanup --- .../nearby/NearbyTestLayersFragment.java | 27 ++++++++++++++++++- .../main/res/layout/fragment_nearby_map.xml | 12 --------- app/src/main/res/menu/drawer.xml | 14 ---------- app/src/main/res/values/strings.xml | 6 ----- 4 files changed, 26 insertions(+), 33 deletions(-) delete mode 100644 app/src/main/res/layout/fragment_nearby_map.xml diff --git a/app/src/main/java/fr/free/nrw/commons/nearby/NearbyTestLayersFragment.java b/app/src/main/java/fr/free/nrw/commons/nearby/NearbyTestLayersFragment.java index 79e588bba..ea36477f8 100644 --- a/app/src/main/java/fr/free/nrw/commons/nearby/NearbyTestLayersFragment.java +++ b/app/src/main/java/fr/free/nrw/commons/nearby/NearbyTestLayersFragment.java @@ -62,6 +62,7 @@ import fr.free.nrw.commons.utils.NearbyFABUtils; import fr.free.nrw.commons.utils.NetworkUtils; import fr.free.nrw.commons.utils.PermissionUtils; import fr.free.nrw.commons.utils.ViewUtil; +import fr.free.nrw.commons.wikidata.WikidataEditListener; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.schedulers.Schedulers; @@ -69,9 +70,12 @@ import timber.log.Timber; import static fr.free.nrw.commons.location.LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED; import static fr.free.nrw.commons.contributions.MainActivity.CONTRIBUTIONS_TAB_POSITION; +import static fr.free.nrw.commons.location.LocationServiceManager.LocationChangeType.MAP_UPDATED; -public class NearbyTestLayersFragment extends CommonsDaggerSupportFragment implements NearbyParentFragmentContract.View { +public class NearbyTestLayersFragment extends CommonsDaggerSupportFragment + implements NearbyParentFragmentContract.View, + WikidataEditListener.WikidataP18EditListener { @BindView(R.id.bottom_sheet) View bottomSheetList; @@ -164,6 +168,8 @@ public class NearbyTestLayersFragment extends CommonsDaggerSupportFragment imple @Inject ContributionController controller; + @Inject + WikidataEditListener wikidataEditListener; private BottomSheetBehavior bottomSheetListBehavior; private BottomSheetBehavior bottomSheetDetailsBehavior; @@ -888,4 +894,23 @@ public class NearbyTestLayersFragment extends CommonsDaggerSupportFragment imple bookmarkButtonImage.setImageResource(bookmarkIcon); } } + + @Override + public void onAttach(Context context) { + super.onAttach(context); + wikidataEditListener.setAuthenticationStateListener(this); + } + + @Override + public void onDestroy() { + super.onDestroy(); + wikidataEditListener.setAuthenticationStateListener(null); + } + + @Override + public void onWikidataEditSuccessful() { + if (mapFragment != null && nearbyParentFragmentPresenter != null && locationManager != null) { + nearbyParentFragmentPresenter.updateMapAndList(MAP_UPDATED, locationManager.getLastLocation()); + } + } } diff --git a/app/src/main/res/layout/fragment_nearby_map.xml b/app/src/main/res/layout/fragment_nearby_map.xml deleted file mode 100644 index 6ebf0b422..000000000 --- a/app/src/main/res/layout/fragment_nearby_map.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/drawer.xml b/app/src/main/res/menu/drawer.xml index e23d91a20..710f9c6d8 100644 --- a/app/src/main/res/menu/drawer.xml +++ b/app/src/main/res/menu/drawer.xml @@ -50,20 +50,6 @@ android:icon="@drawable/ic_feedback_black_24dp" android:title="@string/navigation_item_feedback" /> - - - - - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8e6d61944..9fe8836aa 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -89,9 +89,6 @@ Featured Images Category Peer Review - Nearby Test Activity - Nearby Test Fragment - Nearby Test Fragment Layers About The Wikimedia Commons app is an open-source app created and maintained by grantees and volunteers of the Wikimedia community. The Wikimedia Foundation is not involved in the creation, development, or maintenance of the app. Wikimedia Commons @@ -236,9 +233,6 @@ Notifications Featured Review - Nearby Test Activity - Nearby Test Fragment - Nearby Test Fragment Layers Nearby places cannot be displayed without location permissions no description found Commons file page