Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show Settings instead of toggling after a fxa login #2469

Merged
merged 2 commits into from Dec 21, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -17,6 +17,7 @@

import androidx.annotation.NonNull;

import org.jetbrains.annotations.NotNull;
keianhzo marked this conversation as resolved.
Show resolved Hide resolved
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.vrbrowser.R;
Expand All @@ -25,7 +26,6 @@
import org.mozilla.vrbrowser.browser.SessionChangeListener;
import org.mozilla.vrbrowser.browser.engine.Session;
import org.mozilla.vrbrowser.browser.engine.SessionStore;
import org.mozilla.vrbrowser.telemetry.TelemetryWrapper;
import org.mozilla.vrbrowser.ui.views.UIButton;
import org.mozilla.vrbrowser.ui.widgets.settings.SettingsWidget;

Expand Down Expand Up @@ -388,7 +388,7 @@ public void toggleSettingsDialog() {
toggleSettingsDialog(SettingsWidget.SettingDialog.MAIN);
}

public void toggleSettingsDialog(SettingsWidget.SettingDialog settingDialog) {
public void toggleSettingsDialog(@NotNull SettingsWidget.SettingDialog settingDialog) {
UIWidget widget = getChild(mSettingsDialogHandle);
if (widget == null) {
widget = createChild(SettingsWidget.class, false);
Expand All @@ -405,6 +405,20 @@ public void toggleSettingsDialog(SettingsWidget.SettingDialog settingDialog) {
}
}

public void showSettingsDialog(@NotNull SettingsWidget.SettingDialog settingDialog) {
UIWidget widget = getChild(mSettingsDialogHandle);
if (widget == null) {
widget = createChild(SettingsWidget.class, false);
mSettingsDialogHandle = widget.getHandle();
}

if (mAttachedWindow != null) {
widget.getPlacement().parentHandle = mAttachedWindow.getHandle();
}

((SettingsWidget)widget).show(REQUEST_FOCUS, settingDialog);
}

public void setTrayVisible(boolean aVisible) {
if (mTrayVisible != aVisible) {
mTrayVisible = aVisible;
Expand Down
Expand Up @@ -1427,7 +1427,7 @@ public void onShowContextMenu(@NonNull View view, @NotNull Bookmark item, boolea

@Override
public void onFxASynSettings(@NonNull View view) {
mWidgetManager.getTray().toggleSettingsDialog(SettingsWidget.SettingDialog.FXA);
mWidgetManager.getTray().showSettingsDialog(SettingsWidget.SettingDialog.FXA);
}

@Override
Expand Down Expand Up @@ -1466,7 +1466,7 @@ public void onShowContextMenu(@NonNull View view, @NonNull VisitInfo item, boole

@Override
public void onFxASynSettings(@NonNull View view) {
mWidgetManager.getTray().toggleSettingsDialog(SettingsWidget.SettingDialog.FXA);
mWidgetManager.getTray().showSettingsDialog(SettingsWidget.SettingDialog.FXA);
}

@Override
Expand Down
Expand Up @@ -895,15 +895,15 @@ public void onAuthenticated(@NotNull OAuthAccount oAuthAccount, @NotNull AuthTyp

switch (mAccounts.getLoginOrigin()) {
case BOOKMARKS:
getFocusedWindow().switchBookmarks();
getFocusedWindow().showBookmarks();
break;

case HISTORY:
getFocusedWindow().switchHistory();
getFocusedWindow().showHistory();
break;

case SETTINGS:
mWidgetManager.getTray().toggleSettingsDialog(SettingsWidget.SettingDialog.FXA);
mWidgetManager.getTray().showSettingsDialog(SettingsWidget.SettingDialog.FXA);
break;
}
}
Expand Down
Expand Up @@ -432,7 +432,9 @@ private void showFXAOptionsDialog() {
}

public void show(@ShowFlags int aShowFlags, @NonNull SettingDialog settingDialog) {
show(aShowFlags);
if (!isVisible()) {
show(aShowFlags);
}

switch (settingDialog) {
case LANGUAGE:
Expand Down