Bug 703115: Site security represented a lock in URLbar [r=mfinkle]

This commit is contained in:
Sriram Ramasubramanian 2011-11-16 17:26:44 -08:00
parent c12d69d77f
commit 924bbcb930
6 changed files with 31 additions and 7 deletions

View File

@ -69,6 +69,7 @@ public class BrowserToolbar extends LinearLayout {
final private ImageButton mTabs;
final public ImageButton mFavicon;
final public ImageButton mStop;
final public ImageButton mSiteSecurity;
final private AnimationDrawable mProgressSpinner;
final private TextSwitcher mTabsCount;
@ -150,6 +151,7 @@ public class BrowserToolbar extends LinearLayout {
mTabsCount.setText("0");
mFavicon = (ImageButton) findViewById(R.id.favicon);
mSiteSecurity = (ImageButton) findViewById(R.id.site_security);
mProgressSpinner = (AnimationDrawable) resources.getDrawable(R.drawable.progress_spinner);
mStop = (ImageButton) findViewById(R.id.stop);
@ -254,14 +256,19 @@ public class BrowserToolbar extends LinearLayout {
if (visible) {
mFavicon.setImageDrawable(mProgressSpinner);
mProgressSpinner.start();
mStop.setVisibility(View.VISIBLE);
setStopVisibility(true);
} else {
mProgressSpinner.stop();
mStop.setVisibility(View.GONE);
setStopVisibility(false);
setFavicon(Tabs.getInstance().getSelectedTab().getFavicon());
}
}
public void setStopVisibility(boolean visible) {
mStop.setVisibility(visible ? View.VISIBLE : View.GONE);
mSiteSecurity.setVisibility(visible ? View.GONE : View.VISIBLE);
}
public void setTitle(CharSequence title) {
mAwesomeBar.setText(title);
}
@ -277,11 +284,9 @@ public class BrowserToolbar extends LinearLayout {
}
public void setSecurityMode(String mode) {
if (mode.equals("identified"))
mFavicon.setBackgroundColor(Color.rgb(137, 215, 21));
else if (mode.equals("verified"))
mFavicon.setBackgroundColor(Color.rgb(101, 121, 227));
if (mode.equals("identified") || mode.equals("verified"))
mSiteSecurity.setImageLevel(1);
else
mFavicon.setBackgroundColor(Color.TRANSPARENT);
mSiteSecurity.setImageLevel(0);
}
}

View File

@ -208,6 +208,7 @@ RES_DRAWABLE_MDPI_V8 = \
res/drawable-mdpi-v8/doorhanger_bg.9.png \
res/drawable-mdpi-v8/doorhanger_shadow_bg.9.png \
res/drawable-mdpi-v8/doorhanger_popup_bg.9.png \
res/drawable-mdpi-v8/site_security_lock.png \
res/drawable-mdpi-v8/urlbar_stop.png \
$(NULL)
@ -227,6 +228,7 @@ RES_DRAWABLE_HDPI_V8 = \
res/drawable-hdpi-v8/doorhanger_bg.9.png \
res/drawable-hdpi-v8/doorhanger_shadow_bg.9.png \
res/drawable-hdpi-v8/doorhanger_popup_bg.9.png \
res/drawable-hdpi-v8/site_security_lock.png \
res/drawable-hdpi-v8/urlbar_stop.png \
$(NULL)
@ -340,6 +342,7 @@ MOZ_ANDROID_DRAWABLES += embedding/android/resources/drawable/address_bar_bg.xml
embedding/android/resources/drawable/progress_spinner_17.png \
embedding/android/resources/drawable/progress_spinner_18.png \
embedding/android/resources/drawable/start.png \
embedding/android/resources/drawable/site_security_level.xml \
embedding/android/resources/drawable/tab_new.png \
embedding/android/resources/drawable/tab_close.png \
embedding/android/resources/drawable/tabs_button.xml \

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:maxLevel="0" android:drawable="@android:color/transparent"/>
<item android:maxLevel="1" android:drawable="@drawable/site_security_lock"/>
</level-list>

View File

@ -58,6 +58,15 @@
android:layout_alignRight="@id/awesome_bar"
android:visibility="gone"/>
<ImageButton android:id="@+id/site_security"
style="@style/AddressBar.ImageButton"
android:layout_width="20dip"
android:layout_height="20dip"
android:layout_marginRight="15dip"
android:layout_centerVertical="true"
android:src="@drawable/site_security_level"
android:layout_alignRight="@id/awesome_bar"/>
</RelativeLayout>
</merge>