public void handleMessage(Message msg) { switch (msg.what) { case SETLEAVEDIALOG_DISS: { appSettingAdapter.notifyDataSetChanged(); break; } case SplashActivity.CHECKVERSION_CANCEL: case SplashActivity.CHECKVERSION_EOOR: break; case SplashActivity.CHECKVERSION_DOWN: { // 通知栏更新,下载文件 Intent updateIntent = new Intent(AppSettingActivity.this, UpdateService.class); updateIntent.putExtra("appUrl", downLoadFileUrl); startService(updateIntent); break; } case UPDATEADAPTER: { appSettingAdapter.notifyDataSetChanged(); break; } default: break; } }
private void hideLeaverTime() { for (AppSettingItemInfo appSettingItemInfo : dataAppSettingItemInfos) { if (appSettingItemInfo.getClassID() == 10) { dataAppSettingItemInfos.remove(appSettingItemInfo); appSettingAdapter.notifyDataSetChanged(); break; } } }
private void addAdapter(Vector<AppSettingItemInfo> itemInfos) { Vector<AppSettingItemInfo> appSettingItemInfos = new Vector<AppSettingItemInfo>(); appSettingItemInfos.removeAllElements(); AppSettingItemInfo tmp = null; Set<Integer> set = new HashSet<Integer>(); if (itemInfos != null && itemInfos.size() > 0) { for (int i = 0; i < itemInfos.size(); i++) { tmp = itemInfos.get(i); if (set.contains(tmp.parentID)) { appSettingItemInfos.add(tmp); } else { set.add(tmp.parentID); appSettingItemInfos.add(tmp); } } appSettingAdapter.removeAll(); allItemInfos = appSettingItemInfos; for (AppSettingItemInfo appSettingItemInfo : appSettingItemInfos) { appSettingAdapter.addItem(appSettingItemInfo); } } }
private void showLeaverTime() { AppSettingItemInfo appSettingItemInfo9 = new AppSettingItemInfo( 10, 7, false, false, false, "", getString(R.string.pwdsetting_advance_allowleavetime_title), getString(R.string.pwdsetting_advance_allowleavetime_detail_30second), ""); dataAppSettingItemInfos.add(appSettingItemInfo9); appSettingAdapter.notifyDataSetChanged(); }
@Override protected void onResume() { // TODO Auto-generated method stub appSettingAdapter.notifyDataSetChanged(); super.onResume(); }
@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)); }
@Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub SwitchButton switchButton = (SwitchButton) buttonView; LogUtil.e("colin", "switch is changed:" + switchButton.getId()); switch (switchButton.getId()) { case 2: // 启用加锁 { boolean bIsState = !switchButton.isChecked(); appLockApplication.setAppLockState(bIsState); break; } case 8: // 新应用加锁提示 { break; } case 9: // 允许短暂退出 { boolean bIsState = !switchButton.isChecked(); appLockApplication.setAllowedLeaveAment(bIsState); Intent intent = new Intent(LockService.LOCK_SERVICE_LEAVEAMENT); intent.putExtra(LockService.LOCK_SERVICE_LEAVEAMENT, bIsState); sendBroadcast(intent); LogUtil.d("demo3", "bIsState:" + bIsState); break; } case 11: // 锁锁图标的隐藏和显示 { setHideAppIcon(); break; } case 12: // 防卸载 { if (!switchButton.isChecked() && !devicePolicyManager.isAdminActive(componentName)) { enableDeviceManager(); } else if (switchButton.isChecked() && devicePolicyManager.isAdminActive(componentName)) { disableDeviceManager(); } break; } case 18: // 自动拍照 { appLockApplication.setAutoRecordPic(!switchButton.isChecked()); if (appLockApplication.getAutoRecordPic()) { WarringDialog warringDialog = new WarringDialog(); warringDialog.switchButton = switchButton; warringDialog.show(); } break; } case 19: // 播放告警声音 { appLockApplication.setPlayWarringSoundState(!switchButton.isChecked()); break; } default: break; } appSettingAdapter.notifyDataSetChanged(); }