mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1132547
- Move reader.has_used_toolbar logic to Android's Reader.js. r=bnicholson
This commit is contained in:
parent
4a1fd32d8b
commit
98cbf8e07d
@ -26,8 +26,6 @@ let ReaderParent = {
|
||||
"Reader:ListStatusRequest",
|
||||
"Reader:RemoveFromList",
|
||||
"Reader:Share",
|
||||
"Reader:ShowToast",
|
||||
"Reader:ToolbarVisibility",
|
||||
"Reader:SystemUIVisibility",
|
||||
"Reader:UpdateReaderButton",
|
||||
],
|
||||
@ -70,18 +68,10 @@ let ReaderParent = {
|
||||
// XXX: To implement.
|
||||
break;
|
||||
|
||||
case "Reader:ShowToast":
|
||||
// XXX: To implement.
|
||||
break;
|
||||
|
||||
case "Reader:SystemUIVisibility":
|
||||
// XXX: To implement.
|
||||
break;
|
||||
|
||||
case "Reader:ToolbarVisibility":
|
||||
// XXX: To implement.
|
||||
break;
|
||||
|
||||
case "Reader:UpdateReaderButton": {
|
||||
let browser = message.target;
|
||||
if (message.data && message.data.isArticle !== undefined) {
|
||||
|
@ -774,8 +774,7 @@ public class BrowserApp extends GeckoApp
|
||||
"Reader:Share",
|
||||
"Settings:Show",
|
||||
"Telemetry:Gather",
|
||||
"Updater:Launch",
|
||||
"BrowserToolbar:Visibility");
|
||||
"Updater:Launch");
|
||||
|
||||
Distribution distribution = Distribution.init(this);
|
||||
|
||||
@ -1317,8 +1316,7 @@ public class BrowserApp extends GeckoApp
|
||||
"Reader:Share",
|
||||
"Settings:Show",
|
||||
"Telemetry:Gather",
|
||||
"Updater:Launch",
|
||||
"BrowserToolbar:Visibility");
|
||||
"Updater:Launch");
|
||||
|
||||
if (AppConstants.MOZ_ANDROID_BEAM) {
|
||||
NfcAdapter nfc = NfcAdapter.getDefaultAdapter(this);
|
||||
@ -1534,17 +1532,6 @@ public class BrowserApp extends GeckoApp
|
||||
return (mTabsPanel != null && mTabsPanel.isSideBar());
|
||||
}
|
||||
|
||||
private void setBrowserToolbarVisible(final boolean visible) {
|
||||
ThreadUtils.postToUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mDynamicToolbar.isEnabled()) {
|
||||
mDynamicToolbar.setVisible(visible, VisibilityTransition.IMMEDIATE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isSideBar() {
|
||||
return (HardwareUtils.isTablet() && getOrientation() == Configuration.ORIENTATION_LANDSCAPE);
|
||||
}
|
||||
@ -1705,10 +1692,6 @@ public class BrowserApp extends GeckoApp
|
||||
}
|
||||
} else if ("Updater:Launch".equals(event)) {
|
||||
handleUpdaterLaunch();
|
||||
|
||||
} else if ("BrowserToolbar:Visibility".equals(event)) {
|
||||
setBrowserToolbarVisible(message.getBoolean("visible"));
|
||||
|
||||
} else {
|
||||
super.handleMessage(event, message, callback);
|
||||
}
|
||||
|
@ -15,6 +15,11 @@ let Reader = {
|
||||
STATUS_FETCH_FAILED_UNSUPPORTED_FORMAT: 3,
|
||||
STATUS_FETCHED_ARTICLE: 4,
|
||||
|
||||
get _hasUsedToolbar() {
|
||||
delete this._hasUsedToolbar;
|
||||
return this._hasUsedToolbar = Services.prefs.getBoolPref("reader.has_used_toolbar");
|
||||
},
|
||||
|
||||
observe: function Reader_observe(aMessage, aTopic, aData) {
|
||||
switch (aTopic) {
|
||||
case "Reader:FetchContent": {
|
||||
@ -103,10 +108,6 @@ let Reader = {
|
||||
});
|
||||
break;
|
||||
|
||||
case "Reader:ShowToast":
|
||||
NativeWindow.toast.show(message.data.toast, "short");
|
||||
break;
|
||||
|
||||
case "Reader:SystemUIVisibility":
|
||||
Messaging.sendRequest({
|
||||
type: "SystemUI:Visibility",
|
||||
@ -114,11 +115,12 @@ let Reader = {
|
||||
});
|
||||
break;
|
||||
|
||||
case "Reader:ToolbarVisibility":
|
||||
Messaging.sendRequest({
|
||||
type: "BrowserToolbar:Visibility",
|
||||
visible: message.data.visible
|
||||
});
|
||||
case "Reader:ToolbarHidden":
|
||||
if (!this._hasUsedToolbar) {
|
||||
NativeWindow.toast.show(Strings.browser.GetStringFromName("readerMode.toolbarTip"), "short");
|
||||
Services.prefs.setBoolPref("reader.has_used_toolbar", true);
|
||||
this._hasUsedToolbar = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case "Reader:UpdateReaderButton": {
|
||||
|
@ -179,8 +179,7 @@ lazilyLoadedObserverScripts.forEach(function (aScript) {
|
||||
"Reader:ListStatusRequest",
|
||||
"Reader:RemoveFromList",
|
||||
"Reader:Share",
|
||||
"Reader:ShowToast",
|
||||
"Reader:ToolbarVisibility",
|
||||
"Reader:ToolbarHidden",
|
||||
"Reader:SystemUIVisibility",
|
||||
"Reader:UpdateReaderButton",
|
||||
], "chrome://browser/content/Reader.js"],
|
||||
|
@ -365,6 +365,10 @@ getUserMedia.sharingCameraAndMicrophone.message2 = Camera and microphone are on
|
||||
readerMode.enter = Enter Reader Mode
|
||||
readerMode.exit = Exit Reader Mode
|
||||
|
||||
# LOCALIZATION NOTE (readerMode.toolbarTip):
|
||||
# Tip shown to users the first time we hide the reader mode toolbar.
|
||||
readerMode.toolbarTip=Tap the screen to show reader options
|
||||
|
||||
#Open in App
|
||||
openInApp.pageAction = Open in App
|
||||
openInApp.ok = OK
|
||||
|
@ -420,13 +420,8 @@ AboutReader.prototype = {
|
||||
this._toolbarElement.classList.toggle("toolbar-hidden");
|
||||
this._setSystemUIVisibility(visible);
|
||||
|
||||
if (!visible && !this._hasUsedToolbar) {
|
||||
this._hasUsedToolbar = Services.prefs.getBoolPref("reader.has_used_toolbar");
|
||||
if (!this._hasUsedToolbar) {
|
||||
this._mm.sendAsyncMessage("Reader:ShowToast", { toast: gStrings.GetStringFromName("aboutReader.toolbarTip") });
|
||||
Services.prefs.setBoolPref("reader.has_used_toolbar", true);
|
||||
this._hasUsedToolbar = true;
|
||||
}
|
||||
if (!visible) {
|
||||
this._mm.sendAsyncMessage("Reader:ToolbarHidden");
|
||||
}
|
||||
},
|
||||
|
||||
@ -434,10 +429,6 @@ AboutReader.prototype = {
|
||||
this._setToolbarVisibility(!this._getToolbarVisibility());
|
||||
},
|
||||
|
||||
_setBrowserToolbarVisiblity: function Reader_setBrowserToolbarVisiblity(visible) {
|
||||
this._mm.sendAsyncMessage("Reader:ToolbarVisibility", { visible: visible });
|
||||
},
|
||||
|
||||
_setSystemUIVisibility: function Reader_setSystemUIVisibility(visible) {
|
||||
this._mm.sendAsyncMessage("Reader:SystemUIVisibility", { visible: visible });
|
||||
},
|
||||
|
@ -26,5 +26,3 @@ aboutReader.fontTypeSample=Aa
|
||||
# LOCALIZATION NOTE (aboutReader.fontSizeSample): String used to sample a relative font size
|
||||
# for the font size setting. Tapping different samples will change the font size.
|
||||
aboutReader.fontSizeSample=A
|
||||
|
||||
aboutReader.toolbarTip=Tap the screen to show reader options
|
||||
|
Loading…
Reference in New Issue
Block a user