Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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