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

Change subject: [FOR CUSTOM BUILD] Create dummy revert notification for UX 
testing
......................................................................

[FOR CUSTOM BUILD] Create dummy revert notification for UX testing

As directed on the task.  A "Wallaroo" article will be accessible from
clicking on the notification, provided that the app language is "en" or
"test".

Bug: T156520
Change-Id: I904ccf94f92992ffaca32b20b66df6025175c19d
---
A app/src/main/assets/desc_edit_ux_test.json
M app/src/main/java/org/wikipedia/feed/FeedFragment.java
M app/src/main/java/org/wikipedia/views/ExploreOverflowView.java
M app/src/main/res/layout/view_explore_overflow.xml
M app/src/main/res/values/strings_no_translate.xml
5 files changed, 58 insertions(+), 1 deletion(-)


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

diff --git a/app/src/main/assets/desc_edit_ux_test.json 
b/app/src/main/assets/desc_edit_ux_test.json
new file mode 100644
index 0000000..5609c31
--- /dev/null
+++ b/app/src/main/assets/desc_edit_ux_test.json
@@ -0,0 +1,25 @@
+{
+  "wiki": "wikidatawiki",
+  "id": "1557960",
+  "type": "reverted",
+  "category": "reverted",
+  "timestamp": {
+    "utciso8601": "2017-01-30T17:10:56Z",
+    "utcmw": "20170130171056",
+    "mw": "20170130171056",
+    "date": "Today"
+  },
+  "title": {
+    "full": "Wallaroo",
+    "namespace": "",
+    "namespace-key": 0,
+    "text": "Q1623471"
+  },
+  "agent": {
+    "id": 0,
+    "name": "Mhollo"
+  },
+  "revid": 309132,
+  "read": "20170130172611",
+  "targetpages": []
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/wikipedia/feed/FeedFragment.java 
b/app/src/main/java/org/wikipedia/feed/FeedFragment.java
index 4078712..c4d8dd9 100644
--- a/app/src/main/java/org/wikipedia/feed/FeedFragment.java
+++ b/app/src/main/java/org/wikipedia/feed/FeedFragment.java
@@ -31,7 +31,10 @@
 import org.wikipedia.feed.view.FeedAdapter;
 import org.wikipedia.feed.view.FeedView;
 import org.wikipedia.history.HistoryEntry;
+import org.wikipedia.json.GsonUnmarshaller;
 import org.wikipedia.login.LoginActivity;
+import org.wikipedia.notifications.Notification;
+import org.wikipedia.notifications.NotificationPresenter;
 import org.wikipedia.settings.Prefs;
 import org.wikipedia.settings.SettingsActivity;
 import org.wikipedia.util.FeedbackUtil;
@@ -39,11 +42,14 @@
 import org.wikipedia.util.UriUtil;
 import org.wikipedia.views.ExploreOverflowView;
 
+import java.io.IOException;
 import java.util.List;
 
 import butterknife.BindView;
 import butterknife.ButterKnife;
 import butterknife.Unbinder;
+
+import static org.wikipedia.util.FileUtil.readFile;
 
 public class FeedFragment extends Fragment implements BackPressedHandler {
     @BindView(R.id.feed_swipe_refresh_layout) SwipeRefreshLayout 
swipeRefreshLayout;
@@ -376,5 +382,17 @@
             WikipediaApp.getInstance().logOut();
             FeedbackUtil.showMessage(FeedFragment.this, 
R.string.toast_logout_complete);
         }
+
+        @Override
+        public void exitClick() {
+            try {
+                String json = 
readFile(getResources().getAssets().open("desc_edit_ux_test.json"));
+                Notification n = 
GsonUnmarshaller.unmarshal(Notification.class, json);
+                NotificationPresenter.showNotification(getContext(), n);
+                getActivity().finish();
+            } catch (IOException e) {
+                FeedbackUtil.showError(getActivity(), e);
+            }
+        }
     }
 }
diff --git a/app/src/main/java/org/wikipedia/views/ExploreOverflowView.java 
b/app/src/main/java/org/wikipedia/views/ExploreOverflowView.java
index 2e7cc38..608fe81 100644
--- a/app/src/main/java/org/wikipedia/views/ExploreOverflowView.java
+++ b/app/src/main/java/org/wikipedia/views/ExploreOverflowView.java
@@ -28,9 +28,11 @@
         void logoutClick();
         void settingsClick();
         void donateClick();
+        void exitClick();
     }
 
     @BindView(R.id.explore_overflow_account_name) TextView accountName;
+    @BindView(R.id.explore_overflow_exit_application) View exitView;
     @BindView(R.id.explore_overflow_log_out) View logout;
     @Nullable private Callback callback;
     @Nullable private PopupWindow popupWindowHost;
@@ -53,7 +55,8 @@
     }
 
     @OnClick({R.id.explore_overflow_settings, R.id.explore_overflow_donate,
-            R.id.explore_overflow_account_container, 
R.id.explore_overflow_log_out})
+            R.id.explore_overflow_account_container, 
R.id.explore_overflow_log_out,
+            R.id.explore_overflow_exit_application})
     void onItemClick(View view) {
         if (popupWindowHost != null) {
             popupWindowHost.dismiss();
@@ -74,6 +77,9 @@
             case R.id.explore_overflow_donate:
                 callback.donateClick();
                 break;
+            case R.id.explore_overflow_exit_application:
+                callback.exitClick();
+                break;
             case R.id.explore_overflow_log_out:
                 callback.logoutClick();
                 break;
diff --git a/app/src/main/res/layout/view_explore_overflow.xml 
b/app/src/main/res/layout/view_explore_overflow.xml
index 37311a2..ac26025 100644
--- a/app/src/main/res/layout/view_explore_overflow.xml
+++ b/app/src/main/res/layout/view_explore_overflow.xml
@@ -56,6 +56,11 @@
             android:text="@string/nav_item_donate"/>
 
         <TextView
+            android:id="@+id/explore_overflow_exit_application"
+            style="@style/OverflowMenuItem"
+            android:text="@string/nav_item_exit"/>
+
+        <TextView
             android:id="@+id/explore_overflow_log_out"
             style="@style/OverflowMenuItem"
             android:textColor="@color/foundation_red"
diff --git a/app/src/main/res/values/strings_no_translate.xml 
b/app/src/main/res/values/strings_no_translate.xml
index 0653288..f185ab6 100644
--- a/app/src/main/res/values/strings_no_translate.xml
+++ b/app/src/main/res/values/strings_no_translate.xml
@@ -103,4 +103,7 @@
     ]]></string>
     <!-- /Description editing -->
 
+    <!-- Description editing user test -->
+    <string name="nav_item_exit">Exit the application</string>
+    <string name="revert_notification_title">Reverted edit</string>
 </resources>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I904ccf94f92992ffaca32b20b66df6025175c19d
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