mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
Clean up our back button support to be actually consistent and to not leak nearly as many activities.
This commit is contained in:
parent
3ffad03e9b
commit
1945dc4ad4
@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.fsck.k9.activity.Accounts"
|
android:name="com.fsck.k9.activity.Accounts"
|
||||||
|
android:launchMode="singleTop"
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
@ -37,7 +37,7 @@ import android.os.PowerManager.WakeLock;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.fsck.k9.activity.FolderList;
|
import com.fsck.k9.activity.MessageList;
|
||||||
import com.fsck.k9.mail.Address;
|
import com.fsck.k9.mail.Address;
|
||||||
import com.fsck.k9.mail.FetchProfile;
|
import com.fsck.k9.mail.FetchProfile;
|
||||||
import com.fsck.k9.mail.Flag;
|
import com.fsck.k9.mail.Flag;
|
||||||
@ -3260,8 +3260,7 @@ public class MessagingController implements Runnable
|
|||||||
Notification notif = new Notification(R.drawable.stat_notify_email_generic,
|
Notification notif = new Notification(R.drawable.stat_notify_email_generic,
|
||||||
mApplication.getString(R.string.send_failure_subject), System.currentTimeMillis());
|
mApplication.getString(R.string.send_failure_subject), System.currentTimeMillis());
|
||||||
|
|
||||||
// JRV XXX TODO - do we want to notify MessageList too?
|
Intent i = MessageList.actionHandleFolderIntent(mApplication, account, account.getErrorFolderName());
|
||||||
Intent i = FolderList.actionHandleAccountIntent(mApplication, account, account.getErrorFolderName());
|
|
||||||
|
|
||||||
PendingIntent pi = PendingIntent.getActivity(mApplication, 0, i, 0);
|
PendingIntent pi = PendingIntent.getActivity(mApplication, 0, i, 0);
|
||||||
|
|
||||||
@ -3874,8 +3873,7 @@ public class MessagingController implements Runnable
|
|||||||
{
|
{
|
||||||
Notification notif = new Notification(R.drawable.ic_menu_refresh,
|
Notification notif = new Notification(R.drawable.ic_menu_refresh,
|
||||||
context.getString(R.string.notification_bg_send_ticker, account.getDescription()), System.currentTimeMillis());
|
context.getString(R.string.notification_bg_send_ticker, account.getDescription()), System.currentTimeMillis());
|
||||||
// JRV XXX TODO - do we want to notify MessageList too?
|
Intent intent = MessageList.actionHandleFolderIntent(context, account, K9.INBOX);
|
||||||
Intent intent = FolderList.actionHandleAccountIntent(context, account, K9.INBOX);
|
|
||||||
PendingIntent pi = PendingIntent.getActivity(context, 0, intent, 0);
|
PendingIntent pi = PendingIntent.getActivity(context, 0, intent, 0);
|
||||||
notif.setLatestEventInfo(context, context.getString(R.string.notification_bg_send_title),
|
notif.setLatestEventInfo(context, context.getString(R.string.notification_bg_send_title),
|
||||||
account.getDescription() , pi);
|
account.getDescription() , pi);
|
||||||
@ -3985,8 +3983,7 @@ public class MessagingController implements Runnable
|
|||||||
Notification notif = new Notification(R.drawable.ic_menu_refresh,
|
Notification notif = new Notification(R.drawable.ic_menu_refresh,
|
||||||
context.getString(R.string.notification_bg_sync_ticker, account.getDescription(), folder.getName()),
|
context.getString(R.string.notification_bg_sync_ticker, account.getDescription(), folder.getName()),
|
||||||
System.currentTimeMillis());
|
System.currentTimeMillis());
|
||||||
// JRV XXX TODO - do we want to notify MessageList too?
|
Intent intent = MessageList.actionHandleFolderIntent(context, account, K9.INBOX);
|
||||||
Intent intent = FolderList.actionHandleAccountIntent(context, account, K9.INBOX);
|
|
||||||
PendingIntent pi = PendingIntent.getActivity(context, 0, intent, 0);
|
PendingIntent pi = PendingIntent.getActivity(context, 0, intent, 0);
|
||||||
notif.setLatestEventInfo(context, context.getString(R.string.notification_bg_sync_title), account.getDescription()
|
notif.setLatestEventInfo(context, context.getString(R.string.notification_bg_sync_title), account.getDescription()
|
||||||
+ context.getString(R.string.notification_bg_title_separator) + folder.getName(), pi);
|
+ context.getString(R.string.notification_bg_title_separator) + folder.getName(), pi);
|
||||||
@ -4201,7 +4198,7 @@ public class MessagingController implements Runnable
|
|||||||
Notification notif = new Notification(R.drawable.stat_notify_email_generic, messageNotice, System.currentTimeMillis());
|
Notification notif = new Notification(R.drawable.stat_notify_email_generic, messageNotice, System.currentTimeMillis());
|
||||||
notif.number = unreadMessageCount;
|
notif.number = unreadMessageCount;
|
||||||
|
|
||||||
Intent i = FolderList.actionHandleAccountIntent(context, account);
|
Intent i = MessageList.actionHandleFolderIntent(context, account, account.getAutoExpandFolderName());
|
||||||
PendingIntent pi = PendingIntent.getActivity(context, 0, i, 0);
|
PendingIntent pi = PendingIntent.getActivity(context, 0, i, 0);
|
||||||
|
|
||||||
// 279 Unread (someone@gmail.com)
|
// 279 Unread (someone@gmail.com)
|
||||||
|
@ -40,6 +40,33 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
private AccountsHandler mHandler = new AccountsHandler();
|
private AccountsHandler mHandler = new AccountsHandler();
|
||||||
private AccountsAdapter mAdapter;
|
private AccountsAdapter mAdapter;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||||
|
{
|
||||||
|
if (
|
||||||
|
// TODO - once we upgrade to 2.0, uncomment this
|
||||||
|
// android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ECLAIR &&
|
||||||
|
keyCode == KeyEvent.KEYCODE_BACK
|
||||||
|
&& event.getRepeatCount() == 0)
|
||||||
|
{
|
||||||
|
// Take care of calling this method on earlier versions of
|
||||||
|
// the platform where it doesn't exist.
|
||||||
|
onBackPressed();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onBackPressed()
|
||||||
|
{
|
||||||
|
// This will be called either automatically for you on 2.0
|
||||||
|
// or later, or by the code above on earlier versions of the
|
||||||
|
// platform.
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
class AccountsHandler extends Handler
|
class AccountsHandler extends Handler
|
||||||
{
|
{
|
||||||
private void setViewTitle()
|
private void setViewTitle()
|
||||||
@ -278,8 +305,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
boolean startup = (boolean)intent.getBooleanExtra(EXTRA_STARTUP, true);
|
boolean startup = (boolean)intent.getBooleanExtra(EXTRA_STARTUP, true);
|
||||||
if (startup && accounts.length == 1)
|
if (startup && accounts.length == 1)
|
||||||
{
|
{
|
||||||
onOpenAccount(accounts[0], true);
|
onOpenAccount(accounts[0]);
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -403,16 +429,17 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onOpenAccount(Account account, boolean startup)
|
private void onOpenAccount(Account account)
|
||||||
{
|
{
|
||||||
if (K9.FOLDER_NONE.equals(account.getAutoExpandFolderName()))
|
if (K9.FOLDER_NONE.equals(account.getAutoExpandFolderName()))
|
||||||
{
|
{
|
||||||
FolderList.actionHandleAccount(this, account, startup);
|
FolderList.actionHandleAccount(this, account);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageList.actionHandleFolder(this, account, account.getAutoExpandFolderName(), startup);
|
MessageList.actionHandleFolder(this, account, account.getAutoExpandFolderName());
|
||||||
}
|
}
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick(View view)
|
public void onClick(View view)
|
||||||
@ -506,7 +533,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
onEditAccount(mSelectedContextAccount);
|
onEditAccount(mSelectedContextAccount);
|
||||||
break;
|
break;
|
||||||
case R.id.open:
|
case R.id.open:
|
||||||
onOpenAccount(mSelectedContextAccount, false);
|
onOpenAccount(mSelectedContextAccount);
|
||||||
break;
|
break;
|
||||||
case R.id.check_mail:
|
case R.id.check_mail:
|
||||||
onCheckMail(mSelectedContextAccount);
|
onCheckMail(mSelectedContextAccount);
|
||||||
@ -545,7 +572,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
public void onItemClick(AdapterView parent, View view, int position, long id)
|
public void onItemClick(AdapterView parent, View view, int position, long id)
|
||||||
{
|
{
|
||||||
Account account = (Account)parent.getItemAtPosition(position);
|
Account account = (Account)parent.getItemAtPosition(position);
|
||||||
onOpenAccount(account, false);
|
onOpenAccount(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,8 +48,6 @@ public class FolderList extends K9ListActivity
|
|||||||
|
|
||||||
private static final String EXTRA_CLEAR_NOTIFICATION = "clearNotification";
|
private static final String EXTRA_CLEAR_NOTIFICATION = "clearNotification";
|
||||||
|
|
||||||
private static final String EXTRA_STARTUP = "startup";
|
|
||||||
|
|
||||||
private static final boolean REFRESH_REMOTE = true;
|
private static final boolean REFRESH_REMOTE = true;
|
||||||
|
|
||||||
private ListView mListView;
|
private ListView mListView;
|
||||||
@ -62,8 +60,6 @@ public class FolderList extends K9ListActivity
|
|||||||
|
|
||||||
private FolderListHandler mHandler = new FolderListHandler();
|
private FolderListHandler mHandler = new FolderListHandler();
|
||||||
|
|
||||||
private boolean mStartup = false;
|
|
||||||
|
|
||||||
private int mUnreadMessageCount = 0;
|
private int mUnreadMessageCount = 0;
|
||||||
|
|
||||||
class FolderListHandler extends Handler
|
class FolderListHandler extends Handler
|
||||||
@ -204,11 +200,10 @@ public class FolderList extends K9ListActivity
|
|||||||
sendMail(mAccount);
|
sendMail(mAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void actionHandleAccount(Context context, Account account, String initialFolder, boolean startup)
|
private static void actionHandleAccount(Context context, Account account, String initialFolder)
|
||||||
{
|
{
|
||||||
Intent intent = new Intent(context, FolderList.class);
|
Intent intent = new Intent(context, FolderList.class);
|
||||||
intent.putExtra(EXTRA_ACCOUNT, account);
|
intent.putExtra(EXTRA_ACCOUNT, account);
|
||||||
intent.putExtra(EXTRA_STARTUP, startup);
|
|
||||||
|
|
||||||
if (initialFolder != null)
|
if (initialFolder != null)
|
||||||
{
|
{
|
||||||
@ -218,14 +213,9 @@ public class FolderList extends K9ListActivity
|
|||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void actionHandleAccount(Context context, Account account, String initialFolder)
|
public static void actionHandleAccount(Context context, Account account)
|
||||||
{
|
{
|
||||||
actionHandleAccount(context, account, initialFolder, false);
|
actionHandleAccount(context, account, null);
|
||||||
}
|
|
||||||
|
|
||||||
public static void actionHandleAccount(Context context, Account account, boolean startup)
|
|
||||||
{
|
|
||||||
actionHandleAccount(context, account, null, startup);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Intent actionHandleAccountIntent(Context context, Account account, String initialFolder)
|
public static Intent actionHandleAccountIntent(Context context, Account account, String initialFolder)
|
||||||
@ -243,10 +233,6 @@ public class FolderList extends K9ListActivity
|
|||||||
{
|
{
|
||||||
intent.putExtra(EXTRA_INITIAL_FOLDER, initialFolder);
|
intent.putExtra(EXTRA_INITIAL_FOLDER, initialFolder);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
intent.putExtra(EXTRA_STARTUP, true);
|
|
||||||
}
|
|
||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,17 +255,10 @@ public class FolderList extends K9ListActivity
|
|||||||
if (savedInstanceState == null)
|
if (savedInstanceState == null)
|
||||||
{
|
{
|
||||||
initialFolder = intent.getStringExtra(EXTRA_INITIAL_FOLDER);
|
initialFolder = intent.getStringExtra(EXTRA_INITIAL_FOLDER);
|
||||||
mStartup = (boolean) intent.getBooleanExtra(EXTRA_STARTUP, false);
|
|
||||||
if (initialFolder == null
|
|
||||||
&& mStartup)
|
|
||||||
{
|
|
||||||
initialFolder = mAccount.getAutoExpandFolderName();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
initialFolder = null;
|
initialFolder = null;
|
||||||
mStartup = false;
|
|
||||||
savedFolderName = savedInstanceState.getString(STATE_CURRENT_FOLDER);
|
savedFolderName = savedInstanceState.getString(STATE_CURRENT_FOLDER);
|
||||||
if (savedFolderName != null)
|
if (savedFolderName != null)
|
||||||
{
|
{
|
||||||
@ -287,11 +266,11 @@ public class FolderList extends K9ListActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mStartup
|
if (
|
||||||
&& initialFolder != null
|
initialFolder != null
|
||||||
&& !K9.FOLDER_NONE.equals(initialFolder))
|
&& !K9.FOLDER_NONE.equals(initialFolder))
|
||||||
{
|
{
|
||||||
onOpenFolder(initialFolder, true);
|
onOpenFolder(initialFolder);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -319,7 +298,7 @@ public class FolderList extends K9ListActivity
|
|||||||
{
|
{
|
||||||
public void onItemClick(AdapterView parent, View v, int itemPosition, long id)
|
public void onItemClick(AdapterView parent, View v, int itemPosition, long id)
|
||||||
{
|
{
|
||||||
MessageList.actionHandleFolder(FolderList.this, mAccount, ((FolderInfoHolder)mAdapter.getItem(id)).name, false);
|
onOpenFolder(((FolderInfoHolder)mAdapter.getItem(id)).name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerForContextMenu(mListView);
|
registerForContextMenu(mListView);
|
||||||
@ -394,10 +373,33 @@ public class FolderList extends K9ListActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onBackPressed()
|
||||||
|
{
|
||||||
|
// This will be called either automatically for you on 2.0
|
||||||
|
// or later, or by the code above on earlier versions of the
|
||||||
|
// platform.
|
||||||
|
onAccounts();
|
||||||
|
}
|
||||||
|
|
||||||
@Override public boolean onKeyDown(int keyCode, KeyEvent event)
|
@Override public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||||
{
|
{
|
||||||
//Shortcuts that work no matter what is selected
|
//Shortcuts that work no matter what is selected
|
||||||
|
|
||||||
|
if (
|
||||||
|
// TODO - when we move to android 2.0, uncomment this.
|
||||||
|
// android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ECLAIR &&
|
||||||
|
|
||||||
|
keyCode == KeyEvent.KEYCODE_BACK
|
||||||
|
&& event.getRepeatCount() == 0)
|
||||||
|
{
|
||||||
|
// Take care of calling this method on earlier versions of
|
||||||
|
// the platform where it doesn't exist.
|
||||||
|
onBackPressed();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (keyCode)
|
switch (keyCode)
|
||||||
{
|
{
|
||||||
case KeyEvent.KEYCODE_Q:
|
case KeyEvent.KEYCODE_Q:
|
||||||
@ -444,11 +446,7 @@ public class FolderList extends K9ListActivity
|
|||||||
|
|
||||||
private void onAccounts()
|
private void onAccounts()
|
||||||
{
|
{
|
||||||
if (mStartup || isTaskRoot())
|
Accounts.listAccounts(this);
|
||||||
{
|
|
||||||
Accounts.listAccounts(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,9 +524,10 @@ public class FolderList extends K9ListActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onOpenFolder(String folder, boolean startup)
|
private void onOpenFolder(String folder)
|
||||||
{
|
{
|
||||||
MessageList.actionHandleFolder(this, mAccount, folder, startup);
|
MessageList.actionHandleFolder(this, mAccount, folder);
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onCompact(Account account)
|
private void onCompact(Account account)
|
||||||
@ -558,7 +557,7 @@ public class FolderList extends K9ListActivity
|
|||||||
switch (item.getItemId())
|
switch (item.getItemId())
|
||||||
{
|
{
|
||||||
case R.id.open_folder:
|
case R.id.open_folder:
|
||||||
onOpenFolder(folder.name, false);
|
onOpenFolder(folder.name);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.mark_all_as_read:
|
case R.id.mark_all_as_read:
|
||||||
|
@ -63,7 +63,6 @@ public class MessageList
|
|||||||
private static final int ACTIVITY_CHOOSE_FOLDER_COPY = 2;
|
private static final int ACTIVITY_CHOOSE_FOLDER_COPY = 2;
|
||||||
|
|
||||||
private static final String EXTRA_ACCOUNT = "account";
|
private static final String EXTRA_ACCOUNT = "account";
|
||||||
private static final String EXTRA_STARTUP = "startup";
|
|
||||||
private static final String EXTRA_FOLDER = "folder";
|
private static final String EXTRA_FOLDER = "folder";
|
||||||
private static final String EXTRA_QUERY = "query";
|
private static final String EXTRA_QUERY = "query";
|
||||||
|
|
||||||
@ -283,18 +282,22 @@ public class MessageList
|
|||||||
* given folder
|
* given folder
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static void actionHandleFolder(Context context, Account account, String folder, boolean startup)
|
public static void actionHandleFolder(Context context, Account account, String folder)
|
||||||
|
{
|
||||||
|
Intent intent = actionHandleFolderIntent(context,account,folder);
|
||||||
|
context.startActivity(intent);
|
||||||
|
|
||||||
|
}
|
||||||
|
public static Intent actionHandleFolderIntent(Context context, Account account, String folder)
|
||||||
{
|
{
|
||||||
Intent intent = new Intent(context, MessageList.class);
|
Intent intent = new Intent(context, MessageList.class);
|
||||||
intent.putExtra(EXTRA_ACCOUNT, account);
|
intent.putExtra(EXTRA_ACCOUNT, account);
|
||||||
intent.putExtra(EXTRA_STARTUP, startup);
|
|
||||||
|
|
||||||
if (folder != null)
|
if (folder != null)
|
||||||
{
|
{
|
||||||
intent.putExtra(EXTRA_FOLDER, folder);
|
intent.putExtra(EXTRA_FOLDER, folder);
|
||||||
}
|
}
|
||||||
|
return intent;
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onItemClick(AdapterView parent, View v, int position, long id)
|
public void onItemClick(AdapterView parent, View v, int position, long id)
|
||||||
@ -515,10 +518,29 @@ public class MessageList
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onBackPressed()
|
||||||
|
{
|
||||||
|
// This will be called either automatically for you on 2.0
|
||||||
|
// or later, or by the code above on earlier versions of the
|
||||||
|
// platform.
|
||||||
|
onShowFolderList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event)
|
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||||
{
|
{
|
||||||
|
if (
|
||||||
|
// XXX TODO - when we go to android 2.0, uncomment this
|
||||||
|
// android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ECLAIR &&
|
||||||
|
keyCode == KeyEvent.KEYCODE_BACK
|
||||||
|
&& event.getRepeatCount() == 0)
|
||||||
|
{
|
||||||
|
// Take care of calling this method on earlier versions of
|
||||||
|
// the platform where it doesn't exist.
|
||||||
|
onBackPressed();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
//Shortcuts that work no matter what is selected
|
//Shortcuts that work no matter what is selected
|
||||||
|
|
||||||
switch (keyCode)
|
switch (keyCode)
|
||||||
@ -699,7 +721,7 @@ public class MessageList
|
|||||||
|
|
||||||
private void onShowFolderList()
|
private void onShowFolderList()
|
||||||
{
|
{
|
||||||
FolderList.actionHandleAccount(this, mAccount, false);
|
FolderList.actionHandleAccount(this, mAccount);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +103,14 @@ public class MessageView extends K9Activity
|
|||||||
private Listener mListener = new Listener();
|
private Listener mListener = new Listener();
|
||||||
private MessageViewHandler mHandler = new MessageViewHandler();
|
private MessageViewHandler mHandler = new MessageViewHandler();
|
||||||
|
|
||||||
|
public void onBackPressed()
|
||||||
|
{
|
||||||
|
// This will be called either automatically for you on 2.0
|
||||||
|
// or later, or by the code above on earlier versions of the
|
||||||
|
// platform.
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchKeyEvent(KeyEvent event)
|
public boolean dispatchKeyEvent(KeyEvent event)
|
||||||
@ -122,6 +130,16 @@ public class MessageView extends K9Activity
|
|||||||
|
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event)
|
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||||
{
|
{
|
||||||
|
if (
|
||||||
|
// TODO: when we get to 2.0, uncomment this
|
||||||
|
// android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ECLAIR &&
|
||||||
|
keyCode == KeyEvent.KEYCODE_BACK
|
||||||
|
&& event.getRepeatCount() == 0)
|
||||||
|
{
|
||||||
|
// Take care of calling this method on earlier versions of
|
||||||
|
// the platform where it doesn't exist.
|
||||||
|
onBackPressed();
|
||||||
|
}
|
||||||
switch (keyCode)
|
switch (keyCode)
|
||||||
{
|
{
|
||||||
case KeyEvent.KEYCODE_DEL:
|
case KeyEvent.KEYCODE_DEL:
|
||||||
|
Loading…
Reference in New Issue
Block a user