第一次维护以及报告的合并

master
eazzy 11 months ago committed by SheYu
parent 7d0eae3fdf
commit 9008c4526d

@ -1,71 +1,30 @@
<?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)
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" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.micode.notes" package="net.micode.notes"
android:versionCode="1" android:versionCode="1"
android:versionName="0.1" > android:versionName="0.1"> <!-- - 指定应用程序需要支持的最低的 Android SDK 版本 -->
<!--- 指定应用程序需要支持的最低的 Android SDK 版本 -->
<uses-sdk android:minSdkVersion="14" /> <uses-sdk android:minSdkVersion="14" />
<!-- - 权限声明 --> <!-- - 权限声明 -->
<!-- - 写入 SD 卡的权限 --> <!-- - 写入 SD 卡的权限 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- - 创建、删除有关快捷方式的权限 -->
<!--- 创建、删除有关快捷方式的权限 --> <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" /> <!-- - 访问网络的权限 -->
<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.INTERNET" /> <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" /> <!-- - 验证账户的权限 -->
<!--- 读取联系人的权限 -->
<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.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" /> <uses-permission android:name="android.permission.USE_CREDENTIALS" /> <!-- - 开机自动运行权限 -->
<!--- 开机自动运行权限 -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!--- 存储的读写权限 -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!--- 应用程序组件声明 -->
<!--- 定义应用程序的图标和名称 -->
<application <application
android:icon="@drawable/icon_app_1" android:icon="@drawable/icon_app_1"
android:label="@string/app_name" android:label="@string/app_name">
android:requestLegacyExternalStorage="true"
android:debuggable="true"
android:extractNativeLibs="true"
android:icon="@drawable/icon_app"
android:label="@string/app_name"
android:testOnly="true" >
<activity <activity
android:name=".ui.SplashActivity" android:name=".ui.SplashActivity"
android:configChanges="orientation|keyboardHidden|screenSize" android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="true" android:exported="true"
android:theme="@style/Theme.Notes.Fullscreen"> android:theme="@style/Theme.Notes.Fullscreen">
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@style/NoteTheme"
android:windowSoftInputMode="adjustPan" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
@ -77,17 +36,11 @@
android:name=".ui.NotesListActivity" android:name=".ui.NotesListActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true" android:exported="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/NoteTheme" android:theme="@style/NoteTheme"
android:windowSoftInputMode="adjustPan"> android:windowSoftInputMode="adjustPan">
<!--- 定义该 Activity 为启动器,即默认启动的 Activity -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity> </activity>
<!-- - 笔记编辑 Activity --> <!-- - 笔记编辑 Activity -->
@ -100,6 +53,7 @@
<!-- - 笔记编辑 Activity 的 Intent Filter用于接收其他应用程序发送过来的消息 --> <!-- - 笔记编辑 Activity 的 Intent Filter用于接收其他应用程序发送过来的消息 -->
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<!-- - 笔记编辑 Activity 可以处理的 MIME 类型 --> <!-- - 笔记编辑 Activity 可以处理的 MIME 类型 -->
<data <data
@ -117,6 +71,7 @@
<!-- - 笔记编辑 Activity 的 Intent Filter用于接收其他应用程序发送过来的消息 --> <!-- - 笔记编辑 Activity 的 Intent Filter用于接收其他应用程序发送过来的消息 -->
<intent-filter> <intent-filter>
<action android:name="android.intent.action.INSERT_OR_EDIT" /> <action android:name="android.intent.action.INSERT_OR_EDIT" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<!-- - 笔记编辑 Activity 可以处理的 MIME 类型 --> <!-- - 笔记编辑 Activity 可以处理的 MIME 类型 -->
<data android:mimeType="vnd.android.cursor.item/text_note" /> <data android:mimeType="vnd.android.cursor.item/text_note" />
@ -126,6 +81,7 @@
<!-- - 搜索 Intent Filter用于响应搜索请求 --> <!-- - 搜索 Intent Filter用于响应搜索请求 -->
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEARCH" /> <action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
@ -133,15 +89,11 @@
<meta-data <meta-data
android:name="android.app.searchable" android:name="android.app.searchable"
android:resource="@xml/searchable" /> android:resource="@xml/searchable" />
</activity> </activity> <!-- - 笔记供应器,用于共享笔记数据 -->
<!--- 笔记供应器,用于共享笔记数据 -->
<provider <provider
android:name="net.micode.notes.data.NotesProvider" android:name=".data.NotesProvider"
android:authorities="micode_notes" android:authorities="micode_notes"
android:multiprocess="true" /> android:multiprocess="true" /> <!-- - 笔记小部件,支持两种大小 -->
<!--- 笔记小部件,支持两种大小 -->
<receiver <receiver
android:name=".widget.NoteWidgetProvider_2x" android:name=".widget.NoteWidgetProvider_2x"
android:label="@string/app_widget2x2"> android:label="@string/app_widget2x2">
@ -173,46 +125,31 @@
<meta-data <meta-data
android:name="android.appwidget.provider" android:name="android.appwidget.provider"
android:resource="@xml/widget_4x_info" /> android:resource="@xml/widget_4x_info" />
</receiver> </receiver> <!-- - 启动时需要初始化闹钟服务 -->
<!--- 启动时需要初始化闹钟服务 -->
<receiver android:name=".ui.AlarmInitReceiver"> <receiver android:name=".ui.AlarmInitReceiver">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter> </intent-filter>
</receiver> </receiver> <!-- - 闹钟服务 -->
<!--- 闹钟服务 -->
<receiver <receiver
android:name="net.micode.notes.ui.AlarmReceiver" android:name=".ui.AlarmReceiver"
android:process=":remote" > android:process=":remote"></receiver> <!-- - 闹钟提示 Activity -->
</receiver>
<!--- 闹钟提示 Activity -->
<activity <activity
android:name=".ui.AlarmAlertActivity" android:name=".ui.AlarmAlertActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:theme="@android:style/Theme.Holo.Wallpaper.NoTitleBar" > android:theme="@android:style/Theme.Holo.Wallpaper.NoTitleBar"></activity> <!-- - 首选项 Activity -->
</activity>
<!--- 首选项 Activity -->
<activity <activity
android:name="net.micode.notes.ui.NotesPreferenceActivity" android:name=".ui.NotesPreferenceActivity"
android:label="@string/preferences_title" android:label="@string/preferences_title"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@android:style/Theme.Holo.Light" > android:theme="@android:style/Theme.Holo.Light"></activity> <!-- - GTask 同步服务 -->
</activity>
<!--- GTask 同步服务 -->
<service <service
android:name="net.micode.notes.gtask.remote.GTaskSyncService" android:name=".gtask.remote.GTaskSyncService"
android:exported="false" > android:exported="false"></service> <!-- - 默认搜索 Activity -->
</service>
<!--- 默认搜索 Activity -->
<meta-data <meta-data
android:name="android.app.default_searchable" android:name="android.app.default_searchable"
android:value=".ui.NoteEditActivity" /> android:value=".ui.NoteEditActivity" />
</application> </application>
</manifest> </manifest>

