pull/10/head
pbyhqr72x 3 years ago
commit 603bb850b9

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net) <!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net) <!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)

@ -15,7 +15,8 @@
limitations under the License. limitations under the License.
--> -->
<FrameLayout <FrameLayout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:background="@drawable/list_background" android:background="@drawable/list_background"
@ -58,9 +59,10 @@
<ImageButton <ImageButton
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_gravity="center" android:layout_gravity="center"
android:background="@drawable/bg_btn_set_color" /> android:background="@drawable/bg_btn_set_color" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -71,17 +73,17 @@
<ImageView <ImageView
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="7dip" android:layout_height="49dp"
android:background="@drawable/bg_color_btn_mask" /> android:background="@drawable/bg_color_btn_mask" />
<ScrollView <ScrollView
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="0dip" android:layout_height="0dip"
android:layout_gravity="left|top"
android:layout_weight="1" android:layout_weight="1"
android:scrollbars="none" android:fadingEdgeLength="0dip"
android:overScrollMode="never" android:overScrollMode="never"
android:layout_gravity="left|top" android:scrollbars="none">
android:fadingEdgeLength="0dip">
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -91,37 +93,43 @@
android:id="@+id/note_edit_view" android:id="@+id/note_edit_view"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="left|top"
android:background="@null"
android:autoLink="all" android:autoLink="all"
android:background="@null"
android:gravity="left|top"
android:lineSpacingMultiplier="1.2"
android:linksClickable="false" android:linksClickable="false"
android:minLines="12" android:minLines="12"
android:textAppearance="@style/TextAppearancePrimaryItem" android:textAppearance="@style/TextAppearancePrimaryItem" />
android:lineSpacingMultiplier="1.2" />
<LinearLayout <LinearLayout
android:id="@+id/note_edit_list" android:id="@+id/note_edit_list"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="-10dip" android:layout_marginLeft="-10dip"
android:orientation="vertical"
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
<ImageView <ImageView
android:layout_width="fill_parent" android:id="@+id/m_locker"
android:layout_height="7dip" android:layout_width="match_parent"
android:background="@drawable/bg_color_btn_mask" /> android:layout_height="wrap_content"
android:background="#4CAF50"
android:src="@drawable/bg_color_btn_mask"
tools:src="@android:drawable/ic_lock_idle_lock" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<ImageView <ImageView
android:id="@+id/btn_set_bg_color" android:id="@+id/btn_set_bg_color"
android:layout_height="43dip" android:layout_width="111dp"
android:layout_width="wrap_content" android:layout_height="64dp"
android:background="@drawable/bg_color_btn_mask" android:layout_gravity="top|right"
android:layout_gravity="top|right" /> android:background="@drawable/bg_color_btn_mask" />
<LinearLayout <LinearLayout
android:id="@+id/note_bg_color_selector" android:id="@+id/note_bg_color_selector"
@ -397,4 +405,5 @@
android:src="@drawable/selected" /> android:src="@drawable/selected" />
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>

@ -39,13 +39,13 @@
<ListView <ListView
android:id="@+id/notes_list" android:id="@+id/notes_list"
android:layout_width="fill_parent" android:layout_width="464dp"
android:layout_height="0dip" android:layout_height="0dip"
android:layout_weight="1" android:layout_weight="1"
android:cacheColorHint="@null" android:cacheColorHint="@null"
android:listSelector="@android:color/transparent"
android:divider="@null" android:divider="@null"
android:fadingEdge="@null" /> android:fadingEdge="@null"
android:listSelector="@android:color/transparent" />
</LinearLayout> </LinearLayout>
<Button <Button

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net) <!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)

@ -63,7 +63,7 @@
</style> </style>
<style name="NoteActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid"> <style name="NoteActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:displayOptions" /> <!--item name="android:displayOptions" /-->
<item name="android:visibility">gone</item> <item name="android:visibility">visible</item>
</style> </style>
</resources> </resources>

