Skip to content
Browse files

Simple help info when enabling Remote Search

  • Loading branch information...
1 parent e902ed3 commit 63f1c9c9819955b2c35533b4be71302771b67775 @rbayer committed Feb 29, 2012
Showing with 59 additions and 10 deletions.
  1. +5 −0 res/values/strings.xml
  2. +54 −10 src/com/fsck/k9/activity/setup/AccountSettings.java
View
5 res/values/strings.xml
@@ -1148,4 +1148,9 @@ the import operation. Please install a file manager application from Android Mar
<string name="account_settings_remote_search">Remote Folder Searching</string>
<string name="account_settings_remote_search_full_text_summary">Can be slow</string>
<string name="account_settings_remote_search_full_text">Include Body Text</string>
+ <string name="account_settings_allow_remote_search_help">
+ To perform a remote search, press your device\'s Search button while viewing a folder from this account.
+ \n\nNote: Remote search is NOT available from the Unified Inbox or from a list of folders.
+ </string>
+ <string name="no_show_again">Don\'t Show Again</string>
</resources>
View
64 src/com/fsck/k9/activity/setup/AccountSettings.java
@@ -1,19 +1,30 @@
package com.fsck.k9.activity.setup;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import android.app.AlertDialog;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Vibrator;
-import android.preference.*;
+import android.preference.CheckBoxPreference;
+import android.preference.EditTextPreference;
+import android.preference.ListPreference;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceChangeListener;
+import android.preference.PreferenceScreen;
+import android.preference.RingtonePreference;
import android.util.Log;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.LinkedList;
-import java.util.List;
+import android.view.View;
+import android.widget.CheckBox;
import com.fsck.k9.Account;
import com.fsck.k9.Account.FolderMode;
@@ -22,18 +33,17 @@
import com.fsck.k9.NotificationSetting;
import com.fsck.k9.Preferences;
import com.fsck.k9.R;
-import com.fsck.k9.mail.Folder;
import com.fsck.k9.activity.ChooseFolder;
import com.fsck.k9.activity.ChooseIdentity;
import com.fsck.k9.activity.ColorPickerDialog;
import com.fsck.k9.activity.K9PreferenceActivity;
import com.fsck.k9.activity.ManageIdentities;
import com.fsck.k9.crypto.Apg;
+import com.fsck.k9.mail.Folder;
import com.fsck.k9.mail.Store;
-import com.fsck.k9.service.MailService;
-
-import com.fsck.k9.mail.store.StorageManager;
import com.fsck.k9.mail.store.LocalStore.LocalFolder;
+import com.fsck.k9.mail.store.StorageManager;
+import com.fsck.k9.service.MailService;
public class AccountSettings extends K9PreferenceActivity {
@@ -477,6 +487,15 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
// IMAP-specific preferences
mAllowRemoteSearch = (CheckBoxPreference) findPreference(PREFERENCE_ALLOW_REMOTE_SEARCH);
+
+ mAllowRemoteSearch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+ public boolean onPreferenceChange(Preference pref, Object newVal){
+ if((Boolean) newVal){
+ showRemoteSearchHelp();
+ }
+ return true;
+ }
+ });
mRemoteSearchNumResults = (ListPreference) findPreference(PREFERENCE_REMOTE_SEARCH_NUM_RESULTS);
mRemoteSearchFullText = (CheckBoxPreference) findPreference(PREFERENCE_REMOTE_SEARCH_FULL_TEXT);
mPushPollOnConnect = (CheckBoxPreference) findPreference(PREFERENCE_PUSH_POLL_ON_CONNECT);
@@ -675,6 +694,31 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
handleCryptoAppDependencies();
}
+ protected void showRemoteSearchHelp() {
+ final String noShowHelpPref = "account_settings_remote_search_hide_help";
+ final SharedPreferences prefs = getPreferences(MODE_PRIVATE);
+ if(!prefs.getBoolean(noShowHelpPref, false)){
+ AlertDialog.Builder adb = new AlertDialog.Builder(this);
+ final CheckBox noShowAgain = new CheckBox(this);
+ noShowAgain.setChecked(false);
+ noShowAgain.setText(R.string.no_show_again);
+ adb.setView(noShowAgain)
+ .setMessage(getString(R.string.account_settings_allow_remote_search_help))
+ .setCancelable(false)
+ .setPositiveButton(R.string.okay_action, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ if(noShowAgain.isChecked()){
+ Editor edit = prefs.edit();
+ edit.putBoolean(noShowHelpPref, true);
+ edit.commit();
+ }
+ }
+ });
+ adb.create().show();
+ }
+
+ }
+
private void handleCryptoAppDependencies() {
if ("".equals(mCryptoApp.getValue())) {
mCryptoAutoSignature.setEnabled(false);

0 comments on commit 63f1c9c

Please sign in to comment.
Something went wrong with that request. Please try again.