content: package com.kessi.statussaver;
  
  import android.content.Intent;
  import android.net.Uri;
  import android.os.Build;
  import android.os.Bundle;
  import android.os.Environment;
  import android.os.Handler;
  import android.provider.Settings;
  import android.widget.ImageView;
  import android.widget.Toast;
  
  import androidx.annotation.Nullable;
  import androidx.appcompat.app.AppCompatActivity;
  import androidx.appcompat.app.AppCompatDelegate;
  
  import com.kessi.statussaver.util.SharedPrefs;
  
  import static android.os.Build.VERSION.SDK_INT;
  
  public class SplashActivity extends AppCompatActivity {
  
      ImageView icon;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_splash);
  
          AppCompatDelegate.setDefaultNightMode(SharedPrefs.getAppNightDayMode(this));
  
          icon = findViewById(R.id.icon);
  
  //        if (SDK_INT >= Build.VERSION_CODES.R) {
  //            if (!Environment.isExternalStorageManager()) {
  //                try {
  //                    Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
  //                    intent.addCategory("android.intent.category.DEFAULT");
  //                    intent.setData(Uri.parse(String.format("package:%s", getApplicationContext().getPackageName())));
  //                    startActivityForResult(intent, 2296);
  //                } catch (Exception e) {
  //                    Intent intent = new Intent();
  //                    intent.setAction(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
  //                    startActivityForResult(intent, 2296);
  //                }
  //            } else {
  //                new Handler().postDelayed(new Runnable() {
  //                    @Override
  //                    public void run() {
  //                        startActivity(new Intent(SplashActivity.this, MainActivity.class));
  //                        finish();
  //                    }
  //                }, 2000);
  //
  //            }
  //        } else {
              new Handler().postDelayed(new Runnable() {
                  @Override
                  public void run() {
                      startActivity(new Intent(SplashActivity.this, MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
                      finish();
                  }
              }, 2000);
  
  //        }
  
      }
  
  //    @Override
  //    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
  //        super.onActivityResult(requestCode, resultCode, data);
  //        if (requestCode == 2296) {
  //            if (SDK_INT >= Build.VERSION_CODES.R) {
  //                if (Environment.isExternalStorageManager()) {
  //                    // perform action when allow permission success
  //                    startActivity(new Intent(SplashActivity.this, MainActivity.class));
  //                    finish();
  //                } else {
  //                    Toast.makeText(this, "Allow permission for storage access!", Toast.LENGTH_SHORT).show();
  //                }
  //            }
  //        }
  //    }
  
  
      @Override
      public void onBackPressed() {
      }
  }
  
  
  