功能添加+上个功能补充 #7

Merged
peufo5rvf merged 1 commits from xuningshuo_branch into master 4 weeks ago

@ -250,6 +250,8 @@
</FrameLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/font_size_selector"
android:layout_width="fill_parent"

@ -48,6 +48,21 @@
android:fadingEdge="@null"
android:listSelector="@android:color/transparent"
android:paddingBottom="100dp" />
<GridView
android:id="@+id/notes_grid"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:cacheColorHint="@null"
android:divider="@null"
android:fadingEdge="@null"
android:listSelector="@android:color/transparent"
android:paddingBottom="100dp"
android:numColumns="3"
android:columnWidth="100dp"
android:stretchMode="columnWidth"
android:visibility="gone" />
</LinearLayout>
<Button

@ -33,6 +33,10 @@
android:id="@+id/menu_dark_mode"
android:title="@string/menu_dark_mode"/>
<item
android:id="@+id/menu_layout_mode"
android:title="切换布局"/>
<item
android:id="@+id/menu_sync"
android:title="@string/menu_sync"/>

@ -0,0 +1,32 @@
<?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.
-->
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_restore"
android:title="恢复"/>
<item
android:id="@+id/menu_empty_trash"
android:title="清空回收站"/>
<item
android:id="@+id/menu_exit_folder"
android:title="退至上一级"/>
</menu>

@ -0,0 +1,29 @@
<?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.
-->
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/restore"
android:title="恢复"
android:showAsAction="always|withText" />
<item
android:id="@+id/delete"
android:title="@string/menu_delete"
android:icon="@drawable/menu_delete"
android:showAsAction="always|withText" />
</menu>

