1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Merge pull request #245 from m0vie/fixes

fixes for split-view changes
This commit is contained in:
cketti 2013-02-04 13:57:30 -08:00
commit ecc9f40899
12 changed files with 45 additions and 104 deletions

View File

@ -10,6 +10,22 @@
MessageList.configureMenu() if you make any changes to this file.
-->
<!-- MessageView -->
<item
android:id="@+id/next_message"
android:title="@string/next_action"
android:icon="?attr/iconActionNextMessage"
android:showAsAction="always"
/>
<!-- MessageView -->
<item
android:id="@+id/previous_message"
android:title="@string/previous_action"
android:icon="?attr/iconActionPreviousMessage"
android:showAsAction="always"
/>
<!-- MessageList -->
<item
android:id="@+id/search"

View File

@ -1,68 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/delete"
android:alphabeticShortcut="q"
android:title="@string/delete_action"
android:icon="?attr/iconActionDelete"
android:showAsAction="always"
/>
<item
android:id="@+id/single_message_options"
android:icon="?attr/iconActionSingleMessageOptions"
android:showAsAction="ifRoom"
android:title="@string/single_message_options_action">
<menu>
<item
android:id="@+id/reply"
android:title="@string/reply_action"/>
<item
android:id="@+id/reply_all"
android:title="@string/reply_all_action"/>
<item
android:id="@+id/forward"
android:title="@string/forward_action"/>
<item
android:id="@+id/share"
android:title="@string/send_alternate_action" />
</menu>
</item>
<item
android:id="@+id/archive"
android:title="@string/archive_action"
android:icon="?attr/iconActionArchive"
android:showAsAction="ifRoom"
/>
<item
android:id="@+id/spam"
android:title="@string/spam_action"
android:icon="?attr/iconActionSpam"
android:showAsAction="ifRoom"
/>
<item
android:id="@+id/move"
android:showAsAction="ifRoom"
android:icon="?attr/iconActionMoveOrCopy"
android:title="@string/move_action"
/>
<item
android:id="@+id/copy"
android:title="@string/copy_action"
/>
<item
android:id="@+id/toggle_unread"
android:alphabeticShortcut="u"
android:title="@string/mark_as_unread_action"
android:showAsAction="never"
/>
<item
android:id="@+id/select_text"
android:title="@string/select_text_action"
android:showAsAction="never"
/>
<item
android:id="@+id/toggle_message_view_theme"
android:title="@string/message_view_theme_action_dark"
android:showAsAction="never"
/>
</menu>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/next_message"
android:title="@string/next_action"
android:icon="?attr/iconActionNextMessage"
android:showAsAction="always"
/>
<item
android:id="@+id/previous_message"
android:title="@string/previous_action"
android:icon="?attr/iconActionPreviousMessage"
android:showAsAction="always"
/>
</menu>

View File

@ -50,6 +50,7 @@
<attr name="messageListThreadCountBackground" format="reference|color"/>
<attr name="messageListActiveItemBackgroundColor" format="reference|color"/>
<attr name="messageListDividerColor" format="reference|color"/>
<attr name="messageViewHeaderBackgroundColor" format="reference|color"/>
</declare-styleable>

View File

@ -49,6 +49,7 @@
<item name="messageListThreadCountBackground">@drawable/thread_count_box_light</item>
<item name="messageListActiveItemBackgroundColor">#ff2ea7d1</item>
<item name="messageListDividerColor">#ffcccccc</item>
<item name="messageViewHeaderBackgroundColor">#ffffffff</item>
</style>
<style name="Theme.K9.Dark.Base" parent="Theme.Sherlock">
@ -100,6 +101,7 @@
<item name="messageListThreadCountBackground">@drawable/thread_count_box_dark</item>
<item name="messageListActiveItemBackgroundColor">#ff33b5e5</item>
<item name="messageListDividerColor">#ff333333</item>
<item name="messageViewHeaderBackgroundColor">#000000</item>
</style>
<style name="Theme.K9.Light" parent="Theme.K9.Light.Base">

View File

