pull/15/head
Aoi 4 years ago
parent d01c3b5117
commit 71695c874a

@ -82,12 +82,21 @@
android:resource="@xml/searchable" />
</activity>
<activity
<<<<<<< HEAD:hxs_xiaomi2/res/AndroidManifest.xml
android:name=".ui.PassWordEditActivity"
android:theme="@style/NoteActionBarStyle">
<intent-filter>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
=======
android:name=".ui.PassWordEditActivity"
android:theme="@style/NoteActionBarStyle">
<intent-filter>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
>>>>>>> d01c3b5117a761c71533cfaeda365327c587bd93:src/Notes-master/AndroidManifest.xml
<provider

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="net.micode.notes"
android:versionCode="1"
android:versionName="0.1" >
<!--uses-sdk android:minSdkVersion="14" /-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:icon="@drawable/icon_app"
android:label="@string/app_name" >
<activity
android:name=".ui.NotesListActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@style/NoteTheme"
android:windowSoftInputMode="adjustPan" >
<!--android:uiOptions="splitActionBarWhenNarrow"-->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.NoteEditActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTop"
android:theme="@style/NoteTheme" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/text_note" />
<data android:mimeType="vnd.android.cursor.item/call_note" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.INSERT_OR_EDIT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/text_note" />
<data android:mimeType="vnd.android.cursor.item/call_note" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
<activity
android:name=".ui.PassWordEditActivity"
android:theme="@style/NoteActionBarStyle">
<intent-filter>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<provider
android:name="net.micode.notes.data.NotesProvider"
android:authorities="micode_notes"
android:multiprocess="true" />
<receiver
android:name=".widget.NoteWidgetProvider_2x"
android:label="@string/app_widget2x2" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.appwidget.action.APPWIDGET_DELETED" />
<action android:name="android.intent.action.PRIVACY_MODE_CHANGED" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_2x_info" />
</receiver>
<receiver
android:name=".widget.NoteWidgetProvider_4x"
android:label="@string/app_widget4x4" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.appwidget.action.APPWIDGET_DELETED" />
<action android:name="android.intent.action.PRIVACY_MODE_CHANGED" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_4x_info" />
</receiver>
<receiver android:name=".ui.AlarmInitReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver
android:name="net.micode.notes.ui.AlarmReceiver"
android:process=":remote" >
</receiver>
<activity
android:name=".ui.AlarmAlertActivity"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:theme="@android:style/Theme.Holo.Wallpaper.NoTitleBar" >
</activity>
<activity
android:name="net.micode.notes.ui.NotesPreferenceActivity"
android:label="@string/preferences_title"
android:launchMode="singleTop"
android:theme="@android:style/Theme.Holo.Light" >
</activity>
<service
android:name="net.micode.notes.gtask.remote.GTaskSyncService"
android:exported="false" >
</service>
<meta-data
android:name="android.app.default_searchable"
android:value=".ui.NoteEditActivity" />
</application>
</manifest>

@ -14,63 +14,10 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/old_password_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="输入原密码:"/>
<EditText
android:id="@+id/old_password"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:password="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/new_password_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="输入新建密码:"/>
<EditText
android:id="@+id/new_password"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:password="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/new_password_again_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="确认密码:"/>
<EditText
android:id="@+id/new_password_again"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:password="true"/>
</LinearLayout>
</LinearLayout>
<EditText
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/et_foler_name"
android:layout_width="fill_parent"
android:hint="@string/hint_foler_name"
android:layout_height="fill_parent" />

@ -17,7 +17,6 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/note_item"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
@ -76,10 +75,4 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"/>
<ImageView
android:id="@+id/iv_locker_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"/>
</FrameLayout>

@ -58,4 +58,9 @@
<item
android:id="@+id/menu_delete_passwd"
android:title="Delete password" />
<item
android:id="@+id/menu_font_select"
android:title="@string/menu_font_style" />
</menu>

@ -83,6 +83,7 @@
<!-- TOP -->
<string name="menu_top">置顶</string>
<string name="note_top">置顶</string>
<string name="menu_font_style">选择字体</string>
<!-- Sync -->
<string name="ticker_syncing">同步便签...</string>
<string name="ticker_success">同步成功</string>

