Bug 925546: OnPinSiteListener -> OnEditPinnedSiteListener. r=sriram
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 16 Oct 2013 10:09:41 -0700
changeset 150949 8254d15a537dbaca36aa08d5718ed1428a8d5a79
parent 150948 4291e6d212060c954cabc19548bafcb039202eb1
child 150950 96905a5e44e6877e9afb5054e58d8ac25c31f051
push id3077
push usermichael.l.comella@gmail.com
push dateWed, 16 Oct 2013 17:10:14 +0000
treeherderfx-team@8254d15a537d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssriram
bugs925546
milestone27.0a1
Bug 925546: OnPinSiteListener -> OnEditPinnedSiteListener. r=sriram
mobile/android/base/home/TopSitesGridView.java
mobile/android/base/home/TopSitesPage.java
--- a/mobile/android/base/home/TopSitesGridView.java
+++ b/mobile/android/base/home/TopSitesGridView.java
@@ -28,19 +28,19 @@ import java.util.EnumSet;
 
 /**
  * A grid view of top and pinned sites.
  * Each cell in the grid is a TopSitesGridItemView.
  */
 public class TopSitesGridView extends GridView {
     private static final String LOGTAG = "GeckoTopSitesGridView";
 
-    // Listener for pinning sites.
-    public static interface OnPinSiteListener {
-        public void onPinSite(int position);
+    // Listener for editing pinned sites.
+    public static interface OnEditPinnedSiteListener {
+        public void onEditPinnedSite(int position);
     }
 
     // Max number of top sites that needs to be shown.
     private final int mMaxSites;
 
     // Number of columns to show.
     private final int mNumColumns;
 
@@ -54,18 +54,18 @@ public class TopSitesGridView extends Gr
     private int mMeasuredWidth;
 
     // Measured height of this view.
     private int mMeasuredHeight;
 
     // On URL open listener.
     private OnUrlOpenListener mUrlOpenListener;
 
-    // Pin site listener.
-    private OnPinSiteListener mPinSiteListener;
+    // Edit pinned site listener.
+    private OnEditPinnedSiteListener mEditPinnedSiteListener;
 
     // Context menu info.
     private TopSitesGridContextMenuInfo mContextMenuInfo;
 
     // Whether we're handling focus changes or not. This is used
     // to avoid infinite re-layouts when using this GridView as
     // a ListView header view (see bug 918044).
     private boolean mIsHandlingFocusChange;
@@ -109,18 +109,18 @@ public class TopSitesGridView extends Gr
 
                 // If the url is empty, the user can pin a site.
                 // If not, navigate to the page given by the url.
                 if (!TextUtils.isEmpty(url)) {
                     if (mUrlOpenListener != null) {
                         mUrlOpenListener.onUrlOpen(url, EnumSet.noneOf(OnUrlOpenListener.Flags.class));
                     }
                 } else {
-                    if (mPinSiteListener != null) {
-                        mPinSiteListener.onPinSite(position);
+                    if (mEditPinnedSiteListener != null) {
+                        mEditPinnedSiteListener.onEditPinnedSite(position);
                     }
                 }
             }
         });
 
         setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
             @Override
             public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
@@ -131,17 +131,17 @@ public class TopSitesGridView extends Gr
         });
     }
 
     @Override
     public void onDetachedFromWindow() {
         super.onDetachedFromWindow();
 
         mUrlOpenListener = null;
-        mPinSiteListener = null;
+        mEditPinnedSiteListener = null;
     }
 
     @Override
     protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {
         mIsHandlingFocusChange = true;
         super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
         mIsHandlingFocusChange = false;
     }
@@ -224,22 +224,22 @@ public class TopSitesGridView extends Gr
      *
      * @param listener An url open listener for this view.
      */
     public void setOnUrlOpenListener(OnUrlOpenListener listener) {
         mUrlOpenListener = listener;
     }
 
     /**
-     * Set a pin site listener to be used by this view.
+     * Set an edit pinned site listener to be used by this view.
      *
-     * @param listener A pin site listener for this view.
+     * @param listener An edit pinned site listener for this view.
      */
