Bug 806937: Private tabs support for awesomescreen. [r=mfinkle]

This commit is contained in:
Sriram Ramasubramanian 2012-11-16 00:41:53 -08:00
parent fcb4d6c0bc
commit a70c86db66
8 changed files with 41 additions and 7 deletions

View File

@ -119,12 +119,25 @@ public class AwesomeBar extends GeckoActivity {
Intent intent = getIntent();
String currentUrl = intent.getStringExtra(CURRENT_URL_KEY);
mTarget = intent.getStringExtra(TARGET_KEY);
if (currentUrl != null) {
mText.setText(currentUrl);
mText.selectAll();
}
mTarget = intent.getStringExtra(TARGET_KEY);
if (mTarget.equals(Target.CURRENT_TAB.name())) {
if (Tabs.getInstance().getSelectedTab().isPrivate()) {
BrowserToolbarBackground mAddressBarBg = (BrowserToolbarBackground) findViewById(R.id.address_bar_bg);
mAddressBarBg.setPrivateMode(true);
TabsButton mTabs = (TabsButton) findViewById(R.id.dummy_tab);
if (mTabs != null)
mTabs.setPrivateMode(true);
mText.setPrivateMode(true);
}
}
mText.setOnKeyPreImeListener(new CustomEditText.OnKeyPreImeListener() {
public boolean onKeyPreIme(View v, int keyCode, KeyEvent event) {
// We only want to process one event per tap

View File

@ -9,9 +9,8 @@ import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import android.widget.EditText;
public class CustomEditText extends EditText {
public class CustomEditText extends GeckoEditText {
OnKeyPreImeListener mOnKeyPreImeListener;
OnSelectionChangedListener mOnSelectionChangedListener;
OnWindowFocusChangeListener mOnWindowFocusChangeListener;
@ -67,4 +66,13 @@ public class CustomEditText extends EditText {
if (mOnWindowFocusChangeListener != null)
mOnWindowFocusChangeListener.onWindowFocusChanged(hasFocus);
}
@Override
public void setPrivateMode(boolean isPrivate) {
super.setPrivateMode(isPrivate);
// android:textColorHighlight cannot support a ColorStateList.
int colorId = isPrivate ? R.color.url_bar_text_highlight_pb : R.color.url_bar_text_highlight;
setHighlightColor(getContext().getResources().getColor(colorId));
}
}

View File

@ -86,6 +86,8 @@ public final class GeckoViewsFactory implements LayoutInflater.Factory {
return new LayerView(context, attrs);
else if (TextUtils.equals(viewName, "Button"))
return new GeckoButton(context, attrs);
else if (TextUtils.equals(viewName, "EditText"))
return new GeckoEditText(context, attrs);
else if (TextUtils.equals(viewName, "FrameLayout"))
return new GeckoFrameLayout(context, attrs);
else if (TextUtils.equals(viewName, "ImageButton"))

View File

@ -193,6 +193,7 @@ FENNEC_PP_JAVA_VIEW_FILES = \
GeckoButton.java \
GeckoImageButton.java \
GeckoImageView.java \
GeckoEditText.java \
GeckoFrameLayout.java \
GeckoLinearLayout.java \
GeckoRelativeLayout.java \

View File

@ -8,7 +8,8 @@
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@"
style="@style/AwesomeBar">
<org.mozilla.gecko.BrowserToolbarBackground android:layout_width="fill_parent"
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
@ -25,6 +26,8 @@
android:paddingLeft="15dip"
android:paddingRight="40dip"
android:hint="@string/awesomebar_default_text"
android:textColor="@color/awesome_bar_title"
android:textColorHint="@color/awesome_bar_title_hint"
android:textColorHighlight="@color/url_bar_text_highlight"
android:inputType="textUri|textNoSuggestions"
android:imeOptions="actionSearch|flagNoExtractUi|flagNoFullscreen"

View File

@ -8,7 +8,8 @@
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@"
style="@style/AwesomeBar">
<org.mozilla.gecko.BrowserToolbarBackground android:layout_width="fill_parent"
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
@ -38,6 +39,8 @@
android:paddingLeft="15dip"
android:paddingRight="40dip"
android:hint="@string/awesomebar_default_text"
android:textColor="@color/awesome_bar_title"
android:textColorHint="@color/awesome_bar_title_hint"
android:textColorHighlight="@color/url_bar_text_highlight"
android:inputType="textUri|textNoSuggestions"
android:imeOptions="actionSearch|flagNoExtractUi|flagNoFullscreen"

View File

@ -8,7 +8,8 @@
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@"
style="@style/AwesomeBar">
<org.mozilla.gecko.BrowserToolbarBackground android:layout_width="fill_parent"
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
@ -25,6 +26,8 @@
android:paddingLeft="15dip"
android:paddingRight="40dip"
android:hint="@string/awesomebar_default_text"
android:textColor="@color/awesome_bar_title"
android:textColorHint="@color/awesome_bar_title_hint"
android:textColorHighlight="@color/url_bar_text_highlight"
android:inputType="textUri|textNoSuggestions"
android:imeOptions="actionSearch|flagNoExtractUi|flagNoFullscreen"

View File

@ -12,7 +12,8 @@
<color name="validation_message_text">#ffffff</color>
<color name="identity_verified">#77BAFF</color>
<color name="identity_identified">#B7D46A</color>
<color name="url_bar_text_highlight">#FF9500</color>
<color name="url_bar_text_highlight">#FFFF9500</color>
<color name="url_bar_text_highlight_pb">#FFD06BFF</color>
<color name="suggestion_primary">#dddddd</color>
<color name="suggestion_pressed">#bbbbbb</color>
<color name="abouthome_topsite_shadow">#1000</color>