mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
MessageView: another theme fix
- The attachments view still had the wrong background color in case of different global and message themes. - The attachments view used the activity LayoutInflater, but it needs to use the one of the fragment. - The background drawable for the attachments used transparency, and thus was completely invisible in the black theme. Fix it by adding another one for the black theme.
This commit is contained in:
parent
f5ec5cd3fb
commit
5fa7e65816
BIN
res/drawable/attachment_text_box_dark.9.png
Normal file
BIN
res/drawable/attachment_text_box_dark.9.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 542 B |
Before Width: | Height: | Size: 652 B After Width: | Height: | Size: 652 B |
@ -18,7 +18,7 @@
|
|||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:layout_width="1dip"
|
android:layout_width="1dip"
|
||||||
android:layout_height="42dip"
|
android:layout_height="42dip"
|
||||||
android:background="@drawable/text_box"
|
android:background="?attr/messageViewAttachmentBackground"
|
||||||
android:paddingLeft="36dip"
|
android:paddingLeft="36dip"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:ellipsize="start"
|
android:ellipsize="start"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/text_box"
|
android:background="?attr/messageViewAttachmentBackground"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/attachment_icon"
|
android:id="@+id/attachment_icon"
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<attr name="messageListActiveItemBackgroundColor" format="reference|color"/>
|
<attr name="messageListActiveItemBackgroundColor" format="reference|color"/>
|
||||||
<attr name="messageListDividerColor" format="reference|color"/>
|
<attr name="messageListDividerColor" format="reference|color"/>
|
||||||
<attr name="messageViewHeaderBackgroundColor" format="reference|color"/>
|
<attr name="messageViewHeaderBackgroundColor" format="reference|color"/>
|
||||||
|
<attr name="messageViewAttachmentBackground" format="reference"/>
|
||||||
|
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
<item name="messageListActiveItemBackgroundColor">#ff2ea7d1</item>
|
<item name="messageListActiveItemBackgroundColor">#ff2ea7d1</item>
|
||||||
<item name="messageListDividerColor">#ffcccccc</item>
|
<item name="messageListDividerColor">#ffcccccc</item>
|
||||||
<item name="messageViewHeaderBackgroundColor">#ffffffff</item>
|
<item name="messageViewHeaderBackgroundColor">#ffffffff</item>
|
||||||
|
<item name="messageViewAttachmentBackground">@drawable/attachment_text_box_light</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.K9.Dark.Base" parent="Theme.Sherlock">
|
<style name="Theme.K9.Dark.Base" parent="Theme.Sherlock">
|
||||||
@ -102,6 +103,7 @@
|
|||||||
<item name="messageListActiveItemBackgroundColor">#ff33b5e5</item>
|
<item name="messageListActiveItemBackgroundColor">#ff33b5e5</item>
|
||||||
<item name="messageListDividerColor">#ff333333</item>
|
<item name="messageListDividerColor">#ff333333</item>
|
||||||
<item name="messageViewHeaderBackgroundColor">#000000</item>
|
<item name="messageViewHeaderBackgroundColor">#000000</item>
|
||||||
|
<item name="messageViewAttachmentBackground">@drawable/attachment_text_box_dark</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.K9.Light" parent="Theme.K9.Light.Base">
|
<style name="Theme.K9.Light" parent="Theme.K9.Light.Base">
|
||||||
|
@ -77,6 +77,7 @@ public class MessageViewFragment extends SherlockFragment implements OnClickList
|
|||||||
private MessagingController mController;
|
private MessagingController mController;
|
||||||
private Listener mListener = new Listener();
|
private Listener mListener = new Listener();
|
||||||
private MessageViewHandler mHandler = new MessageViewHandler();
|
private MessageViewHandler mHandler = new MessageViewHandler();
|
||||||
|
private LayoutInflater mLayoutInflater;
|
||||||
|
|
||||||
/** this variable is used to save the calling AttachmentView
|
/** this variable is used to save the calling AttachmentView
|
||||||
* until the onActivityResult is called.
|
* until the onActivityResult is called.
|
||||||
@ -172,8 +173,8 @@ public class MessageViewFragment extends SherlockFragment implements OnClickList
|
|||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
Context context = new ContextThemeWrapper(getActivity().getApplicationContext(),
|
Context context = new ContextThemeWrapper(getActivity().getApplicationContext(),
|
||||||
K9.getK9ThemeResourceId(K9.getK9MessageViewTheme()));
|
K9.getK9ThemeResourceId(K9.getK9MessageViewTheme()));
|
||||||
LayoutInflater localInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
mLayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
View view = localInflater.inflate(R.layout.message, container, false);
|
View view = mLayoutInflater.inflate(R.layout.message, container, false);
|
||||||
|
|
||||||
|
|
||||||
mMessageView = (SingleMessageView) view.findViewById(R.id.message_view);
|
mMessageView = (SingleMessageView) view.findViewById(R.id.message_view);
|
||||||
@ -833,4 +834,8 @@ public class MessageViewFragment extends SherlockFragment implements OnClickList
|
|||||||
public boolean isInitialized() {
|
public boolean isInitialized() {
|
||||||
return mInitialized ;
|
return mInitialized ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LayoutInflater getFragmentLayoutInflater() {
|
||||||
|
return mLayoutInflater;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ import com.fsck.k9.controller.MessagingController;
|
|||||||
import com.fsck.k9.controller.MessagingListener;
|
import com.fsck.k9.controller.MessagingListener;
|
||||||
import com.fsck.k9.crypto.CryptoProvider;
|
import com.fsck.k9.crypto.CryptoProvider;
|
||||||
import com.fsck.k9.crypto.PgpData;
|
import com.fsck.k9.crypto.PgpData;
|
||||||
|
import com.fsck.k9.fragment.MessageViewFragment;
|
||||||
import com.fsck.k9.helper.ClipboardManager;
|
import com.fsck.k9.helper.ClipboardManager;
|
||||||
import com.fsck.k9.helper.Contacts;
|
import com.fsck.k9.helper.Contacts;
|
||||||
import com.fsck.k9.helper.HtmlConverter;
|
import com.fsck.k9.helper.HtmlConverter;
|
||||||
@ -141,7 +142,7 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
|
|||||||
|
|
||||||
mContacts = Contacts.getInstance(activity);
|
mContacts = Contacts.getInstance(activity);
|
||||||
|
|
||||||
mInflater = activity.getLayoutInflater();
|
mInflater = ((MessageViewFragment) fragment).getFragmentLayoutInflater();
|
||||||
mDownloadRemainder = (Button) findViewById(R.id.download_remainder);
|
mDownloadRemainder = (Button) findViewById(R.id.download_remainder);
|
||||||
mDownloadRemainder.setVisibility(View.GONE);
|
mDownloadRemainder.setVisibility(View.GONE);
|
||||||
mAttachmentsContainer.setVisibility(View.GONE);
|
mAttachmentsContainer.setVisibility(View.GONE);
|
||||||
@ -162,6 +163,8 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
|
|||||||
TypedValue outValue = new TypedValue();
|
TypedValue outValue = new TypedValue();
|
||||||
getContext().getTheme().resolveAttribute(R.attr.messageViewHeaderBackgroundColor, outValue, true);
|
getContext().getTheme().resolveAttribute(R.attr.messageViewHeaderBackgroundColor, outValue, true);
|
||||||
mHeaderContainer.setBackgroundColor(outValue.data);
|
mHeaderContainer.setBackgroundColor(outValue.data);
|
||||||
|
// also set background of the whole view (including the attachments view)
|
||||||
|
setBackgroundColor(outValue.data);
|
||||||
|
|
||||||
mTitleBarHeaderContainer = new LinearLayout(activity);
|
mTitleBarHeaderContainer = new LinearLayout(activity);
|
||||||
mMessageContentView.setEmbeddedTitleBarCompat(mTitleBarHeaderContainer);
|
mMessageContentView.setEmbeddedTitleBarCompat(mTitleBarHeaderContainer);
|
||||||
|
Loading…
Reference in New Issue
Block a user