backout e777fa3d7fa9 for build failures

This commit is contained in:
Wes Johnston 2014-03-25 12:58:06 -07:00
parent a564938561
commit dc860eefa9
3 changed files with 5 additions and 44 deletions

View File

@ -18,7 +18,6 @@ import org.mozilla.gecko.home.PanelLayout.OnItemOpenListener;
import org.mozilla.gecko.home.PanelLayout.PanelView;
import android.content.Context;
import android.content.res.Resources;
import android.database.Cursor;
import android.view.View;
import android.widget.AdapterView;
@ -39,10 +38,6 @@ public class PanelGridView extends GridView
itemHandler = new PanelViewItemHandler(viewConfig);
adapter = new PanelViewAdapter(context, viewConfig);
Resources res = getResources();
int size = res.getDimensionPixelSize(R.dimen.panel_grid_view_column_width);
// Gridview images are square
adapter.setTargetImageSize(size, size);
setAdapter(adapter);
setOnItemClickListener(new PanelGridItemClickListener());

View File

@ -19,15 +19,12 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;
class PanelItemView extends LinearLayout {
private final TextView title;
private final TextView description;
private final ImageView image;
private final LinearLayout titleDescContainer;
private int targetWidth = 0;
private int targetHeight = 0;
private PanelItemView(Context context, int layoutId) {
super(context);
@ -39,17 +36,6 @@ class PanelItemView extends LinearLayout {
titleDescContainer = (LinearLayout) findViewById(R.id.title_desc_container);
}
/**
* Allows setting the size that images are resized to explicitly.
*
* @param width the width that images should be resized to
* @param height the height that images should be resized to
*/
public void setTargetImageSize(int width, int height) {
targetWidth = width;
targetHeight = height;
}
public void updateFromCursor(Cursor cursor) {
int titleIndex = cursor.getColumnIndexOrThrow(HomeItems.TITLE);
final String titleText = cursor.getString(titleIndex);
@ -82,15 +68,9 @@ class PanelItemView extends LinearLayout {
image.setVisibility(hasImageUrl ? View.VISIBLE : View.GONE);
if (hasImageUrl) {
RequestCreator picasso = Picasso.with(getContext())
.load(imageUrl);
if (targetWidth != 0 && targetHeight != 0) {
picasso.resize(targetWidth, targetHeight)
.centerCrop();
}
picasso.into(image);
Picasso.with(getContext())
.load(imageUrl)
.into(image);
}
}

View File

@ -24,8 +24,6 @@ class PanelViewAdapter extends CursorAdapter {
private final ViewConfig viewConfig;
private FilterManager filterManager;
private final Context context;
private int targetWidth = 0;
private int targetHeight = 0;
public PanelViewAdapter(Context context, ViewConfig viewConfig) {
super(context, null, 0);
@ -42,11 +40,6 @@ class PanelViewAdapter extends CursorAdapter {
return 2;
}
public void setTargetImageSize(int targetWidth, int targetHeight) {
this.targetWidth = targetWidth;
this.targetHeight = targetHeight;
}
@Override
public int getCount() {
return super.getCount() + (isShowingBack() ? 1 : 0);
@ -72,18 +65,11 @@ class PanelViewAdapter extends CursorAdapter {
}
private View newView(Context context, int position, ViewGroup parent) {
final PanelItemView item;
if (getItemViewType(position) == VIEW_TYPE_BACK) {
item = new PanelBackItemView(context, viewConfig.getBackImageUrl());
return new PanelBackItemView(context, viewConfig.getBackImageUrl());
} else {
item = PanelItemView.create(context, viewConfig.getItemType());
return PanelItemView.create(context, viewConfig.getItemType());
}
if (viewConfig.getItemType() == ItemType.IMAGE && targetWidth > 0 && targetHeight > 0) {
item.setTargetImageSize(targetWidth, targetHeight);
}
return item;
}
private void bindView(View view, int position) {