Bug 980152 - Update code style in some Panel classes. r=lucasr
authorWes Johnston <wjohnston@mozilla.com>
Tue, 25 Mar 2014 12:44:21 -0700
changeset 175407 e4b7b3164899a057e281dd814b8691a4a06dcc26
parent 175319 7476950fea9ea7ddc699ae3a01eb292a6c9e4194
child 175408 e777fa3d7fa90d07daee7acd249d106ca19f8d4e
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerslucasr
bugs980152
milestone31.0a1
Bug 980152 - Update code style in some Panel classes. r=lucasr
mobile/android/base/home/PanelGridView.java
mobile/android/base/home/PanelItemView.java
mobile/android/base/home/PanelViewAdapter.java
--- a/mobile/android/base/home/PanelGridView.java
+++ b/mobile/android/base/home/PanelGridView.java
@@ -22,53 +22,53 @@ import android.database.Cursor;
 import android.view.View;
 import android.widget.AdapterView;
 import android.widget.GridView;
 
 public class PanelGridView extends GridView
                            implements DatasetBacked, PanelView {
     private static final String LOGTAG = "GeckoPanelGridView";
 
-    private final ViewConfig mViewConfig;
-    private final PanelViewAdapter mAdapter;
-    private PanelViewItemHandler mItemHandler;
+    private final ViewConfig viewConfig;
+    private final PanelViewAdapter adapter;
+    private PanelViewItemHandler itemHandler;
 
     public PanelGridView(Context context, ViewConfig viewConfig) {
         super(context, null, R.attr.panelGridViewStyle);
 
-        mViewConfig = viewConfig;
-        mItemHandler = new PanelViewItemHandler(viewConfig);
+        this.viewConfig = viewConfig;
+        itemHandler = new PanelViewItemHandler(viewConfig);
 
-        mAdapter = new PanelViewAdapter(context, viewConfig);
-        setAdapter(mAdapter);
+        adapter = new PanelViewAdapter(context, viewConfig);
+        setAdapter(adapter);
 
         setOnItemClickListener(new PanelGridItemClickListener());
     }
 
     @Override
     public void onDetachedFromWindow() {
         super.onDetachedFromWindow();
-        mItemHandler.setOnItemOpenListener(null);
+        itemHandler.setOnItemOpenListener(null);
     }
 
     @Override
     public void setDataset(Cursor cursor) {
-        mAdapter.swapCursor(cursor);
+        adapter.swapCursor(cursor);
     }
 
     @Override
     public void setOnItemOpenListener(OnItemOpenListener listener) {
-        mItemHandler.setOnItemOpenListener(listener);
+        itemHandler.setOnItemOpenListener(listener);
     }
 
     @Override
     public void setFilterManager(FilterManager filterManager) {
-        mAdapter.setFilterManager(filterManager);
-        mItemHandler.setFilterManager(filterManager);
+        adapter.setFilterManager(filterManager);
+        itemHandler.setFilterManager(filterManager);
     }
 
     private class PanelGridItemClickListener implements AdapterView.OnItemClickListener {
         @Override
         public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-            mItemHandler.openItemAtPosition(mAdapter.getCursor(), position);
+            itemHandler.openItemAtPosition(adapter.getCursor(), position);
         }
     }
 }
