Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/376759 )

Change subject: Show message when user attempts to download an article pack 
while offline
......................................................................

Show message when user attempts to download an article pack while offline

Bug: T172881
Change-Id: I3fd34c9fe8b286a72ef6d9f4e4405889c794aa36
---
M app/src/main/java/org/wikipedia/offline/CompilationDetailFragment.java
M app/src/main/res/values-qq/strings.xml
M app/src/main/res/values/strings.xml
3 files changed, 11 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/59/376759/1

diff --git 
a/app/src/main/java/org/wikipedia/offline/CompilationDetailFragment.java 
b/app/src/main/java/org/wikipedia/offline/CompilationDetailFragment.java
index 945d57c..1cede7d 100644
--- a/app/src/main/java/org/wikipedia/offline/CompilationDetailFragment.java
+++ b/app/src/main/java/org/wikipedia/offline/CompilationDetailFragment.java
@@ -21,6 +21,7 @@
 import org.wikipedia.page.PageActivity;
 import org.wikipedia.page.PageTitle;
 import org.wikipedia.staticdata.MainPageNameData;
+import org.wikipedia.util.DeviceUtil;
 import org.wikipedia.util.FeedbackUtil;
 import org.wikipedia.util.GradientUtil;
 import org.wikipedia.util.log.L;
@@ -108,10 +109,14 @@
     }
 
     @OnClick(R.id.button_compilation_detail_download) void onDownloadClick() {
-        if (!getDownloadObserver().isDownloading(compilation)) {
-            MediaDownloadReceiver.download(getContext(), compilation);
-            downloadPending = true;
-            updateDownloadState(true, null);
+        if (DeviceUtil.isOnline()) {
+            if (!getDownloadObserver().isDownloading(compilation)) {
+                MediaDownloadReceiver.download(getContext(), compilation);
+                downloadPending = true;
+                updateDownloadState(true, null);
+            }
+        } else {
+            FeedbackUtil.showMessage(getActivity(), 
R.string.offline_compilation_download_device_offline);
         }
     }
 
diff --git a/app/src/main/res/values-qq/strings.xml 
b/app/src/main/res/values-qq/strings.xml
index 4831e75..e7a7de0 100644
--- a/app/src/main/res/values-qq/strings.xml
+++ b/app/src/main/res/values-qq/strings.xml
@@ -423,6 +423,7 @@
   <string name="description_edit_revert_reason1">Reason for an edit being 
reverted, because it did not follow the guidelines for descriptions. (Please 
preserve the anchor tag in its exact form)</string>
   <string name="description_edit_revert_reason2">Reason for an edit being 
reverted, because it looks like vandalism.</string>
   <string name="description_edit_revert_history">Message that allows the user 
to go to the edit history associated with the article. (Please preserve the 
anchor tag in its exact form)</string>
+  <string name="offline_compilation_download_device_offline">Message shown 
when the user attempts to download an article pack but the device is 
offline.</string>
   <string name="offline_read_permission_rationale">Message explaining why we 
need permission to access the device storage when reading articles in offline 
mode.</string>
   <string name="offline_read_permission_error">Error shown when the app could 
not read from the internal or external storage of the device due to permission 
not being granted.</string>
   <string name="offline_card_text">Message shown in the Feed card that informs 
the user that they are now browsing Wikipedia in offline mode.</string>
diff --git a/app/src/main/res/values/strings.xml 
b/app/src/main/res/values/strings.xml
index cb04d40..406207b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -476,6 +476,7 @@
     <!-- /Description editing revert help -->
 
     <!-- Offline -->
+    <string name="offline_compilation_download_device_offline">No internet 
connection. Make sure you\'re back online, then try again.</string>
     <string name="offline_read_permission_rationale">Permission to access 
storage on your device is required for offline browsing.</string>
     <string name="offline_read_permission_error">Permission not granted to 
read from device storage.</string>
     <string name="offline_card_text">You are now browsing Wikipedia offline 
with articles in your Offline Library.</string>

-- 
To view, visit https://gerrit.wikimedia.org/r/376759
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3fd34c9fe8b286a72ef6d9f4e4405889c794aa36
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mholloway <mhollo...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to