mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 697726: Stop button in URL bar [r=mfinkle]
This commit is contained in:
parent
bb57a2e56e
commit
995704084e
@ -68,6 +68,7 @@ public class BrowserToolbar extends LinearLayout {
|
||||
final private Button mAwesomeBar;
|
||||
final private ImageButton mTabs;
|
||||
final public ImageButton mFavicon;
|
||||
final public ImageButton mStop;
|
||||
final private AnimationDrawable mProgressSpinner;
|
||||
final private TextSwitcher mTabsCount;
|
||||
|
||||
@ -150,6 +151,13 @@ public class BrowserToolbar extends LinearLayout {
|
||||
|
||||
mFavicon = (ImageButton) findViewById(R.id.favicon);
|
||||
mProgressSpinner = (AnimationDrawable) resources.getDrawable(R.drawable.progress_spinner);
|
||||
|
||||
mStop = (ImageButton) findViewById(R.id.stop);
|
||||
mStop.setOnClickListener(new Button.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
doStop();
|
||||
}
|
||||
});
|
||||
|
||||
mHandler = new Handler();
|
||||
mSlideUpIn = new TranslateAnimation(0, 0, 30, 0);
|
||||
@ -197,6 +205,10 @@ public class BrowserToolbar extends LinearLayout {
|
||||
GeckoApp.mAppContext.showTabs();
|
||||
}
|
||||
|
||||
private void doStop() {
|
||||
GeckoApp.mAppContext.doStop();
|
||||
}
|
||||
|
||||
public int getHighlightColor() {
|
||||
return mColor;
|
||||
}
|
||||
@ -242,8 +254,10 @@ public class BrowserToolbar extends LinearLayout {
|
||||
if (visible) {
|
||||
mFavicon.setImageDrawable(mProgressSpinner);
|
||||
mProgressSpinner.start();
|
||||
mStop.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mProgressSpinner.stop();
|
||||
mStop.setVisibility(View.GONE);
|
||||
setFavicon(Tabs.getInstance().getSelectedTab().getFavicon());
|
||||
}
|
||||
}
|
||||
|
@ -1590,6 +1590,15 @@ abstract public class GeckoApp
|
||||
return tab.doForward();
|
||||
}
|
||||
|
||||
public boolean doStop() {
|
||||
Log.i(LOG_NAME, "Stop requested");
|
||||
Tab tab = Tabs.getInstance().getSelectedTab();
|
||||
if (tab == null)
|
||||
return false;
|
||||
|
||||
return tab.doStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (mDoorHangerPopup.isShowing()) {
|
||||
|
@ -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/urlbar_stop.png \
|
||||
$(NULL)
|
||||
|
||||
RES_DRAWABLE_HDPI_V8 = \
|
||||
@ -226,6 +227,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/urlbar_stop.png \
|
||||
$(NULL)
|
||||
|
||||
RES_DRAWABLE_MDPI_V9 = \
|
||||
|
@ -227,6 +227,12 @@ public class Tab {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean doStop() {
|
||||
GeckoEvent e = new GeckoEvent("Session:Stop", "");
|
||||
GeckoAppShell.sendEventToGecko(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canDoForward() {
|
||||
return (mHistoryIndex + 1 < mHistory.size());
|
||||
}
|
||||
|
BIN
embedding/android/resources/drawable-hdpi-v8/urlbar_stop.png
Normal file
BIN
embedding/android/resources/drawable-hdpi-v8/urlbar_stop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
embedding/android/resources/drawable-mdpi-v8/urlbar_stop.png
Normal file
BIN
embedding/android/resources/drawable-mdpi-v8/urlbar_stop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -16,7 +16,7 @@
|
||||
android:hint="@string/awesomebar_default_text"
|
||||
android:textColor="#222222"
|
||||
android:paddingLeft="42dip"
|
||||
android:paddingRight="8dip"/>
|
||||
android:paddingRight="42dip"/>
|
||||
|
||||
<ImageButton android:id="@+id/favicon"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
@ -48,6 +48,16 @@
|
||||
android:gravity="center_horizontal"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageButton android:id="@+id/stop"
|
||||
style="@style/AddressBar.ImageButton"
|
||||
android:layout_width="20dip"
|
||||
android:layout_height="20dip"
|
||||
android:layout_marginRight="15dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/urlbar_stop"
|
||||
android:layout_alignRight="@id/awesome_bar"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</merge>
|
||||
|
@ -154,6 +154,7 @@ var BrowserApp = {
|
||||
Services.obs.addObserver(this, "Session:Back", false);
|
||||
Services.obs.addObserver(this, "Session:Forward", false);
|
||||
Services.obs.addObserver(this, "Session:Reload", false);
|
||||
Services.obs.addObserver(this, "Session:Stop", false);
|
||||
Services.obs.addObserver(this, "SaveAs:PDF", false);
|
||||
Services.obs.addObserver(this, "Browser:Quit", false);
|
||||
Services.obs.addObserver(this, "Preferences:Get", false);
|
||||
@ -596,6 +597,8 @@ var BrowserApp = {
|
||||
browser.goForward();
|
||||
} else if (aTopic == "Session:Reload") {
|
||||
browser.reload();
|
||||
} else if (aTopic == "Session:Stop") {
|
||||
browser.stop();
|
||||
} else if (aTopic == "Tab:Add") {
|
||||
let uri = URIFixup.createFixupURI(aData, Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP);
|
||||
let newTab = this.addTab(uri ? uri.spec : aData);
|
||||
|
Loading…
Reference in New Issue
Block a user