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

master
eazzy 11 months ago committed by SheYu
parent ea6e0171c8
commit 4d5bea472d

Binary file not shown.

@ -1,21 +1,4 @@
<?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"
@ -57,18 +40,11 @@
android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="true"
android:theme="@style/Theme.Notes.Fullscreen">
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>
android:label="@string/app_name" >
<!--- 应用程序的入口 NotesListActivity -->
<activity
@ -110,9 +86,6 @@
android:mimeType="vnd.android.cursor.item/call_note"
android:path="/notes"
android:scheme="content" />
<data android:mimeType="vnd.android.cursor.item/text_note" android:scheme="content" android:host="com.example.notes.provider" android:path="/notes" />
<data android:mimeType="vnd.android.cursor.item/call_note" android:scheme="content" android:host="com.example.notes.provider" android:path="/notes" />
</intent-filter>
<!--- 笔记编辑 Activity 的 Intent Filter用于接收其他应用程序发送过来的消息 -->

@ -14,7 +14,7 @@
* limitations under the License.
*/
package net.micode.notes.data;//属于data这个包
package net.micode.notes.data;
import android.content.Context;
import android.database.Cursor;
@ -28,61 +28,60 @@ import java.util.HashMap;
* @Package: net.micode.notes.data
* @ClassName: Contact
* @Description:
* Contact
* HashMap
* getContact
*
* SQL
* 线线使
* @Author: YangYizhe
* @CreateDate: 12/17/2023 10:10 AM
* @Author: WUSHUXIAN
* @CreateDate: 2023/12/20 23:26
* @Version: 1.0
*/
public class Contact {
/**
* ,
*/
private static HashMap<String, String> sContactCache;
private static final String TAG = "Contact";//设置日志TAG标签
private static final String TAG = "Contact";
//查询联系人的SQL筛选语句
private static final String CALLER_ID_SELECTION = "PHONE_NUMBERS_EQUAL(" + Phone.NUMBER
+ ",?) AND " + Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'"
+ " AND " + Data.RAW_CONTACT_ID + " IN "
+ "(SELECT raw_contact_id "
+ " FROM phone_lookup"
+ " WHERE min_match = '+')";
//获取联系人
/**
* @method getContact
* @description:
* @date: 2023/12/21 19:18
* @author: WuShuxian
* @param: context
* @param: phoneNumber
* @return: String
*/
public static String getContact(Context context, String phoneNumber) {
if(sContactCache == null) {/*如果缓存为空,就新建一个*/
//
if(sContactCache == null) {
sContactCache = new HashMap<String, String>();
}
if(sContactCache.containsKey(phoneNumber)) {/*如果缓存中已经有该电话号码对应的联系人名字,就直接返回*/
if(sContactCache.containsKey(phoneNumber)) {
return sContactCache.get(phoneNumber);
}
String selection = CALLER_ID_SELECTION.replace("+",
PhoneNumberUtils.toCallerIDMinMatch(phoneNumber));//将电话号码转换为最小匹配模式,用于筛选
PhoneNumberUtils.toCallerIDMinMatch(phoneNumber));
Cursor cursor = context.getContentResolver().query(
Data.CONTENT_URI,
new String [] { Phone.DISPLAY_NAME },
selection,//使用筛选条件
selection,
new String[] { phoneNumber },
null);
if (cursor != null && cursor.moveToFirst()) {//如果找到了符合条件的联系人
if (cursor != null && cursor.moveToFirst()) {
try {
String name = cursor.getString(0);//获取联系人名字
sContactCache.put(phoneNumber, name);//将电话号码和联系人名字添加到缓存中
return name;//返回联系人名字
String name = cursor.getString(0);
sContactCache.put(phoneNumber, name);
return name;
} catch (IndexOutOfBoundsException e) {
Log.e(TAG, " Cursor get string error " + e.toString());
return null;
} finally {
cursor.close();//关闭游标
cursor.close();
}
} else {/*没找到*/
} else {
Log.d(TAG, "No contact matched with number:" + phoneNumber);
return null;
}

@ -34,6 +34,7 @@ import net.micode.notes.tool.DataUtils;
* @Version: 1.0
*/
public class NoteItemData {
// 用于定义查询操作中要返回的列
static final String [] PROJECTION = new String [] {
NoteColumns.ID,
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 enum ListEditState {
NOTE_LIST, SUB_FOLDER, CALL_RECORD_FOLDER
};
@ -100,6 +101,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
private Button mAddNewNote;
private boolean mDispatch;
// 控制背景颜色,初始为亮
private int mBackgroundColor = 1;
private int mOriginY;
@ -117,6 +120,9 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
public static final int NOTES_LISTVIEW_SCROLL_RATE = 30;
/** 私密模式,初始为 0 开启为 1*/
public static int mSecretMode = 0;
private NoteItemData mFocusNoteDataItem;
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) {
super.onCreate(savedInstanceState); // 调用父类的onCreate函数
setContentView(R.layout.note_list);
getWindow().setBackgroundDrawableResource(R.drawable.bg_light);
initResources();
setAppInfoFromRawRes();
}
@ -463,10 +470,12 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
* @return
*/
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,
Notes.CONTENT_NOTE_URI, NoteItemData.PROJECTION, selection, new String[] {String.valueOf(mCurrentFolderId)},
NoteColumns.TYPE + " DESC," + NoteColumns.MODIFIED_DATE + " DESC");
Notes.CONTENT_NOTE_URI, NoteItemData.PROJECTION, selection, new String[]{
String.valueOf(mCurrentFolderId)
}, NoteColumns.TYPE + " DESC," + NoteColumns.MODIFIED_DATE + " DESC");
}
/**
* @Package: net.micode.notes.ui
@ -530,6 +539,98 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
});
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
* @description 便
@ -544,6 +645,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
intent.putExtra(Notes.INTENT_EXTRA_FOLDER_ID, mCurrentFolderId);
this.startActivityForResult(intent, REQUEST_CODE_NEW_NODE);
}
/**
* @method batchDelete
* @description:
@ -558,15 +660,15 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
new AsyncTask<Void, Void, HashSet<AppWidgetAttribute>>() {
protected HashSet<AppWidgetAttribute> doInBackground(Void... unused) {
HashSet<AppWidgetAttribute> widgets = mNotesListAdapter.getSelectedWidget();
//如果没有同步,直接删除
if (!isSyncMode()) {
// 如果是回收站中的,直接删除
if (mCurrentFolderId == Notes.ID_TRASH_FOLER) {
if (DataUtils.batchDeleteNotes(mContentResolver, mNotesListAdapter
.getSelectedItemIds())) {
} else {
Log.e(TAG, "Delete notes error, should not happens");
}
}
//已同步,将删除的便签移到垃圾桶
// 将删除的便签移到回收站
else {
if (!DataUtils.batchMoveToFolder(mContentResolver, mNotesListAdapter
.getSelectedItemIds(), Notes.ID_TRASH_FOLER)) {
@ -891,6 +993,14 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
}
@Override
/**
* @method onPrepareOptionsMenu
* @description menuAndroid
* @date: 1/2/2024 7:40 PM
* @author: YangYizhe
* @param [menu]
* @return boolean
*/
public boolean onPrepareOptionsMenu(Menu menu) {
menu.clear();
if (mState == ListEditState.NOTE_LIST) {
@ -905,10 +1015,29 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
} else {
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;
}
@Override
/**
* @method onOptionsItemSelected
* @description
* @date: 1/2/2024 7:41 PM
* @author: YangYizhe
* @param [item]
* @return boolean
*/
public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId();
if (itemId == R.id.menu_new_folder) {
@ -931,6 +1060,16 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
createNewNote();
} else if (itemId == R.id.menu_search) {
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;
}

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

@ -99,13 +99,13 @@
android:id="@+id/note_edit_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="left|top"
android:background="@null"
android:autoLink="all"
android:background="@null"
android:gravity="left|top"
android:lineSpacingMultiplier="1.2"
android:linksClickable="false"
android:minLines="12"
android:textAppearance="@style/TextAppearancePrimaryItem"
android:lineSpacingMultiplier="1.2" />
android:textAppearance="@style/TextAppearancePrimaryItem" />
<LinearLayout
android:id="@+id/note_edit_list"

@ -17,9 +17,10 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/frame_layout_id"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/list_background">
android:background="@drawable/bg_light">
<LinearLayout
android:layout_width="fill_parent"

@ -36,4 +36,24 @@
<item
android:id="@+id/menu_search"
android:title="@string/menu_search"/>
<item
android:id="@+id/menu_light_mode"
android:title="@string/light_mode"/>
<item
android:id="@+id/menu_dark_mode"
android:title="@string/dark_mode"/>
<item
android:id="@+id/menu_secret"
android:title="@string/menu_secret"/>
<item
android:id="@+id/menu_quit_secret"
android:title="@string/menu_quit_secret"/>
<item
android:id="@+id/menu_restore"
android:title="@string/menu_restore"/>
</menu>

@ -21,4 +21,20 @@
<item
android:id="@+id/menu_new_note"
android:title="@string/notelist_menu_new"/>
<item
android:id="@+id/menu_light_mode"
android:title="@string/light_mode"/>
<item
android:id="@+id/menu_dark_mode"
android:title="@string/dark_mode"/>
<item
android:id="@+id/menu_secret"
android:title="@string/menu_secret"/>
<item
android:id="@+id/menu_quit_secret"
android:title="@string/menu_quit_secret"/>
</menu>

@ -119,6 +119,14 @@
<string name="search">便签</string>
<string name="datetime_dialog_ok">设置</string>
<string name="datetime_dialog_cancel">取消</string>
<string name="light_mode">亮背景</string>
<string name="dark_mode">暗背景</string>
<string name="menu_secret">私密模式</string>
<string name="menu_quit_secret">退出私密模式</string>
<string name="note_length">字符数</string>
<string name="menu_restore">恢复</string>
<string name="title_activity_splash">欢迎页面</string>
<string name="eazzy_note">EAZZY\nNOTE</string>
<plurals name="search_results_title">
<item quantity="other"><xliff:g id="NUMBER">%1$s</xliff:g> 条符合“<xliff:g id="SEARCH">%2$s</xliff:g>”的搜索结果</item>
</plurals>

@ -120,6 +120,14 @@
<string name="search">便籤</string>
<string name="datetime_dialog_ok">設置</string>
<string name="datetime_dialog_cancel">取消</string>
<string name="light_mode">亮背景</string>
<string name="dark_mode">暗背景</string>
<string name="menu_secret">私密模式</string>
<string name="menu_quit_secret">退出私密模式</string>
<string name="note_length">字符数</string>
<string name="menu_restore">恢复</string>
<string name="title_activity_splash">欢迎页面</string>
<string name="eazzy_note">EAZZY\nNOTE</string>
<plurals name="search_results_title">
<item quantity="other"><xliff:g id="NUMBER">%1$s</xliff:g> 條符合”<xliff:g id="SEARCH">%2$s</xliff:g>“的搜尋結果</item>
</plurals>

@ -17,4 +17,9 @@
<resources>
<color name="user_query_highlight">#335b5b5b</color>
<color name="light_blue_600">#FF039BE5</color>
<color name="light_blue_900">#FF01579B</color>
<color name="light_blue_A200">#FF40C4FF</color>
<color name="light_blue_A400">#FF00B0FF</color>
<color name="black_overlay">#66000000</color>
</resources>

@ -15,8 +15,7 @@
limitations under the License.
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_name">Notes</string>
<string name="app_widget2x2">Notes 2x2</string>
<string name="app_widget4x4">Notes 4x4</string>
@ -126,10 +125,24 @@
<string name="search">Notes</string>
<string name="datetime_dialog_ok">set</string>
<string name="datetime_dialog_cancel">cancel</string>
<string name="light_mode">light mode</string>
<string name="dark_mode">dark mode</string>
<!-- secret mode -->
<string name="menu_secret">secret mode</string>
<string name="menu_quit_secret">quit secret mode</string>
<string name="note_length">length</string>
<string name="menu_restore">restore</string>
<string name="title_activity_splash">SplashActivity</string>
<string name="eazzy_note">EAZZY\nNOTE</string>
<plurals name="search_results_title">
<item quantity="one"><xliff:g id="number" example="1">%1$s</xliff:g> result for \"<xliff:g id="search" example="???">%2$s</xliff:g>\"</item>
<item quantity="one"><xliff:g example="1" id="number">%1$s</xliff:g> result for \"<xliff:g example="???" id="search">%2$s</xliff:g>\"</item>
<!-- Case of 0 or 2 or more results. -->
<item quantity="other"><xliff:g id="number" example="15">%1$s</xliff:g> results for \"<xliff:g id="search" example="???">%2$s</xliff:g>\"</item>
<item quantity="other"><xliff:g example="15" id="number">%1$s</xliff:g> results for \"<xliff:g example="???" id="search">%2$s</xliff:g>\"</item>
</plurals>
</resources>

@ -16,18 +16,22 @@
-->
<resources>
<style name="TextAppearanceSuper">
<item name="android:textSize">@dimen/text_font_size_super</item>
<item name="android:textColorLink">#0000ff</item>
</style>
<style name="TextAppearanceLarge">
<item name="android:textSize">@dimen/text_font_size_large</item>
<item name="android:textColorLink">#0000ff</item>
</style>
<style name="TextAppearanceMedium">
<item name="android:textSize">@dimen/text_font_size_medium</item>
<item name="android:textColorLink">#0000ff</item>
</style>
<style name="TextAppearanceNormal">
<item name="android:textSize">@dimen/text_font_size_normal</item>
<item name="android:textColorLink">#0000ff</item>
@ -66,4 +70,13 @@
<item name="android:displayOptions" />
<item name="android:visibility">visible</item>
</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>
Loading…
Cancel
Save