导航菜单

页面标题

页面副标题

Fix Locker v1.5 - GetProvisioningModeActivity.java 源代码

正在查看: Fix Locker v1.5 应用的 GetProvisioningModeActivity.java JAVA 源代码文件

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


package com.user.a4keygen.provision;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.user.a4keygen.R;
import java.util.ArrayList;

public class GetProvisioningModeActivity extends Activity {
    private void showDivider(ViewGroup viewGroup) {
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_get_provisioning_mode);
        showRelevantProvisioningOptions((LinearLayout) findViewById(R.id.dpc_login));
    }

    @Override
    public void onBackPressed() {
        setResult(0);
        super.onBackPressed();
    }

    private void showRelevantProvisioningOptions(ViewGroup viewGroup) {
        hideAllOptions(viewGroup);
        hideDivider(viewGroup);
        ArrayList<Integer> allowedProvisioningModes = getAllowedProvisioningModes();
        if (containsDoOption(allowedProvisioningModes)) {
            showDoOption(viewGroup);
        }
        if (containsPoOption(allowedProvisioningModes)) {
            if (containsDoOption(allowedProvisioningModes)) {
                showDivider(viewGroup);
            }
            showPoOption(viewGroup);
        }
    }

    private ArrayList<Integer> getAllowedProvisioningModes() {
        ArrayList<Integer> integerArrayListExtra = getIntent().getIntegerArrayListExtra("android.app.extra.PROVISIONING_ALLOWED_PROVISIONING_MODES");
        if (integerArrayListExtra != null && !integerArrayListExtra.isEmpty()) {
            return integerArrayListExtra;
        }
        ArrayList<Integer> arrayList = new ArrayList<>();
        arrayList.add(2);
        arrayList.add(1);
        return arrayList;
    }

    private boolean containsDoOption(ArrayList<Integer> arrayList) {
        return arrayList.contains(1);
    }

    private boolean containsPoOption(ArrayList<Integer> arrayList) {
        return arrayList.contains(2) || arrayList.contains(3);
    }

    private void hideAllOptions(ViewGroup viewGroup) {
        viewGroup.findViewById(R.id.po_option).setVisibility(8);
        viewGroup.findViewById(R.id.do_option).setVisibility(8);
    }

    private void hideDivider(ViewGroup viewGroup) {
        viewGroup.findViewById(R.id.divider).setVisibility(8);
    }

    private void showPoOption(ViewGroup viewGroup) {
        viewGroup.findViewById(R.id.po_selection_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                GetProvisioningModeActivity.this.onPoButtonClick(view);
            }
        });
    }

    private void showDoOption(ViewGroup viewGroup) {
        viewGroup.findViewById(R.id.do_option).setVisibility(0);
        viewGroup.findViewById(R.id.do_selection_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                GetProvisioningModeActivity.this.onDoButtonClick(view);
            }
        });
    }

    public void onDoButtonClick(View view) {
        Intent intent = new Intent();
        intent.putExtra("android.app.extra.PROVISIONING_MODE", 1);
        finishWithIntent(intent);
    }

    public void onPoButtonClick(View view) {
        Intent intent = new Intent();
        intent.putExtra("android.app.extra.PROVISIONING_MODE", 2);
        finishWithIntent(intent);
    }

    private void finishWithIntent(Intent intent) {
        setResult(-1, intent);
        finish();
    }
}