@ -25,11 +25,6 @@ public class K9Activity extends SherlockActivity implements K9ActivityMagic {
return super.dispatchTouchEvent(event);
}
@Override
public int getThemeBackgroundColor() {
return mBase.getThemeBackgroundColor();
}
@Override
public void setupGestureDetector(OnSwipeGestureListener listener) {
mBase.setupGestureDetector(listener);

View File

@ -62,7 +62,6 @@ public class K9ActivityCommon {
* in {@link K9ActivityCommon}.</p>
*/
public interface K9ActivityMagic {
int getThemeBackgroundColor();
void setupGestureDetector(OnSwipeGestureListener listener);
}

View File

@ -25,11 +25,6 @@ public class K9FragmentActivity extends SherlockFragmentActivity implements K9Ac
return super.dispatchTouchEvent(event);
}
@Override
public int getThemeBackgroundColor() {
return mBase.getThemeBackgroundColor();
}
@Override
public void setupGestureDetector(OnSwipeGestureListener listener) {
mBase.setupGestureDetector(listener);

View File

@ -54,11 +54,6 @@ public class K9ListActivity extends SherlockListActivity implements K9ActivityMa
mDateFormat = DateFormatter.getDateFormat(this);
}
@Override
public int getThemeBackgroundColor() {
return mBase.getThemeBackgroundColor();
}
@Override
public void setupGestureDetector(OnSwipeGestureListener listener) {
mBase.setupGestureDetector(listener);

View File

@ -777,6 +777,14 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
return true;
}
// MessageView
case R.id.next_message: {
showNextMessage();
return true;
}
case R.id.previous_message: {
showPreviousMessage();
return true;
}
case R.id.delete: {
mMessageViewFragment.onDelete();
return true;
@ -897,6 +905,8 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
*/
if (mMessageViewFragment == null || !mMessageViewFragment.isInitialized()) {
menu.findItem(R.id.next_message).setVisible(false);
menu.findItem(R.id.previous_message).setVisible(false);
menu.findItem(R.id.delete).setVisible(false);
menu.findItem(R.id.single_message_options).setVisible(false);
menu.findItem(R.id.archive).setVisible(false);
@ -907,6 +917,11 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
menu.findItem(R.id.select_text).setVisible(false);
menu.findItem(R.id.toggle_message_view_theme).setVisible(false);
} else {
// hide prev/next buttons in split mode
if (mDisplayMode != DisplayMode.MESSAGE_VIEW) {
menu.findItem(R.id.next_message).setVisible(false);
menu.findItem(R.id.previous_message).setVisible(false);
}
// Set title of menu item to switch to dark/light theme
MenuItem toggleTheme = menu.findItem(R.id.toggle_message_view_theme);
if (K9.getK9MessageViewTheme() == K9.THEME_DARK) {
@ -1347,7 +1362,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
@Override
public void updateMenu() {
configureMenu(mMenu);
invalidateOptionsMenu();
}
@Override

View File

@ -12,6 +12,7 @@ import android.os.Handler;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import android.util.Log;
import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
@ -169,8 +170,10 @@ public class MessageViewFragment extends SherlockFragment implements OnClickList
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.message, container, false);
Context context = new ContextThemeWrapper(getActivity().getApplicationContext(),
K9.getK9ThemeResourceId(K9.getK9MessageViewTheme()));
LayoutInflater localInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = localInflater.inflate(R.layout.message, container, false);
mMessageView = (SingleMessageView) view.findViewById(R.id.message_view);

View File

@ -1,5 +1,6 @@
package com.fsck.k9.view;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
@ -14,6 +15,7 @@ import android.os.Parcelable;
import android.support.v4.app.Fragment;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.KeyEvent;
@ -32,7 +34,6 @@ import android.widget.Toast;
import com.fsck.k9.Account;
import com.fsck.k9.K9;
import com.fsck.k9.R;
import com.fsck.k9.activity.K9ActivityCommon.K9ActivityMagic;
import com.fsck.k9.controller.MessagingController;
import com.fsck.k9.controller.MessagingListener;
import com.fsck.k9.crypto.CryptoProvider;
@ -159,7 +160,9 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
mHeaderPlaceHolder.removeView(mHeaderContainer);
// the HTC version of WebView tries to force the background of the
// titlebar, which is really unfair.
mHeaderContainer.setBackgroundColor(((K9ActivityMagic)activity).getThemeBackgroundColor());
TypedValue outValue = new TypedValue();
getContext().getTheme().resolveAttribute(R.attr.messageViewHeaderBackgroundColor, outValue, true);
mHeaderContainer.setBackgroundColor(outValue.data);
mTitleBarHeaderContainer = new LinearLayout(activity);
mMessageContentView.setEmbeddedTitleBarCompat(mTitleBarHeaderContainer);