gehusileng_branch
刘德华 1 year ago committed by Gehusileng
parent a3e9802b9d
commit 41cf4e5c75

@ -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)

@ -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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

@ -18,8 +18,8 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/list_background">
android:layout_height="fill_parent">
<!--android:background="@drawable/list_background">-->
<LinearLayout
android:layout_width="fill_parent"
@ -48,6 +48,30 @@
android:fadingEdge="@null" />
</LinearLayout>
<!--回收站按钮-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.NotesListActivity"
tools:ignore="MissingClass">
<ImageButton
android:id="@+id/iconButton"
android:layout_width="57dp"
android:layout_height="66dp"
android:layout_marginStart="16dp"
android:layout_marginBottom="16dp"
android:src="@drawable/delete"
android:layout_gravity="center_vertical|left"/>
<!--
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />-->
</LinearLayout>
<Button
android:id="@+id/btn_new_note"
android:background="@drawable/new_note"

@ -22,11 +22,12 @@
android:layout_height="match_parent"
android:orientation="horizontal">
<Button android:id="@+id/selection_menu"
android:divider="?android:attr/listDividerAlertDialog"
android:singleLine="true"
android:gravity="left|center_vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
style="?android:attr/borderlessButtonStyle" />
<Button
android:id="@+id/selection_menu"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:divider="?android:attr/listDividerAlertDialog"
android:gravity="left|center_vertical"
android:singleLine="true" />
</LinearLayout>

@ -49,4 +49,4 @@
<item
android:id="@+id/menu_delete_remind"
android:title="@string/menu_remove_remind" />
</menu>
</menu>

@ -27,8 +27,7 @@
<item
android:id="@+id/menu_sync"
android:title="@string/menu_sync"/>
android:title="@string/menu_sync" />
<item
android:id="@+id/menu_setting"
android:title="@string/menu_setting" />
@ -36,4 +35,20 @@
<item
android:id="@+id/menu_search"
android:title="@string/menu_search"/>
<!--添加的背景按钮-->
<item
android:id="@+id/menu_MyBackground_cloud"
android:title="@string/menu_MyBackground_cloud"/>
<item
android:id="@+id/menu_MyBackground_lake"
android:title="@string/menu_MyBackground_lake"/>
<item
android:id="@+id/menu_MyBackground_gril"
android:title="@string/menu_MyBackground_gril"/>
<!--回收站按钮-->
<item
android:id="@+id/menu_TrashBin"
android:title="@string/menu_TrashBin"/>
</menu>

@ -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)

