Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- |
michael@0 | 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | package org.mozilla.gecko.home; |
michael@0 | 7 | |
michael@0 | 8 | import org.mozilla.gecko.R; |
michael@0 | 9 | import org.mozilla.gecko.home.PanelLayout.FilterDetail; |
michael@0 | 10 | |
michael@0 | 11 | import android.content.Context; |
michael@0 | 12 | import android.text.TextUtils; |
michael@0 | 13 | import android.view.LayoutInflater; |
michael@0 | 14 | import android.widget.ImageView; |
michael@0 | 15 | import android.widget.LinearLayout; |
michael@0 | 16 | import android.widget.TextView; |
michael@0 | 17 | |
michael@0 | 18 | import com.squareup.picasso.Picasso; |
michael@0 | 19 | |
michael@0 | 20 | class PanelBackItemView extends LinearLayout { |
michael@0 | 21 | private final TextView title; |
michael@0 | 22 | |
michael@0 | 23 | public PanelBackItemView(Context context, String backImageUrl) { |
michael@0 | 24 | super(context); |
michael@0 | 25 | |
michael@0 | 26 | LayoutInflater.from(context).inflate(R.layout.panel_back_item, this); |
michael@0 | 27 | setOrientation(HORIZONTAL); |
michael@0 | 28 | |
michael@0 | 29 | title = (TextView) findViewById(R.id.title); |
michael@0 | 30 | |
michael@0 | 31 | final ImageView image = (ImageView) findViewById(R.id.image); |
michael@0 | 32 | |
michael@0 | 33 | if (TextUtils.isEmpty(backImageUrl)) { |
michael@0 | 34 | image.setImageResource(R.drawable.folder_up); |
michael@0 | 35 | } else { |
michael@0 | 36 | Picasso.with(getContext()) |
michael@0 | 37 | .load(backImageUrl) |
michael@0 | 38 | .placeholder(R.drawable.folder_up) |
michael@0 | 39 | .into(image); |
michael@0 | 40 | } |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | public void updateFromFilter(FilterDetail filter) { |
michael@0 | 44 | final String backText = getResources() |
michael@0 | 45 | .getString(R.string.home_move_up_to_filter, filter.title); |
michael@0 | 46 | title.setText(backText); |
michael@0 | 47 | } |
michael@0 | 48 | } |