@ -34,6 +34,7 @@ import net.micode.notes.tool.DataUtils;
* @Version: 1.0 * @Version: 1.0
*/ */
public class NoteItemData { public class NoteItemData {
// 用于定义查询操作中要返回的列
static final String [] PROJECTION = new String [] { static final String [] PROJECTION = new String [] {
NoteColumns.ID, NoteColumns.ID,
NoteColumns.ALERTED_DATE, NoteColumns.ALERTED_DATE,

@ -85,6 +85,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
private static final String PREFERENCE_ADD_INTRODUCTION = "net.micode.notes.introduction"; private static final String PREFERENCE_ADD_INTRODUCTION = "net.micode.notes.introduction";
/**三个状态,主页面,文件夹,通话记录文件夹*/
private enum ListEditState { private enum ListEditState {
NOTE_LIST, SUB_FOLDER, CALL_RECORD_FOLDER NOTE_LIST, SUB_FOLDER, CALL_RECORD_FOLDER
}; };
@ -100,6 +101,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
private Button mAddNewNote; private Button mAddNewNote;
private boolean mDispatch; private boolean mDispatch;
// 控制背景颜色,初始为亮
private int mBackgroundColor = 1;
private int mOriginY; private int mOriginY;
@ -117,6 +120,9 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
public static final int NOTES_LISTVIEW_SCROLL_RATE = 30; public static final int NOTES_LISTVIEW_SCROLL_RATE = 30;
/** 私密模式,初始为 0 开启为 1*/
public static int mSecretMode = 0;
private NoteItemData mFocusNoteDataItem; private NoteItemData mFocusNoteDataItem;
private static final String NORMAL_SELECTION = NoteColumns.PARENT_ID + "=?"; private static final String NORMAL_SELECTION = NoteColumns.PARENT_ID + "=?";
@ -140,6 +146,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
protected void onCreate(final Bundle savedInstanceState) { protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState); // 调用父类的onCreate函数 super.onCreate(savedInstanceState); // 调用父类的onCreate函数
setContentView(R.layout.note_list); setContentView(R.layout.note_list);
getWindow().setBackgroundDrawableResource(R.drawable.bg_light);
initResources(); initResources();
setAppInfoFromRawRes(); setAppInfoFromRawRes();
} }
@ -463,10 +470,12 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
* @return * @return
*/ */
private void startAsyncNotesListQuery() { private void startAsyncNotesListQuery() {
String selection = (mCurrentFolderId == Notes.ID_ROOT_FOLDER) ? ROOT_FOLDER_SELECTION : NORMAL_SELECTION; String selection = (mCurrentFolderId == Notes.ID_ROOT_FOLDER) ? ROOT_FOLDER_SELECTION
: NORMAL_SELECTION;
mBackgroundQueryHandler.startQuery(FOLDER_NOTE_LIST_QUERY_TOKEN, null, mBackgroundQueryHandler.startQuery(FOLDER_NOTE_LIST_QUERY_TOKEN, null,
Notes.CONTENT_NOTE_URI, NoteItemData.PROJECTION, selection, new String[] {String.valueOf(mCurrentFolderId)}, Notes.CONTENT_NOTE_URI, NoteItemData.PROJECTION, selection, new String[]{
NoteColumns.TYPE + " DESC," + NoteColumns.MODIFIED_DATE + " DESC"); String.valueOf(mCurrentFolderId)
}, NoteColumns.TYPE + " DESC," + NoteColumns.MODIFIED_DATE + " DESC");
} }
/** /**
* @Package: net.micode.notes.ui * @Package: net.micode.notes.ui
@ -530,6 +539,98 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
}); });
builder.show(); builder.show();
} }
/**
* @method switchBackground
* @description
* @date: 1/3/2024 3:41 PM
* @author: YangYizhe
*/
private void switchBackground(){
mBackgroundColor = (mBackgroundColor + 1) % 2;
View frameLayout = findViewById(R.id.frame_layout_id);
if (mBackgroundColor == 1){
frameLayout.setBackgroundResource(R.drawable.bg_light);
} else{
frameLayout.setBackgroundResource(R.drawable.bg_dark);
}
}
private boolean isSecretMode(){
if(mSecretMode == 1){
return true;
}else {
return false;
}
}
/**
* @method enterSecertMode
* @description
* @date: 1/2/2024 8:18 PM
* @author: YangYizhe
*/
private void enterSecretMode(){
AlertDialog.Builder dialog = new AlertDialog.Builder(NotesListActivity.this);
dialog.setTitle("重要提醒");
dialog.setMessage("您确认进入隐私模式吗?");
dialog.setCancelable(false);
dialog.setPositiveButton("确认", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mSecretMode = 1;
startAsyncNotesListQuery();
Toast.makeText(NotesListActivity.this,"您已进入隐私模式",Toast.LENGTH_SHORT).show();
}
});
dialog.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which){}
});
dialog.show();
}
/**
* @method quitSecretMode
* @description 退
* @date: 1/2/2024 8:20 PM
* @author: YangYizhe
*/
private void quitSecretMode(){
AlertDialog.Builder dialog = new AlertDialog.Builder(NotesListActivity.this);
dialog.setTitle("重要提醒");
dialog.setMessage("您确认退出隐私模式吗?");
dialog.setCancelable(false);
dialog.setPositiveButton("确认", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mSecretMode = 0;
startAsyncNotesListQuery();
Toast.makeText(NotesListActivity.this,"您已退出隐私模式",Toast.LENGTH_SHORT).show();
}
});
dialog.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which){}
});
dialog.show();
}
/**
* @method restoreDeletedNodes
* @description
* @date: 1/3/2024 8:11 PM
* @author: YangYizhe
*/
private void restoreDeletedNodes(){
mState = ListEditState.SUB_FOLDER;
mCurrentFolderId = Notes.ID_TRASH_FOLER;
startAsyncNotesListQuery();
mTitleBar.setText("回收站");
mTitleBar.setVisibility(View.VISIBLE);
}
/** /**
* @method createNewNote * @method createNewNote
* @description 便 * @description 便
@ -544,6 +645,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
intent.putExtra(Notes.INTENT_EXTRA_FOLDER_ID, mCurrentFolderId); intent.putExtra(Notes.INTENT_EXTRA_FOLDER_ID, mCurrentFolderId);
this.startActivityForResult(intent, REQUEST_CODE_NEW_NODE); this.startActivityForResult(intent, REQUEST_CODE_NEW_NODE);
} }
/** /**
* @method batchDelete * @method batchDelete
* @description: * @description:
@ -558,15 +660,15 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
new AsyncTask<Void, Void, HashSet<AppWidgetAttribute>>() { new AsyncTask<Void, Void, HashSet<AppWidgetAttribute>>() {
protected HashSet<AppWidgetAttribute> doInBackground(Void... unused) { protected HashSet<AppWidgetAttribute> doInBackground(Void... unused) {
HashSet<AppWidgetAttribute> widgets = mNotesListAdapter.getSelectedWidget(); HashSet<AppWidgetAttribute> widgets = mNotesListAdapter.getSelectedWidget();
//如果没有同步,直接删除 // 如果是回收站中的,直接删除
if (!isSyncMode()) { if (mCurrentFolderId == Notes.ID_TRASH_FOLER) {
if (DataUtils.batchDeleteNotes(mContentResolver, mNotesListAdapter if (DataUtils.batchDeleteNotes(mContentResolver, mNotesListAdapter
.getSelectedItemIds())) { .getSelectedItemIds())) {
} else { } else {
Log.e(TAG, "Delete notes error, should not happens"); Log.e(TAG, "Delete notes error, should not happens");
} }
} }
//已同步,将删除的便签移到垃圾桶 // 将删除的便签移到回收站
else { else {
if (!DataUtils.batchMoveToFolder(mContentResolver, mNotesListAdapter if (!DataUtils.batchMoveToFolder(mContentResolver, mNotesListAdapter
.getSelectedItemIds(), Notes.ID_TRASH_FOLER)) { .getSelectedItemIds(), Notes.ID_TRASH_FOLER)) {
@ -891,6 +993,14 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
} }
@Override @Override
/**
* @method onPrepareOptionsMenu
* @description menuAndroid
* @date: 1/2/2024 7:40 PM
* @author: YangYizhe
* @param [menu]
* @return boolean
*/
public boolean onPrepareOptionsMenu(Menu menu) { public boolean onPrepareOptionsMenu(Menu menu) {
menu.clear(); menu.clear();
if (mState == ListEditState.NOTE_LIST) { if (mState == ListEditState.NOTE_LIST) {
@ -905,10 +1015,29 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
} else { } else {
Log.e(TAG, "Wrong state:" + mState); Log.e(TAG, "Wrong state:" + mState);
} }
// 若在隐私模式之中,则不显示进入隐私模式的选项,不在隐私模式之中,则不显示退出隐私模式选项
if(isSecretMode()){
menu.findItem(R.id.menu_secret).setVisible(false);
} else {
menu.findItem(R.id.menu_quit_secret).setVisible(false);
}
if(mBackgroundColor==1) {
menu.findItem(R.id.menu_light_mode).setVisible(false);
} else {
menu.findItem(R.id.menu_dark_mode).setVisible(false);
}
return true; return true;
} }
@Override @Override
/**
* @method onOptionsItemSelected
* @description
* @date: 1/2/2024 7:41 PM
* @author: YangYizhe
* @param [item]
* @return boolean
*/
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId(); int itemId = item.getItemId();
if (itemId == R.id.menu_new_folder) { if (itemId == R.id.menu_new_folder) {
@ -931,6 +1060,16 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
createNewNote(); createNewNote();
} else if (itemId == R.id.menu_search) { } else if (itemId == R.id.menu_search) {
onSearchRequested(); onSearchRequested();
} else if (itemId == R.id.menu_secret) {
enterSecretMode();
} else if (itemId == R.id.menu_quit_secret){
quitSecretMode();
} else if(itemId == R.id.menu_light_mode) {
switchBackground();
} else if(itemId == R.id.menu_dark_mode) {
switchBackground();
} else if (itemId == R.id.menu_restore) {
restoreDeletedNodes();
} }
return true; return true;
} }