@ -91,6 +91,7 @@
<string name="sync_progress_login">登陸%1$s...</string>
<string name="sync_progress_init_list">正在獲取服務器便籤列表...</string>
<string name="sync_progress_syncing">正在同步本地便籤...</string>
<string name="menu_font_style">選擇字体</string>
<!-- Preferences -->
<string name="preferences_title">設置</string>
<string name="preferences_account_title">同步賬號</string>

@ -87,6 +87,7 @@
<!-- TOP -->
<string name="menu_top">menu top</string>
<string name="note_top">note top</string>
<string name="menu_font_style">Select font</string>
<!-- Sync -->
<string name="ticker_syncing">Syncing notes...</string>
<string name="ticker_success">Sync is successful</string>

@ -62,10 +62,6 @@ public class Notes {
public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data");
public interface NoteColumns {
/**
*
*/
public static final String LOCKER="_locker";
/**
*
*/

@ -62,8 +62,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
NoteColumns.GTASK_ID + " TEXT NOT NULL DEFAULT ''," +
NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.PASSWORD+ " TEXT NOT NULL DEFAULT ''," +
NoteColumns.TOP+" INTEGER NOT NULL DEFAULT 0,"+
NoteColumns.LOCKER + " INTEGER NOT NULL DEFAULT 0" +
NoteColumns.TOP+" INTEGER NOT NULL DEFAULT 0"+
//NoteColumns.PASSWORD+ " INTEGER NOT NULL DEFAULT 0" +
")";
@ -330,10 +329,6 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
upgradeToV5(db);
oldVersion++;
}
if (oldVersion == 5) {
upgradeToV6(db);
oldVersion++;
}
if (reCreateTriggers) {
reCreateNoteTableTriggers(db);
@ -376,9 +371,5 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
db.execSQL("ALTER TABLE " + TABLE.NOTE + " ADD COLUMN " + NoteColumns.TOP
+ " INTEGER NOT NULL DEFAULT 0");
}
private void upgradeToV6(SQLiteDatabase db){
db.execSQL("ALTER TABLE " + TABLE.NOTE + " ADD COLUMN " + NoteColumns.LOCKER
+ " INTEGER NOT NULL DEFAULT 0");
}
}