-    public void setOnPinSiteListener(OnPinSiteListener listener) {
-        mPinSiteListener = listener;
+    public void setOnEditPinnedSiteListener(final OnEditPinnedSiteListener listener) {
+        mEditPinnedSiteListener = listener;
     }
 
     /**
      * A ContextMenuInfo for TopBoomarksView that adds details from the cursor.
      */
     public static class TopSitesGridContextMenuInfo extends AdapterContextMenuInfo {
 
         public String url;
--- a/mobile/android/base/home/TopSitesPage.java
+++ b/mobile/android/base/home/TopSitesPage.java
@@ -15,17 +15,17 @@ import org.mozilla.gecko.db.BrowserContr
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.db.BrowserDB.URLColumns;
 import org.mozilla.gecko.db.BrowserDB.TopSitesCursorWrapper;
 import org.mozilla.gecko.favicons.OnFaviconLoadedListener;
 import org.mozilla.gecko.gfx.BitmapUtils;
 import org.mozilla.gecko.home.HomeListView.HomeContextMenuInfo;
 import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
 import org.mozilla.gecko.home.PinSiteDialog.OnSiteSelectedListener;
-import org.mozilla.gecko.home.TopSitesGridView.OnPinSiteListener;
+import org.mozilla.gecko.home.TopSitesGridView.OnEditPinnedSiteListener;
 import org.mozilla.gecko.home.TopSitesGridView.TopSitesGridContextMenuInfo;
 import org.mozilla.gecko.util.ThreadUtils;
 
 import android.app.Activity;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.res.Configuration;
 import android.database.Cursor;
@@ -95,18 +95,18 @@ public class TopSitesPage extends HomeFr
     private boolean mSnapBannerToTop;
 
     // Callbacks used for the search and favicon cursor loaders
     private CursorLoaderCallbacks mCursorLoaderCallbacks;
 
     // Callback for thumbnail loader
     private ThumbnailsLoaderCallbacks mThumbnailsLoaderCallbacks;
 
-    // Listener for pinning sites
-    private PinSiteListener mPinSiteListener;
+    // Listener for editing pinned sites.
+    private EditPinnedSiteListener mEditPinnedSiteListener;
 
     // On URL open listener
     private OnUrlOpenListener mUrlOpenListener;
 
     // Max number of entries shown in the grid from the cursor.
     private int mMaxGridEntries;
 
     // Time in ms until the Gecko thread is reset to normal priority.
@@ -150,17 +150,17 @@ public class TopSitesPage extends HomeFr
         mGrid = new TopSitesGridView(getActivity());
         mList.addHeaderView(mGrid);
 
         return view;
     }
 
     @Override
     public void onViewCreated(View view, Bundle savedInstanceState) {
-        mPinSiteListener = new PinSiteListener();
+        mEditPinnedSiteListener = new EditPinnedSiteListener();
 
         mList.setTag(HomePager.LIST_TAG_TOP_SITES);
         mList.setHeaderDividersEnabled(false);
 
         mList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
             @Override
             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                 final ListView list = (ListView) parent;
@@ -181,17 +181,17 @@ public class TopSitesPage extends HomeFr
                 final String url = c.getString(c.getColumnIndexOrThrow(URLColumns.URL));
 
                 // This item is a TwoLinePageRow, so we allow switch-to-tab.
                 mUrlOpenListener.onUrlOpen(url, EnumSet.of(OnUrlOpenListener.Flags.ALLOW_SWITCH_TO_TAB));
             }
         });
 
         mGrid.setOnUrlOpenListener(mUrlOpenListener);
-        mGrid.setOnPinSiteListener(mPinSiteListener);
+        mGrid.setOnEditPinnedSiteListener(mEditPinnedSiteListener);
 
         registerForContextMenu(mList);
         registerForContextMenu(mGrid);
 
         mBanner = (HomeBanner) view.findViewById(R.id.home_banner);
         mList.setOnTouchListener(new OnTouchListener() {
             @Override
             public boolean onTouch(View v, MotionEvent event) {
@@ -333,17 +333,17 @@ public class TopSitesPage extends HomeFr
                     BrowserDB.unpinSite(context.getContentResolver(), position);
                 }
             });
 
             return true;
         }
 
         if (itemId == R.id.top_sites_edit) {
-            mPinSiteListener.onPinSite(info.position);
+            mEditPinnedSiteListener.onEditPinnedSite(info.position);
             return true;
         }
 
         return false;
     }
 
     @Override
     protected void load() {
@@ -366,28 +366,28 @@ public class TopSitesPage extends HomeFr
         Uri uri = Uri.parse(url);
         if ("user-entered".equals(uri.getScheme())) {
             return uri.getSchemeSpecificPart();
         }
         return url;
     }
 
     /**
-     * Listener for pinning sites.
+     * Listener for editing pinned sites.
      */
-    private class PinSiteListener implements OnPinSiteListener,
-                                             OnSiteSelectedListener {
+    private class EditPinnedSiteListener implements OnEditPinnedSiteListener,
+                                                    OnSiteSelectedListener {
         // Tag for the PinSiteDialog fragment.
         private static final String TAG_PIN_SITE = "pin_site";
 
         // Position of the pin.
         private int mPosition;
 
         @Override
-        public void onPinSite(int position) {
+        public void onEditPinnedSite(int position) {
             mPosition = position;
 
             final FragmentManager manager = getActivity().getSupportFragmentManager();
             PinSiteDialog dialog = (PinSiteDialog) manager.findFragmentByTag(TAG_PIN_SITE);
             if (dialog == null) {
                 dialog = PinSiteDialog.newInstance();
             }