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

Fix warnings in PlatformActivity #828

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Changes from all commits
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
27 changes: 8 additions & 19 deletions app/src/hvr/java/com/igalia/wolvic/PlatformActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package com.igalia.wolvic;

import android.app.Activity;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
Expand All @@ -15,7 +14,7 @@
import android.content.pm.ActivityInfo;
import android.hardware.display.DisplayManager;
import android.os.Bundle;
import androidx.preference.PreferenceManager;
import android.preference.PreferenceManager;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this was a mistake. I'll open a small PR to fix it.

import android.util.Log;
import android.view.KeyEvent;
import android.view.Surface;
Expand Down Expand Up @@ -48,13 +47,10 @@

public abstract class PlatformActivity extends Activity implements SurfaceHolder.Callback, WidgetManagerDelegate {
public static final String TAG = "PlatformActivity";
private SurfaceView mView;
private Context mContext = null;
private HVRLocationManager mLocationManager;
private Dialog mActiveDialog;
private SharedPreferences mPrefs;
private BroadcastReceiver mHmsMessageBroadcastReceiver;
private Runnable mPhoneBackHandler = super::onBackPressed;
private final Runnable mPhoneBackHandler = super::onBackPressed;

static {
Log.i(TAG, "LoadLibrary");
Expand Down Expand Up @@ -96,7 +92,6 @@ protected Intent getStoreIntent() {
protected void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "PlatformActivity onCreate");
super.onCreate(savedInstanceState);
mContext = this;
mLocationManager = new HVRLocationManager(this);
PermissionDelegate.sPlatformLocationOverride = session -> mLocationManager.start(session);

Expand Down Expand Up @@ -205,11 +200,11 @@ private void handlemHmsMessageBroadcast(Intent intent) {

Log.d(TAG, "PushKit: title= " + title + " , body= " + body + " , action= " + action);

if (title != null) {
if (title != null && body != null) {
SystemNotification systemNotification = new SystemNotification(title, body, action, Calendar.getInstance());
Log.i(TAG, "PushKit: created SystemNotification: " + systemNotification);
// FIXME here and in a few other places we cast the current Context to WidgetManagerDelegate
UIWidget parentWidget = ((WidgetManagerDelegate) this).getTray();
UIWidget parentWidget = this.getTray();
SystemNotificationsManager.getInstance().addNewSystemNotification(systemNotification, parentWidget);
}
}
Expand Down Expand Up @@ -240,12 +235,9 @@ public void onDisplayChanged(int displayId) {
}

private void initializeVR() {
if (mActiveDialog != null) {
mActiveDialog.dismiss();
}
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setTheme(R.style.FxR_Dark);
mView = new SurfaceView(this);
SurfaceView mView = new SurfaceView(this);
setContentView(mView);

mView.getHolder().addCallback(this);
Expand Down Expand Up @@ -338,12 +330,9 @@ protected void onPause() {

@Override
public void onBackPressed() {
queueRunnable(new Runnable() {
@Override
public void run() {
finish();
System.exit(0);
}
queueRunnable(() -> {
finish();
System.exit(0);
});
}

Expand Down