content: package com.cicada.player.demo;
  
  import android.content.DialogInterface;
  import android.content.Intent;
  import android.content.pm.ActivityInfo;
  import android.net.Uri;
  import android.os.Build;
  import android.os.Bundle;
  import android.provider.Settings;
  import android.support.annotation.Nullable;
  import android.support.v7.app.AlertDialog;
  import android.support.v7.app.AppCompatActivity;
  
  import com.cicada.player.demo.util.CleanLeakUtils;
  import com.cicada.player.demo.util.IMMLeaks;
  import com.cicada.player.demo.util.VcPlayerLog;
  
  
  public class BaseActivity extends AppCompatActivity {
  
      /**
       * 异常手机
       */
      protected boolean isStrangePhone() {
          boolean strangePhone = "mx5".equalsIgnoreCase(Build.DEVICE)
                  || "Redmi Note2".equalsIgnoreCase(Build.DEVICE)
                  || "Z00A_1".equalsIgnoreCase(Build.DEVICE)
                  || "hwH60-L02".equalsIgnoreCase(Build.DEVICE)
                  || "hermes".equalsIgnoreCase(Build.DEVICE)
                  || ("V4".equalsIgnoreCase(Build.DEVICE) && "Meitu".equalsIgnoreCase(Build.MANUFACTURER))
                  || ("m1metal".equalsIgnoreCase(Build.DEVICE) && "Meizu".equalsIgnoreCase(Build.MANUFACTURER));
  
          VcPlayerLog.e("lfj1115 ", " Build.Device = " + Build.DEVICE + " , isStrange = " + strangePhone);
          return strangePhone;
  
      }
  
      @Override
      protected void onCreate(@Nullable Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          if (isStrangePhone()) {
  //            setTheme(R.style.ActTheme);
          } else {
              setTheme(R.style.NoActionTheme);
          }
          //设置竖屏
          setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
  
      }
  
      //系统授权设置的弹框
      AlertDialog openAppDetDialog = null;
      protected void showPermissionDialog() {
          AlertDialog.Builder builder = new AlertDialog.Builder(this);
          builder.setMessage(getString(R.string.app_name) + getString(R.string.no_write_external_storage_permission));
          builder.setPositiveButton(getString(R.string.cicada_setting), new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                  Intent intent = new Intent();
                  intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                  intent.addCategory(Intent.CATEGORY_DEFAULT);
                  intent.setData(Uri.parse("package:" + getPackageName()));
                  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                  intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
                  intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                  startActivity(intent);
              }
          });
          builder.setCancelable(false);
          builder.setNegativeButton(getString(R.string.cicada_setting_cancel), new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                  //finish();
              }
          });
          if (null == openAppDetDialog) {
              openAppDetDialog = builder.create();
          }
          if (null != openAppDetDialog && !openAppDetDialog.isShowing()) {
              openAppDetDialog.show();
          }
      }
  
      protected void startActivity(Class clazz){
          Intent intent = new Intent(this,clazz);
          startActivity(intent);
      }
  
      @Override
      protected void onDestroy() {
          CleanLeakUtils.fixInputMethodManagerLeak(this);
          CleanLeakUtils.fixHuaWeiMemoryLeak(this);
          CleanLeakUtils.fixTextLineCacheLeak();
          CleanLeakUtils.fixHuaWeiPhoneWindowMemoryLeak();
          IMMLeaks.fixFocusedViewLeak(getApplication());
          super.onDestroy();
      }
  }
  