@ -33,14 +33,13 @@ import net.micode.notes.R;
import net.micode.notes.data.Notes.DataColumns;
import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.data.NotesDatabaseHelper.TABLE;
import net.micode.notes.gtask.data.SqlNote;
public class NotesProvider extends ContentProvider {
private static final UriMatcher mMatcher;
private NotesDatabaseHelper mHelper;
//创建帮助找到下了锁的对应的便签
private static NotesDatabaseHelper mFind_Locker_Helper;
private static final String TAG = "NotesProvider";
private static final int URI_NOTE = 1;
@ -83,7 +82,6 @@ public class NotesProvider extends ContentProvider {
@Override
public boolean onCreate() {
mHelper = NotesDatabaseHelper.getInstance(getContext());
mFind_Locker_Helper=NotesDatabaseHelper.getInstance(getContext());
return true;
}
@ -303,25 +301,5 @@ public class NotesProvider extends ContentProvider {
// TODO Auto-generated method stub
return null;
}
//判断是否上锁
public static boolean isLockedNote(Long id) {
SQLiteDatabase db = mFind_Locker_Helper.getReadableDatabase();
Cursor cursor = null;
cursor = db.query(NotesDatabaseHelper.TABLE.NOTE, null, null, null, null, null, null);
//判断游标是否为空
System.out.println(cursor.getCount());
if (cursor.moveToFirst()) {
//遍历游标
for (int index = 1; index < cursor.getCount(); index++) {
if (cursor.getLong(SqlNote.ID_COLUMN) == id && !cursor.getString(SqlNote.LOCKER_COLUMN).equals("0")) {
cursor.close();
return true;
}
cursor.moveToNext();
}
}
cursor.close();
return false;
}
}

@ -49,7 +49,7 @@ public class SqlNote {
NoteColumns.NOTES_COUNT, NoteColumns.PARENT_ID, NoteColumns.SNIPPET, NoteColumns.TYPE,
NoteColumns.WIDGET_ID, NoteColumns.WIDGET_TYPE, NoteColumns.SYNC_ID,
NoteColumns.LOCAL_MODIFIED, NoteColumns.ORIGIN_PARENT_ID, NoteColumns.GTASK_ID,
NoteColumns.VERSION,NoteColumns.LOCKER
NoteColumns.VERSION
};
public static final int ID_COLUMN = 0;
@ -85,7 +85,6 @@ public class SqlNote {
public static final int GTASK_ID_COLUMN = 15;
public static final int VERSION_COLUMN = 16;
public static final int LOCKER_COLUMN = 17;
private Context mContext;

@ -64,8 +64,6 @@ public class WorkingNote {
private NoteSettingChangedListener mNoteSettingStatusListener;
//新添加的密码变量
private String mPassword;
//添加密码标志
private String mLocker;
public static final String[] DATA_PROJECTION = new String[] {
DataColumns.ID,
@ -87,7 +85,6 @@ public class WorkingNote {
//增加一个密码项
NoteColumns.PASSWORD,
NoteColumns.TOP,
NoteColumns.LOCKER,
};
private static final int DATA_ID_COLUMN = 0;
@ -111,8 +108,6 @@ public class WorkingNote {
private static final int NOTE_MODIFIED_DATE_COLUMN = 5;
//密码
private static final int NOTE_PASSWORD_COLUMN=6;
//密码标志
private static final int NOTE_LOCKER_COLUMN=8;
/**
@ -145,11 +140,6 @@ public class WorkingNote {
public String getmPassword(){
return mPassword;
}
//设置密码标志
public void setLocker(String mlocker){
mLocker=mlocker;//1标志为上锁了 0标志为没有上锁
mNote.setNoteValue(NoteColumns.LOCKER,mLocker);
}
// New note construct
private WorkingNote(Context context, long folderId) {
@ -193,8 +183,6 @@ public class WorkingNote {
mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN);
//密码
mPassword= cursor.getString(NOTE_PASSWORD_COLUMN);
//密码标志
mLocker=cursor.getString(NOTE_LOCKER_COLUMN);
}
cursor.close();
} else {

@ -25,14 +25,10 @@ import android.content.OperationApplicationException;
import android.database.Cursor;
import android.os.RemoteException;
import android.util.Log;
import android.widget.Toast;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.CallNote;
import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.data.NotesProvider;
import net.micode.notes.ui.NoteEditActivity;
import net.micode.notes.ui.NotesListActivity;
import net.micode.notes.ui.NotesListAdapter.AppWidgetAttribute;
import java.util.ArrayList;
@ -57,12 +53,6 @@ public class DataUtils {
Log.e(TAG, "Don't delete system folder root");
continue;
}
/**
*
*/
if (NotesProvider.isLockedNote(id)){
continue;
}
ContentProviderOperation.Builder builder = ContentProviderOperation
.newDelete(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id));
operationList.add(builder.build());

@ -29,6 +29,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.Spannable;
@ -77,6 +78,8 @@ import java.util.regex.Pattern;
public class NoteEditActivity extends Activity implements OnClickListener,
NoteSettingChangedListener, OnTextViewChangeListener {
private AlertDialog alertDialog2;
private class HeadViewHolder {
public TextView tvModified;
@ -151,7 +154,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
private String mUserQuery;
private Pattern mPattern;
//private int flag=0;//作为判断删除密码时有无验证通过
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -280,23 +282,16 @@ public class NoteEditActivity extends Activity implements OnClickListener,
//创建dialog插入edittext用户输入密码并做出检验。
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
View view = LayoutInflater.from(this).inflate(R.layout.dialog_edit_text, null);
//编辑dialog界面
final EditText etNameOld= (EditText)view.findViewById(R.id.old_password);//只需要验证原密码
final EditText etName = (EditText) view.findViewById(R.id.new_password);
etName.setVisibility(view.GONE);
final TextView etName_View=(TextView)view.findViewById(R.id.new_password_view);
etName_View.setVisibility(view.GONE);
final EditText etNameAgain = (EditText) view.findViewById(R.id.new_password_again);
etNameAgain.setVisibility(view.GONE);
final TextView etNameAgain_View=(TextView)view.findViewById(R.id.new_password_again_view);
etNameAgain_View.setVisibility(view.GONE);
//
//编辑Text
final EditText etName = (EditText) view.findViewById(R.id.et_foler_name);
etName.setText("");
etName.setHint("请输入密码");
builder.setTitle("密码检验");
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//获取输入的字符串
String password = etNameOld.getText().toString();
String password = etName.getText().toString();
Log.d("mPassword: ", mPassword);
Log.d("password: ", password);
//判断密码正确性
@ -304,24 +299,22 @@ public class NoteEditActivity extends Activity implements OnClickListener,
Log.d("密码不正确,正确密码是:",mPassword);
Toast.makeText(NoteEditActivity.this, "密码错误", Toast.LENGTH_SHORT).show();
dialog.dismiss();
//onBackPressed();
onBackPressed();
//关闭软键盘
InputMethodManager inputMethodManager = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(etName.getWindowToken(),0);
}
else{
//flag=1;//密码验证正确的标志
deletePassword();
Toast.makeText(NoteEditActivity.this, "密码正确,删除密码成功。", Toast.LENGTH_SHORT).show();
return;
Toast.makeText(NoteEditActivity.this, "密码正确", Toast.LENGTH_SHORT).show();
}
}
});
builder.setNegativeButton("cancel", new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
dialog.dismiss();
onBackPressed();
}
});
final Dialog dialog = builder.setView(view).show();
@ -356,6 +349,56 @@ public class NoteEditActivity extends Activity implements OnClickListener,
*/
showAlertHeader();
}
public void showSingleAlertDiglog(){
final String[] items = {"方正舒体","仿宋","黑体","隶书","行楷","幼圆"};
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
alertBuilder.setTitle("字体选择");
alertBuilder.setSingleChoiceItems(items, 0, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int i) {
switch(i){
case 0:
Typeface typeface0 = Typeface.createFromAsset(getAssets(),"font/FZSTK.TTF");
mNoteEditor.setTypeface(typeface0);
break;
case 1:
Typeface typeface1 = Typeface.createFromAsset(getAssets(),"font/SIMYOU.TTF");
mNoteEditor.setTypeface(typeface1);
break;
case 2:
Typeface typeface2 = Typeface.createFromAsset(getAssets(),"font/STLITI.TTF");
mNoteEditor.setTypeface(typeface2);
break;
case 3:
Typeface typeface3 = Typeface.createFromAsset(getAssets(),"font/STXINGKA.TTF");
mNoteEditor.setTypeface(typeface3);
break;
case 4:
Typeface typeface4 = Typeface.createFromAsset(getAssets(),"font/simfang.ttf");
mNoteEditor.setTypeface(typeface4);
break;
case 5:
Typeface typeface5 = Typeface.createFromAsset(getAssets(),"font/simhei.ttf");
mNoteEditor.setTypeface(typeface5);
break;
}
}
});
alertBuilder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int i) {
alertDialog2.dismiss();
}
});
alertBuilder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int i) {
alertDialog2.dismiss();
}
});
alertDialog2 = alertBuilder.create();
alertDialog2.show();
}
private void showAlertHeader() {
if (mWorkingNote.hasClockAlert()) {
@ -588,15 +631,9 @@ public class NoteEditActivity extends Activity implements OnClickListener,
builder.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if (!mWorkingNote.hasPassword()) {//判断有无密码,有密码则无法删除
deleteCurrentNote();
finish();
}
else{
Toast.makeText(NoteEditActivity.this, "无法删除设密便签", Toast.LENGTH_SHORT).show();
return;
}
}
deleteCurrentNote();
finish();
}
});
builder.setNegativeButton(android.R.string.cancel, null);
builder.show();
@ -629,11 +666,15 @@ public class NoteEditActivity extends Activity implements OnClickListener,
//删除密码
case R.id.menu_delete_passwd:
//删除密码前要检验密码
checkPassword();//并且在里边一并执行deletepassword函数
checkPassword();
deletePassword();
break;
case R.id.top:
mWorkingNote.setTop((mWorkingNote.getTopId()) == 1 ? "0" : "1");
break;
case R.id.menu_font_select:
showSingleAlertDiglog();
break;
default:
break;
}
@ -644,59 +685,17 @@ public class NoteEditActivity extends Activity implements OnClickListener,
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
final View view = LayoutInflater.from(this).inflate(R.layout.dialog_edit_text,null);
//编辑Text
final EditText etNameOld= (EditText)view.findViewById(R.id.old_password);//如果设置了密码,这是原密码
etNameOld.setVisibility(view.GONE);
final TextView etNameOld_View=(TextView)view.findViewById(R.id.old_password_view);
etNameOld_View.setVisibility(view.GONE);
if (mWorkingNote.hasPassword()){//如果设置了密码
etNameOld.setVisibility(view.VISIBLE);
etNameOld_View.setVisibility(view.VISIBLE);
etNameOld.setText("");
etNameOld.setHint("请输入原密码");
}
final EditText etName = (EditText)view.findViewById(R.id.new_password);//要设置的密码
final EditText etNameAgain=(EditText)view.findViewById(R.id.new_password_again);//确认密码
//final EditText finalEtNameOld = etNameOld;
final EditText etName = (EditText)view.findViewById(R.id.et_foler_name);
etName.setText("");
etName.setHint("请输入密码");
etNameAgain.setText("");
etNameAgain.setHint("请确认密码");
builder.setTitle("设置密码");
builder.setTitle("为便签设置新密码");
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//获取输入的字符串
String password = etName.getText().toString();
String password_again=etNameAgain.getText().toString();
String password_old = null;
if (mWorkingNote.hasPassword()){
password_old= etNameOld.getText().toString();
}
//当输入原密码不对时
if (mWorkingNote.hasPassword()) {
if(!password_old.equals(mWorkingNote.getmPassword())) {
Toast.makeText(NoteEditActivity.this, "原密码错误", Toast.LENGTH_SHORT).show();
return;
}
}
//当设置的密码为空的时候
if (password==null || password.length()==0){
//关闭软键盘
InputMethodManager inputMethodManager = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(etName.getWindowToken(),0);
dialog.dismiss();
Toast.makeText(NoteEditActivity.this, "密码不能为空", Toast.LENGTH_SHORT).show();
return;
}
//当确认密码不对时
if (!password.equals(password_again)){
Toast.makeText(NoteEditActivity.this, "密码不一致", Toast.LENGTH_SHORT).show();
return;
}
//设置密码
mWorkingNote.setPassword(password);
mWorkingNote.setLocker("1");//设置密码标志为上锁
//设置密码成功提示
Toast.makeText(NoteEditActivity.this, "密码设置成功", Toast.LENGTH_SHORT).show();
//关闭软键盘
@ -723,8 +722,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
public void deletePassword()
{
mWorkingNote.setPassword("");
mWorkingNote.setLocker("0");//设置密码标志为没有锁
//onBackPressed();
}

