Dbrant has uploaded a new change for review.
https://gerrit.wikimedia.org/r/233943
Change subject: Fix possible crash involving Zero banner.
......................................................................
Fix possible crash involving Zero banner.
When showing the Wikipedia Zero banner from PageActivity, we were
anchoring the SnackBar to a View that's only available when a PageFragment
is active. Therefore, when a different fragment is active (e.g. History),
the view doesn't exist, and thus causes a crash.
This updates the code to use a more generic View from the current Activity
for displaying the banner.
Bug: T110241
Change-Id: I5852b59dd706e428381d8e7b5d39cf414236fe18
---
M app/src/main/java/org/wikipedia/zero/WikipediaZeroHandler.java
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia
refs/changes/43/233943/1
diff --git a/app/src/main/java/org/wikipedia/zero/WikipediaZeroHandler.java
b/app/src/main/java/org/wikipedia/zero/WikipediaZeroHandler.java
index c3214fb..60486ec 100644
--- a/app/src/main/java/org/wikipedia/zero/WikipediaZeroHandler.java
+++ b/app/src/main/java/org/wikipedia/zero/WikipediaZeroHandler.java
@@ -68,7 +68,7 @@
public static void showZeroBanner(@NonNull Activity activity, @NonNull
String text,
@ColorInt int foreColor, @ColorInt int
backColor) {
- Snackbar snackbar =
FeedbackUtil.makeSnackbar(activity.findViewById(R.id.page_contents_container),
text, FeedbackUtil.LENGTH_DEFAULT);
+ Snackbar snackbar =
FeedbackUtil.makeSnackbar(activity.getWindow().getDecorView(), text,
FeedbackUtil.LENGTH_DEFAULT);
ViewGroup rootView = (ViewGroup) snackbar.getView();
TextView textView = (TextView)
rootView.findViewById(R.id.snackbar_text);
rootView.setBackgroundColor(backColor);
--
To view, visit https://gerrit.wikimedia.org/r/233943
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5852b59dd706e428381d8e7b5d39cf414236fe18
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits