michael@0: /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package org.mozilla.gecko.home; michael@0: michael@0: import org.mozilla.gecko.R; michael@0: import org.mozilla.gecko.Tab; michael@0: import org.mozilla.gecko.Tabs; michael@0: import org.mozilla.gecko.AboutPages; michael@0: import org.mozilla.gecko.home.TwoLinePageRow; michael@0: michael@0: import android.content.Context; michael@0: import android.util.AttributeSet; michael@0: michael@0: public class ReadingListRow extends TwoLinePageRow { michael@0: michael@0: public ReadingListRow(Context context) { michael@0: this(context, null); michael@0: } michael@0: michael@0: public ReadingListRow(Context context, AttributeSet attrs) { michael@0: super(context, attrs); michael@0: } michael@0: michael@0: @Override michael@0: protected void updateDisplayedUrl() { michael@0: String pageUrl = getUrl(); michael@0: michael@0: boolean isPrivate = Tabs.getInstance().getSelectedTab().isPrivate(); michael@0: Tab tab = Tabs.getInstance().getFirstTabForUrl(pageUrl, isPrivate); michael@0: michael@0: if (tab != null && AboutPages.isAboutReader(tab.getURL())) { michael@0: setUrl(R.string.switch_to_tab); michael@0: setSwitchToTabIcon(R.drawable.ic_url_bar_tab); michael@0: } else { michael@0: setUrl(pageUrl); michael@0: setSwitchToTabIcon(NO_ICON); michael@0: } michael@0: } michael@0: michael@0: }