@ -19,7 +19,6 @@ package net.micode.notes.ui;
import android.content.Context;
import android.database.Cursor;
import android.text.TextUtils;
import android.util.Log;
import net.micode.notes.data.Contact;
import net.micode.notes.data.Notes;
@ -41,7 +40,6 @@ public class NoteItemData {
NoteColumns.TYPE,
NoteColumns.WIDGET_ID,
NoteColumns.WIDGET_TYPE,
NoteColumns.LOCKER,
};
private static final int ID_COLUMN = 0;
@ -56,8 +54,6 @@ public class NoteItemData {
private static final int TYPE_COLUMN = 9;
private static final int WIDGET_ID_COLUMN = 10;
private static final int WIDGET_TYPE_COLUMN = 11;
//密码标志
private static final int LOCKER_COLUMN=12;
private long mId;
private long mAlertDate;
@ -73,8 +69,6 @@ public class NoteItemData {
private int mWidgetType;
private String mName;
private String mPhoneNumber;
//密码标志
private String mLocker;
private boolean mIsLastItem;
private boolean mIsFirstItem;
@ -82,17 +76,6 @@ public class NoteItemData {
private boolean mIsOneNoteFollowingFolder;
private boolean mIsMultiNotesFollowingFolder;
//判断是否上锁
public boolean isLocked(){
if(mLocker.equals("0")) {
Log.d("标志是", mLocker);
return false;
}else {
Log.d("标志是", mLocker);
return true;
}
}
public NoteItemData(Context context, Cursor cursor) {
mId = cursor.getLong(ID_COLUMN);
mAlertDate = cursor.getLong(ALERTED_DATE_COLUMN);
@ -108,7 +91,6 @@ public class NoteItemData {
mType = cursor.getInt(TYPE_COLUMN);
mWidgetId = cursor.getInt(WIDGET_ID_COLUMN);
mWidgetType = cursor.getInt(WIDGET_TYPE_COLUMN);
mLocker = cursor.getString(LOCKER_COLUMN);
mPhoneNumber = "";
if (mParentId == Notes.ID_CALL_RECORD_FOLDER) {

@ -581,8 +581,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
private void showCreateOrModifyFolderDialog(final boolean create) {
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
View view = LayoutInflater.from(this).inflate(R.layout.dialog_create_new_folder, null);
final EditText etName = (EditText) view.findViewById(R.id.folder_name);
View view = LayoutInflater.from(this).inflate(R.layout.dialog_edit_text, null);
final EditText etName = (EditText) view.findViewById(R.id.et_foler_name);
showSoftInput();
if (!create) {
if (mFocusNoteDataItem != null) {
@ -783,7 +783,6 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
switch (item.getItemId()) {
case R.id.menu_new_folder: {
showCreateOrModifyFolderDialog(true);
Log.d("创建了文件夹","是的");
break;
}
case R.id.menu_export_text: {
@ -911,13 +910,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
case SUB_FOLDER:
case CALL_RECORD_FOLDER:
if (item.getType() == Notes.TYPE_NOTE) {
//打开PassWordEditAcitivity类并传递noteid
Intent intent = new Intent(NotesListActivity.this, PassWordEditActivity.class);
long noteId = item.getId();
intent.putExtra("noteId", noteId);
startActivity(intent);
//
//openNode(item);
openNode(item);
} else {
Log.e(TAG, "Wrong note type in SUB_FOLDER");
}

@ -37,7 +37,7 @@ public class NotesListItem extends LinearLayout {
private TextView mCallName;
private NoteItemData mItemData;
private CheckBox mCheckBox;
private ImageView mLocker;
public NotesListItem(Context context) {
super(context);
inflate(context, R.layout.note_item, this);
@ -46,8 +46,6 @@ public class NotesListItem extends LinearLayout {
mTime = (TextView) findViewById(R.id.tv_time);
mCallName = (TextView) findViewById(R.id.tv_name);
mCheckBox = (CheckBox) findViewById(android.R.id.checkbox);
//添加锁的标志
mLocker =(ImageView)findViewById(R.id.iv_locker_icon);
}
public void bind(Context context, NoteItemData data, boolean choiceMode, boolean checked) {
@ -77,14 +75,6 @@ public class NotesListItem extends LinearLayout {
} else {
mAlert.setVisibility(View.GONE);
}
/**
if(data.isLocked()){
mLocker.setImageResource(R.drawable.ic_lock_idle_lock);
mLocker.setVisibility(View.VISIBLE);
} else{
mLocker.setVisibility(View.GONE);
}
*/
} else {
mCallName.setVisibility(View.GONE);
mTitle.setTextAppearance(context, R.style.TextAppearancePrimaryItem);
@ -102,16 +92,6 @@ public class NotesListItem extends LinearLayout {
} else {
mAlert.setVisibility(View.GONE);
}
//设置密码标志以及使加密便签内容不可见,未加密则可见。
if(data.isLocked()){
mLocker.setImageResource(R.drawable.ic_lock_idle_lock);
mLocker.setVisibility(View.VISIBLE);
String text = "已加密";
mTitle.setText(text);
} else{
mLocker.setVisibility(View.GONE);
}
//
}
}
mTime.setText(DateUtils.getRelativeTimeSpanString(data.getModifiedDate()));

Loading…
Cancel
Save