1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Initial actionbar integration. On top of every activity, no real integration yet.

This commit is contained in:
Sander Bogaert 2012-07-12 12:29:41 -04:00 committed by Andrew Chen
parent 12862e2050
commit 4293914855
11 changed files with 104 additions and 53 deletions

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.K9.Light" parent="android:Theme.Light">
<style name="Theme.K9.Light" parent="Theme.Sherlock.Light">
<item name="android:autoCompleteTextViewStyle">@style/Widget.K9.AutoCompleteTextView</item>
</style>
<style name="Theme.K9.Dark" parent="@android:style/Theme">
<style name="Theme.K9.Dark" parent="Theme.Sherlock">
<item name="android:autoCompleteTextViewStyle">@style/Widget.K9.AutoCompleteTextView</item>
</style>

View File

@ -29,8 +29,8 @@ import android.util.Log;
import android.util.SparseBooleanArray;
import android.util.TypedValue;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
@ -1040,7 +1040,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
}
@Override
public boolean onContextItemSelected(MenuItem item) {
public boolean onContextItemSelected(android.view.MenuItem item) {
AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo)item.getMenuInfo();
// submenus don't actually set the menuInfo, so the "advanced"
// submenu wouldn't work.
@ -1242,7 +1242,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.accounts_option, menu);
getSupportMenuInflater().inflate(R.menu.accounts_option, menu);
return true;
}
@ -1262,7 +1262,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
if (account instanceof SearchAccount) {
for (int i = 0; i < menu.size(); i++) {
MenuItem item = menu.getItem(i);
android.view.MenuItem item = menu.getItem(i);
if (item.getItemId() != R.id.open) {
item.setVisible(false);
}

View File

@ -14,8 +14,8 @@ import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
@ -170,7 +170,7 @@ public class ChooseFolder extends K9ListActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.folder_select_option, menu);
getSupportMenuInflater().inflate(R.menu.folder_select_option, menu);
return true;
}

View File

