Improved shortcut name
Shortcut name is now the name of folder when it's a non-inbox folder; otherwise it's the account name. Previously was always account name. Bug: 4903490 Change-Id: I15b4024d28db6a48464e423db887bdca99132423
This commit is contained in:
parent
9867d8a160
commit
79fab5ae62
@ -31,6 +31,7 @@ import com.android.email.activity.ShortcutPickerFragment.PickerCallback;
|
|||||||
import com.android.emailcommon.Logging;
|
import com.android.emailcommon.Logging;
|
||||||
import com.android.emailcommon.provider.Account;
|
import com.android.emailcommon.provider.Account;
|
||||||
import com.android.emailcommon.provider.EmailContent.Message;
|
import com.android.emailcommon.provider.EmailContent.Message;
|
||||||
|
import com.android.emailcommon.provider.Mailbox;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements a launcher shortcut for directly accessing a single account.
|
* This class implements a launcher shortcut for directly accessing a single account.
|
||||||
@ -87,7 +88,14 @@ public class ShortcutPicker extends Activity implements OnClickListener, PickerC
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSelected(Account account, long mailboxId) {
|
public void onSelected(Account account, long mailboxId) {
|
||||||
setupShortcut(account, mailboxId);
|
String shortcutName;
|
||||||
|
if (Account.isNormalAccount(account.mId) &&
|
||||||
|
(Mailbox.getMailboxType(this, mailboxId) != Mailbox.TYPE_INBOX)) {
|
||||||
|
shortcutName = Mailbox.getDisplayName(this, mailboxId);
|
||||||
|
} else {
|
||||||
|
shortcutName = account.getDisplayName();
|
||||||
|
}
|
||||||
|
setupShortcut(account, mailboxId, shortcutName);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +132,7 @@ public class ShortcutPicker extends Activity implements OnClickListener, PickerC
|
|||||||
* with an appropriate Uri for your content, but any Intent will work here as long as it
|
* with an appropriate Uri for your content, but any Intent will work here as long as it
|
||||||
* triggers the desired action within your Activity.
|
* triggers the desired action within your Activity.
|
||||||
*/
|
*/
|
||||||
private void setupShortcut(Account account, long mailboxId) {
|
private void setupShortcut(Account account, long mailboxId, String shortcutName) {
|
||||||
Activity myActivity = this;
|
Activity myActivity = this;
|
||||||
// First, set up the shortcut intent.
|
// First, set up the shortcut intent.
|
||||||
final Intent shortcutIntent;
|
final Intent shortcutIntent;
|
||||||
@ -145,7 +153,7 @@ public class ShortcutPicker extends Activity implements OnClickListener, PickerC
|
|||||||
// Then, set up the container intent (the response to the caller)
|
// Then, set up the container intent (the response to the caller)
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
|
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
|
||||||
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, account.getDisplayName());
|
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, shortcutName);
|
||||||
Parcelable iconResource
|
Parcelable iconResource
|
||||||
= Intent.ShortcutIconResource.fromContext(myActivity, R.mipmap.ic_launcher_email);
|
= Intent.ShortcutIconResource.fromContext(myActivity, R.mipmap.ic_launcher_email);
|
||||||
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource);
|
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource);
|
||||||
|
Loading…
Reference in New Issue
Block a user