github.com/utopiagio/gio@v0.0.8/app/GioActivity.java (about)

     1  // SPDX-License-Identifier: Unlicense OR MIT
     2  
     3  package org.gioui;
     4  
     5  import android.app.Activity;
     6  import android.os.Bundle;
     7  import android.content.res.Configuration;
     8  import android.view.ViewGroup;
     9  import android.view.View;
    10  import android.view.ViewGroup;
    11  import android.widget.FrameLayout;
    12  
    13  public final class GioActivity extends Activity {
    14  	private GioView view;
    15  	public FrameLayout layer;
    16  
    17  	@Override public void onCreate(Bundle state) {
    18              super.onCreate(state);
    19  
    20              layer = new FrameLayout(this);
    21              view = new GioView(this);
    22  
    23              view.setLayoutParams(new FrameLayout.LayoutParams(
    24                  FrameLayout.LayoutParams.MATCH_PARENT,
    25                  FrameLayout.LayoutParams.MATCH_PARENT
    26              ));
    27              view.setFocusable(true);
    28              view.setFocusableInTouchMode(true);
    29  
    30              layer.addView(view);
    31              setContentView(layer);
    32  	}
    33  
    34  	@Override public void onDestroy() {
    35  		view.destroy();
    36  		super.onDestroy();
    37  	}
    38  
    39  	@Override public void onStart() {
    40  		super.onStart();
    41  		view.start();
    42  	}
    43  
    44  	@Override public void onStop() {
    45  		view.stop();
    46  		super.onStop();
    47  	}
    48  
    49  	@Override public void onConfigurationChanged(Configuration c) {
    50  		super.onConfigurationChanged(c);
    51  		view.configurationChanged();
    52  	}
    53  
    54  	@Override public void onLowMemory() {
    55  		super.onLowMemory();
    56  		GioView.onLowMemory();
    57  	}
    58  
    59  	@Override public void onBackPressed() {
    60  		if (!view.backPressed())
    61  			super.onBackPressed();
    62  	}
    63  }