Add a click handler for the message list widget header
This commit is contained in:
parent
fc6c47159b
commit
3dcf1a59ba
1 changed files with 12 additions and 0 deletions
|
@ -13,6 +13,7 @@ import android.widget.RemoteViews;
|
|||
import com.fsck.k9.R;
|
||||
import com.fsck.k9.activity.MessageCompose;
|
||||
import com.fsck.k9.activity.MessageList;
|
||||
import com.fsck.k9.search.SearchAccount;
|
||||
|
||||
|
||||
public class MessageListWidgetProvider extends AppWidgetProvider {
|
||||
|
@ -54,6 +55,9 @@ public class MessageListWidgetProvider extends AppWidgetProvider {
|
|||
PendingIntent composeAction = composeActionPendingIntent(context);
|
||||
views.setOnClickPendingIntent(R.id.new_message, composeAction);
|
||||
|
||||
PendingIntent headerClickAction = viewUnifiedInboxPendingIntent(context);
|
||||
views.setOnClickPendingIntent(R.id.top_controls, headerClickAction);
|
||||
|
||||
appWidgetManager.updateAppWidget(appWidgetId, views);
|
||||
}
|
||||
|
||||
|
@ -76,6 +80,14 @@ public class MessageListWidgetProvider extends AppWidgetProvider {
|
|||
return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
|
||||
private PendingIntent viewUnifiedInboxPendingIntent(Context context) {
|
||||
SearchAccount unifiedInboxAccount = SearchAccount.createUnifiedInboxAccount();
|
||||
Intent intent = MessageList.intentDisplaySearch(
|
||||
context, unifiedInboxAccount.getRelatedSearch(), true, true, true);
|
||||
|
||||
return PendingIntent.getActivity(context, -1, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
|
||||
private PendingIntent composeActionPendingIntent(Context context) {
|
||||
Intent intent = new Intent(context, MessageCompose.class);
|
||||
intent.setAction(MessageCompose.ACTION_COMPOSE);
|
||||
|
|
Loading…
Reference in a new issue