同意
pull/9/head
pvqf6mep3 3 years ago
commit 1efd5b314b

@ -0,0 +1,151 @@
<?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"
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" >
<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>
<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=".ui.UnlockActivity" android:theme="@style/Theme.AppCompat.Light.NoActionBar"> </activity>
<activity android:name=".ui.SetLockActivity" android:theme="@style/Theme.AppCompat.Light.NoActionBar"> </activity>
<activity android:name=".ui.DeletePasscodeActivity" android:theme="@style/Theme.AppCompat.Light.NoActionBar"> </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>

@ -303,7 +303,7 @@ public class NotesProvider extends ContentProvider {
return null;
}
public static boolean isStarNoteOrLockedNote(Long id) {
public static boolean isStarNote(Long id) {
SQLiteDatabase db;
db = mHelper.getReadableDatabase();
Cursor cursor = null;
@ -313,7 +313,27 @@ public class NotesProvider extends ContentProvider {
//遍历游标
for (int index = 1; index < cursor.getCount(); index++) {
cursor.moveToNext();
if (cursor.getLong(SqlNote.ID_COLUMN) == id && !cursor.getString(SqlNote.STAR_COLUMN).equals("0") && !cursor.getString(SqlNote.PASSCODE_COLUMN).equals("")) {
if (cursor.getLong(SqlNote.ID_COLUMN) == id && !cursor.getString(SqlNote.STAR_COLUMN).equals("0")) {
cursor.close();
return true;
}
}
}
cursor.close();
return false;
}
public static boolean isLockedNote(Long id) {
SQLiteDatabase db;
db = mHelper.getReadableDatabase();
Cursor cursor = null;
cursor = db.query(NotesDatabaseHelper.TABLE.NOTE, null, null, null, null, null, null);
//判断游标是否为空
if (cursor.moveToFirst()) {
//遍历游标
for (int index = 1; index < cursor.getCount(); index++) {
cursor.moveToNext();
if (cursor.getLong(SqlNote.ID_COLUMN) == id && !cursor.getString(SqlNote.PASSCODE_COLUMN).equals("")) {
cursor.close();
return true;
}

@ -90,7 +90,7 @@ public class SqlNote {
public static final int STAR_COLUMN = 18;
public static final int PASSCODE_COLUMN = 18;
public static final int PASSCODE_COLUMN = 19;
private Context mContext;
@ -128,6 +128,8 @@ public class SqlNote {
private String mStar;
private String mPasscode;
private ContentValues mDiffNoteValues;
private ArrayList<SqlData> mDataList;
@ -151,6 +153,7 @@ public class SqlNote {
mVersion = 0;
mTop = getmTop();
mStar = getmStar();
mPasscode = getmPasscode();
mDiffNoteValues = new ContentValues();
mDataList = new ArrayList<SqlData>();
}
@ -166,6 +169,7 @@ public class SqlNote {
mDiffNoteValues = new ContentValues();
mTop = getmTop();
mStar = getmStar();
mPasscode = getmPasscode();
}
public SqlNote(Context context, long id) {
@ -179,6 +183,7 @@ public class SqlNote {
mDiffNoteValues = new ContentValues();
mTop = getmTop();
mStar = getmStar();
mPasscode = getmPasscode();
}
public String getmTop(){
@ -189,6 +194,10 @@ public class SqlNote {
return mStar;
}
public String getmPasscode(){
return mPasscode;
}
private void loadFromCursor(long id) {
Cursor c = null;
try {
@ -223,6 +232,7 @@ public class SqlNote {
mVersion = c.getLong(VERSION_COLUMN);
mTop = c.getString(Top_COLUMN);
mStar = c.getString(STAR_COLUMN);
mPasscode = c.getString(PASSCODE_COLUMN);
}
private void loadDataContent() {

@ -70,6 +70,7 @@ public class WorkingNote {
/**记录便签所属类别*/
private int mClass;
private String mStar = "0";
private NoteSettingChangedListener mNoteSettingStatusListener;

@ -65,7 +65,7 @@ public class DataUtils {
/**
* if can delete
*/
if (NotesProvider.isStarNoteOrLockedNote(id)){
if (NotesProvider.isStarNote(id) || NotesProvider.isLockedNote(id)){
continue;
}
ContentProviderOperation.Builder builder = ContentProviderOperation

@ -0,0 +1,52 @@
package net.micode.notes.ui;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import net.micode.notes.R;
import net.micode.notes.model.WorkingNote;
public class DeletePasscodeActivity extends AppCompatActivity {
private LockPatternView mLockPatternView;
private String mPasswordStr;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lock);
mLockPatternView = (LockPatternView) findViewById(R.id.lockView);
Intent pre = getIntent();
final Long noteId = pre.getLongExtra(Intent.EXTRA_UID, 0);
mLockPatternView.setLockListener(new LockPatternView.OnLockListener() {
WorkingNote mWorkingNote = WorkingNote.load(DeletePasscodeActivity.this,noteId);
String password = mWorkingNote.getPasscode();
@Override
public void getStringPassword(String password) {
mPasswordStr = password;
}
@Override
public boolean isPassword() {
if (mPasswordStr.equals(password)) {
Toast.makeText(DeletePasscodeActivity.this, R.string.note_passcode_deleted, Toast.LENGTH_SHORT).show();
mWorkingNote.setPasscode("");
mWorkingNote.saveNote();
Intent intent = new Intent(DeletePasscodeActivity.this, NoteEditActivity.class);
intent.setAction(Intent.ACTION_VIEW);
intent.putExtra(Intent.EXTRA_UID, noteId);
startActivity(intent);
DeletePasscodeActivity.this.finish();
} else {
Toast.makeText(DeletePasscodeActivity.this, "密码不正确", Toast.LENGTH_SHORT).show();
}
return false;
}
});
}
}

@ -155,6 +155,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
private Pattern mPattern;
private boolean Locked; /* 用以判断是否已解锁 */
private boolean verified = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -271,6 +273,9 @@ public class NoteEditActivity extends Activity implements OnClickListener,
if (intent.hasExtra("lock")) {
Locked = false;
}
if (intent.hasExtra("verified")){
verified = true;
}
return true;
}
@ -307,6 +312,10 @@ public class NoteEditActivity extends Activity implements OnClickListener,
*/
showAlertHeader();
showTopHeader();
unlockNote();
}
private void unlockNote(){
//如果设置了密码,启动输入密码页面
if (mWorkingNote.hasPasscode() && Locked) {
saveNote();
@ -317,6 +326,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
}
}
private void showAlertHeader() {
if (mWorkingNote.hasClockAlert()) {
long time = System.currentTimeMillis();
@ -582,13 +592,13 @@ 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.getStarId()==0) {
System.out.println(mWorkingNote.getStarId());
if(mWorkingNote.getStarId()==0 && !mWorkingNote.hasPasscode()) {
deleteCurrentNote();
finish();
System.out.println(mWorkingNote.getStarId());
} else{
} else if(mWorkingNote.getStarId()==1){
showToast(R.string.error_delete_star_note);
} else if(mWorkingNote.hasPasscode()){
showToast(R.string.error_delete_locked_note);
}
//finish();
}
@ -937,9 +947,15 @@ public class NoteEditActivity extends Activity implements OnClickListener,
* 便
*/
private void deletePasscode() {
mWorkingNote.setPasscode("");
//验证密码
if (mWorkingNote.hasPasscode()) {
saveNote();
Intent intent = new Intent(this,DeletePasscodeActivity.class);
intent.putExtra(Intent.EXTRA_UID, mWorkingNote.getNoteId());
startActivity(intent);
finish();
}
saveNote();
Toast.makeText(NoteEditActivity.this,R.string.note_passcode_deleted,Toast.LENGTH_SHORT).show();
}
private void sendToDesktop() {

@ -11,7 +11,6 @@ import net.micode.notes.R;
import net.micode.notes.ui.LockPatternView;
public class UnlockActivity extends AppCompatActivity {
private LockPatternView mLockPatternView;
private String mPasswordStr;

@ -86,6 +86,7 @@
<string name="error_note_empty_for_top">不能置顶空便签</string>
<string name="error_note_empty_for_send_to_desktop">不能将空便签发送到桌面</string>
<string name="error_delete_star_note">不能删除星标便签</string>
<string name="error_delete_locked_note">不能删除加密便签</string>
<string name="success_sdcard_export">导出成功</string>
<string name="failed_sdcard_export">导出失败</string>
<string name="format_exported_file_location">已将文本文件(%1$s)输出至SD卡(%2$s)目录</string>

@ -85,6 +85,7 @@
<string name="error_note_empty_for_clock">不能爲空便籤設置鬧鐘提醒</string>
<string name="error_note_empty_for_send_to_desktop">不能將空便籤發送到桌面</string>
<string name="error_delete_star_note">不能删除星标便签</string>
<string name="error_delete_locked_note">不能删除加密便签</string>
<string name="success_sdcard_export">導出成功</string>
<string name="failed_sdcard_export">導出失敗</string>
<string name="format_exported_file_location">已將文本文件(%1$s)導出至SD(%2$s)目錄</string>

@ -92,6 +92,7 @@
<string name="error_note_empty_for_top">Sorry, can not set top on empty note</string>
<string name="error_note_empty_for_send_to_desktop">Sorry, can not send and empty note to home</string>
<string name="error_delete_star_note">Sorry, can not delete star note</string>
<string name="error_delete_locked_note">Sorry, can not delete locked note</string>
<string name="success_sdcard_export">Export successful</string>
<string name="failed_sdcard_export">Export fail</string>
<string name="format_exported_file_location">Export text file (%1$s) to SD (%2$s) directory</string>

Loading…
Cancel
Save