diff --git a/app/src/common/shared/org/mozilla/vrbrowser/browser/SessionStore.java b/app/src/common/shared/org/mozilla/vrbrowser/browser/SessionStore.java index 9ad28dd18..197c7252a 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/browser/SessionStore.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/browser/SessionStore.java @@ -8,7 +8,6 @@ import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; -import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; @@ -17,7 +16,6 @@ import android.view.inputmethod.ExtractedText; import android.view.inputmethod.ExtractedTextRequest; -import org.mozilla.gecko.GeckoAppShell; import org.mozilla.gecko.GeckoProfile; import org.mozilla.geckoview.AllowOrDeny; import org.mozilla.geckoview.ContentBlocking; @@ -855,7 +853,14 @@ public void setConsoleOutputEnabled(boolean enabled) { } public void setMaxWindowSize(int width, int height) { - GeckoAppShell.setScreenSizeOverride(new Rect(0, 0, width, height)); + SharedPreferences.Editor editor = mPrefs.edit(); + editor.putInt( + mContext.getString(R.string.settings_key_max_window_height), + height); + editor.putInt( + mContext.getString(R.string.settings_key_max_window_width), + width); + editor.commit(); } public void setServo(final boolean enabled) { diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/views/BookmarksView.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/views/BookmarksView.java index 165f54a89..7505fc038 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/views/BookmarksView.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/views/BookmarksView.java @@ -39,8 +39,6 @@ import androidx.lifecycle.LiveData; import androidx.lifecycle.Observer; -import static org.mozilla.gecko.GeckoAppShell.getApplicationContext; - public class BookmarksView extends FrameLayout implements Application.ActivityLifecycleCallbacks, GeckoSession.NavigationDelegate { @@ -72,7 +70,7 @@ private void initialize(Context aContext) { mAudio = AudioEngine.fromContext(aContext); - ((Application)getApplicationContext()).registerActivityLifecycleCallbacks(this); + ((Application)getContext().getApplicationContext()).registerActivityLifecycleCallbacks(this); SessionStore.get().addNavigationListener(this); LayoutInflater inflater = LayoutInflater.from(aContext); @@ -83,7 +81,7 @@ private void initialize(Context aContext) { mBookmarkAdapter = new BookmarkAdapter(mBookmarkClickCallback, aContext); mBinding.bookmarksList.setAdapter(mBookmarkAdapter); - mBookmarkListModel = new BookmarkListViewModel(((Application)getApplicationContext())); + mBookmarkListModel = new BookmarkListViewModel(((Application)getContext().getApplicationContext())); subscribeUi(mBookmarkListModel.getBookmarks()); setVisibility(GONE); diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/dialogs/VoiceSearchWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/dialogs/VoiceSearchWidget.java index d36f5ff84..9c6e47e25 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/dialogs/VoiceSearchWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/dialogs/VoiceSearchWidget.java @@ -34,8 +34,6 @@ import androidx.annotation.IdRes; import androidx.core.app.ActivityCompat; -import static org.mozilla.gecko.GeckoAppShell.getApplicationContext; - public class VoiceSearchWidget extends UIWidget implements WidgetManagerDelegate.PermissionListener, Application.ActivityLifecycleCallbacks, WidgetManagerDelegate.FocusChangeListener { @@ -126,7 +124,7 @@ private void initialize(Context aContext) { onDismiss(); }); - ((Application)getApplicationContext()).registerActivityLifecycleCallbacks(this); + ((Application)aContext.getApplicationContext()).registerActivityLifecycleCallbacks(this); } public void setDelegate(VoiceSearchDelegate delegate) { @@ -138,7 +136,7 @@ public void releaseWidget() { mWidgetManager.removeFocusChangeListener(this); mWidgetManager.removePermissionListener(this); mMozillaSpeechService.removeListener(mVoiceSearchListener); - ((Application)getApplicationContext()).unregisterActivityLifecycleCallbacks(this); + ((Application)getContext().getApplicationContext()).unregisterActivityLifecycleCallbacks(this); super.releaseWidget(); } @@ -219,7 +217,7 @@ public void run() { }; public void startVoiceSearch() { - if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.RECORD_AUDIO) + if (ActivityCompat.checkSelfPermission(getContext().getApplicationContext(), Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions((Activity)getContext(), new String[]{Manifest.permission.RECORD_AUDIO}, VOICESEARCH_AUDIO_REQUEST_CODE); @@ -227,7 +225,7 @@ public void startVoiceSearch() { String language = SettingsStore.getInstance(getContext()).getVoiceSearchLanguage(); mMozillaSpeechService.setLanguage(language); mMozillaSpeechService.addListener(mVoiceSearchListener); - mMozillaSpeechService.start(getApplicationContext()); + mMozillaSpeechService.start(getContext().getApplicationContext()); mIsSpeechRecognitionRunning = true; } } diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/options/DisplayOptionsWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/options/DisplayOptionsWidget.java index f045e46ae..e1e7053a3 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/options/DisplayOptionsWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/options/DisplayOptionsWidget.java @@ -429,6 +429,7 @@ private void setMaxWindowSize(int newMaxWindowWidth, int newMaxWindowHeight, boo if (doApply) { SessionStore.get().setMaxWindowSize(newMaxWindowWidth, newMaxWindowHeight); + showRestartDialog(); } }