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

Change subject: Grand renaming: the sequel
......................................................................

Grand renaming: the sequel

Update to align with current mocks.

Also updates both code and presentation so as not to refer to the comp
date as a download date.

Bug: T172546
Change-Id: Ib59e20475530112fd5f60610bc75fb8549ccec6f
---
M app/src/main/java/org/wikipedia/offline/DownloadManagerObserver.java
M app/src/main/java/org/wikipedia/page/Page.java
M app/src/main/java/org/wikipedia/page/PageFragmentLoadState.java
M app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
M app/src/main/res/values-qq/strings.xml
M app/src/main/res/values/strings.xml
M app/src/main/res/values/strings_no_translate.xml
7 files changed, 42 insertions(+), 38 deletions(-)


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

diff --git 
a/app/src/main/java/org/wikipedia/offline/DownloadManagerObserver.java 
b/app/src/main/java/org/wikipedia/offline/DownloadManagerObserver.java
index 0df6965..8049ac6 100644
--- a/app/src/main/java/org/wikipedia/offline/DownloadManagerObserver.java
+++ b/app/src/main/java/org/wikipedia/offline/DownloadManagerObserver.java
@@ -72,7 +72,7 @@
                                        @NonNull final 
DialogInterface.OnClickListener onRemoveClick) {
         new AlertDialog.Builder(context)
                 .setMessage(R.string.compilation_remove_confirm)
-                .setPositiveButton(R.string.compilation_remove_confirm_yes, 
new DialogInterface.OnClickListener() {
+                .setPositiveButton(android.R.string.yes, new 
DialogInterface.OnClickListener() {
                     @Override
                     public void onClick(DialogInterface dialogInterface, int 
i) {
                         remove(compilation);
@@ -80,7 +80,7 @@
                         onRemoveClick.onClick(dialogInterface, i);
                     }
                 })
-                .setNegativeButton(R.string.compilation_remove_confirm_no, 
null)
+                .setNegativeButton(android.R.string.no, null)
                 .show();
     }
 
diff --git a/app/src/main/java/org/wikipedia/page/Page.java 
b/app/src/main/java/org/wikipedia/page/Page.java
index 30836a7..77a11e6 100755
--- a/app/src/main/java/org/wikipedia/page/Page.java
+++ b/app/src/main/java/org/wikipedia/page/Page.java
@@ -4,9 +4,9 @@
 import android.support.annotation.Nullable;
 import android.support.annotation.VisibleForTesting;
 
+import org.wikipedia.offline.Compilation;
 import org.wikipedia.settings.RbSwitch;
 
-import java.util.Date;
 import java.util.List;
 
 /**
@@ -20,7 +20,8 @@
     @NonNull private final List<Section> sections;
     @NonNull private final PageProperties pageProperties;
 
-    @Nullable private Date compilationDownloadDate;
+    @Nullable private String compName;
+    @Nullable private long compTimestamp;
 
     /**
      * An indicator what payload version the page content was originally 
retrieved from.
@@ -94,15 +95,20 @@
     }
 
     public boolean isFromOfflineCompilation() {
-        return compilationDownloadDate != null;
+        return compName != null;
     }
 
-    @Nullable public Date getCompilationDownloadDate() {
-        return compilationDownloadDate;
+    @Nullable public long getCompilationTimestamp() {
+        return compTimestamp;
     }
 
-    public void setCompilationDownloadDate(@NonNull Date date) {
-        this.compilationDownloadDate = date;
+    @Nullable public String getCompilationName() {
+        return compName;
+    }
+
+    public void setCompilation(@NonNull Compilation comp) {
+        this.compName = comp.name();
+        this.compTimestamp = comp.timestamp();
     }
 
     /** For old PHP API */
diff --git a/app/src/main/java/org/wikipedia/page/PageFragmentLoadState.java 
b/app/src/main/java/org/wikipedia/page/PageFragmentLoadState.java
index ae22167..a299b47 100644
--- a/app/src/main/java/org/wikipedia/page/PageFragmentLoadState.java
+++ b/app/src/main/java/org/wikipedia/page/PageFragmentLoadState.java
@@ -58,7 +58,6 @@
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Date;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -480,8 +479,7 @@
             sendMarginPayload();
             OfflineManager.HtmlResult result = OfflineManager.instance()
                     .getHtmlForTitle(model.getTitle().getDisplayText());
-            Date downloadDate = new Date(result.compilation().timestamp());
-            page.setCompilationDownloadDate(downloadDate);
+            page.setCompilation(result.compilation());
             JSONObject zimPayload = setLeadSectionMetadata(new JSONObject(), 
page)
                     .put("zimhtml", result.html())
                     .put("fromRestBase", false)
@@ -499,7 +497,7 @@
             //give it our expected scroll position, in case we need the page 
to be pre-scrolled upon loading.
             zimPayload.put("scrollY", (int) (stagedScrollY / 
DimenUtil.getDensityScalar()));
             bridge.sendMessage("displayFromZim", zimPayload);
-            showOfflineCompilationMessage(downloadDate);
+            showOfflineCompilationMessage(result.compilation().name(), 
result.compilation().timestamp());
         } catch (JSONException e) {
             throw new RuntimeException(e);
         } catch (IOException e) {
@@ -644,11 +642,11 @@
         }
     }
 
