mobile/android/base/home/ReadingListRow.java

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/base/home/ReadingListRow.java	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,43 @@
     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.Tab;
    1.13 +import org.mozilla.gecko.Tabs;
    1.14 +import org.mozilla.gecko.AboutPages;
    1.15 +import org.mozilla.gecko.home.TwoLinePageRow;
    1.16 +
    1.17 +import android.content.Context;
    1.18 +import android.util.AttributeSet;
    1.19 +
    1.20 +public class ReadingListRow extends TwoLinePageRow {
    1.21 +
    1.22 +    public ReadingListRow(Context context) {
    1.23 +        this(context, null);
    1.24 +    }
    1.25 +
    1.26 +    public ReadingListRow(Context context, AttributeSet attrs) {
    1.27 +        super(context, attrs);
    1.28 +    }
    1.29 +
    1.30 +    @Override
    1.31 +    protected void updateDisplayedUrl() {
    1.32 +        String pageUrl = getUrl();
    1.33 +
    1.34 +        boolean isPrivate = Tabs.getInstance().getSelectedTab().isPrivate();
    1.35 +        Tab tab = Tabs.getInstance().getFirstTabForUrl(pageUrl, isPrivate);
    1.36 +
    1.37 +        if (tab != null && AboutPages.isAboutReader(tab.getURL())) {
    1.38 +            setUrl(R.string.switch_to_tab);
    1.39 +            setSwitchToTabIcon(R.drawable.ic_url_bar_tab);
    1.40 +        } else {
    1.41 +            setUrl(pageUrl);
    1.42 +            setSwitchToTabIcon(NO_ICON);
    1.43 +        }
    1.44 +    }
    1.45 +
    1.46 +}

mercurial