Bug 949902 - Correct "Up to" strings in Bookmarks View, deleted unused icons, and update tests. r=lucasr
authorShashank Sabniveesu <shashank@linux.com>
Wed, 18 Jun 2014 19:31:00 -0400
changeset 190642 5b7a06134d307e008e3eb73e3353b29fed33d99f
parent 190522 357002b68cb520b5c3947c9c3a20051eb8d37ae7
child 190643 b043afd9261faa92ac9a511c59c170a5b98195bd
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerslucasr
bugs949902
milestone33.0a1
Bug 949902 - Correct "Up to" strings in Bookmarks View, deleted unused icons, and update tests. r=lucasr
mobile/android/base/home/BookmarksListAdapter.java
mobile/android/base/home/BookmarksPanel.java
mobile/android/base/resources/drawable-hdpi/bookmark_folder_opened.png
mobile/android/base/resources/drawable-mdpi/bookmark_folder_opened.png
mobile/android/base/resources/drawable-xhdpi/bookmark_folder_opened.png
mobile/android/base/resources/drawable/bookmark_folder.xml
mobile/android/base/tests/StringHelper.java
mobile/android/base/tests/testBookmarkFolders.java
--- a/mobile/android/base/home/BookmarksListAdapter.java
+++ b/mobile/android/base/home/BookmarksListAdapter.java
@@ -283,17 +283,18 @@ class BookmarksListAdapter extends Multi
         }
 
         if (viewType == VIEW_TYPE_ITEM) {
             final TwoLinePageRow row = (TwoLinePageRow) view;
             row.updateFromCursor(cursor);
         } else {
             final BookmarkFolderView row = (BookmarkFolderView) view;
             if (cursor == null) {
-                row.setText(mParentStack.peek().title);
+                final Resources res = context.getResources();
+                row.setText(res.getString(R.string.home_move_up_to_filter, mParentStack.get(1).title));
                 row.open();
             } else {
                 row.setText(getFolderTitle(context, cursor));
                 row.close();
             }
         }
     }
 }
--- a/mobile/android/base/home/BookmarksPanel.java
+++ b/mobile/android/base/home/BookmarksPanel.java
@@ -12,16 +12,17 @@ import org.mozilla.gecko.db.BrowserContr
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.home.BookmarksListAdapter.FolderInfo;
 import org.mozilla.gecko.home.BookmarksListAdapter.OnRefreshFolderListener;
 import org.mozilla.gecko.home.BookmarksListAdapter.RefreshType;
 import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
 
 import android.app.Activity;
 import android.content.Context;
