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
This commit is contained in:
neslihanturan 2018-12-17 14:00:06 +02:00 committed by Vivek Maskara
parent 36e077f0b1
commit 615c0be375
3 changed files with 3 additions and 36 deletions

View file

@ -1,5 +1,6 @@
package fr.free.nrw.commons.contributions; package fr.free.nrw.commons.contributions;
import android.app.AlertDialog;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageManager; 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 // 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 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); ImageView nearbyInfo = nearbyTabLinearLayout.findViewById(R.id.nearby_info_image);
tabLayout.getTabAt(1).setCustomView(nearbyTabLinearLayout); tabLayout.getTabAt(1).setCustomView(nearbyTabLinearLayout);
nearbyInfo.setOnClickListener(new View.OnClickListener() { nearbyInfo.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
/*new AlertDialog.Builder(MainActivity.this) new AlertDialog.Builder(MainActivity.this)
.setTitle(R.string.title_activity_nearby) .setTitle(R.string.title_activity_nearby)
.setMessage(R.string.showcase_view_whole_nearby_activity) .setMessage(R.string.showcase_view_whole_nearby_activity)
.setCancelable(true) .setCancelable(true)
.setNeutralButton(android.R.string.ok, (dialog, id) -> dialog.cancel()) .setNeutralButton(android.R.string.ok, (dialog, id) -> dialog.cancel())
.create() .create()
.show();*/ .show();
String popupText = getResources().getString(R.string.showcase_view_whole_nearby_activity);
ViewUtil.displayPopupWindow(nearbyInfo, MainActivity.this, nearbyInfoPopupWindowLayout, popupText);
} }
}); });

View file

@ -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 * A snack bar which has an action button which on click dismisses the snackbar and invokes the
* listener passed * listener passed
@ -111,5 +100,4 @@ public class ViewUtil {
snackbar.show(); snackbar.show();
}); });
} }
} }

View file

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/mainTabBackground"
>
<TextView
android:id="@+id/info_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginVertical="16dp"
android:layout_marginHorizontal="8dp"
android:gravity="center"
android:textColor="@color/white"
android:text="@string/showcase_view_whole_nearby_activity" />
</LinearLayout>