Bug 880047: Kill LinkTextView in old about:home [r=margaret]

--HG--
extra : rebase_source : 01c1761d615e9f877ee04742bf107cb68dd1fcbc
This commit is contained in:
Sriram Ramasubramanian 2013-07-18 14:11:49 -07:00
parent 27bb0f12ca
commit 4533e6f246
6 changed files with 0 additions and 108 deletions

View File

@ -262,7 +262,6 @@ FENNEC_JAVA_FILES = \
widget/GeckoPopupMenu.java \ widget/GeckoPopupMenu.java \
widget/GeckoActionProvider.java \ widget/GeckoActionProvider.java \
widget/IconTabWidget.java \ widget/IconTabWidget.java \
widget/LinkTextView.java \
widget/PromoBox.java \ widget/PromoBox.java \
widget/TabRow.java \ widget/TabRow.java \
widget/ThumbnailView.java \ widget/ThumbnailView.java \
@ -1029,7 +1028,6 @@ RES_DRAWABLE_XLARGE_XHDPI_V11 = \
$(NULL) $(NULL)
RES_COLOR = \ RES_COLOR = \
res/color/abouthome_section_more_text.xml \
res/color/abouthome_section_subtitle.xml \ res/color/abouthome_section_subtitle.xml \
res/color/abouthome_section_title.xml \ res/color/abouthome_section_title.xml \
res/color/primary_text.xml \ res/color/primary_text.xml \
@ -1045,7 +1043,6 @@ RES_COLOR = \
$(NULL) $(NULL)
RES_MENU = \ RES_MENU = \
res/menu/abouthome_topsites_contextmenu.xml \
res/menu/browser_app_menu.xml \ res/menu/browser_app_menu.xml \
res/menu/gecko_app_menu.xml \ res/menu/gecko_app_menu.xml \
res/menu/home_contextmenu.xml \ res/menu/home_contextmenu.xml \

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gecko="http://schemas.android.com/apk/res-auto">
<!-- dark theme -->
<item gecko:state_dark="true" android:color="#80FFFFFF" />
<!-- light theme -->
<item gecko:state_light="true" android:color="#80222222" />
<!-- default -->
<item android:color="#FF22629E"/>
</selector>

View File

@ -34,12 +34,4 @@
android:isScrollContainer="false" android:isScrollContainer="false"
android:duplicateParentState="true"/> android:duplicateParentState="true"/>
<org.mozilla.gecko.widget.LinkTextView android:id="@+id/more_text"
android:layout_width="fill_parent"
android:layout_height="@dimen/abouthome_rowitem_height"
android:textColor="@color/abouthome_section_more_text"
android:textSize="12sp"
android:gravity="center"
android:focusable="true"/>
</merge> </merge>

View File

@ -34,7 +34,6 @@
<declare-styleable name="AboutHomeSection"> <declare-styleable name="AboutHomeSection">
<attr name="title" format="string"/> <attr name="title" format="string"/>
<attr name="subtitle" format="string"/> <attr name="subtitle" format="string"/>
<attr name="more_text" format="string"/>
</declare-styleable> </declare-styleable>
<!-- DoorHangers --> <!-- DoorHangers -->

View File

@ -22,7 +22,6 @@ public class AboutHomeSection extends GeckoLinearLayout {
private TextView mTitle; private TextView mTitle;
private TextView mSubtitle; private TextView mSubtitle;
private LinearLayout mItemsContainer; private LinearLayout mItemsContainer;
private LinkTextView mMoreText;
public AboutHomeSection(Context context, AttributeSet attrs) { public AboutHomeSection(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
@ -34,12 +33,10 @@ public class AboutHomeSection extends GeckoLinearLayout {
mTitle = (TextView) this.findViewById(R.id.title); mTitle = (TextView) this.findViewById(R.id.title);
mSubtitle = (TextView) this.findViewById(R.id.subtitle); mSubtitle = (TextView) this.findViewById(R.id.subtitle);
mItemsContainer = (LinearLayout) this.findViewById(R.id.items_container); mItemsContainer = (LinearLayout) this.findViewById(R.id.items_container);
mMoreText = (LinkTextView) this.findViewById(R.id.more_text);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AboutHomeSection); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AboutHomeSection);
setTitle(a.getText(R.styleable.AboutHomeSection_title)); setTitle(a.getText(R.styleable.AboutHomeSection_title));
setSubtitle(a.getText(R.styleable.AboutHomeSection_subtitle)); setSubtitle(a.getText(R.styleable.AboutHomeSection_subtitle));
setMoreText(a.getText(R.styleable.AboutHomeSection_more_text));
a.recycle(); a.recycle();
} }
@ -65,20 +62,6 @@ public class AboutHomeSection extends GeckoLinearLayout {
} }
} }
public void setMoreText(CharSequence moreText) {
if (!TextUtils.isEmpty(moreText)) {
mMoreText.setText(moreText);
mMoreText.setVisibility(View.VISIBLE);
} else {
mMoreText.setVisibility(View.GONE);
}
}
public void setOnMoreTextClickListener(View.OnClickListener listener) {
mMoreText.setOnClickListener(listener);
mMoreText.setOnKeyListener(GamepadUtils.getClickDispatcher());
}
public void addItem(View item) { public void addItem(View item) {
mItemsContainer.addView(item); mItemsContainer.addView(item);
@ -99,12 +82,4 @@ public class AboutHomeSection extends GeckoLinearLayout {
public void hide() { public void hide() {
setVisibility(View.GONE); setVisibility(View.GONE);
} }
public void showMoreText() {
mMoreText.setVisibility(View.VISIBLE);
}
public void hideMoreText() {
mMoreText.setVisibility(View.GONE);
}
} }

View File

@ -1,53 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.widget;
import org.mozilla.gecko.R;
import android.content.Context;
import android.graphics.Rect;
import android.text.SpannableString;
import android.text.style.BackgroundColorSpan;
import android.text.style.UnderlineSpan;
import android.util.AttributeSet;
import android.widget.TextView;
public class LinkTextView extends TextView {
private final BackgroundColorSpan mFocusBackgroundSpan;
private boolean mFocusApplied;
public LinkTextView(Context context, AttributeSet attrs) {
super(context, attrs);
mFocusBackgroundSpan = new BackgroundColorSpan(context.getResources().getColor(R.color.highlight_focused));
}
@Override
public void setText(CharSequence text, BufferType type) {
SpannableString content = new SpannableString(text + " \u00BB");
content.setSpan(new UnderlineSpan(), 0, text.length(), 0);
super.setText(content, BufferType.SPANNABLE);
}
@Override
public void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
super.onFocusChanged(focused, direction, previouslyFocusedRect);
if (focused == mFocusApplied) {
return;
}
mFocusApplied = focused;
CharSequence text = getText();
if (text instanceof SpannableString) {
SpannableString spannable = (SpannableString)text;
if (focused) {
spannable.setSpan(mFocusBackgroundSpan, 0, text.length(), 0);
} else {
spannable.removeSpan(mFocusBackgroundSpan);
}
}
}
}