Explicitly call out the name of the folder/label being removed.
Fixes b/On swipe change copy for Remove from label to Remove from [labelname]
Also, that's not a not =P if it is animating, skip, otherwise, refresh
Change-Id: I450033cac8adf2b95e9ed101e1a4651f708e5ac0
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0c30907..5c23de1 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -112,7 +112,7 @@
<!-- Menu item: remove the star from this conversation -->
<string name="remove_star">Remove star</string>
<!-- Remove the folder from this conversation [CHAR LIMIT = 30]-->
- <string name="remove_folder">Remove from folder</string>
+ <string name="remove_folder">Remove from <xliff:g id="folderName">%1$s</xliff:g></string>
<!-- Menu item: archive this conversation -->
<string name="archive">Archive</string>
<!-- Menu item: report this conversation as spam [CHAR LIMIT = 30] -->
@@ -433,7 +433,7 @@
<!-- Displayed when swiping away a single conversation to archive it [CHAR LIMIT=80] -->
<string name="archived">Archived</string>
<!-- Displayed when swiping away a single conversation to remove the currently displayed folder [CHAR LIMIT=80] -->
- <string name="folder_removed">Removed from folder</string>
+ <string name="folder_removed">Removed from <xliff:g id="folderName">%1$s</xliff:g></string>
<plurals name="conversation_marked_important">
<!-- Displayed while marking a single conversation as important. [CHAR LIMIT=80] -->
diff --git a/src/com/android/mail/browse/SwipeableConversationItemView.java b/src/com/android/mail/browse/SwipeableConversationItemView.java
index 3035066..41537c0 100644
--- a/src/com/android/mail/browse/SwipeableConversationItemView.java
+++ b/src/com/android/mail/browse/SwipeableConversationItemView.java
@@ -44,10 +44,6 @@
addView(mConversationItemView);
}
- public void addBackground(Context context, int textRes) {
- addBackground(context, context.getResources().getString(textRes));
- }
-
public void addBackground(Context context, String text) {
mBackground = (TextView) findViewById(R.id.background);
if (mBackground == null) {
@@ -93,7 +89,7 @@
priorityArrowsEnabled, animatedAdapter);
}
- public void startUndoAnimation(int actionText, ViewMode viewMode, AnimatedAdapter listener,
+ public void startUndoAnimation(String actionText, ViewMode viewMode, AnimatedAdapter listener,
boolean swipe) {
if (swipe) {
addBackground(getContext(), actionText);
diff --git a/src/com/android/mail/ui/AbstractActivityController.java b/src/com/android/mail/ui/AbstractActivityController.java
index 9caabaf..59ade28 100644
--- a/src/com/android/mail/ui/AbstractActivityController.java
+++ b/src/com/android/mail/ui/AbstractActivityController.java
@@ -1911,7 +1911,7 @@
LogUtils.d(LOG_TAG, "onRefreshRequired: delay until scrolling done");
return;
}
- if (!isAnimating()) {
+ if (isAnimating()) {
LogUtils.d(LOG_TAG, "onRefreshRequired: delay until animating done");
return;
}
diff --git a/src/com/android/mail/ui/AnimatedAdapter.java b/src/com/android/mail/ui/AnimatedAdapter.java
index 985d6b2..e49c680 100644
--- a/src/com/android/mail/ui/AnimatedAdapter.java
+++ b/src/com/android/mail/ui/AnimatedAdapter.java
@@ -301,7 +301,7 @@
fadeOutLeaveBehindItems();
LeaveBehindItem leaveBehind = (LeaveBehindItem) LayoutInflater.from(mContext).inflate(
R.layout.swipe_leavebehind, null);
- leaveBehind.bindOperations(deletedRow, mAccount, this, undoOp, target);
+ leaveBehind.bindOperations(deletedRow, mAccount, this, undoOp, target, mFolder);
mLeaveBehindItem = leaveBehind;
mLastDeletingItems.add(deletedRow);
return leaveBehind;
diff --git a/src/com/android/mail/ui/LeaveBehindItem.java b/src/com/android/mail/ui/LeaveBehindItem.java
index 213aac5..3837581 100644
--- a/src/com/android/mail/ui/LeaveBehindItem.java
+++ b/src/com/android/mail/ui/LeaveBehindItem.java
@@ -36,6 +36,7 @@
import com.android.mail.browse.ConversationItemViewCoordinates;
import com.android.mail.providers.Account;
import com.android.mail.providers.Conversation;
+import com.android.mail.providers.Folder;
import com.google.common.collect.ImmutableList;
public class LeaveBehindItem extends LinearLayout implements OnClickListener,
@@ -77,14 +78,14 @@
}
public void bindOperations(int position, Account account, AnimatedAdapter adapter,
- ToastBarOperation undoOp, Conversation target) {
+ ToastBarOperation undoOp, Conversation target, Folder folder) {
mUndoOp = undoOp;
mAccount = account;
mAdapter = adapter;
mConversationCursor = (ConversationCursor) adapter.getCursor();
setData(target);
((TextView) findViewById(R.id.undo_descriptionview)).setText(Html.fromHtml(mUndoOp
- .getSingularDescription(getContext())));
+ .getSingularDescription(getContext(), folder)));
((RelativeLayout) findViewById(R.id.undo_button)).setOnClickListener(this);
}
diff --git a/src/com/android/mail/ui/SwipeableListView.java b/src/com/android/mail/ui/SwipeableListView.java
index 1aa5a7c..0ec0bdc 100644
--- a/src/com/android/mail/ui/SwipeableListView.java
+++ b/src/com/android/mail/ui/SwipeableListView.java
@@ -19,6 +19,7 @@
import android.content.Context;
import android.content.res.Configuration;
+import android.content.res.Resources;
import android.net.Uri;
import android.util.AttributeSet;
import android.view.MotionEvent;
@@ -368,15 +369,11 @@
/**
* Get the text resource corresponding to the result of a swipe.
*/
- public int getSwipeActionText() {
- switch (mSwipeAction) {
- case R.id.archive:
- return R.string.archive;
- case R.id.delete:
- return R.string.delete;
- case R.id.change_folder:
- return R.string.remove_folder;
+ public String getSwipeActionText() {
+ Resources res = getContext().getResources();
+ if (mSwipeAction == R.id.change_folder) {
+ return res.getString(R.string.remove_folder, mFolder.name);
}
- return -1;
+ return res.getString(mSwipeAction == R.id.archive ? R.string.archive : R.string.delete);
}
}
diff --git a/src/com/android/mail/ui/ToastBarOperation.java b/src/com/android/mail/ui/ToastBarOperation.java
index bd93701..ce8d98f 100644
--- a/src/com/android/mail/ui/ToastBarOperation.java
+++ b/src/com/android/mail/ui/ToastBarOperation.java
@@ -17,6 +17,7 @@
package com.android.mail.ui;
import com.android.mail.R;
+import com.android.mail.providers.Folder;
import android.content.Context;
import android.os.Parcel;
@@ -124,7 +125,10 @@
return desc;
}
- public String getSingularDescription(Context context) {
+ public String getSingularDescription(Context context, Folder folder) {
+ if (mAction == R.id.change_folder) {
+ return context.getString(R.string.folder_removed, folder.name);
+ }
int resId = -1;
switch (mAction) {
case R.id.delete:
@@ -133,11 +137,8 @@
case R.id.archive:
resId = R.string.archived;
break;
- case R.id.change_folder:
- resId = R.string.folder_removed;
- break;
}
- return(resId == -1) ? "" : context.getString(resId);
+ return (resId == -1) ? "" : context.getString(resId);
}
@Override