@ -36,15 +36,23 @@
<string name="note_link_web">Browse web</string>
<string name="note_link_other">Open map</string>
<!-- Text export file information -->
<string name="file_path">/MIUI/notes/</string>
<string name="file_name_txt_format">notes_%s.txt</string>
<string name="file_path" translatable="false">/MIUI/notes/</string>
<string name="file_name_txt_format" translatable="false">notes_%s.txt</string>
<!-- notes list string -->
<string name="format_folder_files_count">(%d)</string>
<string name="format_folder_files_count" translatable="false">(%d)</string>
<string name="menu_create_folder">New Folder</string>
<string name="menu_export_text">Export text</string>
<string name="menu_sync">Sync</string>
<string name="menu_sync_cancel">Cancel syncing</string>
<string name="menu_setting">Settings</string>
<!--切换背景所需按钮标签-->
<string name="menu_MyBackground_cloud" translatable="false">MyBackground_cloud</string>
<string name="menu_MyBackground_lake" translatable="false">MyBackground_lake</string>
<string name="menu_MyBackground_gril" translatable="false">MyBackground_gril</string>
<!--回收站-->
<string name="menu_TrashBin" translatable="false">TrashBin</string>
<string name="menu_search">Search</string>
<string name="menu_delete">Delete</string>
<string name="menu_move">Move to folder</string>
@ -74,6 +82,13 @@
<string name="alert_title_delete">Delete selected notes</string>
<string name="alert_message_delete_notes">Confirm to delete the selected %d notes?</string>
<string name="alert_message_delete_note">Confirm to delete this note?</string>
<!--切换背景的确认窗口标签-->
<string name="alert_title_check_background" translatable="false">Check background</string>
<string name="alert_message_check_cloud" translatable="false">Confirm to check background to cloud?</string>
<string name="alert_message_check_lake" translatable="false">Confirm to check background to lake?</string>
<string name="alert_message_check_girl" translatable="false">Confirm to check background to girl</string>
<string name="format_move_notes_to_folder">Have moved selected %1$d notes to %2$s folder</string>
<!-- Error information -->
<string name="error_sdcard_unmounted">SD card busy, not available now</string>
@ -84,6 +99,10 @@
<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>
<!--换背景错误操作提醒标签-->
<string name="error_check_background" translatable="false">Sorry, can not check background</string>
<!-- Sync -->
<string name="ticker_syncing">Syncing notes...</string>
<string name="ticker_success">Sync is successful</string>
@ -101,7 +120,7 @@
<string name="preferences_account_title">Sync account</string>
<string name="preferences_account_summary">Sync notes with google task</string>
<string name="preferences_last_sync_time">Last sync time %1$s</string>
<string name="preferences_last_sync_time_format">yyyy-MM-dd hh:mm:ss</string>
<string name="preferences_last_sync_time_format" translatable="false">yyyy-MM-dd hh:mm:ss</string>
<string name="preferences_add_account">Add account</string>
<string name="preferences_menu_change_account">Change sync account</string>
<string name="preferences_menu_remove_account">Remove sync account</string>

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

