本文整理匯總了Java中com.eftimoff.patternview.PatternView類的典型用法代碼示例。如果您正苦於以下問題:Java PatternView類的具體用法?Java PatternView怎麽用?Java PatternView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PatternView類屬於com.eftimoff.patternview包,在下文中一共展示了PatternView類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreateView
import com.eftimoff.patternview.PatternView; //導入依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.content_login, container, false);
getActivity().setTitle("登錄");
db = getActivity().openOrCreateDatabase("tachi.db", getActivity().MODE_PRIVATE, null);
patternView = (PatternView) view.findViewById(R.id.patternView);
patternView.setTactileFeedbackEnabled(false);
Cursor c = db.rawQuery("select * from user", null);
if (!c.moveToNext()) {
Toast.makeText(getActivity(), "首次使用需設定解鎖圖案", Toast.LENGTH_SHORT).show();
}
bundle = getArguments();
try {
bundle.getString("finger");
} catch (Exception e) {
e.printStackTrace();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isSetFinger()) {
fingerAuth();
}
}
return view;
}
示例2: onCreateView
import com.eftimoff.patternview.PatternView; //導入依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.content_login, container, false);
getActivity().setTitle("更改密碼");
db = getActivity().openOrCreateDatabase("tachi.db", getActivity().MODE_PRIVATE, null);
patternView = (PatternView) view.findViewById(R.id.patternView);
patternView.setTactileFeedbackEnabled(false);
return view;
}
示例3: onActivityCreated
import com.eftimoff.patternview.PatternView; //導入依賴的package包/類
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
patternView.setOnPatternDetectedListener(new PatternView.OnPatternDetectedListener() {
@Override
public void onPatternDetected() {
if (patternString == null) {
patternString = patternView.getPatternString();
Toast.makeText(getActivity(), "請重複一次", Toast.LENGTH_SHORT).show();
patternView.clearPattern();
return;
}
if (patternString.equals(patternView.getPatternString())) {
patternView.clearPattern();
try {
db.execSQL("UPDATE user SET password = '"+MD5.encrypt(patternString)+"' WHERE user='';");
Toast.makeText(getActivity(), "修改成功,請重新登陸", Toast.LENGTH_SHORT).show();
SharedPreferences.Editor editor = getActivity().getSharedPreferences("logined", getActivity().MODE_PRIVATE).edit();
editor.putString("logined", "");
editor.apply();
Fragment login = new FragmentLogin();
FragmentManager fm=getActivity().getSupportFragmentManager();//清除回退stack
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
fm.beginTransaction().replace(R.id.id_content, login).commit();
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(getActivity(), "修改失敗", Toast.LENGTH_SHORT).show();
}
}else {
Toast.makeText(getActivity(), "兩次不匹配", Toast.LENGTH_SHORT).show();
patternView.clearPattern();
patternString = null;
}
}
});
super.onActivityCreated(savedInstanceState);
}
示例4: onEventMainThread
import com.eftimoff.patternview.PatternView; //導入依賴的package包/類
public void onEventMainThread(Object event) {
if (!(event instanceof CryptoEvent)) {
return;
}
if ((event == null || ((CryptoEvent) event).getField() == null) && (type != ShowTypeSet)) {
patternView.setPattern(PatternView.DisplayMode.Wrong, patternView.getPattern());
return;
}
switch (((CryptoEvent) event).getType()) {
case AppConstants.TYPE_DECRYPT :
finish();
break;
case AppConstants.TYPE_ENCRYPT :
Account save = new Account();
save.setType(AppConstants.TYPE_QUICK);
save.setHash(((CryptoEvent) event).getResult());
save.setSalt("");
save.setName("");
save.setTag("");
AccountHelper.getInstance(null).saveAccount(save);
setResult(RESULT_OK);
finish();
break;
case AppConstants.TYPE_MASTERPWD:
masterPassword = ((CryptoEvent) event).getResult();
if (type == ShowTypeSet)
saveQuickPass();
break;
case AppConstants.TYPE_SHTHPPN:
patternView.setPattern(PatternView.DisplayMode.Wrong, patternView.getPattern());
break;
default:
break;
}
}
示例5: onActivityCreated
import com.eftimoff.patternview.PatternView; //導入依賴的package包/類
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
patternView.setOnPatternDetectedListener(new PatternView.OnPatternDetectedListener() {
@Override
public void onPatternDetected() {
Cursor c = db.rawQuery("select * from user", null);
if (!c.moveToNext()) {
if (patternString == null) {
patternString = patternView.getPatternString();
Toast.makeText(getActivity(), "請重複一次", Toast.LENGTH_SHORT).show();
patternView.clearPattern();
return;
}
if (patternString.equals(patternView.getPatternString())) {
patternView.clearPattern();
try {
db.execSQL("insert into user (user,password) values ('', '" + MD5.encrypt(patternString) + "');");
Toast.makeText(getActivity(), "注冊成功", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(getActivity(), "注冊失敗", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(getActivity(), "兩次不匹配", Toast.LENGTH_SHORT).show();
patternView.clearPattern();
patternString = null;
}
} else {
c.close();
db = getActivity().openOrCreateDatabase("tachi.db", getActivity().MODE_PRIVATE, null);
c = db.rawQuery("select * from user", null);
if (c != null) {
while (c.moveToNext()) {
if (Objects.equals(MD5.encrypt(patternView.getPatternString()), c.getString(c.getColumnIndex("password")))) {
loginSuccess();
} else {
Toast.makeText(getActivity(), "圖案錯誤", Toast.LENGTH_SHORT).show();
}
}
c.close();
}
}
}
});
super.onActivityCreated(savedInstanceState);
}
示例6: onCreate
import com.eftimoff.patternview.PatternView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_set_quick_password);
EventBus.getDefault().register(this);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
hintStrSet = getString(R.string.set_gesture_password);
hintStrVerify = getString(R.string.verify_gesture_password);
patternView = (PatternView) findViewById(R.id.lock_view);
hintTextView = (AppCompatTextView) findViewById(R.id.hint_view);
type = getIntent().getLongExtra("type", ShowTypeSet);
// findViewById(R.id.content_setpassword).getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
// @Override
// public boolean onPreDraw() {
//
// Blurry.with(SetQuickPasswordActivity.this)
// .radius(0)
// .sampling(2)
// .onto((ViewGroup) findViewById(R.id.content_setpassword));
// return true;
// }
// });
patternView.setOnPatternDetectedListener(new PatternView.OnPatternDetectedListener() {
@Override
public void onPatternDetected() {
quickCode = patternView.getPatternString();
if (type == ShowTypeVerify) {
checkQuickPass();
}
}
});
if (type == ShowTypeVerify) {
masterPassword = getIntent().getStringExtra("masterPassword");
fab.setVisibility(View.INVISIBLE);
hintTextView.setText(hintStrVerify);
} else {
fab.setVisibility(View.VISIBLE);
hintTextView.setText(hintStrSet);
}
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!validateInput())
return;
startActivity(new Intent(SetQuickPasswordActivity.this, AuthorizeActivity.class));
}
});
}