@ -62,6 +62,10 @@ public class Notes {
public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data"); public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data");
public interface NoteColumns { public interface NoteColumns {
/**
*
*/
public static final String PASSWORD="_password";
/** /**
* The unique ID for a row * The unique ID for a row
* <P> Type: INTEGER (long) </P> * <P> Type: INTEGER (long) </P>

@ -60,7 +60,8 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
NoteColumns.LOCAL_MODIFIED + " INTEGER NOT NULL DEFAULT 0," + NoteColumns.LOCAL_MODIFIED + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.ORIGIN_PARENT_ID + " INTEGER NOT NULL DEFAULT 0," + NoteColumns.ORIGIN_PARENT_ID + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.GTASK_ID + " TEXT NOT NULL DEFAULT ''," + NoteColumns.GTASK_ID + " TEXT NOT NULL DEFAULT ''," +
NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0" + NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.PASSWORD+ " INTEGER NOT NULL DEFAULT 0" +
")"; ")";
private static final String CREATE_DATA_TABLE_SQL = private static final String CREATE_DATA_TABLE_SQL =

@ -17,12 +17,14 @@
package net.micode.notes.gtask.remote; package net.micode.notes.gtask.remote;
import android.annotation.TargetApi;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import net.micode.notes.R; import net.micode.notes.R;
import net.micode.notes.ui.NotesListActivity; import net.micode.notes.ui.NotesListActivity;
@ -63,6 +65,7 @@ public class GTaskASyncTask extends AsyncTask<Void, String, Integer> {
}); });
} }
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void showNotification(int tickerId, String content) { private void showNotification(int tickerId, String content) {
Notification notification = new Notification(R.drawable.notification, mContext Notification notification = new Notification(R.drawable.notification, mContext
.getString(tickerId), System.currentTimeMillis()); .getString(tickerId), System.currentTimeMillis());
@ -77,8 +80,17 @@ public class GTaskASyncTask extends AsyncTask<Void, String, Integer> {
pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext,
NotesListActivity.class), 0); NotesListActivity.class), 0);
} }
notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content, //notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content,
pendingIntent); // pendingIntent);
notification = new Notification.Builder(mContext)
.setContentIntent(pendingIntent)
.setTicker(mContext.getString(R.string.app_name))
.setContentTitle(mContext.getString(R.string.app_name))
.setContentText(content)
.setWhen(System.currentTimeMillis())
.setSmallIcon(R.drawable.icon_app)
.build();
notification.icon = R.drawable.icon_app;
mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification); mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification);
} }

@ -61,7 +61,22 @@ public class WorkingNote {
private boolean mIsDeleted; private boolean mIsDeleted;
private NoteSettingChangedListener mNoteSettingStatusListener; private NoteSettingChangedListener mNoteSettingStatusListener;
//新添加的密码变量
private String mPassword;
/**
* 便访
* @param password 访
*/
public void setPassword(String password){
//将该类的mPassword属性设置为新的访问密码
mPassword = password;
//将修改后的便签密码写入到便签数据库中
mNote.setNoteValue(NoteColumns.PASSWORD,mPassword);
}
public String getmPassword(){
return mPassword;
}
public static final String[] DATA_PROJECTION = new String[] { public static final String[] DATA_PROJECTION = new String[] {
DataColumns.ID, DataColumns.ID,
DataColumns.CONTENT, DataColumns.CONTENT,
@ -78,7 +93,9 @@ public class WorkingNote {
NoteColumns.BG_COLOR_ID, NoteColumns.BG_COLOR_ID,
NoteColumns.WIDGET_ID, NoteColumns.WIDGET_ID,
NoteColumns.WIDGET_TYPE, NoteColumns.WIDGET_TYPE,
NoteColumns.MODIFIED_DATE NoteColumns.MODIFIED_DATE,
//增加一个密码项
NoteColumns.PASSWORD,
}; };
private static final int DATA_ID_COLUMN = 0; private static final int DATA_ID_COLUMN = 0;
@ -100,7 +117,8 @@ public class WorkingNote {
private static final int NOTE_WIDGET_TYPE_COLUMN = 4; private static final int NOTE_WIDGET_TYPE_COLUMN = 4;
private static final int NOTE_MODIFIED_DATE_COLUMN = 5; private static final int NOTE_MODIFIED_DATE_COLUMN = 5;
//密码
private static final int NOTE_PASSWORD_COLUMN=6;
// New note construct // New note construct
private WorkingNote(Context context, long folderId) { private WorkingNote(Context context, long folderId) {
mContext = context; mContext = context;
@ -137,6 +155,8 @@ public class WorkingNote {
mWidgetType = cursor.getInt(NOTE_WIDGET_TYPE_COLUMN); mWidgetType = cursor.getInt(NOTE_WIDGET_TYPE_COLUMN);
mAlertDate = cursor.getLong(NOTE_ALERTED_DATE_COLUMN); mAlertDate = cursor.getLong(NOTE_ALERTED_DATE_COLUMN);
mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN); mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN);
//密码
mPassword= cursor.getString(NOTE_PASSWORD_COLUMN);
} }
cursor.close(); cursor.close();
} else { } else {

@ -78,6 +78,7 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener
DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_DATE |
DateUtils.FORMAT_SHOW_TIME; DateUtils.FORMAT_SHOW_TIME;
flag |= mIs24HourView ? DateUtils.FORMAT_24HOUR : DateUtils.FORMAT_24HOUR; flag |= mIs24HourView ? DateUtils.FORMAT_24HOUR : DateUtils.FORMAT_24HOUR;
//flag =DateUtils.FORMAT_24HOUR;
setTitle(DateUtils.formatDateTime(this.getContext(), date, flag)); setTitle(DateUtils.formatDateTime(this.getContext(), date, flag));
} }

@ -62,6 +62,11 @@ import net.micode.notes.tool.ResourceParser;
import net.micode.notes.tool.ResourceParser.TextAppearanceResources; import net.micode.notes.tool.ResourceParser.TextAppearanceResources;
import net.micode.notes.ui.DateTimePickerDialog.OnDateTimeSetListener; import net.micode.notes.ui.DateTimePickerDialog.OnDateTimeSetListener;
import net.micode.notes.ui.NoteEditText.OnTextViewChangeListener; import net.micode.notes.ui.NoteEditText.OnTextViewChangeListener;
import net.micode.notes.ui.PasswordView;
import android.app.Dialog;
import android.view.inputmethod.InputMethodManager;
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;
@ -82,6 +87,10 @@ public class NoteEditActivity extends Activity implements OnClickListener,
public TextView tvAlertDate; public TextView tvAlertDate;
public ImageView ibSetBgColor; public ImageView ibSetBgColor;
//方便后边增加一个点击监听器
public ImageView ibSetBgLocker;
} }
private static final Map<Integer, Integer> sBgSelectorBtnsMap = new HashMap<Integer, Integer>(); private static final Map<Integer, Integer> sBgSelectorBtnsMap = new HashMap<Integer, Integer>();
@ -128,6 +137,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
private View mFontSizeSelector; private View mFontSizeSelector;
private EditText mNoteEditor; private EditText mNoteEditor;
private View mNoteEditorPanel; private View mNoteEditorPanel;
@ -148,6 +158,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
private String mUserQuery; private String mUserQuery;
private Pattern mPattern; private Pattern mPattern;
//密码
private String mPassword;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -269,6 +281,47 @@ public class NoteEditActivity extends Activity implements OnClickListener,
} }
private void initNoteScreen() { private void initNoteScreen() {
//密码验证
mPassword = mWorkingNote.getmPassword();
if (mPassword!=null) {
//创建dialog插入edittext用户输入密码并做出检验。
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
View view = LayoutInflater.from(this).inflate(R.layout.dialog_edit_text, null);
//编辑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 = etName.getText().toString();
Log.d("mPassword: ", mPassword);
Log.d("password: ", password);
//判断密码正确性
if (!password.equals(mPassword)) {
Log.d("密码不正确,正确密码是:",mPassword);
Toast.makeText(NoteEditActivity.this, "密码错误", Toast.LENGTH_SHORT).show();
dialog.dismiss();
onBackPressed();
}
else{
Toast.makeText(NoteEditActivity.this, "密码正确", Toast.LENGTH_SHORT).show();
}
}
});
builder.setNegativeButton("cancel", new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
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) {
@ -295,6 +348,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
showAlertHeader(); showAlertHeader();
} }
private void showAlertHeader() { private void showAlertHeader() {
if (mWorkingNote.hasClockAlert()) { if (mWorkingNote.hasClockAlert()) {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
@ -370,6 +425,10 @@ public class NoteEditActivity extends Activity implements OnClickListener,
mNoteHeaderHolder.ivAlertIcon = (ImageView) findViewById(R.id.iv_alert_icon); mNoteHeaderHolder.ivAlertIcon = (ImageView) findViewById(R.id.iv_alert_icon);
mNoteHeaderHolder.tvAlertDate = (TextView) findViewById(R.id.tv_alert_date); mNoteHeaderHolder.tvAlertDate = (TextView) findViewById(R.id.tv_alert_date);
mNoteHeaderHolder.ibSetBgColor = (ImageView) findViewById(R.id.btn_set_bg_color); mNoteHeaderHolder.ibSetBgColor = (ImageView) findViewById(R.id.btn_set_bg_color);
//增加一个监听器
mNoteHeaderHolder.ibSetBgLocker= (ImageView) findViewById(R.id.m_locker);
mNoteHeaderHolder.ibSetBgLocker.setOnClickListener(this);
mNoteHeaderHolder.ibSetBgColor.setOnClickListener(this); mNoteHeaderHolder.ibSetBgColor.setOnClickListener(this);
mNoteEditor = (EditText) findViewById(R.id.note_edit_view); mNoteEditor = (EditText) findViewById(R.id.note_edit_view);
mNoteEditorPanel = findViewById(R.id.sv_note_edit); mNoteEditorPanel = findViewById(R.id.sv_note_edit);
@ -378,7 +437,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
ImageView iv = (ImageView) findViewById(id); ImageView iv = (ImageView) findViewById(id);
iv.setOnClickListener(this); iv.setOnClickListener(this);
} }
mFontSizeSelector = findViewById(R.id.font_size_selector); mFontSizeSelector = findViewById(R.id.font_size_selector);
for (int id : sFontSizeBtnsMap.keySet()) { for (int id : sFontSizeBtnsMap.keySet()) {
View view = findViewById(id); View view = findViewById(id);
@ -430,8 +488,9 @@ 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);
mWorkingNote.setBgColorId(sBgSelectorBtnsMap.get(id)); mWorkingNote.setBgColorId(sBgSelectorBtnsMap.get(id));
@ -450,6 +509,44 @@ public class NoteEditActivity extends Activity implements OnClickListener,
} }
mFontSizeSelector.setVisibility(View.GONE); mFontSizeSelector.setVisibility(View.GONE);
} }
//添加设置密码的点击
if (id==R.id.m_locker){
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
final View view = LayoutInflater.from(this).inflate(R.layout.dialog_edit_text,null);
//编辑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 = etName.getText().toString();
//设置密码
mWorkingNote.setPassword(password);
//设置密码成功提示
Toast.makeText(NoteEditActivity.this, "密码设置成功", Toast.LENGTH_SHORT).show();
//关闭软键盘
InputMethodManager inputMethodManager = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(etName.getWindowToken(),0);
//关闭dialog
dialog.dismiss();
}
});
builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//关闭软键盘
InputMethodManager inputMethodManager = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(etName.getWindowToken(),0);
}
});
final Dialog dialog = builder.setView(view).show();
dialog.show();
}
} }
@Override @Override
@ -457,7 +554,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
if(clearSettingState()) { if(clearSettingState()) {
return; return;
} }
saveNote(); saveNote();
super.onBackPressed(); super.onBackPressed();
} }