@ -26,7 +26,7 @@ public class NotesListItem extends LinearLayout {
private ImageView mAlert;//闹钟图片 private ImageView mAlert;//闹钟图片
private TextView mTitle; //标题 private TextView mTitle; //标题
private TextView mTime; //时间 private TextView mTime; //时间
private TextView mCallName; // private TextView mCallName;
private NoteItemData mItemData; //标签数据 private NoteItemData mItemData; //标签数据
private CheckBox mCheckBox; //打钩框 private CheckBox mCheckBox; //打钩框

@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
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/bg_light">
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"

@ -74,4 +74,13 @@
<item name="android:background">@color/black_overlay</item> <item name="android:background">@color/black_overlay</item>
<item name="android:buttonBarStyle">?android:attr/buttonBarStyle</item> <item name="android:buttonBarStyle">?android:attr/buttonBarStyle</item>
</style> </style>
<style name="Widget.Theme.Notes.ActionBar.Fullscreen" parent="Widget.AppCompat.ActionBar">
<item name="android:background">@color/black_overlay</item>
</style>
<style name="Widget.Theme.Notes.ButtonBar.Fullscreen" parent="">
<item name="android:background">@color/black_overlay</item>
<item name="android:buttonBarStyle">?android:attr/buttonBarStyle</item>
</style>
</resources> </resources>
Loading…
Cancel
Save