github.com/gop9/olt@v0.0.0-20200202132135-d956aad50b08/gio/app/internal/window/GioActivity.java (about)

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