Bug 1374630 - Add deep link for home and general setting page. r?maliu draft
authorNevin Chen <cnevinchen@gmail.com>
Tue, 20 Jun 2017 21:45:42 +0800
changeset 603225 0722832f5c47fde688c64dea64f9cf249a58876b
parent 603204 6f8f10f48ace5692256efd91f011bd23054ee2ec
child 603226 ec394531c65fa436b546c5dba3e330fc39426427
push id66695
push userbmo:cnevinchen@gmail.com
push dateMon, 03 Jul 2017 05:30:48 +0000
reviewersmaliu
bugs1374630
milestone56.0a1
Bug 1374630 - Add deep link for home and general setting page. r?maliu MozReview-Commit-ID: KC80CbDPp1M
mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java
mobile/android/base/java/org/mozilla/gecko/deeplink/DeepLinkContract.java
mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferenceFragment.java
--- a/mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java
@@ -23,25 +23,28 @@ import org.mozilla.gecko.preferences.Gec
 import org.mozilla.gecko.tabqueue.TabQueueHelper;
 import org.mozilla.gecko.tabqueue.TabQueueService;
 
 import static org.mozilla.gecko.BrowserApp.ACTIVITY_REQUEST_PREFERENCES;
 import static org.mozilla.gecko.deeplink.DeepLinkContract.DEEP_LINK_SCHEME;
 import static org.mozilla.gecko.deeplink.DeepLinkContract.LINK_BOOKMARK_LIST;
 import static org.mozilla.gecko.deeplink.DeepLinkContract.LINK_DEFAULT_BROWSER;
 import static org.mozilla.gecko.deeplink.DeepLinkContract.LINK_HISTORY_LIST;
+import static org.mozilla.gecko.deeplink.DeepLinkContract.LINK_PREFERENCES_HOME;
 import static org.mozilla.gecko.deeplink.DeepLinkContract.LINK_PREFERENCES;
 import static org.mozilla.gecko.deeplink.DeepLinkContract.LINK_PREFERENCES_ACCESSIBILITY;
+import static org.mozilla.gecko.deeplink.DeepLinkContract.LINK_PREFERENCES_GENERAL;
 import static org.mozilla.gecko.deeplink.DeepLinkContract.LINK_PREFERENCES_NOTIFICATIONS;
 import static org.mozilla.gecko.deeplink.DeepLinkContract.LINK_PREFERENCES_PRIAVACY;
 import static org.mozilla.gecko.deeplink.DeepLinkContract.LINK_PREFERENCES_SEARCH;
 import static org.mozilla.gecko.deeplink.DeepLinkContract.LINK_SAVE_AS_PDF;
 import static org.mozilla.gecko.deeplink.DeepLinkContract.LINK_SIGN_UP;
 import static org.mozilla.gecko.deeplink.DeepLinkContract.SUMO_DEFAULT_BROWSER;
 import static org.mozilla.gecko.deeplink.DeepLinkContract.LINK_FXA_SIGNIN;
+
 import org.mozilla.gecko.deeplink.DeepLinkContract;
 
 /**
  * Activity that receives incoming Intents and dispatches them to the appropriate activities (e.g. browser, custom tabs, web app).
  */
 public class LauncherActivity extends Activity {
     private static final String TAG = LauncherActivity.class.getSimpleName();
 
@@ -208,16 +211,18 @@ public class LauncherActivity extends Ac
                 break;
             case LINK_PREFERENCES:
                 Intent settingsIntent = new Intent(this, GeckoPreferences.class);
 
                 // We want to know when the Settings activity returns, because
                 // we might need to redisplay based on a locale change.
                 startActivityForResult(settingsIntent, ACTIVITY_REQUEST_PREFERENCES);
                 break;
+            case LINK_PREFERENCES_GENERAL:
+            case LINK_PREFERENCES_HOME:
             case LINK_PREFERENCES_PRIAVACY:
             case LINK_PREFERENCES_SEARCH:
             case LINK_PREFERENCES_NOTIFICATIONS:
             case LINK_PREFERENCES_ACCESSIBILITY:
                 settingsIntent = new Intent(this, GeckoPreferences.class);
                 GeckoPreferences.setResourceToOpen(settingsIntent, host);
                 startActivityForResult(settingsIntent, ACTIVITY_REQUEST_PREFERENCES);
                 break;
--- a/mobile/android/base/java/org/mozilla/gecko/deeplink/DeepLinkContract.java
+++ b/mobile/android/base/java/org/mozilla/gecko/deeplink/DeepLinkContract.java
@@ -14,18 +14,20 @@ public class DeepLinkContract {
 
     public static final String LINK_FXA_SIGNIN = "fxa-signin";
 
     public static final String LINK_DEFAULT_BROWSER = "default_browser";
     public static final String LINK_SAVE_AS_PDF = "save_as_pdf";
     public static final String LINK_BOOKMARK_LIST = "bookmark_list";
     public static final String LINK_HISTORY_LIST = "history_list";
     public static final String LINK_SIGN_UP = "sign_up";
+    public static final String LINK_PREFERENCES_GENERAL = "preferences_general";
     public static final String LINK_PREFERENCES = "preferences";
     public static final String LINK_PREFERENCES_PRIAVACY = "preferences_privacy";
     public static final String LINK_PREFERENCES_SEARCH = "preferences_search";
     public static final String LINK_PREFERENCES_NOTIFICATIONS = "preferences_notifications";
     public static final String LINK_PREFERENCES_ACCESSIBILITY = "preferences_accessibility";
+    public static final String LINK_PREFERENCES_HOME = "preferences_home";
 
     public static final String ACCOUNTS_TOKEN_PARAM = "signin";
     public static final String ACCOUNTS_ENTRYPOINT_PARAM = "entrypoint";
     public static final String ACCOUNTS_UTM_PREFIX = "utm_";
 }
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferenceFragment.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferenceFragment.java
@@ -103,16 +103,24 @@ public class GeckoPreferenceFragment ext
      * This method sets the title that you see on non-multi-pane devices.
      */
     private String getTitle() {
         final int res = getResource();
         if (res == R.xml.preferences) {
             return getString(R.string.settings_title);
         }
 
+        if (res == R.xml.preferences_general) {
+            return getString(R.string.pref_category_general);
+        }
+
+        if (res == R.xml.preferences_home) {
+            return getString((R.string.pref_category_home));
+        }
+
         // We can launch this category from the Data Reporting notification.
         if (res == R.xml.preferences_privacy) {
             return getString(R.string.pref_category_privacy_short);
         }
 
         // We can launch this category from the the magnifying glass in the quick search bar.
         if (res == R.xml.preferences_search) {
             return getString(R.string.pref_category_search);