|
|
@ -19,6 +19,8 @@ package net.micode.notes.ui;
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.app.AlarmManager;
|
|
|
|
import android.app.AlarmManager;
|
|
|
|
import android.app.AlertDialog;
|
|
|
|
import android.app.AlertDialog;
|
|
|
|
|
|
|
|
import android.app.AlertDialog.Builder;
|
|
|
|
|
|
|
|
import android.app.Dialog;
|
|
|
|
import android.app.PendingIntent;
|
|
|
|
import android.app.PendingIntent;
|
|
|
|
import android.app.SearchManager;
|
|
|
|
import android.app.SearchManager;
|
|
|
|
import android.appwidget.AppWidgetManager;
|
|
|
|
import android.appwidget.AppWidgetManager;
|
|
|
@ -65,6 +67,8 @@ import net.micode.notes.ui.NoteEditText.OnTextViewChangeListener;
|
|
|
|
import net.micode.notes.widget.NoteWidgetProvider_2x;
|
|
|
|
import net.micode.notes.widget.NoteWidgetProvider_2x;
|
|
|
|
import net.micode.notes.widget.NoteWidgetProvider_4x;
|
|
|
|
import net.micode.notes.widget.NoteWidgetProvider_4x;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import net.micode.notes.ui.text;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
@ -82,6 +86,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
public TextView tvAlertDate;
|
|
|
|
public TextView tvAlertDate;
|
|
|
|
|
|
|
|
|
|
|
|
public ImageView ibSetBgColor;
|
|
|
|
public ImageView ibSetBgColor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static final Map<Integer, Integer> sBgSelectorBtnsMap = new HashMap<Integer, Integer>();
|
|
|
|
private static final Map<Integer, Integer> sBgSelectorBtnsMap = new HashMap<Integer, Integer>();
|
|
|
@ -149,6 +155,15 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
private String mUserQuery;
|
|
|
|
private String mUserQuery;
|
|
|
|
private Pattern mPattern;
|
|
|
|
private Pattern mPattern;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private text t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void settext(String str1){
|
|
|
|
|
|
|
|
t.setStr(str1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public String Gettext(){
|
|
|
|
|
|
|
|
return t.GetStr();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
@ -269,6 +284,35 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void initNoteScreen() {
|
|
|
|
private void initNoteScreen() {
|
|
|
|
|
|
|
|
final String mPassword = mWorkingNote.getmPassword();
|
|
|
|
|
|
|
|
if(mPassword != null && mPassword.length() != 0) {
|
|
|
|
|
|
|
|
View view = LayoutInflater.from(this).inflate(R.layout.dialog_edit_text, null);
|
|
|
|
|
|
|
|
//编辑Text
|
|
|
|
|
|
|
|
final EditText inputServer = (EditText) view.findViewById(R.id.et_foler_name);
|
|
|
|
|
|
|
|
inputServer.setText("");
|
|
|
|
|
|
|
|
inputServer.setHint("请输入密码");
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(this).setTitle("密码校验");
|
|
|
|
|
|
|
|
builder.setIcon(android.R.drawable.ic_dialog_info).setView(inputServer);
|
|
|
|
|
|
|
|
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
|
|
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
|
|
|
dialog.dismiss();
|
|
|
|
|
|
|
|
onBackPressed();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
|
|
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
|
|
|
String password = inputServer.getText().toString();
|
|
|
|
|
|
|
|
if (!password.equals(mPassword)) {
|
|
|
|
|
|
|
|
dialog.dismiss();
|
|
|
|
|
|
|
|
onBackPressed();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
final Dialog dialog = builder.setView(view).show();
|
|
|
|
|
|
|
|
dialog.show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
mNoteEditor.setTextAppearance(this, TextAppearanceResources
|
|
|
|
mNoteEditor.setTextAppearance(this, TextAppearanceResources
|
|
|
|
.getTexAppearanceResource(mFontSizeId));
|
|
|
|
.getTexAppearanceResource(mFontSizeId));
|
|
|
|
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
|
|
|
|
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
|
|
|
@ -293,6 +337,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
* is not ready
|
|
|
|
* is not ready
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
showAlertHeader();
|
|
|
|
showAlertHeader();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void showAlertHeader() {
|
|
|
|
private void showAlertHeader() {
|
|
|
@ -430,7 +476,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
if (id == R.id.btn_set_bg_color) {
|
|
|
|
if (id == R.id.btn_set_bg_color) {
|
|
|
|
mNoteBgColorSelector.setVisibility(View.VISIBLE);
|
|
|
|
mNoteBgColorSelector.setVisibility(View.VISIBLE);
|
|
|
|
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
|
|
|
|
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
|
|
|
|
- View.VISIBLE);
|
|
|
|
View.VISIBLE);
|
|
|
|
} else if (sBgSelectorBtnsMap.containsKey(id)) {
|
|
|
|
} else if (sBgSelectorBtnsMap.containsKey(id)) {
|
|
|
|
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
|
|
|
|
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
|
|
|
|
View.GONE);
|
|
|
|
View.GONE);
|
|
|
@ -505,6 +551,27 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void encoding(){
|
|
|
|
|
|
|
|
//final EditText inputServer = new EditText(this);
|
|
|
|
|
|
|
|
View view = LayoutInflater.from(this).inflate(R.layout.dialog_edit_text, null);
|
|
|
|
|
|
|
|
//编辑Text
|
|
|
|
|
|
|
|
final EditText inputServer = (EditText) view.findViewById(R.id.et_foler_name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(this).setTitle("请输入密钥");
|
|
|
|
|
|
|
|
builder.setIcon(android.R.drawable.ic_dialog_info).setView(inputServer).setNegativeButton("Cancel", null);
|
|
|
|
|
|
|
|
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener(){
|
|
|
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
|
|
|
String string = inputServer.getText().toString();
|
|
|
|
|
|
|
|
mWorkingNote.setPassword(string);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} ).show();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
switch (item.getItemId()) {
|
|
|
@ -547,6 +614,9 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
case R.id.menu_delete_remind:
|
|
|
|
case R.id.menu_delete_remind:
|
|
|
|
mWorkingNote.setAlertDate(0, false);
|
|
|
|
mWorkingNote.setAlertDate(0, false);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case R.id.menu_encoding:
|
|
|
|
|
|
|
|
encoding();
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|