mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1692246 - Add menu item to collapse the GV view. r=aklotz
Differential Revision: https://phabricator.services.mozilla.com/D104842
This commit is contained in:
parent
67bf517e00
commit
0bbf1ceff4
@ -389,6 +389,7 @@ public class GeckoViewActivity
|
||||
private GeckoView mGeckoView;
|
||||
private boolean mFullAccessibilityTree;
|
||||
private boolean mUsePrivateBrowsing;
|
||||
private boolean mCollapsed;
|
||||
private boolean mKillProcessOnDestroy;
|
||||
private boolean mDesktopMode;
|
||||
private boolean mTrackingProtectionException;
|
||||
@ -875,27 +876,27 @@ public class GeckoViewActivity
|
||||
|
||||
ViewGroup.LayoutParams params = mPopupView.getLayoutParams();
|
||||
boolean shouldShow = force || params.width == 0;
|
||||
setPopupVisibility(shouldShow);
|
||||
setViewVisibility(mPopupView, shouldShow);
|
||||
|
||||
return shouldShow ? mPopupSession : null;
|
||||
}
|
||||
|
||||
private void setPopupVisibility(boolean visible) {
|
||||
if (mPopupView == null) {
|
||||
private static void setViewVisibility(final View view, final boolean visible) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ViewGroup.LayoutParams params = mPopupView.getLayoutParams();
|
||||
ViewGroup.LayoutParams params = view.getLayoutParams();
|
||||
|
||||
if (visible) {
|
||||
params.height = 1100;
|
||||
params.width = 1200;
|
||||
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
} else {
|
||||
params.height = 0;
|
||||
params.width = 0;
|
||||
}
|
||||
|
||||
mPopupView.setLayoutParams(params);
|
||||
view.setLayoutParams(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -906,8 +907,8 @@ public class GeckoViewActivity
|
||||
private class PopupSessionContentDelegate implements GeckoSession.ContentDelegate {
|
||||
@Override
|
||||
public void onCloseRequest(final GeckoSession session) {
|
||||
setPopupVisibility(false);
|
||||
if (mPopupSession != null) {
|
||||
setViewVisibility(mPopupView, false);
|
||||
if (mPopupSession != null) {
|
||||
mPopupSession.close();
|
||||
}
|
||||
mPopupSession = null;
|
||||
@ -1097,6 +1098,7 @@ public class GeckoViewActivity
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
menu.findItem(R.id.action_pb).setChecked(mUsePrivateBrowsing);
|
||||
menu.findItem(R.id.collapse).setChecked(mCollapsed);
|
||||
menu.findItem(R.id.desktop_mode).setChecked(mDesktopMode);
|
||||
menu.findItem(R.id.action_tpe).setChecked(mTrackingProtectionException);
|
||||
menu.findItem(R.id.action_forward).setEnabled(mCanGoForward);
|
||||
@ -1132,6 +1134,10 @@ public class GeckoViewActivity
|
||||
mUsePrivateBrowsing = !mUsePrivateBrowsing;
|
||||
recreateSession();
|
||||
break;
|
||||
case R.id.collapse:
|
||||
mCollapsed = !mCollapsed;
|
||||
setViewVisibility(mGeckoView, !mCollapsed);
|
||||
break;
|
||||
case R.id.install_addon:
|
||||
installAddon();
|
||||
break;
|
||||
@ -1168,7 +1174,7 @@ public class GeckoViewActivity
|
||||
|
||||
// We only suopport one extension at a time, so remove the currently installed
|
||||
// extension if there is one
|
||||
setPopupVisibility(false);
|
||||
setViewVisibility(mPopupView, false);
|
||||
mPopupView = null;
|
||||
mPopupSession = null;
|
||||
sExtensionManager.unregisterExtension().then(unused -> {
|
||||
|
@ -4,6 +4,8 @@
|
||||
android:id="@+id/action_tpe" app:showAsAction="never" />
|
||||
<item android:title="@string/desktop_mode" android:id="@+id/desktop_mode" android:checkable="true"
|
||||
app:showAsAction="never" />
|
||||
<item android:title="@string/collapse" android:id="@+id/collapse" android:checkable="true"
|
||||
app:showAsAction="never" />
|
||||
<item android:title="@string/private_browsing" android:checkable="true" android:id="@+id/action_pb"/>
|
||||
<item android:title="@string/new_tab" android:id="@+id/action_new_tab"/>
|
||||
<item android:title="@string/install_addon" android:id="@+id/install_addon"/>
|
||||
|
@ -41,6 +41,7 @@
|
||||
<string name="update_addon">Update Add-on</string>
|
||||
<string name="close_tab">Close tab</string>
|
||||
<string name="desktop_mode">Desktop site</string>
|
||||
<string name="collapse">Collapse GV</string>
|
||||
<string name="slow_script">A script on this page is causing your web browser to run slowly</string>
|
||||
<string name="wait">Wait</string>
|
||||
<string name="stop">Stop</string>
|
||||
|
Loading…
Reference in New Issue
Block a user