@ -1,148 +0,0 @@
<?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.
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_name">便签</string>
<string name="app_widget2x2">便签2x2</string>
<string name="app_widget4x4">便签4x4</string>
<string name="widget_havenot_content">没有关联内容,点击新建便签。</string>
<string name="widget_under_visit_mode">访客模式下,便签内容不可见</string>
<string name="notelist_string_info">...</string>
<string name="notelist_menu_new">新建便签</string>
<string name="delete_remind_time_message">成功删除提醒</string>
<string name="set_remind_time_message">创建提醒</string>
<string name="note_alert_expired">已过期</string>
<string name="format_date_ymd">yyyyMMdd</string>
<string name="format_datetime_mdhm">MM月dd日 kk:mm</string>
<string name="notealert_ok">知道了</string>
<string name="notealert_enter">查看</string>
<string name="note_link_tel">呼叫电话</string>
<string name="note_link_email">发送邮件</string>
<string name="note_link_web">浏览网页</string>
<string name="note_link_other">打开地图</string>
<!-- Text export file information -->
<string name="file_path">/MIUI/notes/</string>
<string name="file_name_txt_format">notes_%s.txt</string>
<!-- notes list string -->
<string name="format_folder_files_count">(%d)</string>
<string name="menu_create_folder">新建文件夹</string>
<string name="menu_export_text">导出文本</string>
<string name="menu_sync">同步</string>
<string name="menu_sync_cancel">取消同步</string>
<string name="menu_setting">设置</string>
<string name="menu_search">搜索</string>
<string name="menu_delete">删除</string>
<string name="menu_move">移动到文件夹</string>
<string name="menu_pin">置顶</string>
<string name="format_pin_notes">已置顶 %d 条便签</string>
<string name="category_important_urgent">重要且紧急</string>
<string name="category_important_not_urgent">重要但不紧急</string>
<string name="category_not_important_urgent">不重要但紧急</string>
<string name="category_not_important_not_urgent">不重要且不紧急</string>
<string name="menu_category">分类</string>
<string name="alert_title_select_category">选择分类</string>
<string name="menu_dark_mode">深色模式</string>
<string name="menu_select_title">选中了 %d 项</string>
<string name="menu_select_none">没有选中项,操作无效</string>
<string name="menu_select_all">全选</string>
<string name="menu_deselect_all">取消全选</string>
<string name="menu_font_size">文字大小</string>
<string name="menu_font_small"></string>
<string name="menu_font_normal">正常</string>
<string name="menu_font_large"></string>
<string name="menu_font_super">超大</string>
<string name="menu_list_mode">进入清单模式</string>
<string name="menu_normal_mode">退出清单模式</string>
<string name="menu_folder_view">查看文件夹</string>
<string name="menu_folder_delete">删除文件夹</string>
<string name="menu_folder_change_name">修改文件夹名称</string>
<string name="folder_exist">文件夹 %1$s 已存在,请重新命名</string>
<string name="menu_share">分享</string>
<string name="menu_send_to_desktop">发送到桌面</string>
<string name="menu_alert">提醒我</string>
<string name="menu_remove_remind">删除提醒</string>
<string name="menu_title_select_folder">选择文件夹</string>
<string name="menu_move_parent_folder">上一级文件夹</string>
<string name="info_note_enter_desktop">已添加到桌面</string>
<string name="alert_title_delete">删除</string>
<string name="alert_message_delete_notes">确认要删除所选的 %d 条便签吗?</string>
<string name="alert_message_delete_note">确认要删除该条便签吗?</string>
<string name="alert_message_delete_folder">确认删除文件夹及所包含的便签吗?</string>
<string name="format_move_notes_to_folder">已将所选 %1$d 条便签移到 %2$s 文件夹</string>
<!-- export text -->
<string name="error_sdcard_unmounted">SD卡被占用不能操作</string>
<string name="error_sdcard_export">导出文本时发生错误请检查SD卡</string>
<string name="error_note_not_exist">要查看的便签不存在</string>
<string name="error_note_empty_for_clock">不能为空便签设置闹钟提醒</string>
<string name="error_note_empty_for_send_to_desktop">不能将空便签发送到桌面</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>
<!-- Sync -->
<string name="ticker_syncing">同步便签...</string>
<string name="ticker_success">同步成功</string>
<string name="ticker_fail">同步失败</string>
<string name="ticker_cancel">同步已取消</string>
<string name="success_sync_account">与%1$s同步成功</string>
<string name="error_sync_network">同步失败,请检查网络和帐号设置</string>
<string name="error_sync_internal">同步失败,发生内部错误</string>
<string name="error_sync_cancelled">同步已取消</string>
<string name="sync_progress_login">登录%1$s...</string>
<string name="sync_progress_init_list">正在获取服务器便签列表...</string>
<string name="sync_progress_syncing">正在同步本地便签...</string>
<!-- Preferences -->
<string name="preferences_title">设置</string>
<string name="preferences_account_title">同步账号</string>
<string name="preferences_account_summary">与google task同步便签记录</string>
<string name="preferences_last_sync_time">上次同步于 %1$s</string>
<string name="preferences_last_sync_time_format">yyyy-MM-dd hh:mm:ss</string>
<string name="preferences_add_account">添加账号</string>
<string name="preferences_menu_change_account">更换账号</string>
<string name="preferences_menu_remove_account">删除账号</string>
<string name="preferences_menu_cancel">取消</string>
<string name="preferences_button_sync_immediately">立即同步</string>
<string name="preferences_button_sync_cancel">取消同步</string>
<string name="preferences_dialog_change_account_title">当前帐号 %1$s</string>
<string name="preferences_dialog_change_account_warn_msg">如更换同步帐号,过去的帐号同步信息将被清空,再次切换的同时可能会造成数据重复</string>
<string name="preferences_dialog_select_account_title">同步便签</string>
<string name="preferences_dialog_select_account_tips">请选择google帐号便签将与该帐号的google task内容同步。</string>
<string name="preferences_toast_cannot_change_account">正在同步中,不能修改同步帐号</string>
<string name="preferences_toast_success_set_accout">同步帐号已设置为%1$s</string>
<string name="preferences_bg_random_appear_title">新建便签背景颜色随机</string>
<string name="button_delete">删除</string>
<string name="call_record_folder_name">通话便签</string>
<string name="hint_foler_name">请输入名称</string>
<string name="search_label">正在搜索便签</string>
<string name="search_hint">搜索便签</string>
<string name="search_setting_description">便签中的文字</string>
<string name="search">便签</string>
<string name="datetime_dialog_ok">设置</string>
<string name="datetime_dialog_cancel">取消</string>
<plurals name="search_results_title">
<item quantity="one"><xliff:g id="number" example="1">%1$s</xliff:g> 条符合"<xliff:g id="search" example="???">%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> 条符合"<xliff:g id="search" example="???">%2$s</xliff:g>"的搜索结果</item>
</plurals>
<!-- 回收站相关字符串 -->
<string name="alert_title_empty_trash">清空回收站</string>
<string name="alert_message_empty_trash">确认要清空回收站中的所有便签吗?此操作不可恢复。</string>
<string name="format_restore_notes">已恢复 %d 条便签</string>
<string name="toast_empty_trash_success">回收站已清空</string>
</resources>

