mysq 1 week ago
parent aa0b9bdebf
commit e41f4d59af

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

@ -0,0 +1,144 @@
Menu-note-list
<!-- 背景图功能 -->
<item
android:id="@+id/menu_a1"
android:title="@string/menu_a1"/>
<item
android:id="@+id/menu_a2"
android:title="@string/menu_a2"/>
<item
android:id="@+id/menu_a3"
android:title="@string/menu_a3"/>
NotelistActivity
//背景图功能
public int mode=-1;
// 私密模式
public static int secret_mode = 0;
// 背景图功能
getWindow().setBackgroundDrawableResource(R.drawable.a3);
getWindow().setBackgroundDrawableResource(R.drawable.a2);
getWindow().setBackgroundDrawableResource(R.drawable.a1);
// 背景功能
if(mode==-1)
menu.findItem(R.id.menu_a1).setVisible(false);
else if (mode==0)
menu.findItem(R.id.menu_a2).setVisible(false);
else if (mode==1)
menu.findItem(R.id.menu_a3).setVisible(false);
// 背景功能
case R.id.menu_a1:{
mode=-1;
getWindow().setBackgroundDrawableResource(R.drawable.a1);
break;
}
case R.id.menu_a2:{
mode=0;
getWindow().setBackgroundDrawableResource(R.drawable.a2);
break;
}
case R.id.menu_a3:{
mode=1;
getWindow().setBackgroundDrawableResource(R.drawable.a3);
break;
}
Values_string
<!-- 背景图功能 -->
<string name="menu_a2">Background: a2</string>
<string name="menu_a1">Background: a1</string>
<string name="menu_a3">Background: a3</string>
if(secret_mode == 1)menu.findItem(R.id.menu_secret).setVisible(false); else
menu.findItem(R.id.menu_quit_secret).setVisible(false);
public void supportInvalidateOptionsMenu() {
invalidateOptionsMenu(); // 最终调用 Activity 的原生方法
}
case R.id.menu_secret: { // 进入私密模式
secret_mode = 1; // 先临时设为1用于对话框标题提示
AlertDialog.Builder dialog = new AlertDialog.Builder(NotesListActivity.this);
dialog.setTitle("重要提醒")
.setMessage("您确认进入私密模式吗?")
.setCancelable(false)
.setPositiveButton("确认", (d, which) -> {
startAsyncNotesListQuery();
Toast.makeText(NotesListActivity.this, "您已进入私密模式", Toast.LENGTH_SHORT).show();
})
.setNegativeButton("取消", (d, which) -> {
secret_mode = 0; // 恢复状态
supportInvalidateOptionsMenu(); // 强制刷新菜单 })
.show();
break;}
case R.id.menu_quit_secret: { // 退出私密模式
AlertDialog.Builder dialog = new AlertDialog.Builder(NotesListActivity.this);
dialog.setTitle("重要提醒")
.setMessage("您确认退出私密模式吗?")
.setCancelable(false)
.setPositiveButton("确认", (d, which) -> {
secret_mode = 0;
startAsyncNotesListQuery();
supportInvalidateOptionsMenu(); // 刷新菜单
Toast.makeText(NotesListActivity.this, "您已退出私密模式", Toast.LENGTH_SHORT).show();
})
.setNegativeButton("取消", null) // 无需操作
.show();
break;
}
Values_string
ShareActionProvider
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.note_list, menu);
MenuItem enterSecret = menu.findItem(R.id.menu_secret);
MenuItem quitSecret = menu.findItem(R.id.menu_quit_secret);
enterSecret.setVisible(secret_mode == 0); // 非私密模式时显示"进入"
quitSecret.setVisible(secret_mode == 1); // 私密模式时显示"退出"
return true;
}
<!-- 私密模式 -->
<string name="Secret">secret model</string>
<string name="Quit_Secret">quit secret model</string>
Menu_Sub_folder
<!-- 私密模式 -->
<item
android:id="@+id/menu_secret"
android:title="@string/Secret"/>
<item
android:id="@+id/menu_quit_secret"
android:title="@string/Quit_Secret"/>
// 私密模式
public static int secret_mode = 0;
private void startAsyncNotesListQuery() {
String selection = (mCurrentFolderId == Notes.ID_ROOT_FOLDER) ? ROOT_FOLDER_SELECTION
: NORMAL_SELECTION;
if(secret_mode == 0) {
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");
}
else{
String str1 = "111";
String [] PROJECTION = new String [] { //定义一个新的PROJECTION数组只换掉SNIPPET
NoteColumns.ID,
NoteColumns.ALERTED_DATE,
NoteColumns.BG_COLOR_ID,
NoteColumns.CREATED_DATE,
NoteColumns.HAS_ATTACHMENT,
NoteColumns.MODIFIED_DATE,
NoteColumns.NOTES_COUNT,
NoteColumns.PARENT_ID,
// NoteColumns.SNIPPET,
str1,
NoteColumns.TYPE,
NoteColumns.WIDGET_ID,
NoteColumns.WIDGET_TYPE,
};
mBackgroundQueryHandler.startQuery(FOLDER_NOTE_LIST_QUERY_TOKEN, null,
Notes.CONTENT_NOTE_URI, PROJECTION, selection, new String[]{
String.valueOf(mCurrentFolderId)
}, NoteColumns.TYPE + " DESC," + NoteColumns.MODIFIED_DATE + " DESC");
}
}
Loading…
Cancel
Save