widget combined inbox view only shows messages in inbox
instead of showing all messages (e.g. messages in drafts, etc...) the "combined inbox" view now only messages in the inbox folder. This is now identical to the "combined inbox" view available in the full email UI. bug 3368613 Change-Id: I0080b56cd2718a3dce82b279277c63c4f43e86dc
This commit is contained in:
parent
a5de96be71
commit
3db3e4b795
@ -53,7 +53,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-2sp"
|
||||
android:text="@string/widget_all_mail"
|
||||
android:text="@string/widget_all_inbox"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@android:color/white"
|
||||
|
@ -1005,8 +1005,8 @@ save attachment.</string>
|
||||
<!-- Widget -->
|
||||
<!-- Instruction for how to move to different widget views [CHAR LIMIT=20] -->
|
||||
<string name="widget_other_views">Tap icon to change</string>
|
||||
<!-- Header for the "All Mail" widget view (showing all of the user's mail) [CHAR LIMIT=20] -->
|
||||
<string name="widget_all_mail">Combined Inbox</string>
|
||||
<!-- Header for the "Combined Inbox" view (showing mail in all inboxes) [CHAR LIMIT=20] -->
|
||||
<string name="widget_all_inbox">Combined Inbox</string>
|
||||
<!-- Header for the "Unread" widget view (showing all unread mail) [CHAR LIMIT=20] -->
|
||||
<string name="widget_unread">Unread</string>
|
||||
<!-- Header for the "Starred" widget view (showing all starred mail) [CHAR LIMIT=20] -->
|
||||
|
@ -124,7 +124,7 @@ public class WidgetProvider extends AppWidgetProvider {
|
||||
* mail; we rotate between them. Each ViewType is composed of a selection string and a title.
|
||||
*/
|
||||
public enum ViewType {
|
||||
ALL_MAIL(null, NO_ARGUMENTS, R.string.widget_all_mail),
|
||||
ALL_INBOX(null, NO_ARGUMENTS, R.string.widget_all_inbox),
|
||||
UNREAD(MessageColumns.FLAG_READ + "=0", NO_ARGUMENTS, R.string.widget_unread),
|
||||
STARRED(Message.ALL_FAVORITE_SELECTION, NO_ARGUMENTS, R.string.widget_starred),
|
||||
ACCOUNT(MessageColumns.ACCOUNT_KEY + "=?", new String[1], 0);
|
||||
@ -146,6 +146,15 @@ public class WidgetProvider extends AppWidgetProvider {
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getSelection(Context context) {
|
||||
// For "all inbox", we define a special selection
|
||||
if (this == ViewType.ALL_INBOX) {
|
||||
// Rebuild selection every time in case accounts have been added or removed
|
||||
return Utility.buildMailboxIdSelection(context, Mailbox.QUERY_ALL_INBOXES);
|
||||
}
|
||||
return selection;
|
||||
}
|
||||
}
|
||||
|
||||
static class EmailWidget implements RemoteViewsService.RemoteViewsFactory {
|
||||
@ -248,7 +257,7 @@ public class WidgetProvider extends AppWidgetProvider {
|
||||
*/
|
||||
private void load(ViewType viewType) {
|
||||
reset();
|
||||
setSelection(viewType.selection);
|
||||
setSelection(viewType.getSelection(sContext));
|
||||
setSelectionArgs(viewType.selectionArgs);
|
||||
startLoading();
|
||||
}
|
||||
@ -284,11 +293,11 @@ public class WidgetProvider extends AppWidgetProvider {
|
||||
// Otherwise, fall through to the accounts themselves
|
||||
case STARRED:
|
||||
if (EmailContent.count(sContext, Account.CONTENT_URI) > 1) {
|
||||
mViewType = ViewType.ALL_MAIL;
|
||||
mViewType = ViewType.ALL_INBOX;
|
||||
break;
|
||||
}
|
||||
//$FALL-THROUGH$
|
||||
case ALL_MAIL:
|
||||
case ALL_INBOX:
|
||||
ViewType.ACCOUNT.selectionArgs[0] = "0";
|
||||
//$FALL-THROUGH$
|
||||
case ACCOUNT:
|
||||
|
@ -75,9 +75,9 @@ public class WidgetProviderTests extends ProviderTestCase2<EmailProvider> {
|
||||
ProviderTestUtils.setupAccount("account2", true, mMockContext);
|
||||
// Create a widget
|
||||
widget = new EmailWidget(2);
|
||||
// Since there are two accounts, this should switch to the ALL_MAIL view
|
||||
// Since there are two accounts, this should switch to the ALL_INBOX view
|
||||
switchSync(widget);
|
||||
assertEquals(WidgetProvider.ViewType.ALL_MAIL, widget.mViewType);
|
||||
assertEquals(WidgetProvider.ViewType.ALL_INBOX, widget.mViewType);
|
||||
|
||||
// The next two switches should be to the two accounts
|
||||
switchSync(widget);
|
||||
|
Loading…
Reference in New Issue
Block a user