mobile/android/base/home/PanelBackItemView.java

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

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

mercurial