Merge 2.9 release with master (#2174)

* Fix memory leak due to wikidata edit listener (#2048)

* Fix bookmark crash fix (#2047)

* Fix bookmark crash fix

* Fix check for bookmark creator

* Bug fix #2042 (#2056)

* Bug fix #2042
* Added a snack with retry when api in AA fails
* Increased connection timeouts in okhttpclient builder

* added missing string resource

* Bugfix/duplicate categories (#2080)

* Increased timeout to 60 seconds

* Bug fix #1550
* filter duplicate categories

* Fix crash because of inactive fragment UI (#2046)

* Fix crash because of inactive fragment UI

* Add java docs

* 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:
Vivek Maskara 2018-12-19 22:29:49 +05:30 committed by neslihanturan
parent 21edcb7cbe
commit f3b450e020
19 changed files with 91 additions and 65 deletions

View file

@ -28,4 +28,13 @@ public class FragmentUtils {
}
return false;
}
/**
* Utility function to check whether the fragment UI is still active or not
* @param fragment
* @return
*/
public static boolean isFragmentUIActive(Fragment fragment) {
return fragment.getActivity() != null && fragment.isAdded() && !fragment.isDetached() && !fragment.isRemoving();
}
}

View file

@ -11,6 +11,9 @@ public class NetworkUtils {
ConnectivityManager cm =
(ConnectivityManager)context.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm == null) {
return false;
}
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
return activeNetwork != null &&
activeNetwork.isConnectedOrConnecting();

View file

@ -17,7 +17,12 @@ public class ViewUtil {
public static final String SHOWCASE_VIEW_ID_2 = "SHOWCASE_VIEW_ID_2";
public static final String SHOWCASE_VIEW_ID_3 = "SHOWCASE_VIEW_ID_3";
public static void showSnackbar(View view, int messageResourceId) {
/**
* Utility function to show short snack bar
* @param view
* @param messageResourceId
*/
public static void showShortSnackbar(View view, int messageResourceId) {
if (view.getContext() == null) {
return;
}
@ -76,15 +81,23 @@ 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
*/
public static void showDismissibleSnackBar(View view, int messageResourceId,
int actionButtonResourceId, View.OnClickListener onClickListener) {
if (view.getContext() == null) {
return;
}
ExecutorUtils.uiExecutor().execute(() -> {
Snackbar snackbar = Snackbar.make(view, view.getContext().getString(messageResourceId),
Snackbar.LENGTH_INDEFINITE);
snackbar.setAction(view.getContext().getString(actionButtonResourceId), v -> {
snackbar.dismiss();
onClickListener.onClick(v);
});
snackbar.show();
});
}
}