From 65ca06c7ec2776d3e84216ae72d478e14e3a0321 Mon Sep 17 00:00:00 2001 From: neslihanturan Date: Thu, 29 Aug 2019 11:30:06 +0300 Subject: [PATCH] Move nearby card methods --- .../nearby/NearbyNotificationCardView.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/nearby/NearbyNotificationCardView.java b/app/src/main/java/fr/free/nrw/commons/nearby/NearbyNotificationCardView.java index d6dfa65c7..c2d3fc496 100644 --- a/app/src/main/java/fr/free/nrw/commons/nearby/NearbyNotificationCardView.java +++ b/app/src/main/java/fr/free/nrw/commons/nearby/NearbyNotificationCardView.java @@ -73,34 +73,34 @@ public class NearbyNotificationCardView extends SwipableCardView { @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - /* // If you don't setVisibility after getting layout params, then you will se an empty space in place of nearby NotificationCardView - if (((MainActivity)getContext()).defaultKvStore.getBoolean("displayNearbyCardView", true) && this.cardViewVisibilityState == NearbyNotificationCardView.CardViewVisibilityState.READY) { + // If you don't setVisibility after getting layout params, then you will se an empty space in place of nearby NotificationCardView + if (((NearbyTestFragmentLayersActivity)getContext()).defaultKvStore.getBoolean("displayNearbyCardView", true) && this.cardViewVisibilityState == NearbyNotificationCardView.CardViewVisibilityState.READY) { this.setVisibility(VISIBLE); } else { this.setVisibility(GONE); - }*/ + } } private void setActionListeners(Place place) { - /* this.setOnClickListener(view -> { - MainActivity m = (MainActivity) getContext(); + this.setOnClickListener(view -> { + NearbyTestFragmentLayersActivity m = (NearbyTestFragmentLayersActivity) getContext(); // Change to nearby tab m.viewPager.setCurrentItem(NEARBY_TAB_POSITION); // Center the map to the place //((NearbyFragment) m.contributionsActivityPagerAdapter.getItem(NEARBY_TAB_POSITION)).centerMapToPlace(place); - });*/ + }); } @Override public boolean onSwipe(View view) { - /* view.setVisibility(GONE); + view.setVisibility(GONE); // Save shared preference for nearby card view accordingly - ((MainActivity) getContext()).defaultKvStore.putBoolean("displayNearbyCardView", false); + ((NearbyTestFragmentLayersActivity) getContext()).defaultKvStore.putBoolean("displayNearbyCardView", false); ViewUtil.showLongToast(getContext(), getResources().getString(R.string.nearby_notification_dismiss_message)); - */return true; + return true; } /**