app/internal/wm: [Android] make GioView delegate methods public

GioActivity is final to avoid the brittle base class problem. However,
to permit replacement of GioActivity the GioView delegate methods must
be public.

While here fix a function signature, rename lowMemory to onLowMemory and make it
static. Also move view specific setup to GioView, simplifying the host
activity further.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-05-19 15:06:12 +02:00
parent a7be7cc22b
commit 9ad492e93b
3 changed files with 15 additions and 23 deletions
+3 -12
View File
@@ -3,12 +3,8 @@
package org.gioui;
import android.app.Activity;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.content.res.Configuration;
public final class GioActivity extends Activity {
private GioView view;
@@ -16,13 +12,8 @@ public final class GioActivity extends Activity {
@Override public void onCreate(Bundle state) {
super.onCreate(state);
Window w = getWindow();
this.view = new GioView(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
this.view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
}
this.view.setLayoutParams(new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT));
setContentView(view);
}
@@ -48,7 +39,7 @@ public final class GioActivity extends Activity {
@Override public void onLowMemory() {
super.onLowMemory();
view.lowMemory();
GioView.onLowMemory();
}
@Override public void onBackPressed() {