-    private void showOfflineCompilationMessage(@NonNull Date lastModified) {
+    private void showOfflineCompilationMessage(@NonNull String compName, 
@NonNull long timestamp) {
         if (fragment.isAdded()) {
-            String dateStr = DateUtil.getShortDateString(lastModified);
+            String dateStr = DateUtil.getShortDateString(timestamp);
             Toast.makeText(fragment.getContext().getApplicationContext(),
-                    
fragment.getString(R.string.page_offline_notice_compilation_download_date, 
dateStr),
+                    
fragment.getString(R.string.page_offline_notice_compilation_download_date, 
compName, dateStr),
                     Toast.LENGTH_LONG).show();
         }
     }
diff --git 
a/app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java 
b/app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
index 7a48a9e..8c5ffb3 100644
--- 
a/app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
+++ 
b/app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
@@ -52,6 +52,7 @@
 
 import retrofit2.Call;
 
+import static org.wikipedia.util.DateUtil.getShortDateString;
 import static org.wikipedia.util.L10nUtil.formatDateRelative;
 import static org.wikipedia.util.L10nUtil.getStringForArticleLanguage;
 import static org.wikipedia.util.UriUtil.visitInExternalBrowser;
@@ -298,12 +299,12 @@
     // content, or, for a ZIM compilation, a plain string (nothing to link) 
with the ZIM file's
     // local last modified date (most likely, the download date).
     private String getDateMessage(Page page) {
-        return page.isFromOfflineCompilation() ? 
compilationLastModifiedString(page) : lastUpdatedHtml(page);
+        return page.isFromOfflineCompilation() ? compilationInfoString(page) : 
lastUpdatedHtml(page);
     }
 
-    private String compilationLastModifiedString(Page page) {
-        return 
parentFragment.getContext().getString(R.string.bottom_content_date_downloaded,
-                formatDateRelative(page.getCompilationDownloadDate()));
+    private String compilationInfoString(Page page) {
+        return 
String.format(parentFragment.getString(R.string.offline_library_article_name_date),
+                page.getCompilationName(), 
getShortDateString(page.getCompilationTimestamp()));
     }
 
     private String lastUpdatedHtml(Page page) {
diff --git a/app/src/main/res/values-qq/strings.xml 
b/app/src/main/res/values-qq/strings.xml
index d116b9b..33f05a7 100644
--- a/app/src/main/res/values-qq/strings.xml
+++ b/app/src/main/res/values-qq/strings.xml
@@ -240,7 +240,7 @@
   <string name="page_offline_notice_cannot_load_while_offline">Message 
informing the user that an article cannot be loaded while the app is offline. 
This message is followed by page_offline_notice_add_to_reading_list.</string>
   <string name="page_offline_notice_add_to_reading_list">Message inviting the 
user to add the requested article to a reading list to be downloaded when the 
app is online. This message follows 
{{msg-wm|Wikipedia-android-strings-page_offline_notice_cannot_load_while_offline}}.</string>
   <string name="page_offline_notice_last_date">Message that tells the user 
that the current article is loaded from offline storage. The %s symbol is 
replaced with the date when the article was saved.</string>
-  <string name="page_offline_notice_compilation_download_date">Message that 
tells the user that the current article is loaded from a downloaded offline 
compilation. The %s symbol is replaced with the date when the compilation was 
downloaded.</string>
+  <string name="page_offline_notice_compilation_download_date">Message that 
tells the user that the current article is loaded from a downloaded offline 
compilation. The %1$s symbol is replaced with the name of the article pack 
containing the article, and the %2$s symbol is replaced with the date when the 
compilation was downloaded.</string>
   <string name="button_get_directions">Button to obtain directions to the 
location specified in the link preview.</string>
   <string name="error_no_maps_app">Error displayed when the device does not 
have any apps installed that are capable of providing directions to a 
location.</string>
   <string name="preference_title_show_link_previews">Title of the preference 
for enabling or disabling link previews.\n\nShown in the preferences screen 
along with the following:\n* 
{{msg-wikimedia|Wikipedia-android-strings-preference title show images}}\n* 
{{msg-wikimedia|Wikipedia-android-strings-preference title language}}\n* 
{{msg-wikimedia|Wikipedia-android-strings-preference title show link 
previews}}\n* {{msg-wikimedia|Wikipedia-android-strings-preference title 
eventlogging opt in}}\n* {{msg-wikimedia|Wikipedia-android-strings-zero warn 
when leaving}}</string>
@@ -421,13 +421,13 @@
   <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>
-  <string name="offline_my_compilations">Button label for the user to access 
their list of article packs.</string>
+  <string name="offline_my_compilations">Button label for the user to navigate 
to the offline library screen.</string>
   <string name="offline_compilations_title">Title shown on the toolbar of the 
activity for managing article packs.</string>
   <string name="offline_compilations_search_by_name">Menu item for searching 
article packs by name.</string>
-  <string name="offline_compilations_found_count">Label that states how many 
article packs the user has available. The %d symbol is replaced with the number 
of article packs detected.</string>
-  <string name="offline_compilations_add">Button text for adding an offline 
article pack.</string>
+  <string name="offline_compilations_found_count">Label that states how many 
article packs the user has available in the Offline Library. The %d symbol is 
replaced with the number of article packs detected.</string>
+  <string name="offline_compilations_add">Button text for adding an offline 
article pack to the Offline Library.</string>
   <string name="remote_compilations_title">Title shown on the toolbar of the 
activity that shows all downloadable article packs.</string>
-  <string name="remote_compilations_description">Short description about 
article packs and their benefits.</string>
+  <string name="remote_compilations_description">Short description of the 
Offline Library.</string>
   <string name="offline_compilation_detail_date_size">Information about the 
date and size of an article pack. The %1$s and %2$.2f symbols will be replaced 
with the date and size. Only the \"GB\" unit needs to be translated (see 
storage_size_gb).</string>
   <string name="offline_compilation_detail_button_download">Label for a button 
for downloading an offline article pack. The %.2f symbol is replaced with the 
article pack size, in gigabytes (GB).</string>
   <string name="offline_compilation_detail_button_remove">Label for a button 
for removing an offline article pack from storage on the user\'s 
device.</string>
@@ -449,8 +449,6 @@
   <string name="compilation_share">Menu label for sharing the selected article 
pack through another app.</string>
   <string name="compilation_remove">Menu label for removing the selected 
article pack from the device.</string>
   <string name="compilation_remove_confirm">Confirmation message asking if the 
user really wants to remove the selected article pack from the device.</string>
-  <string name="compilation_remove_confirm_yes">Affirmative answer to remove 
the selected article pack.\n{{Identical|Yes}}</string>
-  <string name="compilation_remove_confirm_no">Negative answer to cancel the 
selected article pack.\n{{Identical|No}}</string>
   <string name="offline_library_title">Title shown at the top of the activity 
for managing the offline library.</string>
   <string name="offline_library_empty_title">Message shown when the offline 
library is empty.</string>
   <string name="offline_library_empty_description">Explanation encouraging the 
user to download an article pack for offline use later.</string>
diff --git a/app/src/main/res/values/strings.xml 
b/app/src/main/res/values/strings.xml
index c235df8..8e61537 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -254,7 +254,7 @@
     <string name="page_offline_notice_cannot_load_while_offline">Article 
cannot be loaded while offline.</string>
     <string name="page_offline_notice_add_to_reading_list">Hint: Add the 
article to a reading list and it will be downloaded once you\'re back 
online.</string>
     <string name="page_offline_notice_last_date">You are reading an offline 
version of this article saved on %s.</string>
-    <string name="page_offline_notice_compilation_download_date">You are 
reading an offline version of this article from a compilation downloaded on 
%s.</string>
+    <string name="page_offline_notice_compilation_download_date">You\'re 
reading the version of this article from %1$s • %2$s.</string>
     <string name="button_get_directions">Get directions</string>
     <string name="error_no_maps_app">Could not find any apps that provide 
directions.</string>
     <string name="preference_title_show_link_previews">Show link 
previews</string>
@@ -473,14 +473,14 @@
     <!-- Offline -->
     <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 in offline 
mode. Please note that offline articles may not be fully up to date with the 
online version.</string>
-    <string name="offline_my_compilations">My article packs</string>
+    <string name="offline_card_text">You are now browsing Wikipedia offline 
with articles in your Offline Library.</string>
+    <string name="offline_my_compilations">Manage my offline library</string>
     <string name="offline_compilations_title">Offline Library</string>
     <string name="offline_compilations_search_by_name">Search article packs by 
name</string>
-    <string name="offline_compilations_found_count">My article packs 
(%d)</string>
-    <string name="offline_compilations_add">Add article pack</string>
-    <string name="remote_compilations_title">All article packs</string>
-    <string name="remote_compilations_description">Article packs are large 
bundles of articles that can be downloaded as one file to your device, so you 
can continue browsing while offline.</string>
+    <string name="offline_compilations_found_count">In my library (%d)</string>
+    <string name="offline_compilations_add">Add to my Offline Library</string>
+    <string name="remote_compilations_title">Offline Library</string>
+    <string name="remote_compilations_description">With the Offline Library, 
you can now download packs of articles for reading when you have no internet 
connection available.</string>
     <string name="offline_compilation_detail_date_size">%1$s • %2$.2f 
GB</string>
     <string name="offline_compilation_detail_button_download">Download • %.2f 
GB</string>
     <string name="offline_compilation_detail_button_remove">Remove</string>
@@ -501,14 +501,12 @@
     <string name="compilation_download_cancel_confirm_no">No</string>
     <string name="compilation_share">Share</string>
     <string name="compilation_remove">Remove</string>
-    <string name="compilation_remove_confirm">Are you sure you want to remove 
this article pack from your device?</string>
-    <string name="compilation_remove_confirm_yes">Yes</string>
-    <string name="compilation_remove_confirm_no">No</string>
+    <string name="compilation_remove_confirm">Do you want to remove this from 
your Offline Library?</string>
     <string name="offline_library_title">Offline Library</string>
     <string name="offline_library_empty_title">Nothing in your Offline 
Library</string>
     <string name="offline_library_empty_description">Choose a pack of 
Wikipedia articles to download now, for data-free access later.</string>
     <string name="offline_library_empty_search">Search Offline Library</string>
-    <string name="offline_library_search_results_state">Search results from 
available offline library</string>
+    <string name="offline_library_search_results_state">Search results from 
your Offline Library</string>
     <string name="offline_library_onboarding_action">Find out more</string>
     <string name="offline_library_onboarding_text">Introducing Offline Library 
— download article packs now for offline reading later.</string>
     <string name="offline_library_onboarding_button_done">Done</string>
diff --git a/app/src/main/res/values/strings_no_translate.xml 
b/app/src/main/res/values/strings_no_translate.xml
index d2454c1..18e379f 100644
--- a/app/src/main/res/values/strings_no_translate.xml
+++ b/app/src/main/res/values/strings_no_translate.xml
@@ -106,4 +106,7 @@
 
     <string name="storage_size_format">%.2f</string>
 
+    <!-- Offline Library article bottom content -->
+    <string name="offline_library_article_name_date">%1$s • %2$s</string>
+
 </resources>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib59e20475530112fd5f60610bc75fb8549ccec6f
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mholloway <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to