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

Remove org.mozilla.gecko.GeckoAppShell #956

Merged
merged 1 commit into from
Feb 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -126,7 +124,7 @@ private void initialize(Context aContext) {
onDismiss();
});

((Application)getApplicationContext()).registerActivityLifecycleCallbacks(this);
((Application)aContext.getApplicationContext()).registerActivityLifecycleCallbacks(this);
}

public void setDelegate(VoiceSearchDelegate delegate) {
Expand All @@ -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();
}
Expand Down Expand Up @@ -219,15 +217,15 @@ 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);
} else {
String language = SettingsStore.getInstance(getContext()).getVoiceSearchLanguage();
mMozillaSpeechService.setLanguage(language);
mMozillaSpeechService.addListener(mVoiceSearchListener);
mMozillaSpeechService.start(getApplicationContext());
mMozillaSpeechService.start(getContext().getApplicationContext());
mIsSpeechRecognitionRunning = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ private void setMaxWindowSize(int newMaxWindowWidth, int newMaxWindowHeight, boo

if (doApply) {
SessionStore.get().setMaxWindowSize(newMaxWindowWidth, newMaxWindowHeight);
showRestartDialog();
}
}

Expand Down