From 453ecbed4df5106b000c35afaef7834e27a66c9a Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Tue, 24 Apr 2012 15:29:04 -0700 Subject: [PATCH] Removed a bunch of unnecessary stuff related to toasting on tag save --- .../astrid/actfm/TagSettingsActivity.java | 8 ----- .../astrid/actfm/sync/ActFmSyncService.java | 34 ------------------- astrid/res/values/strings-actfm.xml | 3 -- .../astrid/activity/EditPreferences.java | 4 ++- .../src/com/todoroo/astrid/utility/Flags.java | 5 --- 5 files changed, 3 insertions(+), 51 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java index 755125429..8d4e070eb 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java @@ -26,7 +26,6 @@ import android.widget.CheckBox; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; -import android.widget.Toast; import com.timsu.astrid.R; import com.todoroo.andlib.service.Autowired; @@ -53,7 +52,6 @@ import com.todoroo.astrid.tags.TagFilterExposer; import com.todoroo.astrid.tags.TagService; import com.todoroo.astrid.ui.PeopleContainer; import com.todoroo.astrid.ui.PeopleContainer.ParseSharedException; -import com.todoroo.astrid.utility.Flags; import com.todoroo.astrid.welcome.HelpInfoPopover; public class TagSettingsActivity extends FragmentActivity { @@ -295,7 +293,6 @@ public class TagSettingsActivity extends FragmentActivity { getString(R.string.actfm_TVA_login_to_share), R.string.actfm_EPA_login_button, R.string.actfm_EPA_dont_share_button, android.R.drawable.ic_dialog_alert, okListener, cancelListener); - Toast.makeText(this, R.string.tag_list_saved, Toast.LENGTH_LONG).show(); return; @@ -309,11 +306,6 @@ public class TagSettingsActivity extends FragmentActivity { tagData.setValue(TagData.MEMBER_COUNT, members.length()); tagData.setFlag(TagData.FLAGS, TagData.FLAG_SILENT, isSilent.isChecked()); - if(actFmPreferenceService.isLoggedIn()) - Flags.set(Flags.TOAST_ON_SAVE); - else - Toast.makeText(this, R.string.tag_list_saved, Toast.LENGTH_LONG).show(); - InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(tagName.getWindowToken(), 0); diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java index 15fcdf3e1..2e1ac2684 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java @@ -21,16 +21,11 @@ import org.json.JSONException; import org.json.JSONObject; import android.content.ContentValues; -import android.content.Context; import android.graphics.Bitmap; import android.os.ConditionVariable; -import android.os.Handler; -import android.os.Looper; import android.text.TextUtils; import android.util.Log; -import android.widget.Toast; -import com.timsu.astrid.R; import com.todoroo.andlib.data.AbstractModel; import com.todoroo.andlib.data.DatabaseDao; import com.todoroo.andlib.data.DatabaseDao.ModelUpdateListener; @@ -38,7 +33,6 @@ import com.todoroo.andlib.data.Property.LongProperty; import com.todoroo.andlib.data.Property.StringProperty; import com.todoroo.andlib.data.TodorooCursor; import com.todoroo.andlib.service.Autowired; -import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.sql.Order; @@ -566,7 +560,6 @@ public final class ActFmSyncService { params.add("id"); params.add(remoteId); } - String error = null; try { params.add("token"); params.add(token); JSONObject result = actFmInvoker.invoke("tag_save", params.toArray(new Object[params.size()])); @@ -577,7 +570,6 @@ public final class ActFmSyncService { } } catch (ActFmServiceException e) { handleException("tag-save", e); - error = e.getMessage(); try { fetchTag(tagData); @@ -589,33 +581,7 @@ public final class ActFmSyncService { } catch (IOException e) { addFailedPush(new FailedPush(PUSH_TYPE_TAG, tagData.getId())); handleException("tag-save", e); - error = e.getMessage(); } - if(!Flags.checkAndClear(Flags.TOAST_ON_SAVE)) - return; - - toastSuccessOrFailure(error); - } - - /** - * Show a toast on success (error = nil) or failure - * @param error - */ - private void toastSuccessOrFailure(String error) { - final String finalError = error; - Handler handler = new Handler(Looper.getMainLooper()); - handler.post(new Runnable() { - @Override - public void run() { - Context context = ContextManager.getContext(); - if(finalError == null) - Toast.makeText(context, - R.string.actfm_toast_success, Toast.LENGTH_LONG).show(); - else - Toast.makeText(context, - context.getString(R.string.actfm_toast_error, finalError), Toast.LENGTH_LONG).show(); - } - }); } // --- data fetch methods diff --git a/astrid/res/values/strings-actfm.xml b/astrid/res/values/strings-actfm.xml index 0015d6ecd..83f0dfbb8 100644 --- a/astrid/res/values/strings-actfm.xml +++ b/astrid/res/values/strings-actfm.xml @@ -16,9 +16,6 @@ Saved on Server - - Save Failed: %s - Sorry, this operation is not yet supported for shared tags. diff --git a/astrid/src/com/todoroo/astrid/activity/EditPreferences.java b/astrid/src/com/todoroo/astrid/activity/EditPreferences.java index d995b574f..ceff9f1e0 100644 --- a/astrid/src/com/todoroo/astrid/activity/EditPreferences.java +++ b/astrid/src/com/todoroo/astrid/activity/EditPreferences.java @@ -78,7 +78,7 @@ public class EditPreferences extends TodorooPreferenceActivity { private static final int REQUEST_CODE_PERFORMANCE = 1; public static final int RESULT_CODE_THEME_CHANGED = 1; - public static final int RESULT_CODE_PERFORMANCE_PREF_CHANGED = 2; + public static final int RESULT_CODE_PERFORMANCE_PREF_CHANGED = 3; // --- instance variables @@ -228,6 +228,8 @@ public class EditPreferences extends TodorooPreferenceActivity { preference.setTitle(resolveInfo.activityInfo.loadLabel(pm)); try { Class intentComponent = Class.forName(intent.getComponent().getClassName()); + if (intentComponent.getSuperclass().equals(SyncProviderPreferences.class)) + intentComponent = SyncProviderPreferences.class; if (PREFERENCE_REQUEST_CODES.containsKey(intentComponent)) { final int code = PREFERENCE_REQUEST_CODES.get(intentComponent); preference.setOnPreferenceClickListener(new OnPreferenceClickListener() { diff --git a/astrid/src/com/todoroo/astrid/utility/Flags.java b/astrid/src/com/todoroo/astrid/utility/Flags.java index 6a32714e6..d83d90c40 100644 --- a/astrid/src/com/todoroo/astrid/utility/Flags.java +++ b/astrid/src/com/todoroo/astrid/utility/Flags.java @@ -16,11 +16,6 @@ public class Flags { */ public static final int TAGS_CHANGED = 1 << 1; - /** - * If set, sync service should toast on save or failure - */ - public static final int TOAST_ON_SAVE = 1 << 2; - /** * If set, indicates that the edit popover was dismissed by the edit fragment/back button */