Bug 1366704 - Part 2: Modify search suggestion custom views to refrsh UI when changing to private mode. r?sebastian,walkingice draft
authorJing-wei Wu <topwu.tw@gmail.com>
Wed, 28 Jun 2017 09:34:32 -0700
changeset 602830 90f4ab22ec10ef7c7ebce70caf8144546628ba2e
parent 602829 65560f1efa79b0beb430f2fb4996e6f68f58d8be
child 602831 dd1cf85243b948019e9fd69a40042ad85ffc5b22
push id66568
push userbmo:topwu.tw@gmail.com
push dateFri, 30 Jun 2017 20:17:31 +0000
reviewerssebastian, walkingice
bugs1366704
milestone56.0a1
Bug 1366704 - Part 2: Modify search suggestion custom views to refrsh UI when changing to private mode. r?sebastian,walkingice MozReview-Commit-ID: 5g1S25J1hsn
mobile/android/app/src/australis/java/org/mozilla/gecko/home/SearchEngineRow.java
mobile/android/app/src/photon/java/org/mozilla/gecko/home/SearchEngineRow.java
mobile/android/base/java/org/mozilla/gecko/home/HomeListView.java
mobile/android/base/java/org/mozilla/gecko/home/TwoLinePageRow.java
--- a/mobile/android/app/src/australis/java/org/mozilla/gecko/home/SearchEngineRow.java
+++ b/mobile/android/app/src/australis/java/org/mozilla/gecko/home/SearchEngineRow.java
@@ -14,42 +14,42 @@ import org.mozilla.gecko.home.BrowserSea
 import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
 import org.mozilla.gecko.icons.IconResponse;
 import org.mozilla.gecko.preferences.GeckoPreferences;
 import org.mozilla.gecko.util.DrawableUtil;
 import org.mozilla.gecko.util.StringUtils;
 import org.mozilla.gecko.util.HardwareUtils;
 import org.mozilla.gecko.widget.FaviconView;
 import org.mozilla.gecko.widget.FlowLayout;
+import org.mozilla.gecko.widget.themed.ThemedRelativeLayout;
 
 import android.content.Context;
 import android.content.SharedPreferences;
 import android.graphics.drawable.Drawable;
 import android.graphics.Typeface;
 import android.support.annotation.Nullable;
 import android.text.TextUtils;
 import android.text.style.StyleSpan;
 import android.text.Spannable;
 import android.text.SpannableStringBuilder;
 import android.util.AttributeSet;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
 import android.widget.TextView;
 
 import java.util.ArrayList;
 import java.util.EnumSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.regex.Pattern;
 
