コード例 #1
0
 public void setHideAppIcon() {
   PackageManager packageManager = getPackageManager();
   ComponentName componentName = new ComponentName(AppSettingActivity.this, SplashActivity.class);
   int res = packageManager.getComponentEnabledSetting(componentName);
   if (res == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT
       || res == PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
     // 隐藏应用图标
     packageManager.setComponentEnabledSetting(
         componentName,
         PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
         PackageManager.DONT_KILL_APP);
     appLockApplication.appIconIsHided = true;
     LogUtil.e("colin", "隐藏应用图标");
   } else {
     // 显示应用图标
     packageManager.setComponentEnabledSetting(
         componentName,
         PackageManager.COMPONENT_ENABLED_STATE_DEFAULT,
         PackageManager.DONT_KILL_APP);
     appLockApplication.appIconIsHided = false;
     LogUtil.e("colin", "显示应用图标");
   }
 }
コード例 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_appsetting);
    context = this;
    devicePolicyManager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
    componentName = new ComponentName(this, DeviceMyReceiver.class);
    appLockApplication.appIconIsHided = getHideAppIcon();

    appSettingListView = (ListView) findViewById(R.id.appsettinglistview);
    appSettingAdapter = new AppSettingAdapter(context, mCheckedChangeListener, appLockApplication);
    appSettingAdapter.setComponentName(componentName);
    appSettingAdapter.setDevicePolicyManager(devicePolicyManager);
    appSettingListView.setAdapter(appSettingAdapter);
    appSettingListView.setOnItemClickListener(itemClickListener);

    AppSettingItemInfo appSettingItemInfo =
        new AppSettingItemInfo(
            1, 0, true, false, false, getString(R.string.server_title), "", "", "");
    AppSettingItemInfo appSettingItemInfo1 =
        new AppSettingItemInfo(
            2,
            1,
            false,
            true,
            false,
            "",
            getString(R.string.server_startlock_title),
            getString(R.string.server_startlock_detail),
            "");
    AppSettingItemInfo appSettingItemInfo2 =
        new AppSettingItemInfo(
            3, 3000, true, false, false, getString(R.string.pwdsetting_title), "", "", "");
    AppSettingItemInfo appSettingItemInfo3 =
        new AppSettingItemInfo(
            4,
            3,
            false,
            false,
            true,
            "",
            getString(R.string.pwdsetting_modify_title),
            getString(R.string.pwdsetting_modify_detail),
            getString(R.string.pwdsetting_modify_handler));
    AppSettingItemInfo appSettingItemInfo4 =
        new AppSettingItemInfo(
            5,
            3,
            false,
            false,
            true,
            "",
            getString(R.string.pwdsetting_notrue_title),
            getString(R.string.pwdsetting_notrue_detail),
            "");
    AppSettingItemInfo appSettingItemInfo5 =
        new AppSettingItemInfo(
            6,
            3,
            false,
            false,
            true,
            "",
            getString(R.string.pwdsetting_secret_title),
            getString(R.string.pwdsetting_secret_detail),
            "");
    AppSettingItemInfo appSettingItemInfo6 =
        new AppSettingItemInfo(
            7, 3001, true, false, false, getString(R.string.pwdsetting_advance_title), "", "", "");
    AppSettingItemInfo appSettingItemInfo17 =
        new AppSettingItemInfo(
            18,
            7,
            false,
            true,
            false,
            "",
            getString(R.string.pwdsetting_advance_aoturecordpic__title),
            getString(R.string.pwdsetting_advance_aoturecordpic__detail),
            "");
    AppSettingItemInfo appSettingItemInfo18 =
        new AppSettingItemInfo(
            19,
            7,
            false,
            true,
            false,
            "",
            getString(R.string.pwdsetting_advance_playwarringsound__title),
            getString(R.string.pwdsetting_advance_playwarringsound__detail),
            "");
    AppSettingItemInfo appSettingItemInfo7 =
        new AppSettingItemInfo(
            8,
            7,
            false,
            true,
            false,
            "",
            getString(R.string.pwdsetting_advance_tipsnewapp_title),
            getString(R.string.pwdsetting_advance_tipsnewapp_detail),
            "");
    AppSettingItemInfo appSettingItemInfo8 =
        new AppSettingItemInfo(
            9,
            7,
            false,
            true,
            false,
            "",
            getString(R.string.pwdsetting_advance_allowleave_title),
            getString(R.string.pwdsetting_advance_allowleave_detail),
            "");
    AppSettingItemInfo appSettingItemInfo9 =
        new AppSettingItemInfo(
            10,
            7,
            false,
            false,
            false,
            "",
            getString(R.string.pwdsetting_advance_allowleavetime_title),
            getString(R.string.pwdsetting_advance_allowleavetime_detail_30second),
            "");
    AppSettingItemInfo appSettingItemInfo10 =
        new AppSettingItemInfo(
            11,
            7,
            false,
            true,
            false,
            "",
            getString(R.string.pwdsetting_advance_hideappicon_title),
            getString(R.string.pwdsetting_advance_hideappicon__detail),
            "");
    AppSettingItemInfo appSettingItemInfo11 =
        new AppSettingItemInfo(
            12,
            7,
            false,
            true,
            false,
            "",
            getString(R.string.pwdsetting_advance_uninstallapp_title),
            getString(R.string.pwdsetting_advance_uninstallapp_detail),
            "");
    AppSettingItemInfo appSettingItemInfo12 =
        new AppSettingItemInfo(
            13,
            3002,
            true,
            false,
            false,
            getString(R.string.pwdsetting_aboutour_title),
            "",
            "",
            "");
    AppSettingItemInfo appSettingItemInfo21 =
        new AppSettingItemInfo(
            22,
            13,
            false,
            false,
            true,
            "",
            getString(R.string.pwdsetting_aboutour_apps_title),
            getString(R.string.pwdsetting_aboutour_apps_detail),
            "");
    AppSettingItemInfo appSettingItemInfo13 =
        new AppSettingItemInfo(
            14,
            13,
            false,
            false,
            true,
            "",
            getString(R.string.pwdsetting_aboutour_feedback_title),
            getString(R.string.pwdsetting_aboutour_feedback_detail),
            "");
    AppSettingItemInfo appSettingItemInfo14 =
        new AppSettingItemInfo(
            15,
            13,
            false,
            false,
            true,
            "",
            getString(R.string.pwdsetting_aboutour_qa_title),
            getString(R.string.pwdsetting_aboutour_qa_detail),
            "");
    AppSettingItemInfo appSettingItemInfo15 =
        new AppSettingItemInfo(
            16,
            13,
            false,
            false,
            true,
            "",
            getString(R.string.pwdsetting_aboutour_version_title),
            getString(R.string.pwdsetting_aboutour_version_detail),
            getString(R.string.pwdsetting_aboutour_version_hasnew));
    AppSettingItemInfo appSettingItemInfo16 =
        new AppSettingItemInfo(
            17,
            13,
            false,
            false,
            true,
            "",
            getString(R.string.pwdsetting_aboutour_lookmyprivate_title),
            getString(R.string.pwdsetting_aboutour_lookmyprivate_detail),
            "");

    AppSettingItemInfo appSettingItemInfo19 =
        new AppSettingItemInfo(
            20,
            1,
            false,
            false,
            true,
            "",
            getString(R.string.pwdsetting_share_title),
            getString(R.string.pwdsetting_share_detail),
            "");

    dataAppSettingItemInfos.add(appSettingItemInfo);
    dataAppSettingItemInfos.add(appSettingItemInfo1);
    dataAppSettingItemInfos.add(appSettingItemInfo16);
    dataAppSettingItemInfos.add(appSettingItemInfo2);
    dataAppSettingItemInfos.add(appSettingItemInfo3);
    dataAppSettingItemInfos.add(appSettingItemInfo5);
    dataAppSettingItemInfos.add(appSettingItemInfo6);
    dataAppSettingItemInfos.add(appSettingItemInfo17);
    dataAppSettingItemInfos.add(appSettingItemInfo18);
    dataAppSettingItemInfos.add(appSettingItemInfo7);
    dataAppSettingItemInfos.add(appSettingItemInfo8);
    dataAppSettingItemInfos.add(appSettingItemInfo9);
    dataAppSettingItemInfos.add(appSettingItemInfo12);
    dataAppSettingItemInfos.add(appSettingItemInfo21);
    dataAppSettingItemInfos.add(appSettingItemInfo13);
    dataAppSettingItemInfos.add(appSettingItemInfo15);

    addAdapter(dataAppSettingItemInfos);

    leaveTimeStrings.add(getString(R.string.pwdsetting_advance_allowleavetime_detail_30second));
    leaveTimeStrings.add(getString(R.string.pwdsetting_advance_allowleavetime_detail_1minute));
    leaveTimeStrings.add(getString(R.string.pwdsetting_advance_allowleavetime_detail_2minute));
    leaveTimeStrings.add(getString(R.string.pwdsetting_advance_allowleavetime_detail_5minute));
  }