导航菜单

页面标题

页面副标题

Pesohere v1.0.5 - PermissionActivity.java 源代码

正在查看: Pesohere v1.0.5 应用的 PermissionActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.yanzhenjie.permission;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;

public final class PermissionActivity extends Activity {
    public static a b;

    public interface a {
        void a(String[] strArr);
    }

    public static void a(Activity activity) {
        if (Build.VERSION.SDK_INT >= 21) {
            Window window = activity.getWindow();
            View decorView = window.getDecorView();
            decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() | 1024 | 256);
            window.addFlags(Integer.MIN_VALUE);
            window.setStatusBarColor(0);
        }
    }

    public static void b(Context context, String[] strArr, a aVar) {
        b = aVar;
        Intent intent = new Intent(context, (Class<?>) PermissionActivity.class);
        intent.setFlags(268435456);
        intent.putExtra("KEY_INPUT_PERMISSIONS", strArr);
        context.startActivity(intent);
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        a(this);
        String[] stringArrayExtra = getIntent().getStringArrayExtra("KEY_INPUT_PERMISSIONS");
        if (stringArrayExtra != null && b != null) {
            requestPermissions(stringArrayExtra, 1);
        } else {
            b = null;
            finish();
        }
    }

    @Override
    public boolean onKeyDown(int i2, KeyEvent keyEvent) {
        if (i2 == 4) {
            return true;
        }
        return super.onKeyDown(i2, keyEvent);
    }

    @Override
    public void onRequestPermissionsResult(int i2, String[] strArr, int[] iArr) {
        a aVar = b;
        if (aVar != null) {
            aVar.a(strArr);
            b = null;
        }
        finish();
    }
}