@ -1,5 +1,11 @@
package com.fsck.k9.activity;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
@ -13,20 +19,42 @@ import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.util.TypedValue;
import android.view.*;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.fsck.k9.*;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.fsck.k9.Account;
import com.fsck.k9.Account.FolderMode;
import com.fsck.k9.activity.FolderInfoHolder;
import com.fsck.k9.AccountStats;
import com.fsck.k9.BaseAccount;
import com.fsck.k9.FontSizes;
import com.fsck.k9.K9;
import com.fsck.k9.Preferences;
import com.fsck.k9.R;
import com.fsck.k9.SearchSpecification;
import com.fsck.k9.activity.FolderList.FolderListAdapter.FolderListFilter;
import com.fsck.k9.activity.setup.Prefs;
import com.fsck.k9.activity.setup.AccountSettings;
import com.fsck.k9.activity.setup.FolderSettings;
import com.fsck.k9.activity.setup.Prefs;
import com.fsck.k9.controller.MessagingController;
import com.fsck.k9.controller.MessagingListener;
import com.fsck.k9.helper.SizeFormatter;
@ -35,14 +63,9 @@ import com.fsck.k9.helper.power.TracingPowerManager.TracingWakeLock;
import com.fsck.k9.mail.Flag;
import com.fsck.k9.mail.Folder;
import com.fsck.k9.mail.Message;
import com.fsck.k9.mail.store.LocalStore.LocalFolder;
import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.store.LocalStore.LocalFolder;
import com.fsck.k9.service.MailService;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
/**
* FolderList is the primary user interface for the program. This
@ -578,11 +601,11 @@ public class FolderList extends K9ListActivity {
@Override public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.folder_list_option, menu);
getSupportMenuInflater().inflate(R.menu.folder_list_option, menu);
return true;
}
@Override public boolean onContextItemSelected(MenuItem item) {
@Override public boolean onContextItemSelected(android.view.MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item .getMenuInfo();
FolderInfoHolder folder = (FolderInfoHolder) mAdapter.getItem(info.position);

View File

@ -3,7 +3,6 @@ package com.fsck.k9.activity;
import java.util.Locale;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.TypedArray;
@ -15,10 +14,12 @@ import android.view.MotionEvent;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import com.actionbarsherlock.app.SherlockActivity;
import com.fsck.k9.K9;
public class K9Activity extends Activity {
public class K9Activity extends SherlockActivity {
protected static final int BEZEL_SWIPE_THRESHOLD = 20;
protected GestureDetector mGestureDetector;

View File

@ -1,15 +1,16 @@
package com.fsck.k9.activity;
import android.app.ListActivity;
import android.util.Log;
import android.view.KeyEvent;
import android.widget.AdapterView;
import android.widget.ListView;
import android.os.Bundle;
import com.actionbarsherlock.app.SherlockListActivity;
import com.fsck.k9.K9;
import com.fsck.k9.helper.DateFormatter;
public class K9ListActivity extends ListActivity {
public class K9ListActivity extends SherlockListActivity {
@Override
public void onCreate(Bundle icicle) {
K9Activity.setLanguage(this, K9.getK9Language());

View File

@ -1,20 +1,28 @@
package com.fsck.k9.activity;
import com.actionbarsherlock.app.SherlockPreferenceActivity;
import com.fsck.k9.K9;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.ListPreference;
import android.preference.Preference;
public class K9PreferenceActivity extends PreferenceActivity {
public class K9PreferenceActivity extends SherlockPreferenceActivity {
@Override
public void onCreate(Bundle icicle) {
K9Activity.setLanguage(this, K9.getK9Language());
// http://code.google.com/p/k9mail/issues/detail?id=2439
// Re-enable themeing support in preferences when
// http://code.google.com/p/android/issues/detail?id=4611 is resolved
// setTheme(K9.getK9Theme());
if (Build.VERSION.SDK_INT >= 6 && Build.VERSION.SDK_INT < 11) {
// there's a display bug in 2.1, 2.2, 2.3 (unsure about 2.0)
// which causes PreferenceScreens to have a black background.
// http://code.google.com/p/android/issues/detail?id=4611
setTheme(K9.getK9ThemeResourceId(K9.THEME_DARK));
}else{
setTheme(K9.getK9ThemeResourceId());
}
super.onCreate(icicle);
}

View File

@ -1,12 +1,16 @@
package com.fsck.k9.activity;
import android.content.Intent;
import android.view.*;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.ListView;
import android.widget.Toast;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.fsck.k9.Identity;
import com.fsck.k9.Preferences;
import com.fsck.k9.R;
@ -40,7 +44,7 @@ public class ManageIdentities extends ChooseIdentity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.manage_identities_option, menu);
getSupportMenuInflater().inflate(R.menu.manage_identities_option, menu);
return true;
}
@ -66,7 +70,7 @@ public class ManageIdentities extends ChooseIdentity {
}
@Override
public boolean onContextItemSelected(MenuItem item) {
public boolean onContextItemSelected(android.view.MenuItem item) {
AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo)item.getMenuInfo();
switch (item.getItemId()) {
case R.id.edit:

View File

@ -22,8 +22,8 @@ import android.text.util.Rfc822Tokenizer;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
@ -2180,7 +2180,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.message_compose_option, menu);
getSupportMenuInflater().inflate(R.menu.message_compose_option, menu);
// Disable the 'Save' menu option if Drafts folder is set to -NONE-
if (!mAccount.hasDraftsFolder()) {

View File

@ -30,8 +30,8 @@ import android.view.ContextMenu.ContextMenuInfo;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
@ -1677,13 +1677,13 @@ public class MessageList
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.message_list_option, menu);
getSupportMenuInflater().inflate(R.menu.message_list_option, menu);
return true;
}
@Override
public boolean onContextItemSelected(MenuItem item) {
public boolean onContextItemSelected(android.view.MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
final MessageInfoHolder holder = mSelectedMessage == null ? (MessageInfoHolder) mAdapter.getItem(info.position) : mSelectedMessage;
// don't need this anymore

View File

@ -1,5 +1,10 @@
package com.fsck.k9.activity;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
@ -8,24 +13,34 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.*;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;
import com.fsck.k9.*;
import android.widget.Toast;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.Window;
import com.fsck.k9.Account;
import com.fsck.k9.K9;
import com.fsck.k9.Preferences;
import com.fsck.k9.R;
import com.fsck.k9.controller.MessagingController;
import com.fsck.k9.controller.MessagingListener;
import com.fsck.k9.crypto.PgpData;
import com.fsck.k9.helper.FileBrowserHelper;
import com.fsck.k9.helper.FileBrowserHelper.FileBrowserFailOverCallback;
import com.fsck.k9.mail.*;
import com.fsck.k9.mail.Flag;
import com.fsck.k9.mail.Message;
import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.Part;
import com.fsck.k9.mail.store.LocalStore.LocalMessage;
import com.fsck.k9.mail.store.StorageManager;
import com.fsck.k9.view.AttachmentView;
import com.fsck.k9.view.SingleMessageView;
import com.fsck.k9.view.AttachmentView.AttachmentFileDownloadCallback;
import java.io.File;
import java.util.*;
import com.fsck.k9.view.SingleMessageView;
public class MessageView extends K9Activity implements OnClickListener {
private static final String EXTRA_MESSAGE_REFERENCE = "com.fsck.k9.MessageView_messageReference";
@ -301,7 +316,6 @@ public class MessageView extends K9Activity implements OnClickListener {
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.message_view);
mMessageView = (SingleMessageView) findViewById(R.id.message_view);
@ -891,7 +905,7 @@ public class MessageView extends K9Activity implements OnClickListener {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.message_view_option, menu);
getSupportMenuInflater().inflate(R.menu.message_view_option, menu);
if (!mController.isCopyCapable(mAccount)) {
menu.findItem(R.id.copy).setVisible(false);
}