@ -0,0 +1,287 @@
|
||||
/*
|
||||
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.micode.notes.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Vibrator;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.micode.notes.R;
|
||||
import net.micode.notes.model.WorkingNote;
|
||||
import net.micode.notes.tool.LockPasswordUtils;
|
||||
|
||||
/**
|
||||
* 数字密码输入界面
|
||||
* 用于设置、修改或删除6位数字密码
|
||||
*/
|
||||
public class NumericPasswordActivity extends Activity {
|
||||
private static final String TAG = "NumericPasswordActivity";
|
||||
|
||||
public static final String EXTRA_NOTE_ID = "note_id";
|
||||
public static final String EXTRA_MODE = "mode";
|
||||
public static final String MODE_SET = "set";
|
||||
public static final String MODE_CHANGE = "change";
|
||||
public static final String MODE_REMOVE = "remove";
|
||||
public static final String MODE_VERIFY = "verify";
|
||||
|
||||
private TextView mPasswordDisplay;
|
||||
private TextView mHintText;
|
||||
private Button[] mNumberButtons = new Button[10];
|
||||
private Button mDeleteButton;
|
||||
private Button mCancelButton;
|
||||
|
||||
private long mNoteId;
|
||||
private String mMode;
|
||||
private WorkingNote mWorkingNote;
|
||||
|
||||
private String mFirstPassword;
|
||||
private String mSecondPassword;
|
||||
private String mOldPassword;
|
||||
private StringBuilder mCurrentPassword;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_numeric_password);
|
||||
|
||||
mNoteId = getIntent().getLongExtra(EXTRA_NOTE_ID, 0);
|
||||
mMode = getIntent().getStringExtra(EXTRA_MODE);
|
||||
|
||||
if (mNoteId <= 0) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
mWorkingNote = WorkingNote.load(this, mNoteId);
|
||||
mCurrentPassword = new StringBuilder();
|
||||
|
||||
initViews();
|
||||
setupMode();
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
mPasswordDisplay = (TextView) findViewById(R.id.tv_password_display);
|
||||
mHintText = (TextView) findViewById(R.id.tv_password_hint);
|
||||
mDeleteButton = (Button) findViewById(R.id.btn_delete);
|
||||
mCancelButton = (Button) findViewById(R.id.btn_cancel);
|
||||
|
||||
mNumberButtons[0] = (Button) findViewById(R.id.btn_0);
|
||||
mNumberButtons[1] = (Button) findViewById(R.id.btn_1);
|
||||
mNumberButtons[2] = (Button) findViewById(R.id.btn_2);
|
||||
mNumberButtons[3] = (Button) findViewById(R.id.btn_3);
|
||||
mNumberButtons[4] = (Button) findViewById(R.id.btn_4);
|
||||
mNumberButtons[5] = (Button) findViewById(R.id.btn_5);
|
||||
mNumberButtons[6] = (Button) findViewById(R.id.btn_6);
|
||||
mNumberButtons[7] = (Button) findViewById(R.id.btn_7);
|
||||
mNumberButtons[8] = (Button) findViewById(R.id.btn_8);
|
||||
mNumberButtons[9] = (Button) findViewById(R.id.btn_9);
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
final int number = i;
|
||||
mNumberButtons[i].setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onNumberPressed(number);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mDeleteButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onDeletePressed();
|
||||
}
|
||||
});
|
||||
|
||||
mCancelButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupMode() {
|
||||
if (MODE_SET.equals(mMode)) {
|
||||
mHintText.setText(R.string.numeric_password_hint_set);
|
||||
} else if (MODE_CHANGE.equals(mMode)) {
|
||||
mHintText.setText(R.string.numeric_password_hint_verify);
|
||||
} else if (MODE_REMOVE.equals(mMode)) {
|
||||
mHintText.setText(R.string.numeric_password_hint_remove);
|
||||
} else if (MODE_VERIFY.equals(mMode)) {
|
||||
mHintText.setText(R.string.numeric_password_hint_verify);
|
||||
}
|
||||
}
|
||||
|
||||
private void onNumberPressed(int number) {
|
||||
if (mCurrentPassword.length() < 6) {
|
||||
mCurrentPassword.append(number);
|
||||
updatePasswordDisplay();
|
||||
|
||||
if (mCurrentPassword.length() == 6) {
|
||||
handlePasswordComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onDeletePressed() {
|
||||
if (mCurrentPassword.length() > 0) {
|
||||
mCurrentPassword.deleteCharAt(mCurrentPassword.length() - 1);
|
||||
updatePasswordDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePasswordDisplay() {
|
||||
StringBuilder display = new StringBuilder();
|
||||
for (int i = 0; i < mCurrentPassword.length(); i++) {
|
||||
display.append("●");
|
||||
}
|
||||
mPasswordDisplay.setText(display.toString());
|
||||
}
|
||||
|
||||
private void handlePasswordComplete() {
|
||||
String password = mCurrentPassword.toString();
|
||||
|
||||
if (MODE_SET.equals(mMode)) {
|
||||
handleSetMode(password);
|
||||
} else if (MODE_CHANGE.equals(mMode)) {
|
||||
handleChangeMode(password);
|
||||
} else if (MODE_REMOVE.equals(mMode)) {
|
||||
handleRemoveMode(password);
|
||||
} else if (MODE_VERIFY.equals(mMode)) {
|
||||
handleVerifyMode(password);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleSetMode(String password) {
|
||||
if (mFirstPassword == null) {
|
||||
mFirstPassword = password;
|
||||
mHintText.setText(R.string.numeric_password_confirm);
|
||||
mCurrentPassword.setLength(0);
|
||||
updatePasswordDisplay();
|
||||
} else {
|
||||
mSecondPassword = password;
|
||||
if (mFirstPassword.equals(mSecondPassword)) {
|
||||
String encryptedPassword = LockPasswordUtils.encryptPassword(mFirstPassword);
|
||||
mWorkingNote.setLocked(true);
|
||||
mWorkingNote.setPasswordType(LockPasswordUtils.TYPE_NUMERIC);
|
||||
mWorkingNote.setNumericPassword(encryptedPassword);
|
||||
mWorkingNote.setLockPassword("");
|
||||
mWorkingNote.saveNote();
|
||||
Toast.makeText(this, R.string.numeric_password_success, Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
} else {
|
||||
mHintText.setText(R.string.numeric_password_confirm_error);
|
||||
mFirstPassword = null;
|
||||
mSecondPassword = null;
|
||||
mCurrentPassword.setLength(0);
|
||||
updatePasswordDisplay();
|
||||
vibrate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleChangeMode(String password) {
|
||||
if (mOldPassword == null) {
|
||||
String encryptedInput = LockPasswordUtils.encryptPassword(password);
|
||||
String storedPassword = mWorkingNote.getNumericPassword();
|
||||
|
||||
if (encryptedInput.equals(storedPassword)) {
|
||||
mOldPassword = storedPassword;
|
||||
mHintText.setText(R.string.numeric_password_hint_new);
|
||||
mCurrentPassword.setLength(0);
|
||||
updatePasswordDisplay();
|
||||
} else {
|
||||
mHintText.setText(R.string.numeric_password_error);
|
||||
mCurrentPassword.setLength(0);
|
||||
updatePasswordDisplay();
|
||||
vibrate();
|
||||
}
|
||||
} else if (mFirstPassword == null) {
|
||||
mFirstPassword = password;
|
||||
mHintText.setText(R.string.numeric_password_confirm);
|
||||
mCurrentPassword.setLength(0);
|
||||
updatePasswordDisplay();
|
||||
} else {
|
||||
mSecondPassword = password;
|
||||
if (mFirstPassword.equals(mSecondPassword)) {
|
||||
String encryptedPassword = LockPasswordUtils.encryptPassword(mFirstPassword);
|
||||
mWorkingNote.setNumericPassword(encryptedPassword);
|
||||
mWorkingNote.saveNote();
|
||||
Toast.makeText(this, R.string.numeric_password_success, Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
} else {
|
||||
mHintText.setText(R.string.numeric_password_confirm_error);
|
||||
mFirstPassword = null;
|
||||
mSecondPassword = null;
|
||||
mCurrentPassword.setLength(0);
|
||||
updatePasswordDisplay();
|
||||
vibrate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleRemoveMode(String password) {
|
||||
String encryptedInput = LockPasswordUtils.encryptPassword(password);
|
||||
String storedPassword = mWorkingNote.getNumericPassword();
|
||||
|
||||
if (encryptedInput.equals(storedPassword)) {
|
||||
mWorkingNote.setLocked(false);
|
||||
mWorkingNote.setNumericPassword("");
|
||||
mWorkingNote.setPasswordType("");
|
||||
mWorkingNote.saveNote();
|
||||
Toast.makeText(this, R.string.numeric_password_removed, Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
} else {
|
||||
mHintText.setText(R.string.numeric_password_error);
|
||||
mCurrentPassword.setLength(0);
|
||||
updatePasswordDisplay();
|
||||
vibrate();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleVerifyMode(String password) {
|
||||
String encryptedInput = LockPasswordUtils.encryptPassword(password);
|
||||
String storedPassword = mWorkingNote.getNumericPassword();
|
||||
|
||||
if (encryptedInput.equals(storedPassword)) {
|
||||
Intent intent = new Intent(this, NoteEditActivity.class);
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.putExtra(Intent.EXTRA_UID, mNoteId);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} else {
|
||||
mHintText.setText(R.string.numeric_password_error);
|
||||
mCurrentPassword.setLength(0);
|
||||
updatePasswordDisplay();
|
||||
vibrate();
|
||||
}
|
||||
}
|
||||
|
||||
private void vibrate() {
|
||||
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
|
||||
if (vibrator != null && vibrator.hasVibrator()) {
|
||||
vibrator.vibrate(200);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,273 @@
|
||||
/*
|
||||
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.micode.notes.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.micode.notes.R;
|
||||
import net.micode.notes.data.Notes;
|
||||
import net.micode.notes.model.WorkingNote;
|
||||
import net.micode.notes.tool.LockPasswordUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设置密码界面
|
||||
* 用于设置、修改或删除便签的手势密码
|
||||
*/
|
||||
public class SetLockActivity extends Activity {
|
||||
private static final String TAG = "SetLockActivity";
|
||||
|
||||
public static final String EXTRA_NOTE_ID = "note_id";
|
||||
public static final String EXTRA_MODE = "mode";
|
||||
public static final String MODE_SET = "set";
|
||||
public static final String MODE_CHANGE = "change";
|
||||
public static final String MODE_REMOVE = "remove";
|
||||
|
||||
private LockPatternView mLockPatternView;
|
||||
private TextView mTitleText;
|
||||
private TextView mHintText;
|
||||
private Button mConfirmButton;
|
||||
private Button mCancelButton;
|
||||
|
||||
private long mNoteId;
|
||||
private String mMode;
|
||||
private WorkingNote mWorkingNote;
|
||||
|
||||
private List<Integer> mFirstPattern;
|
||||
private List<Integer> mSecondPattern;
|
||||
private String mOldPassword;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_set_lock);
|
||||
|
||||
mNoteId = getIntent().getLongExtra(EXTRA_NOTE_ID, 0);
|
||||
mMode = getIntent().getStringExtra(EXTRA_MODE);
|
||||
|
||||
if (mNoteId <= 0) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
mWorkingNote = WorkingNote.load(this, mNoteId);
|
||||
|
||||
initViews();
|
||||
setupMode();
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
mLockPatternView = (LockPatternView) findViewById(R.id.lock_pattern_view);
|
||||
mTitleText = (TextView) findViewById(R.id.tv_lock_title);
|
||||
mHintText = (TextView) findViewById(R.id.tv_lock_hint);
|
||||
mConfirmButton = (Button) findViewById(R.id.btn_confirm);
|
||||
mCancelButton = (Button) findViewById(R.id.btn_cancel);
|
||||
|
||||
mLockPatternView.setOnPatternListener(new LockPatternView.OnPatternListener() {
|
||||
@Override
|
||||
public void onPatternStart() {
|
||||
mHintText.setText("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPatternCleared() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPatternDetected(List<Integer> pattern) {
|
||||
handlePatternDetected(pattern);
|
||||
}
|
||||
});
|
||||
|
||||
mCancelButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
mConfirmButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
handleConfirm();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupMode() {
|
||||
if (MODE_SET.equals(mMode)) {
|
||||
mTitleText.setText(R.string.lock_pattern_title);
|
||||
mHintText.setText(R.string.lock_pattern_hint_set);
|
||||
mConfirmButton.setVisibility(View.GONE);
|
||||
} else if (MODE_CHANGE.equals(mMode)) {
|
||||
mTitleText.setText(R.string.lock_pattern_title_change);
|
||||
mHintText.setText(R.string.lock_pattern_hint_old);
|
||||
mConfirmButton.setVisibility(View.GONE);
|
||||
} else if (MODE_REMOVE.equals(mMode)) {
|
||||
mTitleText.setText(R.string.lock_pattern_title_remove);
|
||||
mHintText.setText(R.string.lock_pattern_hint_remove);
|
||||
mConfirmButton.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void handlePatternDetected(List<Integer> pattern) {
|
||||
if (pattern.size() < 4) {
|
||||
mHintText.setText(R.string.lock_pattern_too_short);
|
||||
mLockPatternView.clearPattern();
|
||||
return;
|
||||
}
|
||||
|
||||
if (MODE_SET.equals(mMode)) {
|
||||
handleSetMode(pattern);
|
||||
} else if (MODE_CHANGE.equals(mMode)) {
|
||||
handleChangeMode(pattern);
|
||||
} else if (MODE_REMOVE.equals(mMode)) {
|
||||
handleRemoveMode(pattern);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleSetMode(List<Integer> pattern) {
|
||||
if (mFirstPattern == null) {
|
||||
mFirstPattern = pattern;
|
||||
mHintText.setText(R.string.lock_pattern_confirm);
|
||||
mLockPatternView.clearPattern();
|
||||
} else {
|
||||
mSecondPattern = pattern;
|
||||
if (patternsMatch(mFirstPattern, mSecondPattern)) {
|
||||
String password = LockPasswordUtils.patternToString(
|
||||
LockPasswordUtils.stringToPattern(
|
||||
LockPasswordUtils.patternToString(convertPatternToIntArray(mFirstPattern))
|
||||
)
|
||||
);
|
||||
String encryptedPassword = LockPasswordUtils.encryptPassword(password);
|
||||
mWorkingNote.setLocked(true);
|
||||
mWorkingNote.setPasswordType(LockPasswordUtils.TYPE_GESTURE);
|
||||
mWorkingNote.setLockPassword(encryptedPassword);
|
||||
mWorkingNote.setNumericPassword("");
|
||||
mWorkingNote.saveNote();
|
||||
Toast.makeText(this, R.string.lock_pattern_success, Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
} else {
|
||||
mHintText.setText(R.string.lock_pattern_confirm_error);
|
||||
mFirstPattern = null;
|
||||
mSecondPattern = null;
|
||||
mLockPatternView.clearPattern();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleChangeMode(List<Integer> pattern) {
|
||||
if (mOldPassword == null) {
|
||||
String inputPassword = LockPasswordUtils.patternToString(
|
||||
LockPasswordUtils.stringToPattern(
|
||||
LockPasswordUtils.patternToString(convertPatternToIntArray(pattern))
|
||||
)
|
||||
);
|
||||
String encryptedInput = LockPasswordUtils.encryptPassword(inputPassword);
|
||||
String storedPassword = mWorkingNote.getLockPassword();
|
||||
|
||||
if (encryptedInput.equals(storedPassword)) {
|
||||
mOldPassword = storedPassword;
|
||||
mHintText.setText(R.string.lock_pattern_hint_new);
|
||||
mLockPatternView.clearPattern();
|
||||
} else {
|
||||
mHintText.setText(R.string.lock_pattern_error);
|
||||
mLockPatternView.clearPattern();
|
||||
}
|
||||
} else if (mFirstPattern == null) {
|
||||
mFirstPattern = pattern;
|
||||
mHintText.setText(R.string.lock_pattern_confirm);
|
||||
mLockPatternView.clearPattern();
|
||||
} else {
|
||||
mSecondPattern = pattern;
|
||||
if (patternsMatch(mFirstPattern, mSecondPattern)) {
|
||||
String password = LockPasswordUtils.patternToString(
|
||||
LockPasswordUtils.stringToPattern(
|
||||
LockPasswordUtils.patternToString(convertPatternToIntArray(mFirstPattern))
|
||||
)
|
||||
);
|
||||
String encryptedPassword = LockPasswordUtils.encryptPassword(password);
|
||||
mWorkingNote.setLockPassword(encryptedPassword);
|
||||
mWorkingNote.saveNote();
|
||||
Toast.makeText(this, R.string.lock_pattern_success, Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
} else {
|
||||
mHintText.setText(R.string.lock_pattern_confirm_error);
|
||||
mFirstPattern = null;
|
||||
mSecondPattern = null;
|
||||
mLockPatternView.clearPattern();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleRemoveMode(List<Integer> pattern) {
|
||||
String inputPassword = LockPasswordUtils.patternToString(
|
||||
LockPasswordUtils.stringToPattern(
|
||||
LockPasswordUtils.patternToString(convertPatternToIntArray(pattern))
|
||||
)
|
||||
);
|
||||
String encryptedInput = LockPasswordUtils.encryptPassword(inputPassword);
|
||||
String storedPassword = mWorkingNote.getLockPassword();
|
||||
|
||||
if (encryptedInput.equals(storedPassword)) {
|
||||
mWorkingNote.setLocked(false);
|
||||
mWorkingNote.setLockPassword("");
|
||||
mWorkingNote.setPasswordType("");
|
||||
mWorkingNote.saveNote();
|
||||
Toast.makeText(this, R.string.lock_pattern_removed, Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
} else {
|
||||
mHintText.setText(R.string.lock_pattern_error);
|
||||
mLockPatternView.clearPattern();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleConfirm() {
|
||||
finish();
|
||||
}
|
||||
|
||||
private boolean patternsMatch(List<Integer> pattern1, List<Integer> pattern2) {
|
||||
if (pattern1 == null || pattern2 == null) {
|
||||
return false;
|
||||
}
|
||||
if (pattern1.size() != pattern2.size()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < pattern1.size(); i++) {
|
||||
if (!pattern1.get(i).equals(pattern2.get(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private int[] convertPatternToIntArray(List<Integer> pattern) {
|
||||
int[] array = new int[pattern.size()];
|
||||
for (int i = 0; i < pattern.size(); i++) {
|
||||
array[i] = pattern.get(i);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,183 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
android:background="@android:color/white">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_password_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/numeric_password_title"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_password_hint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:textColor="@color/secondary_text_dark" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_password_display"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="32sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="48dp"
|
||||
android:textColor="@color/primary_text_dark" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_weight="1"
|
||||
android:text="1"
|
||||
android:textSize="24sp"
|
||||
android:layout_margin="4dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_weight="1"
|
||||
android:text="2"
|
||||
android:textSize="24sp"
|
||||
android:layout_margin="4dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_weight="1"
|
||||
android:text="3"
|
||||
android:textSize="24sp"
|
||||
android:layout_margin="4dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_weight="1"
|
||||
android:text="4"
|
||||
android:textSize="24sp"
|
||||
android:layout_margin="4dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_5"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_weight="1"
|
||||
android:text="5"
|
||||
android:textSize="24sp"
|
||||
android:layout_margin="4dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_6"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_weight="1"
|
||||
android:text="6"
|
||||
android:textSize="24sp"
|
||||
android:layout_margin="4dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_7"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_weight="1"
|
||||
android:text="7"
|
||||
android:textSize="24sp"
|
||||
android:layout_margin="4dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_8"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_weight="1"
|
||||
android:text="8"
|
||||
android:textSize="24sp"
|
||||
android:layout_margin="4dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_9"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_weight="1"
|
||||
android:text="9"
|
||||
android:textSize="24sp"
|
||||
android:layout_margin="4dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_delete"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_weight="1"
|
||||
android:text="←"
|
||||
android:textSize="24sp"
|
||||
android:layout_margin="4dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_0"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_weight="1"
|
||||
android:text="0"
|
||||
android:textSize="24sp"
|
||||
android:layout_margin="4dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_cancel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@android:string/cancel"
|
||||
android:textSize="16sp"
|
||||
android:layout_margin="4dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
android:background="@android:color/white">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_lock_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_lock_hint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:textColor="@color/secondary_text_dark" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/rg_password_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_gesture"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/lock_type_gesture"
|
||||
android:checked="true" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_numeric"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/lock_type_numeric" />
|
||||
</RadioGroup>
|
||||
|
||||
<net.micode.notes.ui.LockPatternView
|
||||
android:id="@+id/lock_pattern_view"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="300dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="32dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@android:string/cancel"
|
||||
android:minWidth="120dp"
|
||||
android:layout_marginEnd="16dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@android:string/ok"
|
||||
android:minWidth="120dp"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
android:background="@android:color/white">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_unlock_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/lock_note_title_lock"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_unlock_hint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:textColor="@color/secondary_text_dark" />
|
||||
|
||||
<net.micode.notes.ui.LockPatternView
|
||||
android:id="@+id/lock_pattern_view"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="300dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="32dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@android:string/cancel"
|
||||
android:minWidth="120dp"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
|
||||
</LinearLayout>
|
||||
Loading…
Reference in new issue