@ -19,6 +19,7 @@ package net.micode.notes.ui;
import android.content.Context; import android.content.Context;
import android.database.Cursor; import android.database.Cursor;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import net.micode.notes.data.Contact; import net.micode.notes.data.Contact;
import net.micode.notes.data.Notes; import net.micode.notes.data.Notes;
@ -40,6 +41,7 @@ public class NoteItemData {
NoteColumns.TYPE, NoteColumns.TYPE,
NoteColumns.WIDGET_ID, NoteColumns.WIDGET_ID,
NoteColumns.WIDGET_TYPE, NoteColumns.WIDGET_TYPE,
NoteColumns.PASSWORD,//密码
}; };
private static final int ID_COLUMN = 0; private static final int ID_COLUMN = 0;
@ -54,6 +56,8 @@ public class NoteItemData {
private static final int TYPE_COLUMN = 9; private static final int TYPE_COLUMN = 9;
private static final int WIDGET_ID_COLUMN = 10; private static final int WIDGET_ID_COLUMN = 10;
private static final int WIDGET_TYPE_COLUMN = 11; private static final int WIDGET_TYPE_COLUMN = 11;
//密码
private static final int PASSWORD_COLUMN=12;
private long mId; private long mId;
private long mAlertDate; private long mAlertDate;
@ -69,6 +73,8 @@ public class NoteItemData {
private int mWidgetType; private int mWidgetType;
private String mName; private String mName;
private String mPhoneNumber; private String mPhoneNumber;
//密码
private String mPassword;
private boolean mIsLastItem; private boolean mIsLastItem;
private boolean mIsFirstItem; private boolean mIsFirstItem;
@ -92,6 +98,10 @@ public class NoteItemData {
mWidgetId = cursor.getInt(WIDGET_ID_COLUMN); mWidgetId = cursor.getInt(WIDGET_ID_COLUMN);
mWidgetType = cursor.getInt(WIDGET_TYPE_COLUMN); mWidgetType = cursor.getInt(WIDGET_TYPE_COLUMN);
//增加读取密码
mPassword= cursor.getString(PASSWORD_COLUMN);
mPhoneNumber = ""; mPhoneNumber = "";
if (mParentId == Notes.ID_CALL_RECORD_FOLDER) { if (mParentId == Notes.ID_CALL_RECORD_FOLDER) {
mPhoneNumber = DataUtils.getCallNumberByNoteId(context.getContentResolver(), mId); mPhoneNumber = DataUtils.getCallNumberByNoteId(context.getContentResolver(), mId);
@ -108,6 +118,24 @@ public class NoteItemData {
} }
checkPostion(cursor); checkPostion(cursor);
} }
//读取对应小米便签的密码
public String getPassword(){
String password=mPassword;
//System.out(password);
Log.d("getPassword密码是",password);
return password;
}
//判断是否设置了密码
public boolean hasPassword(){
String password=mPassword;
//System.out(password);
Log.d("hasPassword密码是",password);
Object o = "";
if (password.equals(o)){
return false;
}
return true;
}
private void checkPostion(Cursor cursor) { private void checkPostion(Cursor cursor) {
mIsLastItem = cursor.isLast() ? true : false; mIsLastItem = cursor.isLast() ? true : false;

@ -875,7 +875,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
Intent intent = new Intent(from, NotesPreferenceActivity.class); Intent intent = new Intent(from, NotesPreferenceActivity.class);
from.startActivityIfNeeded(intent, -1); from.startActivityIfNeeded(intent, -1);
} }
//修改为继承Activity便于包含Context。Builder函数的参数要求是Context。extends Activity
private class OnListItemClickListener implements OnItemClickListener { private class OnListItemClickListener implements OnItemClickListener {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
@ -895,7 +895,9 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
if (item.getType() == Notes.TYPE_FOLDER if (item.getType() == Notes.TYPE_FOLDER
|| item.getType() == Notes.TYPE_SYSTEM) { || item.getType() == Notes.TYPE_SYSTEM) {
openFolder(item); openFolder(item);
} else if (item.getType() == Notes.TYPE_NOTE) { }
//判断为点击的是便签
else if (item.getType() == Notes.TYPE_NOTE) {
openNode(item); openNode(item);
} else { } else {
Log.e(TAG, "Wrong note type in NOTE_LIST"); Log.e(TAG, "Wrong note type in NOTE_LIST");

Loading…
Cancel
Save