|
|
|
@ -17,10 +17,10 @@
|
|
|
|
|
package net.micode.notes.ui;
|
|
|
|
|
|
|
|
|
|
import android.Manifest;
|
|
|
|
|
|
|
|
|
|
import android.speech.tts.TextToSpeech.OnInitListener;
|
|
|
|
|
import android.app.AlarmManager;
|
|
|
|
|
import android.app.AlertDialog;
|
|
|
|
|
import android.app.Dialog;
|
|
|
|
|
import android.app.PendingIntent;
|
|
|
|
|
import android.app.SearchManager;
|
|
|
|
|
import android.appwidget.AppWidgetManager;
|
|
|
|
@ -50,11 +50,7 @@ import android.view.MotionEvent;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
import android.view.View.OnClickListener;
|
|
|
|
|
import android.view.WindowManager;
|
|
|
|
|
<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
import android.view.inputmethod.InputMethodManager;
|
|
|
|
|
=======
|
|
|
|
|
import android.widget.Button;
|
|
|
|
|
>>>>>>> 8c352e6399667edb8fde9a423fcc254e47cee228:src/main/java/ui/NoteEditActivity.java
|
|
|
|
|
import android.widget.CheckBox;
|
|
|
|
|
import android.widget.CompoundButton;
|
|
|
|
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
|
|
|
@ -100,7 +96,9 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
|
|
|
|
|
public ImageView ibSetBgColor;
|
|
|
|
|
}
|
|
|
|
|
//使用Map实现数据存储
|
|
|
|
|
|
|
|
|
|
final String[] mPermissionList = new String[]{
|
|
|
|
|
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
|
|
|
|
Manifest.permission.READ_EXTERNAL_STORAGE};
|
|
|
|
|
private static final Map<Integer, Integer> sBgSelectorBtnsMap = new HashMap<Integer, Integer>();
|
|
|
|
|
static {
|
|
|
|
|
sBgSelectorBtnsMap.put(R.id.iv_bg_yellow, ResourceParser.YELLOW);
|
|
|
|
@ -309,8 +307,7 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initNoteScreen() {
|
|
|
|
|
|
|
|
|
|
//对便签的初始化操作
|
|
|
|
|
//对界面的初始化操作
|
|
|
|
|
mNoteEditor.setTextAppearance(this, TextAppearanceResources
|
|
|
|
|
.getTexAppearanceResource(mFontSizeId));
|
|
|
|
|
//设置外观
|
|
|
|
@ -583,60 +580,14 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
|
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
|
//根据菜单的id来编剧相关项目
|
|
|
|
|
<<<<<<< HEAD:src/main/java/net/micode/notes/ui/NoteEditActivity.java
|
|
|
|
|
case R.id.locker:
|
|
|
|
|
//为便签上锁
|
|
|
|
|
final AlertDialog.Builder create_password = new AlertDialog.Builder(this);
|
|
|
|
|
//创建关于上锁操作的对话框
|
|
|
|
|
final View view = LayoutInflater.from(this).inflate(R.layout.buttom,null);
|
|
|
|
|
//???
|
|
|
|
|
final EditText etName = (EditText)view.findViewById(R.id.password);
|
|
|
|
|
final EditText etTag = (EditText)view.findViewById(R.id.tag);
|
|
|
|
|
//???
|
|
|
|
|
etName.setText("");
|
|
|
|
|
etName.setHint(" Please input your password");
|
|
|
|
|
etTag.setText("");
|
|
|
|
|
etTag.setHint(" Please input your tag");
|
|
|
|
|
create_password.setTitle(getString(R.string.alert_set_password));
|
|
|
|
|
//设置标题为Set your password
|
|
|
|
|
create_password.setNegativeButton("OK", new DialogInterface.OnClickListener() {//设置监听,获取输入的字符串
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
String password = etName.getText().toString();
|
|
|
|
|
String tag = etTag.getText().toString();
|
|
|
|
|
//获取输入的字符串
|
|
|
|
|
mWorkingNote.setPassword(password,tag);
|
|
|
|
|
//设置密码
|
|
|
|
|
Toast.makeText(NoteEditActivity.this,"Password created successfully",Toast.LENGTH_SHORT).show();
|
|
|
|
|
//设置密码成功的消息弹窗
|
|
|
|
|
InputMethodManager inputMethodManager = (InputMethodManager)
|
|
|
|
|
getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
|
|
inputMethodManager.hideSoftInputFromWindow(etName.getWindowToken(),0);
|
|
|
|
|
//关闭软键盘
|
|
|
|
|
dialog.dismiss();
|
|
|
|
|
//关闭dialog
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
create_password.setPositiveButton("Cancel", new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
//关闭软键盘
|
|
|
|
|
Toast.makeText(NoteEditActivity.this,"Canceling...",Toast.LENGTH_SHORT).show();
|
|
|
|
|
InputMethodManager inputMethodManager = (InputMethodManager)
|
|
|
|
|
getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
|
|
inputMethodManager.hideSoftInputFromWindow(etName.getWindowToken(),0);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
final Dialog dialog = create_password.setView(view).show();//error
|
|
|
|
|
dialog.show();
|
|
|
|
|
break;
|
|
|
|
|
case R.id.unlocker:
|
|
|
|
|
mWorkingNote.setPassword("","");
|
|
|
|
|
Toast.makeText(NoteEditActivity.this,"Password unlocked successfully",Toast.LENGTH_SHORT).show();
|
|
|
|
|
case R.id.action_insert_image:
|
|
|
|
|
//绑定按钮的点击响应,获取危险权限,这里的100是申请码,可以自己定义,整数即可
|
|
|
|
|
ActivityCompat.requestPermissions(NoteEditActivity.this, mPermissionList, 100);
|
|
|
|
|
//用于获取焦点,否则插入图片时没有响应
|
|
|
|
|
mNoteEditor.getFocusable();
|
|
|
|
|
mNoteEditor.insertImage(realPathFromUri, realPathFromUri + "\" style=\"max-width:100%");
|
|
|
|
|
break;
|
|
|
|
|
=======
|
|
|
|
|
|
|
|
|
|
>>>>>>> 8c352e6399667edb8fde9a423fcc254e47cee228:src/main/java/ui/NoteEditActivity.java
|
|
|
|
|
case R.id.menu_new_note:
|
|
|
|
|
//创建一个新的便签
|
|
|
|
|
createNewNote();
|
|
|
|
@ -1255,4 +1206,5 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
|
|
|
|
|
// mNoteEditor.focusEditor();
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|