|
@@ -0,0 +1,73 @@
|
|
|
+package com.xplora.xpvideo.activity;
|
|
|
+
|
|
|
+import android.app.Activity;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.util.Log;
|
|
|
+import android.view.View;
|
|
|
+import android.view.Window;
|
|
|
+import android.view.WindowManager;
|
|
|
+import android.widget.Toast;
|
|
|
+import androidx.annotation.Nullable;
|
|
|
+import com.xplora.xpvideo.utils.Macros;
|
|
|
+
|
|
|
+public class BaseActivity extends Activity {
|
|
|
+ public String TAG = "losion / xpvideo :" + getClass().getSimpleName();
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+ Log.d(TAG, "onCreate: ");
|
|
|
+
|
|
|
+ if (Macros.DEBUG_FULLSCREEN) {
|
|
|
+ setFullView();
|
|
|
+ setHardKey();
|
|
|
+ }
|
|
|
+
|
|
|
+ onCreateBase();
|
|
|
+ initDataBase();
|
|
|
+ initViewBase();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onStart() {
|
|
|
+ super.onStart();
|
|
|
+ onStartBase();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onDestroy() {
|
|
|
+ super.onDestroy();
|
|
|
+ onDestroyBase();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected void onCreateBase() { }
|
|
|
+ protected void onStartBase() { }
|
|
|
+ protected void initDataBase() { }
|
|
|
+ protected void initViewBase() { }
|
|
|
+ protected void onDestroyBase() { }
|
|
|
+
|
|
|
+ private void setFullView() {
|
|
|
+ this.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
|
|
+ this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setHardKey() {
|
|
|
+ View decorView = getWindow().getDecorView();
|
|
|
+ int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
|
|
+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_FULLSCREEN;
|
|
|
+ decorView.setSystemUiVisibility(uiOptions);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void changeStatusBar(boolean isShow) {
|
|
|
+ if (isShow) {
|
|
|
+ getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
|
|
+ } else {
|
|
|
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void toast(String content) {
|
|
|
+ Toast t = Toast.makeText(this, content, Toast.LENGTH_SHORT);
|
|
|
+ t.show();
|
|
|
+ }
|
|
|
+}
|