|
|
|
@ -14,63 +14,61 @@
|
|
|
|
* limitations under the License.
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
package net.micode.notes.ui;
|
|
|
|
package net.micode.notes.ui;
|
|
|
|
|
|
|
|
|
|
|
|
import android.accounts.Account;
|
|
|
|
import android.accounts.Account;
|
|
|
|
import android.accounts.AccountManager;
|
|
|
|
import android.accounts.AccountManager;
|
|
|
|
import android.app.ActionBar;
|
|
|
|
import android.app.ActionBar;
|
|
|
|
import android.app.AlertDialog;
|
|
|
|
import android.app.AlertDialog;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
|
|
import android.content.ContentValues;
|
|
|
|
import android.content.ContentValues;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.DialogInterface;
|
|
|
|
import android.content.DialogInterface;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.IntentFilter;
|
|
|
|
import android.content.IntentFilter;
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.preference.Preference;
|
|
|
|
import android.preference.Preference;
|
|
|
|
import android.preference.Preference.OnPreferenceClickListener;
|
|
|
|
import android.preference.Preference.OnPreferenceClickListener;
|
|
|
|
import android.preference.PreferenceActivity;
|
|
|
|
import android.preference.PreferenceActivity;
|
|
|
|
import android.preference.PreferenceCategory;
|
|
|
|
import android.preference.PreferenceCategory;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.format.DateFormat;
|
|
|
|
import android.text.format.DateFormat;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.Toast;
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
|
|
|
|
import net.micode.notes.R;
|
|
|
|
import net.micode.notes.R;
|
|
|
|
import net.micode.notes.data.Notes;
|
|
|
|
import net.micode.notes.data.Notes;
|
|
|
|
import net.micode.notes.data.Notes.NoteColumns;
|
|
|
|
import net.micode.notes.data.Notes.NoteColumns;
|
|
|
|
import net.micode.notes.gtask.remote.GTaskSyncService;
|
|
|
|
import net.micode.notes.gtask.remote.GTaskSyncService;
|
|
|
|
|
|
|
|
|
|
|
|
// 定义一个名为 NotesPreferenceActivity 的类,继承自 PreferenceActivity
|
|
|
|
|
|
|
|
public class NotesPreferenceActivity extends PreferenceActivity {
|
|
|
|
public class NotesPreferenceActivity extends PreferenceActivity {
|
|
|
|
public static final String PREFERENCE_NAME = "notes_preferences";
|
|
|
|
public static final String PREFERENCE_NAME = "notes_preferences";
|
|
|
|
// 同步账户名称的偏好键名
|
|
|
|
|
|
|
|
public static final String PREFERENCE_SYNC_ACCOUNT_NAME = "pref_key_account_name";
|
|
|
|
public static final String PREFERENCE_SYNC_ACCOUNT_NAME = "pref_key_account_name";
|
|
|
|
// 最后同步时间的偏好键名
|
|
|
|
|
|
|
|
public static final String PREFERENCE_LAST_SYNC_TIME = "pref_last_sync_time";
|
|
|
|
public static final String PREFERENCE_LAST_SYNC_TIME = "pref_last_sync_time";
|
|
|
|
// 设置背景颜色随机出现的偏好键名
|
|
|
|
|
|
|
|
public static final String PREFERENCE_SET_BG_COLOR_KEY = "pref_key_bg_random_appear";
|
|
|
|
public static final String PREFERENCE_SET_BG_COLOR_KEY = "pref_key_bg_random_appear";
|
|
|
|
// 同步账户偏好类别键名
|
|
|
|
|
|
|
|
private static final String PREFERENCE_SYNC_ACCOUNT_KEY = "pref_sync_account_key";
|
|
|
|
private static final String PREFERENCE_SYNC_ACCOUNT_KEY = "pref_sync_account_key";
|
|
|
|
// 权限过滤器键名
|
|
|
|
|
|
|
|
private static final String AUTHORITIES_FILTER_KEY = "authorities";
|
|
|
|
private static final String AUTHORITIES_FILTER_KEY = "authorities";
|
|
|
|
|
|
|
|
|
|
|
|
// 账户偏好类别对象
|
|
|
|
|
|
|
|
private PreferenceCategory mAccountCategory;
|
|
|
|
private PreferenceCategory mAccountCategory;
|
|
|
|
// 广播接收器对象
|
|
|
|
|
|
|
|
private GTaskReceiver mReceiver;
|
|
|
|
private GTaskReceiver mReceiver;
|
|
|
|
// 原始账户数组
|
|
|
|
|
|
|
|
private Account[] mOriAccounts;
|
|
|
|
private Account[] mOriAccounts;
|
|
|
|
// 是否添加了账户的标志
|
|
|
|
|
|
|
|
private boolean mHasAddedAccount;
|
|
|
|
private boolean mHasAddedAccount;
|
|
|
|
|
|
|
|
|
|
|
|
// 活动创建时调用的方法
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle icicle) {
|
|
|
|
protected void onCreate(Bundle icicle) {
|
|
|
|
super.onCreate(icicle);
|
|
|
|
super.onCreate(icicle);
|
|
|
|
@ -78,30 +76,27 @@
|
|
|
|
/* using the app icon for navigation */
|
|
|
|
/* using the app icon for navigation */
|
|
|
|
getActionBar().setDisplayHomeAsUpEnabled(true);
|
|
|
|
getActionBar().setDisplayHomeAsUpEnabled(true);
|
|
|
|
|
|
|
|
|
|
|
|
// 从资源文件中加载偏好设置
|
|
|
|
|
|
|
|
addPreferencesFromResource(R.xml.preferences);
|
|
|
|
addPreferencesFromResource(R.xml.preferences);
|
|
|
|
mAccountCategory = (PreferenceCategory) findPreference(PREFERENCE_SYNC_ACCOUNT_KEY);
|
|
|
|
mAccountCategory = (PreferenceCategory) findPreference(PREFERENCE_SYNC_ACCOUNT_KEY);
|
|
|
|
mReceiver = new GTaskReceiver();
|
|
|
|
mReceiver = new GTaskReceiver();
|
|
|
|
IntentFilter filter = new IntentFilter();
|
|
|
|
IntentFilter filter = new IntentFilter();
|
|
|
|
filter.addAction(GTaskSyncService.GTASK_SERVICE_BROADCAST_NAME);
|
|
|
|
filter.addAction(GTaskSyncService.GTASK_SERVICE_BROADCAST_NAME);
|
|
|
|
// 注册广播接收器
|
|
|
|
|
|
|
|
registerReceiver(mReceiver, filter);
|
|
|
|
registerReceiver(mReceiver, filter);
|
|
|
|
|
|
|
|
|
|
|
|
mOriAccounts = null;
|
|
|
|
mOriAccounts = null;
|
|
|
|
// 加载头部视图
|
|
|
|
|
|
|
|
View header = LayoutInflater.from(this).inflate(R.layout.settings_header, null);
|
|
|
|
View header = LayoutInflater.from(this).inflate(R.layout.settings_header, null);
|
|
|
|
getListView().addHeaderView(header, null, true);
|
|
|
|
getListView().addHeaderView(header, null, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 活动恢复时调用的方法
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onResume() {
|
|
|
|
protected void onResume() {
|
|
|
|
super.onResume();
|
|
|
|
super.onResume();
|
|
|
|
|
|
|
|
|
|
|
|
// 如果添加了账户,则需要自动设置同步账户
|
|
|
|
// need to set sync account automatically if user has added a new
|
|
|
|
|
|
|
|
// account
|
|
|
|
if (mHasAddedAccount) {
|
|
|
|
if (mHasAddedAccount) {
|
|
|
|
Account[] accounts = getGoogleAccounts();
|
|
|
|
Account[] accounts = getGoogleAccounts();
|
|
|
|
if (mOriAccounts!= null && accounts.length > mOriAccounts.length) {
|
|
|
|
if (mOriAccounts != null && accounts.length > mOriAccounts.length) {
|
|
|
|
for (Account accountNew : accounts) {
|
|
|
|
for (Account accountNew : accounts) {
|
|
|
|
boolean found = false;
|
|
|
|
boolean found = false;
|
|
|
|
for (Account accountOld : mOriAccounts) {
|
|
|
|
for (Account accountOld : mOriAccounts) {
|
|
|
|
@ -118,21 +113,17 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 刷新用户界面
|
|
|
|
|
|
|
|
refreshUI();
|
|
|
|
refreshUI();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 活动销毁时调用的方法
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onDestroy() {
|
|
|
|
protected void onDestroy() {
|
|
|
|
if (mReceiver!= null) {
|
|
|
|
if (mReceiver != null) {
|
|
|
|
// 注销广播接收器
|
|
|
|
|
|
|
|
unregisterReceiver(mReceiver);
|
|
|
|
unregisterReceiver(mReceiver);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
super.onDestroy();
|
|
|
|
super.onDestroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 加载账户偏好设置的方法
|
|
|
|
|
|
|
|
private void loadAccountPreference() {
|
|
|
|
private void loadAccountPreference() {
|
|
|
|
mAccountCategory.removeAll();
|
|
|
|
mAccountCategory.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
@ -144,14 +135,14 @@
|
|
|
|
public boolean onPreferenceClick(Preference preference) {
|
|
|
|
public boolean onPreferenceClick(Preference preference) {
|
|
|
|
if (!GTaskSyncService.isSyncing()) {
|
|
|
|
if (!GTaskSyncService.isSyncing()) {
|
|
|
|
if (TextUtils.isEmpty(defaultAccount)) {
|
|
|
|
if (TextUtils.isEmpty(defaultAccount)) {
|
|
|
|
// 如果是第一次设置账户,则显示选择账户的警告对话框
|
|
|
|
// the first time to set account
|
|
|
|
showSelectAccountAlertDialog();
|
|
|
|
showSelectAccountAlertDialog();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// 如果账户已经设置,则显示更改账户确认的警告对话框
|
|
|
|
// if the account has already been set, we need to promp
|
|
|
|
|
|
|
|
// user about the risk
|
|
|
|
showChangeAccountConfirmAlertDialog();
|
|
|
|
showChangeAccountConfirmAlertDialog();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// 如果正在同步,则显示不能更改账户的吐司消息
|
|
|
|
|
|
|
|
Toast.makeText(NotesPreferenceActivity.this,
|
|
|
|
Toast.makeText(NotesPreferenceActivity.this,
|
|
|
|
R.string.preferences_toast_cannot_change_account, Toast.LENGTH_SHORT)
|
|
|
|
R.string.preferences_toast_cannot_change_account, Toast.LENGTH_SHORT)
|
|
|
|
.show();
|
|
|
|
.show();
|
|
|
|
@ -163,12 +154,11 @@
|
|
|
|
mAccountCategory.addPreference(accountPref);
|
|
|
|
mAccountCategory.addPreference(accountPref);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 加载同步按钮的方法
|
|
|
|
|
|
|
|
private void loadSyncButton() {
|
|
|
|
private void loadSyncButton() {
|
|
|
|
Button syncButton = (Button) findViewById(R.id.preference_sync_button);
|
|
|
|
Button syncButton = (Button) findViewById(R.id.preference_sync_button);
|
|
|
|
TextView lastSyncTimeView = (TextView) findViewById(R.id.prefenerece_sync_status_textview);
|
|
|
|
TextView lastSyncTimeView = (TextView) findViewById(R.id.prefenerece_sync_status_textview);
|
|
|
|
|
|
|
|
|
|
|
|
// 设置按钮状态
|
|
|
|
// set button state
|
|
|
|
if (GTaskSyncService.isSyncing()) {
|
|
|
|
if (GTaskSyncService.isSyncing()) {
|
|
|
|
syncButton.setText(getString(R.string.preferences_button_sync_cancel));
|
|
|
|
syncButton.setText(getString(R.string.preferences_button_sync_cancel));
|
|
|
|
syncButton.setOnClickListener(new View.OnClickListener() {
|
|
|
|
syncButton.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@ -186,13 +176,13 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
syncButton.setEnabled(!TextUtils.isEmpty(getSyncAccountName(this)));
|
|
|
|
syncButton.setEnabled(!TextUtils.isEmpty(getSyncAccountName(this)));
|
|
|
|
|
|
|
|
|
|
|
|
// 设置最后同步时间文本
|
|
|
|
// set last sync time
|
|
|
|
if (GTaskSyncService.isSyncing()) {
|
|
|
|
if (GTaskSyncService.isSyncing()) {
|
|
|
|
lastSyncTimeView.setText(GTaskSyncService.getProgressString());
|
|
|
|
lastSyncTimeView.setText(GTaskSyncService.getProgressString());
|
|
|
|
lastSyncTimeView.setVisibility(View.VISIBLE);
|
|
|
|
lastSyncTimeView.setVisibility(View.VISIBLE);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
long lastSyncTime = getLastSyncTime(this);
|
|
|
|
long lastSyncTime = getLastSyncTime(this);
|
|
|
|
if (lastSyncTime!= 0) {
|
|
|
|
if (lastSyncTime != 0) {
|
|
|
|
lastSyncTimeView.setText(getString(R.string.preferences_last_sync_time,
|
|
|
|
lastSyncTimeView.setText(getString(R.string.preferences_last_sync_time,
|
|
|
|
DateFormat.format(getString(R.string.preferences_last_sync_time_format),
|
|
|
|
DateFormat.format(getString(R.string.preferences_last_sync_time_format),
|
|
|
|
lastSyncTime)));
|
|
|
|
lastSyncTime)));
|
|
|
|
@ -203,13 +193,11 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 刷新用户界面的方法
|
|
|
|
|
|
|
|
private void refreshUI() {
|
|
|
|
private void refreshUI() {
|
|
|
|
loadAccountPreference();
|
|
|
|
loadAccountPreference();
|
|
|
|
loadSyncButton();
|
|
|
|
loadSyncButton();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 显示选择账户警告对话框的方法
|
|
|
|
|
|
|
|
private void showSelectAccountAlertDialog() {
|
|
|
|
private void showSelectAccountAlertDialog() {
|
|
|
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
|
|
|
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
|
|
|
|
|
|
|
|
|
|
|
|
@ -266,7 +254,6 @@
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 显示更改账户确认警告对话框的方法
|
|
|
|
|
|
|
|
private void showChangeAccountConfirmAlertDialog() {
|
|
|
|
private void showChangeAccountConfirmAlertDialog() {
|
|
|
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
|
|
|
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
|
|
|
|
|
|
|
|
|
|
|
|
@ -296,28 +283,26 @@
|
|
|
|
dialogBuilder.show();
|
|
|
|
dialogBuilder.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取谷歌账户数组的方法
|
|
|
|
|
|
|
|
private Account[] getGoogleAccounts() {
|
|
|
|
private Account[] getGoogleAccounts() {
|
|
|
|
AccountManager accountManager = AccountManager.get(this);
|
|
|
|
AccountManager accountManager = AccountManager.get(this);
|
|
|
|
return accountManager.getAccountsByType("com.google");
|
|
|
|
return accountManager.getAccountsByType("com.google");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 设置同步账户的方法
|
|
|
|
|
|
|
|
private void setSyncAccount(String account) {
|
|
|
|
private void setSyncAccount(String account) {
|
|
|
|
if (!getSyncAccountName(this).equals(account)) {
|
|
|
|
if (!getSyncAccountName(this).equals(account)) {
|
|
|
|
SharedPreferences settings = getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE);
|
|
|
|
SharedPreferences settings = getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE);
|
|
|
|
SharedPreferences.Editor editor = settings.edit();
|
|
|
|
SharedPreferences.Editor editor = settings.edit();
|
|
|
|
if (account!= null) {
|
|
|
|
if (account != null) {
|
|
|
|
editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, account);
|
|
|
|
editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, account);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, "");
|
|
|
|
editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
editor.commit();
|
|
|
|
editor.commit();
|
|
|
|
|
|
|
|
|
|
|
|
// 清理最后同步时间
|
|
|
|
// clean up last sync time
|
|
|
|
setLastSyncTime(this, 0);
|
|
|
|
setLastSyncTime(this, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// 清理本地与谷歌任务相关的信息
|
|
|
|
// clean up local gtask related info
|
|
|
|
new Thread(new Runnable() {
|
|
|
|
new Thread(new Runnable() {
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
ContentValues values = new ContentValues();
|
|
|
|
ContentValues values = new ContentValues();
|
|
|
|
@ -333,7 +318,6 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 移除同步账户的方法
|
|
|
|
|
|
|
|
private void removeSyncAccount() {
|
|
|
|
private void removeSyncAccount() {
|
|
|
|
SharedPreferences settings = getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE);
|
|
|
|
SharedPreferences settings = getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE);
|
|
|
|
SharedPreferences.Editor editor = settings.edit();
|
|
|
|
SharedPreferences.Editor editor = settings.edit();
|
|
|
|
@ -345,7 +329,7 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
editor.commit();
|
|
|
|
editor.commit();
|
|
|
|
|
|
|
|
|
|
|
|
// 清理本地与谷歌任务相关的信息
|
|
|
|
// clean up local gtask related info
|
|
|
|
new Thread(new Runnable() {
|
|
|
|
new Thread(new Runnable() {
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
ContentValues values = new ContentValues();
|
|
|
|
ContentValues values = new ContentValues();
|
|
|
|
@ -356,14 +340,12 @@
|
|
|
|
}).start();
|
|
|
|
}).start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取同步账户名称的静态方法
|
|
|
|
|
|
|
|
public static String getSyncAccountName(Context context) {
|
|
|
|
public static String getSyncAccountName(Context context) {
|
|
|
|
SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME,
|
|
|
|
SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME,
|
|
|
|
Context.MODE_PRIVATE);
|
|
|
|
Context.MODE_PRIVATE);
|
|
|
|
return settings.getString(PREFERENCE_SYNC_ACCOUNT_NAME, "");
|
|
|
|
return settings.getString(PREFERENCE_SYNC_ACCOUNT_NAME, "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 设置最后同步时间的静态方法
|
|
|
|
|
|
|
|
public static void setLastSyncTime(Context context, long time) {
|
|
|
|
public static void setLastSyncTime(Context context, long time) {
|
|
|
|
SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME,
|
|
|
|
SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME,
|
|
|
|
Context.MODE_PRIVATE);
|
|
|
|
Context.MODE_PRIVATE);
|
|
|
|
@ -372,14 +354,12 @@
|
|
|
|
editor.commit();
|
|
|
|
editor.commit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取最后同步时间的静态方法
|
|
|
|
|
|
|
|
public static long getLastSyncTime(Context context) {
|
|
|
|
public static long getLastSyncTime(Context context) {
|
|
|
|
SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME,
|
|
|
|
SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME,
|
|
|
|
Context.MODE_PRIVATE);
|
|
|
|
Context.MODE_PRIVATE);
|
|
|
|
return settings.getLong(PREFERENCE_LAST_SYNC_TIME, 0);
|
|
|
|
return settings.getLong(PREFERENCE_LAST_SYNC_TIME, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 广播接收器内部类
|
|
|
|
|
|
|
|
private class GTaskReceiver extends BroadcastReceiver {
|
|
|
|
private class GTaskReceiver extends BroadcastReceiver {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@ -394,8 +374,7 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 选项菜单项被选择时调用的方法
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
public boolean onOptionsItemSelected(
|
|
|
|
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
case android.R.id.home:
|
|
|
|
case android.R.id.home:
|
|
|
|
Intent intent = new Intent(this, NotesListActivity.class);
|
|
|
|
Intent intent = new Intent(this, NotesListActivity.class);
|
|
|
|
|