@ -451,6 +451,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
View view = findViewById(id);
view.setOnClickListener(this);
};//对字体大小的选择
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
mFontSizeId = mSharedPrefs.getInt(PREFERENCE_FONT_SIZE, ResourceParser.BG_DEFAULT_FONT_SIZE);
/**

@ -39,6 +39,7 @@ import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ListView;
import android.widget.PopupMenu;
import android.widget.TextView;
@ -91,6 +92,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
private ListView mNotesListView;
private GridView mNotesGridView;
private Button mAddNewNote;
private boolean mDispatch;
@ -115,6 +118,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
private NoteItemData mFocusNoteDataItem;
private boolean mIsGridMode = false; // 是否为九宫格模式
private static final String NORMAL_SELECTION = NoteColumns.PARENT_ID + "=?";
private static final String ROOT_FOLDER_SELECTION = "(" + NoteColumns.TYPE + "<>"
@ -234,6 +239,13 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
mNotesListView.setOnItemLongClickListener(this);
mNotesListAdapter = new NotesListAdapter(this);
mNotesListView.setAdapter(mNotesListAdapter);
// 初始化GridView
mNotesGridView = (GridView) findViewById(R.id.notes_grid);
mNotesGridView.setOnItemClickListener(new OnListItemClickListener());
mNotesGridView.setOnItemLongClickListener(this);
mNotesGridView.setAdapter(mNotesListAdapter);
mAddNewNote = (Button) findViewById(R.id.btn_new_note);// 在activity中要获取该按钮
mAddNewNote.setOnClickListener(this);
mAddNewNote.setOnTouchListener(new NewNoteOnTouchListener());
@ -880,6 +892,10 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
toggleDarkMode();
break;
}
case R.id.menu_layout_mode: {
toggleLayoutMode();
break;
}
case R.id.menu_sync: {
if (isSyncMode()) {
if (TextUtils.equals(item.getTitle(), getString(R.string.menu_sync))) {
@ -1052,6 +1068,21 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
}
private void toggleLayoutMode() {
mIsGridMode = !mIsGridMode;
if (mIsGridMode) {
// 切换到九宫格模式
mNotesListView.setVisibility(View.GONE);
mNotesGridView.setVisibility(View.VISIBLE);
Toast.makeText(this, "已切换到九宫格模式", Toast.LENGTH_SHORT).show();
} else {
// 切换到列表模式
mNotesGridView.setVisibility(View.GONE);
mNotesListView.setVisibility(View.VISIBLE);
Toast.makeText(this, "已切换到列表模式", Toast.LENGTH_SHORT).show();
}
}
private void restoreSelectedNotes() {
if (mNotesListAdapter.getSelectedCount() == 0) {
Toast.makeText(this, "请先选择要恢复的便签", Toast.LENGTH_SHORT).show();

Loading…
Cancel
Save