@ -24,6 +24,7 @@ package net.micode.notes.ui;
* UI
*/
import android.annotation.SuppressLint;
import android.app.Activity; //表示应用程序中的一个活动,例如界面展示等
import android.app.AlertDialog; //用于显示对话框的类
import android.app.Dialog; //用于创建对话框的类
@ -50,6 +51,7 @@ import android.view.Display; //表示屏幕上的显示内
import android.view.HapticFeedbackConstants; //用于触觉反馈的常量值。
import android.view.KeyEvent;
import android.view.LayoutInflater; //用于动态加载 XML 布局文件。
import android.view.Menu; //表示应用程序的菜单。
import android.view.MenuItem; //用于表示菜单项。
@ -123,6 +125,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
NOTE_LIST, SUB_FOLDER, CALL_RECORD_FOLDER
};
private int mBackgroundState = -1; //定义了一个用于标识开始界面背景的变量
private ListEditState mState; //定义了一个标识列表编辑状态的变量
private BackgroundQueryHandler mBackgroundQueryHandler; //用于在后台执行数据库查询等操作以避免阻塞UI线程
@ -174,6 +178,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.note_list);
getWindow().setBackgroundDrawableResource(R.drawable.list_background);
initResources();
/**
@ -275,6 +280,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
mContentResolver = this.getContentResolver();
mBackgroundQueryHandler = new BackgroundQueryHandler(this.getContentResolver());
mCurrentFolderId = Notes.ID_ROOT_FOLDER;
//mCurrentFolderId = Notes.ID_TRASH_FOLER;
mNotesListView = (ListView) findViewById(R.id.notes_list);
mNotesListView.addFooterView(LayoutInflater.from(this).inflate(R.layout.note_list_footer, null),
null, false);
@ -416,12 +422,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
builder.setMessage(getString(R.string.alert_message_delete_notes,
mNotesListAdapter.getSelectedCount()));
builder.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
batchDelete();
}
});
(dialog, which) -> batchDelete());
builder.setNegativeButton(android.R.string.cancel, null);
builder.show();
} else if (itemId == R.id.move) {
@ -571,7 +572,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
// in sync mode, we'll move the deleted note into the trash
// folder
if (!DataUtils.batchMoveToFolder(mContentResolver, mNotesListAdapter
.getSelectedItemIds(), Notes.ID_TRASH_FOLER)) {
.getSelectedItemIds(), Notes.ID_TRASH_FOLDER)) {
Log.e(TAG, "Move notes to trash folder error, should not happens");
}
}
@ -608,7 +609,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
DataUtils.batchDeleteNotes(mContentResolver, ids);
} else {
// in sync mode, we'll move the deleted folder into the trash folder
DataUtils.batchMoveToFolder(mContentResolver, ids, Notes.ID_TRASH_FOLER);
DataUtils.batchMoveToFolder(mContentResolver, ids, Notes.ID_TRASH_FOLDER);
}
if (widgets != null) {
for (AppWidgetAttribute widget : widgets) {
@ -747,6 +748,33 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
});
}
private void checkBackground(int itemId, AlertDialog.Builder bkgBuilder) {
bkgBuilder.setTitle(getString(R.string.alert_title_check_background));
bkgBuilder.setIcon(android.R.drawable.ic_dialog_alert);
if (itemId == R.id.menu_MyBackground_cloud && mBackgroundState != 0) {
bkgBuilder.setMessage(getString(R.string.alert_message_check_cloud));
bkgBuilder.setPositiveButton(android.R.string.ok, (dialog, which) ->
getWindow().setBackgroundDrawableResource(R.drawable.mybackground_cloud)); //采用lambda方法更新背景
mBackgroundState = 0;
bkgBuilder.setNegativeButton(android.R.string.cancel, null);
bkgBuilder.show();
} else if (itemId == R.id.menu_MyBackground_lake && mBackgroundState != 1) {
bkgBuilder.setMessage(getString(R.string.alert_message_check_lake));
bkgBuilder.setPositiveButton(android.R.string.ok, (dialog, which) ->
getWindow().setBackgroundDrawableResource(R.drawable.mybackground_lake));
bkgBuilder.setNegativeButton(android.R.string.cancel, null);
mBackgroundState = 1;
bkgBuilder.show();
} else if (itemId == R.id.menu_MyBackground_gril && mBackgroundState != 2) {
bkgBuilder.setMessage(getString(R.string.alert_message_check_girl));
bkgBuilder.setPositiveButton(android.R.string.ok, (dialog, which) ->
getWindow().setBackgroundDrawableResource(R.drawable.mybackground_girl));
bkgBuilder.setNegativeButton(android.R.string.cancel, null);
mBackgroundState = 2;
bkgBuilder.show();
}
}
@Override
public void onBackPressed() {
switch (mState) {
@ -864,6 +892,12 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId();
/**
*
*/
AlertDialog.Builder bkgBuilder = new AlertDialog.Builder(NotesListActivity.this);
if (itemId == R.id.menu_new_folder) {
showCreateOrModifyFolderDialog(true);
} else if (itemId == R.id.menu_export_text) {
@ -884,7 +918,13 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
createNewNote();
} else if (itemId == R.id.menu_search) {
onSearchRequested();
}
} else if (itemId == R.id.menu_MyBackground_cloud) { //给便签软件换开始界面
checkBackground(itemId, bkgBuilder);
} else if (itemId == R.id.menu_MyBackground_lake) {
checkBackground(itemId, bkgBuilder);
} else if (itemId == R.id.menu_MyBackground_gril) {
checkBackground(itemId, bkgBuilder);
}
return true;
}
@ -935,7 +975,6 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
}.execute();
}
private boolean isSyncMode() {
return NotesPreferenceActivity.getSyncAccountName(this).trim().length() > 0;
}
@ -999,7 +1038,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
selection,
new String[] {
String.valueOf(Notes.TYPE_FOLDER),
String.valueOf(Notes.ID_TRASH_FOLER),
String.valueOf(Notes.ID_TRASH_FOLDER),
String.valueOf(mCurrentFolderId)
},
NoteColumns.MODIFIED_DATE + " DESC");

Loading…
Cancel
Save