1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/base/home/PanelBackItemView.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,48 @@ 1.4 +/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- 1.5 + * This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +package org.mozilla.gecko.home; 1.10 + 1.11 +import org.mozilla.gecko.R; 1.12 +import org.mozilla.gecko.home.PanelLayout.FilterDetail; 1.13 + 1.14 +import android.content.Context; 1.15 +import android.text.TextUtils; 1.16 +import android.view.LayoutInflater; 1.17 +import android.widget.ImageView; 1.18 +import android.widget.LinearLayout; 1.19 +import android.widget.TextView; 1.20 + 1.21 +import com.squareup.picasso.Picasso; 1.22 + 1.23 +class PanelBackItemView extends LinearLayout { 1.24 + private final TextView title; 1.25 + 1.26 + public PanelBackItemView(Context context, String backImageUrl) { 1.27 + super(context); 1.28 + 1.29 + LayoutInflater.from(context).inflate(R.layout.panel_back_item, this); 1.30 + setOrientation(HORIZONTAL); 1.31 + 1.32 + title = (TextView) findViewById(R.id.title); 1.33 + 1.34 + final ImageView image = (ImageView) findViewById(R.id.image); 1.35 + 1.36 + if (TextUtils.isEmpty(backImageUrl)) { 1.37 + image.setImageResource(R.drawable.folder_up); 1.38 + } else { 1.39 + Picasso.with(getContext()) 1.40 + .load(backImageUrl) 1.41 + .placeholder(R.drawable.folder_up) 1.42 + .into(image); 1.43 + } 1.44 + } 1.45 + 1.46 + public void updateFromFilter(FilterDetail filter) { 1.47 + final String backText = getResources() 1.48 + .getString(R.string.home_move_up_to_filter, filter.title); 1.49 + title.setText(backText); 1.50 + } 1.51 +}