From 615c0be375a137b39f7fc1ed2b248b24a87e5a19 Mon Sep 17 00:00:00 2001 From: neslihanturan Date: Mon, 17 Dec 2018 14:00:06 +0200 Subject: [PATCH] Add information icon action Fiixes #2055 2.9.0: the 'i' icon in nearby doesn't do anything (#2057) * Localisation updates from https://translatewiki.net. * Remove unused mediawiki api dependency (#1991) * Categories with pipe suffix (#1873) * Bug fix issue #1826 Changes made : -Certain category names used to show suffixed with strings prefixed with pipe '|'. Removed everything after the pipe. As per the discussion on the thread, its safe to remove everything after the pipe, including the pipe * review suggested changes *Code formatting *Extracted out the index of pipe in a variable *Added issue link in comments * Remove libraries section from README (#1988) * Remove libraries section from README * Add wiki link to "libraries used" to README * Localisation updates from https://translatewiki.net. * Localisation updates from https://translatewiki.net. * Use alert dialog instead of popup window, for nearby information * Revert irrelevant changes, sorry --- .../commons/contributions/MainActivity.java | 8 +++----- .../fr/free/nrw/commons/utils/ViewUtil.java | 12 ------------ .../res/layout/nearby_info_popup_layout.xml | 19 ------------------- 3 files changed, 3 insertions(+), 36 deletions(-) delete mode 100644 app/src/main/res/layout/nearby_info_popup_layout.xml diff --git a/app/src/main/java/fr/free/nrw/commons/contributions/MainActivity.java b/app/src/main/java/fr/free/nrw/commons/contributions/MainActivity.java index 9b8035e5d..24f47e3f0 100644 --- a/app/src/main/java/fr/free/nrw/commons/contributions/MainActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/contributions/MainActivity.java @@ -1,5 +1,6 @@ package fr.free.nrw.commons.contributions; +import android.app.AlertDialog; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; @@ -119,22 +120,19 @@ public class MainActivity extends AuthenticatedActivity implements FragmentManag // Set custom view to add nearby info icon next to text View nearbyTabLinearLayout = LayoutInflater.from(this).inflate(R.layout.custom_nearby_tab_layout, null); - View nearbyInfoPopupWindowLayout = LayoutInflater.from(this).inflate(R.layout.nearby_info_popup_layout, null); ImageView nearbyInfo = nearbyTabLinearLayout.findViewById(R.id.nearby_info_image); tabLayout.getTabAt(1).setCustomView(nearbyTabLinearLayout); nearbyInfo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - /*new AlertDialog.Builder(MainActivity.this) + new AlertDialog.Builder(MainActivity.this) .setTitle(R.string.title_activity_nearby) .setMessage(R.string.showcase_view_whole_nearby_activity) .setCancelable(true) .setNeutralButton(android.R.string.ok, (dialog, id) -> dialog.cancel()) .create() - .show();*/ - String popupText = getResources().getString(R.string.showcase_view_whole_nearby_activity); - ViewUtil.displayPopupWindow(nearbyInfo, MainActivity.this, nearbyInfoPopupWindowLayout, popupText); + .show(); } }); diff --git a/app/src/main/java/fr/free/nrw/commons/utils/ViewUtil.java b/app/src/main/java/fr/free/nrw/commons/utils/ViewUtil.java index 527bf4b9e..e88194d15 100644 --- a/app/src/main/java/fr/free/nrw/commons/utils/ViewUtil.java +++ b/app/src/main/java/fr/free/nrw/commons/utils/ViewUtil.java @@ -81,17 +81,6 @@ public class ViewUtil { } } - public static void displayPopupWindow(View anchorView, Context context, View popupWindowLayout, String text) { - - PopupWindow popup = new PopupWindow(context); - popup.setContentView(popupWindowLayout); - // Closes the popup window when touch outside of it - when looses focus - popup.setOutsideTouchable(true); - popup.setFocusable(true); - // Show anchored to button - popup.showAsDropDown(anchorView); - } - /** * A snack bar which has an action button which on click dismisses the snackbar and invokes the * listener passed @@ -111,5 +100,4 @@ public class ViewUtil { snackbar.show(); }); } - } diff --git a/app/src/main/res/layout/nearby_info_popup_layout.xml b/app/src/main/res/layout/nearby_info_popup_layout.xml deleted file mode 100644 index 04c1a2d54..000000000 --- a/app/src/main/res/layout/nearby_info_popup_layout.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - \ No newline at end of file