Bug 698436: Use a custom blue spinner for progress bar [r=mfinkle]
@ -41,6 +41,7 @@
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
@ -48,13 +49,12 @@ import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
public class BrowserToolbar extends LinearLayout {
|
||||
final private ProgressBar mProgressBar;
|
||||
final private Button mAwesomeBar;
|
||||
final private ImageButton mTabs;
|
||||
final private ImageButton mFavicon;
|
||||
final private AnimationDrawable mProgressSpinner;
|
||||
|
||||
public BrowserToolbar(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@ -65,8 +65,6 @@ public class BrowserToolbar extends LinearLayout {
|
||||
|
||||
inflater.inflate(R.layout.browser_toolbar, this);
|
||||
|
||||
mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
|
||||
|
||||
mAwesomeBar = (Button) findViewById(R.id.awesome_bar);
|
||||
mAwesomeBar.setOnClickListener(new Button.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
@ -85,6 +83,7 @@ public class BrowserToolbar extends LinearLayout {
|
||||
});
|
||||
|
||||
mFavicon = (ImageButton) findViewById(R.id.favicon);
|
||||
mProgressSpinner = (AnimationDrawable) context.getResources().getDrawable(R.drawable.progress_spinner);
|
||||
}
|
||||
|
||||
private void onAwesomeBarSearch() {
|
||||
@ -107,8 +106,13 @@ public class BrowserToolbar extends LinearLayout {
|
||||
}
|
||||
|
||||
public void setProgressVisibility(boolean visible) {
|
||||
mProgressBar.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
mFavicon.setVisibility(visible ? View.GONE : View.VISIBLE);
|
||||
if (visible) {
|
||||
mFavicon.setImageDrawable(mProgressSpinner);
|
||||
mProgressSpinner.start();
|
||||
} else {
|
||||
mProgressSpinner.stop();
|
||||
setFavicon(Tabs.getInstance().getSelectedTab().getFavicon());
|
||||
}
|
||||
}
|
||||
|
||||
public void setTitle(CharSequence title) {
|
||||
@ -116,6 +120,9 @@ public class BrowserToolbar extends LinearLayout {
|
||||
}
|
||||
|
||||
public void setFavicon(Drawable image) {
|
||||
if (Tabs.getInstance().getSelectedTab().isLoading())
|
||||
return;
|
||||
|
||||
if (image != null)
|
||||
mFavicon.setImageDrawable(image);
|
||||
else
|
||||
|
@ -191,6 +191,25 @@ MOZ_ANDROID_DRAWABLES += embedding/android/resources/drawable/addons.png
|
||||
embedding/android/resources/drawable/bookmark_remove.png \
|
||||
embedding/android/resources/drawable/desktop_notification.png \
|
||||
embedding/android/resources/drawable/favicon.png \
|
||||
embedding/android/resources/drawable/progress_spinner.xml \
|
||||
embedding/android/resources/drawable/progress_spinner_1.png \
|
||||
embedding/android/resources/drawable/progress_spinner_2.png \
|
||||
embedding/android/resources/drawable/progress_spinner_3.png \
|
||||
embedding/android/resources/drawable/progress_spinner_4.png \
|
||||
embedding/android/resources/drawable/progress_spinner_5.png \
|
||||
embedding/android/resources/drawable/progress_spinner_6.png \
|
||||
embedding/android/resources/drawable/progress_spinner_7.png \
|
||||
embedding/android/resources/drawable/progress_spinner_8.png \
|
||||
embedding/android/resources/drawable/progress_spinner_9.png \
|
||||
embedding/android/resources/drawable/progress_spinner_10.png \
|
||||
embedding/android/resources/drawable/progress_spinner_11.png \
|
||||
embedding/android/resources/drawable/progress_spinner_12.png \
|
||||
embedding/android/resources/drawable/progress_spinner_13.png \
|
||||
embedding/android/resources/drawable/progress_spinner_14.png \
|
||||
embedding/android/resources/drawable/progress_spinner_15.png \
|
||||
embedding/android/resources/drawable/progress_spinner_16.png \
|
||||
embedding/android/resources/drawable/progress_spinner_17.png \
|
||||
embedding/android/resources/drawable/progress_spinner_18.png \
|
||||
embedding/android/resources/drawable/quit.png \
|
||||
embedding/android/resources/drawable/reload.png \
|
||||
embedding/android/resources/drawable/share.png \
|
||||
|
24
embedding/android/resources/drawable/progress_spinner.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:oneshot="false">
|
||||
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_1"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_2"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_3"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_4"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_5"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_6"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_7"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_8"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_9"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_10"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_11"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_12"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_13"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_14"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_15"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_16"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_17"/>
|
||||
<item android:duration="50" android:drawable="@drawable/progress_spinner_18"/>
|
||||
|
||||
</animation-list>
|
BIN
embedding/android/resources/drawable/progress_spinner_1.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_10.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_11.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_12.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_13.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_14.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_15.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_16.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_17.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_18.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_2.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_3.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_4.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_5.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_6.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_7.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_8.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
embedding/android/resources/drawable/progress_spinner_9.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
@ -36,17 +36,7 @@
|
||||
android:layout_marginLeft="0dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/favicon"
|
||||
android:layout_alignLeft="@id/awesome_bar"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ProgressBar android:id="@+id/progress_bar"
|
||||
style="@android:style/Widget.ProgressBar.Small"
|
||||
android:layout_width="24dip"
|
||||
android:layout_height="24dip"
|
||||
android:layout_marginLeft="0dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignLeft="@id/awesome_bar"
|
||||
android:visibility="visible"/>
|
||||
android:layout_alignLeft="@id/awesome_bar"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|