+import android.content.res.Resources;
 import android.content.res.Configuration;
 import android.database.Cursor;
 import android.os.Bundle;
 import android.support.v4.app.LoaderManager.LoaderCallbacks;
 import android.support.v4.content.Loader;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -183,17 +184,21 @@ public class BookmarksPanel extends Home
     /**
      * Loader for the list for bookmarks.
      */
     private static class BookmarksLoader extends SimpleCursorLoader {
         private final FolderInfo mFolderInfo;
         private final RefreshType mRefreshType;
 
         public BookmarksLoader(Context context) {
-            this(context, new FolderInfo(Bookmarks.FIXED_ROOT_ID), RefreshType.CHILD);
+            super(context);
+            final Resources res = context.getResources();
+            final String title = res.getString(R.string.bookmarks_title);
+            mFolderInfo = new FolderInfo(Bookmarks.FIXED_ROOT_ID, title);
+            mRefreshType = RefreshType.CHILD;
         }
 
         public BookmarksLoader(Context context, FolderInfo folderInfo, RefreshType refreshType) {
             super(context);
             mFolderInfo = folderInfo;
             mRefreshType = refreshType;
         }
 
deleted file mode 100644
index 550d0acc4af3e81f695a2cca55fd38c4a03caae1..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 5d9e1b8696d479d643fe22ed68e40ade7d926c7f..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 66dde750c239d67d94cc1b02eb5e92fb28476969..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/mobile/android/base/resources/drawable/bookmark_folder.xml
+++ b/mobile/android/base/resources/drawable/bookmark_folder.xml
@@ -3,14 +3,14 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <selector xmlns:android="http://schemas.android.com/apk/res/android"
           xmlns:gecko="http://schemas.android.com/apk/res-auto">
 
     <!-- state open -->
     <item gecko:state_open="true"
-          android:drawable="@drawable/bookmark_folder_opened"/>
+          android:drawable="@drawable/folder_up"/>
 
     <!-- state close -->
     <item android:drawable="@drawable/bookmark_folder_closed"/>
 
 </selector>
--- a/mobile/android/base/tests/StringHelper.java
+++ b/mobile/android/base/tests/StringHelper.java
@@ -144,16 +144,18 @@ public class StringHelper {
     public static final String HISTORY_LABEL = "HISTORY";
     public static final String TOP_SITES_LABEL = "TOP SITES";
     public static final String BOOKMARKS_LABEL = "BOOKMARKS";
     public static final String READING_LIST_LABEL = "READING LIST";
     public static final String TODAY_LABEL = "Today";
     public static final String TABS_FROM_LAST_TIME_LABEL = "Open all tabs from last time";
 
     // Desktop default bookmarks folders
+    public static final String BOOKMARKS_UP_TO = "Up to %s";
+    public static final String BOOKMARKS_ROOT_LABEL = "Bookmarks";
     public static final String DESKTOP_FOLDER_LABEL = "Desktop Bookmarks";
     public static final String TOOLBAR_FOLDER_LABEL = "Bookmarks Toolbar";
     public static final String BOOKMARKS_MENU_FOLDER_LABEL = "Bookmarks Menu";
     public static final String UNSORTED_FOLDER_LABEL = "Unsorted Bookmarks";
 
     // Menu items - some of the items are found only on android 2.3 and lower and some only on android 3.0+
     public static final String NEW_TAB_LABEL = "New Tab";
     public static final String NEW_PRIVATE_TAB_LABEL = "New Private Tab";
--- a/mobile/android/base/tests/testBookmarkFolders.java
+++ b/mobile/android/base/tests/testBookmarkFolders.java
@@ -35,20 +35,20 @@ public class testBookmarkFolders extends
             mAsserter.is(adapter.getCount(), 5, "Checking that the correct number of folders is displayed in the Desktop Bookmarks folder");
         } else { // On phones it's just the 4 folders
             mAsserter.is(adapter.getCount(), 4, "Checking that the correct number of folders is displayed in the Desktop Bookmarks folder");
         }
 
         clickOnBookmarkFolder(StringHelper.TOOLBAR_FOLDER_LABEL);
 
         // Go up in the bookmark folder hierarchy
-        clickOnBookmarkFolder(StringHelper.TOOLBAR_FOLDER_LABEL);
+        clickOnBookmarkFolder(String.format(StringHelper.BOOKMARKS_UP_TO, StringHelper.DESKTOP_FOLDER_LABEL));
         mAsserter.ok(waitForText(StringHelper.BOOKMARKS_MENU_FOLDER_LABEL), "Going up in the folder hierarchy", "We are back in the Desktop Bookmarks folder");
 
-        clickOnBookmarkFolder(StringHelper.DESKTOP_FOLDER_LABEL);
+        clickOnBookmarkFolder(String.format(StringHelper.BOOKMARKS_UP_TO, StringHelper.BOOKMARKS_ROOT_LABEL));
         mAsserter.ok(waitForText(StringHelper.DESKTOP_FOLDER_LABEL), "Going up in the folder hierarchy", "We are back in the main Bookmarks List View");
 
         clickOnBookmarkFolder(StringHelper.DESKTOP_FOLDER_LABEL);
         clickOnBookmarkFolder(StringHelper.TOOLBAR_FOLDER_LABEL);
         isBookmarkDisplayed(DESKTOP_BOOKMARK_URL);
 
         // Open the bookmark from a bookmark folder hierarchy
         loadBookmark(DESKTOP_BOOKMARK_URL);
@@ -69,17 +69,17 @@ public class testBookmarkFolders extends
         }, MAX_WAIT_MS);
 
         mAsserter.ok(success, "Trying to long click on the Desktop Bookmarks","Desktop Bookmarks folder could not be long clicked");
 
         final String contextMenuString = StringHelper.BOOKMARK_CONTEXT_MENU_ITEMS[0];
         mAsserter.ok(!waitForText(contextMenuString), "Folders do not have context menus", "The context menu was not opened");
 
         // Even if no context menu is opened long clicking a folder still opens it. We need to close it.
-        clickOnBookmarkFolder(StringHelper.DESKTOP_FOLDER_LABEL);
+        clickOnBookmarkFolder(String.format(StringHelper.BOOKMARKS_UP_TO, StringHelper.BOOKMARKS_ROOT_LABEL));
     }
 
     private void clickOnBookmarkFolder(final String folderName) {
         boolean success = waitForCondition(new Condition() {
             @Override
             public boolean isSatisfied() {
                 View bookmarksFolder = getBookmarkFolderView(folderName);
                 if (bookmarksFolder == null) {