--- a/mobile/android/base/home/PanelItemView.java
+++ b/mobile/android/base/home/PanelItemView.java
@@ -16,65 +16,66 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import com.squareup.picasso.Picasso;
 
 class PanelItemView extends LinearLayout {
-    private final TextView mTitle;
-    private final TextView mDescription;
-    private final ImageView mImage;
-    private final LinearLayout mTitleDescContainer;
+    private final TextView title;
+    private final TextView description;
+    private final ImageView image;
+    private final LinearLayout titleDescContainer;
 
     private PanelItemView(Context context, int layoutId) {
         super(context);
 
         LayoutInflater.from(context).inflate(layoutId, this);
-        mTitle = (TextView) findViewById(R.id.title);
-        mDescription = (TextView) findViewById(R.id.description);
-        mImage = (ImageView) findViewById(R.id.image);
-        mTitleDescContainer = (LinearLayout) findViewById(R.id.title_desc_container);
+        title = (TextView) findViewById(R.id.title);
+        description = (TextView) findViewById(R.id.description);
+        image = (ImageView) findViewById(R.id.image);
+        titleDescContainer = (LinearLayout) findViewById(R.id.title_desc_container);
     }
 
     public void updateFromCursor(Cursor cursor) {
         int titleIndex = cursor.getColumnIndexOrThrow(HomeItems.TITLE);
-        final String title = cursor.getString(titleIndex);
+        final String titleText = cursor.getString(titleIndex);
 
         // Only show title if the item has one
-        final boolean hasTitle = !TextUtils.isEmpty(title);
-        mTitle.setVisibility(hasTitle ? View.VISIBLE : View.GONE);
+        final boolean hasTitle = !TextUtils.isEmpty(titleText);
+        title.setVisibility(hasTitle ? View.VISIBLE : View.GONE);
+        titleDescContainer.setVisibility(hasTitle ? View.VISIBLE : View.GONE);
         if (hasTitle) {
-            mTitle.setText(title);
+            title.setText(titleText);
         }
 
         int descriptionIndex = cursor.getColumnIndexOrThrow(HomeItems.DESCRIPTION);
-        final String description = cursor.getString(descriptionIndex);
+        final String descriptionText = cursor.getString(descriptionIndex);
 
         // Only show description if the item has one
-        final boolean hasDescription = !TextUtils.isEmpty(description);
-        mDescription.setVisibility(hasDescription ? View.VISIBLE : View.GONE);
+        final boolean hasDescription = !TextUtils.isEmpty(descriptionText);
+        description.setVisibility(hasDescription ? View.VISIBLE : View.GONE);
         if (hasDescription) {
-            mDescription.setText(description);
+            description.setText(descriptionText);
         }
 
-        mTitleDescContainer.setVisibility(hasTitle || hasDescription ? View.VISIBLE : View.GONE);
+        titleDescContainer.setVisibility(hasTitle || hasDescription ? View.VISIBLE : View.GONE);
 
         int imageIndex = cursor.getColumnIndexOrThrow(HomeItems.IMAGE_URL);
         final String imageUrl = cursor.getString(imageIndex);
 
         // Only try to load the image if the item has define image URL
         final boolean hasImageUrl = !TextUtils.isEmpty(imageUrl);
-        mImage.setVisibility(hasImageUrl ? View.VISIBLE : View.GONE);
+        image.setVisibility(hasImageUrl ? View.VISIBLE : View.GONE);
 
         if (hasImageUrl) {
             Picasso.with(getContext())
                    .load(imageUrl)
-                   .into(mImage);
+                   .into(image);
         }
     }
 
     private static class ArticleItemView extends PanelItemView {
         private ArticleItemView(Context context) {
             super(context, R.layout.panel_article_item);
             setOrientation(LinearLayout.HORIZONTAL);
         }
--- a/mobile/android/base/home/PanelViewAdapter.java
+++ b/mobile/android/base/home/PanelViewAdapter.java
@@ -16,28 +16,28 @@ import android.database.Cursor;
 import android.support.v4.widget.CursorAdapter;
 import android.view.View;
 import android.view.ViewGroup;
 
 class PanelViewAdapter extends CursorAdapter {
     private static final int VIEW_TYPE_ITEM = 0;
     private static final int VIEW_TYPE_BACK = 1;
 
-	private final Context mContext;
-    private final ViewConfig mViewConfig;
-    private FilterManager mFilterManager;
+    private final ViewConfig viewConfig;
+    private FilterManager filterManager;
+    private final Context context;
 
     public PanelViewAdapter(Context context, ViewConfig viewConfig) {
         super(context, null, 0);
-        mContext = context;
-        mViewConfig = viewConfig;
+        this.context = context;
+        this.viewConfig = viewConfig;
     }
 
     public void setFilterManager(FilterManager manager) {
-        mFilterManager = manager;
+        this.filterManager = manager;
     }
 
     @Override
     public final int getViewTypeCount() {
         return 2;
     }
 
     @Override
@@ -61,40 +61,40 @@ class PanelViewAdapter extends CursorAda
         }
 
         bindView(convertView, position);
         return convertView;
     }
 
     private View newView(Context context, int position, ViewGroup parent) {
         if (getItemViewType(position) == VIEW_TYPE_BACK) {
-            return new PanelBackItemView(context, mViewConfig.getBackImageUrl());
+            return new PanelBackItemView(context, viewConfig.getBackImageUrl());
         } else {
-            return PanelItemView.create(context, mViewConfig.getItemType());
+            return PanelItemView.create(context, viewConfig.getItemType());
         }
     }
 
     private void bindView(View view, int position) {
         if (isShowingBack()) {
             if (position == 0) {
                 final PanelBackItemView item = (PanelBackItemView) view;
-                item.updateFromFilter(mFilterManager.getPreviousFilter());
+                item.updateFromFilter(filterManager.getPreviousFilter());
                 return;
             }
 
             position--;
         }
 
         final Cursor cursor = getCursor(position);
         final PanelItemView item = (PanelItemView) view;
         item.updateFromCursor(cursor);
     }
 
     private boolean isShowingBack() {
-        return (mFilterManager != null ? mFilterManager.canGoBack() : false);
+        return (filterManager != null ? filterManager.canGoBack() : false);
     }
 
     private final Cursor getCursor(int position) {
         final Cursor cursor = getCursor();
         if (cursor == null || !cursor.moveToPosition(position)) {
             throw new IllegalStateException("Couldn't move cursor to position " + position);
         }