-class SearchEngineRow extends RelativeLayout {
+class SearchEngineRow extends ThemedRelativeLayout {
 
     // Inner views
     private final FlowLayout mSuggestionView;
     private final FaviconView mIconView;
     private final LinearLayout mUserEnteredView;
     private final TextView mUserEnteredTextView;
 
     // Inflater used when updating from suggestions
--- a/mobile/android/app/src/photon/java/org/mozilla/gecko/home/SearchEngineRow.java
+++ b/mobile/android/app/src/photon/java/org/mozilla/gecko/home/SearchEngineRow.java
@@ -14,42 +14,42 @@ import org.mozilla.gecko.home.BrowserSea
 import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
 import org.mozilla.gecko.icons.IconResponse;
 import org.mozilla.gecko.preferences.GeckoPreferences;
 import org.mozilla.gecko.util.DrawableUtil;
 import org.mozilla.gecko.util.StringUtils;
 import org.mozilla.gecko.util.HardwareUtils;
 import org.mozilla.gecko.widget.FaviconView;
 import org.mozilla.gecko.widget.FlowLayout;
+import org.mozilla.gecko.widget.themed.ThemedRelativeLayout;
 
 import android.content.Context;
 import android.content.SharedPreferences;
 import android.graphics.drawable.Drawable;
 import android.graphics.Typeface;
 import android.support.annotation.Nullable;
 import android.text.TextUtils;
 import android.text.style.StyleSpan;
 import android.text.Spannable;
 import android.text.SpannableStringBuilder;
 import android.util.AttributeSet;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
 import android.widget.TextView;
 
 import java.util.ArrayList;
 import java.util.EnumSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.regex.Pattern;
 
-class SearchEngineRow extends RelativeLayout {
+class SearchEngineRow extends ThemedRelativeLayout {
 
     // Inner views
     private final FlowLayout mSuggestionView;
     private final FaviconView mIconView;
     private final LinearLayout mUserEnteredView;
     private final TextView mUserEnteredTextView;
 
     // Inflater used when updating from suggestions
--- a/mobile/android/base/java/org/mozilla/gecko/home/HomeListView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/HomeListView.java
@@ -2,33 +2,33 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * 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/. */
 
 package org.mozilla.gecko.home;
 
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
+import org.mozilla.gecko.widget.themed.ThemedListView;
 
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.database.Cursor;
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
 import android.view.ContextMenu.ContextMenuInfo;
 import android.view.View;
 import android.widget.AdapterView;
 import android.widget.AdapterView.OnItemLongClickListener;
-import android.widget.ListView;
 
 /**
  * HomeListView is a custom extension of ListView, that packs a HomeContextMenuInfo
  * when any of its rows is long pressed.
  */
-public class HomeListView extends ListView
+public class HomeListView extends ThemedListView
                           implements OnItemLongClickListener {
 
     // ContextMenuInfo associated with the currently long pressed list item.
     private HomeContextMenuInfo mContextMenuInfo;
 
     // On URL open listener
     protected OnUrlOpenListener mUrlOpenListener;
 
--- a/mobile/android/base/java/org/mozilla/gecko/home/TwoLinePageRow.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/TwoLinePageRow.java
@@ -13,35 +13,35 @@ import android.database.Cursor;
 import android.support.v4.view.ViewCompat;
 import android.support.v4.widget.TextViewCompat;
 import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.view.Gravity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.ImageView;
-import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import org.mozilla.gecko.AboutPages;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.Tab;
 import org.mozilla.gecko.Tabs;
 import org.mozilla.gecko.db.BrowserContract;
 import org.mozilla.gecko.db.BrowserContract.Combined;
 import org.mozilla.gecko.db.BrowserContract.URLColumns;
 import org.mozilla.gecko.distribution.PartnerBookmarksProviderProxy;
 import org.mozilla.gecko.icons.IconDescriptor;
 import org.mozilla.gecko.icons.IconResponse;
 import org.mozilla.gecko.icons.Icons;
 import org.mozilla.gecko.reader.ReaderModeUtils;
 import org.mozilla.gecko.reader.SavedReaderViewHelper;
 import org.mozilla.gecko.widget.FaviconView;
+import org.mozilla.gecko.widget.themed.ThemedLinearLayout;
 
-public class TwoLinePageRow extends LinearLayout
+public class TwoLinePageRow extends ThemedLinearLayout
                             implements Tabs.OnTabsChangedListener {
 
     protected static final int NO_ICON = 0;
 
     private final TextView mTitle;
     private final TextView mUrl;
     private final ImageView mStatusIcon;
 
@@ -76,24 +76,24 @@ public class TwoLinePageRow extends Line
 
         mSwitchToTabIconId = NO_ICON;
         mShowIcons = true;
 
         mFavicon = (FaviconView) findViewById(R.id.icon);
     }
 
     @Override
-    protected void onAttachedToWindow() {
+    public void onAttachedToWindow() {
         super.onAttachedToWindow();
 
         Tabs.registerOnTabsChangedListener(this);
     }
 
     @Override
-    protected void onDetachedFromWindow() {
+    public void onDetachedFromWindow() {
         super.onDetachedFromWindow();
 
         // Tabs' listener array is safe to modify during use: its
         // iteration pattern is based on snapshots.
         Tabs.unregisterOnTabsChangedListener(this);
     }
 
     /**