Skip to content

Commit

Permalink
Merge pull request #568 from wordpress-mobile/issue/311-confusing-err…
Browse files Browse the repository at this point in the history
…or-dialogs

fix #311: replace confusing error dialog by a toast
  • Loading branch information
roundhill committed Dec 23, 2013
2 parents 43ce1b0 + 2816c78 commit bd410de
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 123 deletions.
11 changes: 7 additions & 4 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@
<string name="reset_auto_share_preference">Reset auto-sharing settings</string>
<string name="auto_sharing_preference_reset">Auto-sharing settings reset.</string>
<string name="auto_sharing_preference_reset_caused_by_error">Previously selected blog is no longer visible.</string>

<string name="always_use_these_settings_to_share">Always use these settings</string>

<!-- file errors -->
<string name="file_error_create">Could not create temp file for media upload. Please make sure there is enough free space on your device.</string>

Expand Down Expand Up @@ -536,7 +537,11 @@

<!-- Error Messages -->
<string name="error_delete_post">Sorry, an error occurred while attempting to delete the %s.</string>
<string name="error_refresh">Sorry, %s could not be refreshed at this time. Please try again later.</string>
<!-- The 4 following messages can't be factorized due to i18n -->
<string name="error_refresh_posts">Posts could not be refreshed at this time.</string>
<string name="error_refresh_pages">Pages could not be refreshed at this time.</string>
<string name="error_refresh_notifications">Notifications could not be refreshed at this time.</string>
<string name="error_refresh_comments">Comments could not be refreshed at this time.</string>
<string name="error_generic">Sorry, an error occurred. Please try again later.</string>
<string name="error_parsing_response">Sorry, an error occurred while fetching data. Please try again later.</string>
<string name="error_moderate_comment">Sorry, an error occurred while attempting to moderate. Please try again later.</string>
Expand Down Expand Up @@ -702,6 +707,4 @@
<string name="nux_welcome_create_account">Create account</string>
<string name="nux_add_selfhosted_blog">Add self-hosted site</string>
<string name="nux_oops_not_selfhosted_blog">Sign in to WordPress.com</string>
<string name="one_blog_must_be_selected">At least one blog must be visible</string>
<string name="always_use_these_settings_to_share">Always use these settings</string>
</resources>
2 changes: 0 additions & 2 deletions src/org/wordpress/android/ui/WPActionBarActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,6 @@ public void onSignout() {

}



public void startAnimatingRefreshButton(MenuItem refreshItem) {
if (refreshItem != null && !isAnimatingRefreshButton) {
isAnimatingRefreshButton = true;
Expand Down
5 changes: 3 additions & 2 deletions src/org/wordpress/android/ui/comments/CommentsActivity.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.wordpress.android.ui.comments;

import java.util.List;

import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Intent;
Expand All @@ -26,6 +24,8 @@
import org.wordpress.android.ui.comments.CommentsListFragment.OnCommentSelectedListener;
import org.wordpress.android.util.ToastUtils;

import java.util.List;

public class CommentsActivity extends WPActionBarActivity
implements OnCommentSelectedListener,
CommentActions.OnCommentChangeListener,
Expand Down Expand Up @@ -321,6 +321,7 @@ public void onAnimateRefreshButton(boolean start) {
shouldAnimateRefreshButton = true;
this.startAnimatingRefreshButton(refreshMenuItem);
} else {
shouldAnimateRefreshButton = false;
this.stopAnimatingRefreshButton(refreshMenuItem);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.wordpress.android.util.GravatarUtils;
import org.wordpress.android.util.ListScrollPositionManager;
import org.wordpress.android.util.StringUtils;
import org.wordpress.android.util.ToastUtils;
import org.wordpress.android.util.WPAlertDialogFragment;
import org.xmlrpc.android.ApiHelper;
import org.xmlrpc.android.XMLRPCClient;
Expand Down Expand Up @@ -728,11 +729,8 @@ protected void onPostExecute(Map<Integer, Map<?, ?>> commentsResult) {

mOnAnimateRefreshButton.onAnimateRefreshButton(false);
if (!moderateErrorMsg.equals("") && !getActivity().isFinishing()) {
FragmentTransaction ft = getFragmentManager().beginTransaction();
WPAlertDialogFragment alert = WPAlertDialogFragment.newInstance(
String.format(getResources().getString(R.string.error_refresh),
getResources().getText(R.string.tab_comments)), moderateErrorMsg);
alert.show(ft, "alert");
ToastUtils.showToast(getActivity(), R.string.error_refresh_comments,
ToastUtils.Duration.LONG);
moderateErrorMsg = "";
}
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.wordpress.android.ui.comments.CommentActions;
import org.wordpress.android.ui.comments.CommentDetailFragment;
import org.wordpress.android.ui.reader_native.actions.ReaderAuthActions;
import org.wordpress.android.util.ToastUtils;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -42,6 +43,7 @@
import java.util.Map;
import java.util.Set;

import static org.wordpress.android.WordPress.getContext;
import static org.wordpress.android.WordPress.restClient;

public class NotificationsActivity extends WPActionBarActivity implements CommentActions.OnCommentChangeListener {
Expand Down Expand Up @@ -466,7 +468,8 @@ public void onErrorResponse(VolleyError error){
adapter.clear();
adapter.addAll(new ArrayList<Note>());
adapter.notifyDataSetChanged();
Toast.makeText(NotificationsActivity.this, String.format(getResources().getString(R.string.error_refresh), getResources().getText(R.string.notifications).toString().toLowerCase()), Toast.LENGTH_LONG).show();
ToastUtils.showToast(getContext(), R.string.error_refresh_notifications,
ToastUtils.Duration.LONG);
stopAnimatingRefreshButton(mRefreshMenuItem);
shouldAnimateRefreshButton = false;
}
Expand Down
Loading

0 comments on commit bd410de

Please sign in to comment.