新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Android手勢密碼--設置和校驗功能的實現(xiàn)代碼-創(chuàng)新互聯(lián)
效果圖如下,大家感覺不錯請參考實現(xiàn)代碼
private void setGesturePassword() { toggleMore.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { // UIUtils.toast("開啟了手勢密碼", false); // sp.edit().putBoolean("isOpen", true).commit(); String inputCode = sp.getString("inputCode", ""); if (TextUtils.isEmpty(inputCode)) {//之前沒有設置過 new AlertDialog.Builder(MoreFragment.this.getActivity()) .setTitle("設置手勢密碼") .setMessage("是否現(xiàn)在設置手勢密碼") .setPositiveButton("確定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { UIUtils.toast("現(xiàn)在設置手勢密碼", false); sp.edit().putBoolean("isOpen", true).commit(); // toggleMore.setChecked(true); //開啟新的activity: ((BaseActivity) MoreFragment.this.getActivity()).goToActivity(GestureEditActivity.class, null); } }) .setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { UIUtils.toast("取消了現(xiàn)在設置手勢密碼", false); sp.edit().putBoolean("isOpen", false).commit(); toggleMore.setChecked(false); } }) .show(); } else { UIUtils.toast("開啟手勢密碼", false); sp.edit().putBoolean("isOpen", true).commit(); // toggleMore.setChecked(true); } } else { UIUtils.toast("關(guān)閉了手勢密碼", false); sp.edit().putBoolean("isOpen", false).commit(); // toggleMore.setChecked(false); } } }); } private void resetGesture() { tvMoreReset.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { boolean checked = toggleMore.isChecked(); if (checked) { ((BaseActivity) MoreFragment.this.getActivity()).goToActivity(GestureEditActivity.class, null); } else { UIUtils.toast("手勢密碼操作已關(guān)閉,請開啟后再設置", false); } } }); }
本文名稱:Android手勢密碼--設置和校驗功能的實現(xiàn)代碼-創(chuàng)新互聯(lián)
分享地址:http://ef60e0e.cn/article/ddshdg.html