mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-22 02:48:27 +00:00
Update conversation item style.
1) Don't print sender/recipient name in message body. 2) Do the split conversation icon view. 3) Adjust font sizes and colors.
This commit is contained in:
parent
eeeeac126c
commit
a7cc47d259
BIN
res/drawable-hdpi/divet_left.png
Normal file
BIN
res/drawable-hdpi/divet_left.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
res/drawable-hdpi/divet_right.png
Normal file
BIN
res/drawable-hdpi/divet_right.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
res/drawable-mdpi/divet_left.png
Normal file
BIN
res/drawable-mdpi/divet_left.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
res/drawable-mdpi/divet_right.png
Normal file
BIN
res/drawable-mdpi/divet_right.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
res/drawable-xhdpi/divet_left.png
Normal file
BIN
res/drawable-xhdpi/divet_left.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
res/drawable-xhdpi/divet_right.png
Normal file
BIN
res/drawable-xhdpi/divet_right.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
@ -1,19 +1,20 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ListView android:id="@android:id/list"
|
<ListView android:id="@android:id/list"
|
||||||
android:layout_width="match_parent"
|
style="?android:attr/listViewWhiteStyle"
|
||||||
android:layout_height="match_parent"
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1.0"
|
android:layout_weight="1.0"
|
||||||
android:listSelector="@drawable/chat_history_selector"
|
android:listSelector="@drawable/chat_history_selector"
|
||||||
android:drawSelectorOnTop="true"
|
android:drawSelectorOnTop="true"
|
||||||
android:transcriptMode="alwaysScroll"
|
android:transcriptMode="alwaysScroll"
|
||||||
android:scrollbarAlwaysDrawVerticalTrack="true"
|
android:scrollbarAlwaysDrawVerticalTrack="false"
|
||||||
android:scrollbarStyle="insideInset"
|
android:scrollbarStyle="insideOverlay"
|
||||||
android:stackFromBottom="true"
|
android:stackFromBottom="true"
|
||||||
android:fadingEdge="none"
|
android:fadingEdge="none"
|
||||||
android:layout_marginBottom="1dip"/>
|
android:layout_marginBottom="1dip"/>
|
||||||
|
@ -1,159 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<!--<org.thoughtcrime.securesms.ConversationItem-->
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/conversation_item"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingLeft="10px"
|
|
||||||
android:paddingTop="5px"
|
|
||||||
android:paddingRight="10px"
|
|
||||||
android:paddingBottom="10px"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<!-- <android.widget.QuickContactBadge android:id="@+id/contact_photo"-->
|
|
||||||
<!-- android:layout_width="60dp"-->
|
|
||||||
<!-- android:layout_height="60dp"-->
|
|
||||||
<!-- android:cropToPadding="true"-->
|
|
||||||
<!-- android:layout_marginRight="10px"-->
|
|
||||||
<!-- android:scaleType="centerCrop"-->
|
|
||||||
<!-- android:visibility="gone" />-->
|
|
||||||
|
|
||||||
<ImageView android:id="@+id/contact_photo"
|
|
||||||
android:layout_width="60dp"
|
|
||||||
android:layout_height="60dp"
|
|
||||||
android:cropToPadding="true"
|
|
||||||
android:layout_marginRight="10px"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/conversation_item_parent"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical" >
|
|
||||||
|
|
||||||
<TextView android:id="@+id/conversation_item_body"
|
|
||||||
android:autoLink="all"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:linksClickable="true"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
|
||||||
android:textColor="#ff000000"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/mms_view"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:paddingTop="7dip"
|
|
||||||
android:paddingBottom="7dip">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/image_view"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:maxWidth="178dip"
|
|
||||||
android:maxHeight="178dip"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:background="@android:drawable/picture_frame"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/play_slideshow_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@drawable/mms_play_btn"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/mms_download_controls"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<Button android:id="@+id/mms_download_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:text="Download"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<TextView android:id="@+id/mms_label_downloading"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_marginLeft="5dp"
|
|
||||||
android:layout_marginRight="5dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="Downloading"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<TextView android:id="@+id/conversation_item_date"
|
|
||||||
android:autoLink="all"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:linksClickable="false"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
|
||||||
android:textColor="#bf000000"
|
|
||||||
android:paddingTop="3px"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
<LinearLayout android:id="@+id/indicators_parent"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/key_exchange_indicator"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:src="@drawable/key"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/sms_pending_indicator"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:src="@drawable/ic_sms_mms_pending"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/sms_secure_indicator"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:src="@drawable/ic_lock_small"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/sms_failed_indicator"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:src="@drawable/ic_sms_mms_not_delivered"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
<!--</org.thoughtcrime.securesms.ConversationItem>-->
|
|
||||||
</LinearLayout>
|
|
147
res/layout/conversation_item_received.xml
Normal file
147
res/layout/conversation_item_received.xml
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<org.thoughtcrime.securesms.ConversationItem
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/conversation_item"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingRight="10dip"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<view xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
class="org.thoughtcrime.securesms.components.ImageDivet"
|
||||||
|
position="right"
|
||||||
|
android:id="@id/contact_photo"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:cropToPadding="true"
|
||||||
|
android:layout_marginRight="10dip"
|
||||||
|
android:scaleType="centerCrop" />
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/conversation_item_parent"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toLeftOf="@+id/indicators_parent"
|
||||||
|
android:layout_toRightOf="@id/contact_photo"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<TextView android:id="@+id/conversation_item_body"
|
||||||
|
android:autoLink="all"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:linksClickable="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="#ff000000"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/mms_view"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:paddingTop="7dip"
|
||||||
|
android:paddingBottom="7dip">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image_view"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:maxWidth="178dip"
|
||||||
|
android:maxHeight="178dip"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:background="@android:drawable/picture_frame"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/play_slideshow_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/mms_play_btn"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/mms_download_controls"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button android:id="@+id/mms_download_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:text="Download"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/mms_label_downloading"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Downloading"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView android:id="@+id/conversation_item_date"
|
||||||
|
android:autoLink="all"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:linksClickable="false"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:gravity="left"
|
||||||
|
android:textColor="#ffcccccc"
|
||||||
|
android:paddingTop="1dip"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/indicators_parent"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_alignParentRight="true">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/key_exchange_indicator"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:src="@drawable/key"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/sms_pending_indicator"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:src="@drawable/ic_sms_mms_pending"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/sms_secure_indicator"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:src="@drawable/ic_lock_small"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/sms_failed_indicator"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:src="@drawable/ic_sms_mms_not_delivered"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
</org.thoughtcrime.securesms.ConversationItem>
|
151
res/layout/conversation_item_sent.xml
Normal file
151
res/layout/conversation_item_sent.xml
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<org.thoughtcrime.securesms.ConversationItem
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/conversation_item"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="10dip"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/indicators_parent"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_alignParentLeft="true">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/key_exchange_indicator"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:src="@drawable/key"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/sms_pending_indicator"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:src="@drawable/ic_sms_mms_pending"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/sms_secure_indicator"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:src="@drawable/ic_lock_small"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/sms_failed_indicator"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:src="@drawable/ic_sms_mms_not_delivered"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/conversation_item_parent"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toRightOf="@id/indicators_parent"
|
||||||
|
android:layout_toLeftOf="@+id/contact_photo"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<TextView android:id="@+id/conversation_item_body"
|
||||||
|
android:autoLink="all"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:linksClickable="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:gravity="right"
|
||||||
|
android:textColor="#ff000000"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/mms_view"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:paddingTop="7dip"
|
||||||
|
android:paddingBottom="7dip">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image_view"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:maxWidth="178dip"
|
||||||
|
android:maxHeight="178dip"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:background="@android:drawable/picture_frame"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/play_slideshow_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/mms_play_btn"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/mms_download_controls"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button android:id="@+id/mms_download_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:text="Download"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/mms_label_downloading"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Downloading"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView android:id="@+id/conversation_item_date"
|
||||||
|
android:autoLink="all"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:linksClickable="false"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:gravity="right"
|
||||||
|
android:textColor="#ffcccccc"
|
||||||
|
android:paddingTop="1dip"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<view xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
class="org.thoughtcrime.securesms.components.ImageDivet"
|
||||||
|
position="left"
|
||||||
|
android:id="@id/contact_photo"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:cropToPadding="true"
|
||||||
|
android:layout_marginLeft="10dip"
|
||||||
|
android:layout_marginRight="0dip"
|
||||||
|
android:padding="0dip"
|
||||||
|
android:scaleType="centerCrop" />
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
</org.thoughtcrime.securesms.ConversationItem>
|
@ -44,25 +44,6 @@
|
|||||||
android:title="Choose Identity"
|
android:title="Choose Identity"
|
||||||
android:summary="Choose your contact entry from the contacts list."/>
|
android:summary="Choose your contact entry from the contacts list."/>
|
||||||
|
|
||||||
<CheckBoxPreference android:defaultValue="true"
|
|
||||||
android:key="pref_dark_threads"
|
|
||||||
android:summary="Display dark background in thread list"
|
|
||||||
android:title="Dark Thread List Theme" />
|
|
||||||
|
|
||||||
<CheckBoxPreference android:defaultValue="false"
|
|
||||||
android:key="pref_dark_conversation"
|
|
||||||
android:summary="Display dark background in conversation view"
|
|
||||||
android:title="Dark Conversation Theme" />
|
|
||||||
|
|
||||||
<CheckBoxPreference android:defaultValue="true"
|
|
||||||
android:key="pref_conversation_list_icons"
|
|
||||||
android:summary="Show contact photo icons in list of conversation threads"
|
|
||||||
android:title="List Photos" />
|
|
||||||
|
|
||||||
<CheckBoxPreference android:defaultValue="true"
|
|
||||||
android:key="pref_conversation_icons"
|
|
||||||
android:summary="Show contact photo icons in conversation"
|
|
||||||
android:title="Conversation Photos" />
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="Encryption Settings">
|
<PreferenceCategory android:title="Encryption Settings">
|
||||||
|
@ -16,6 +16,16 @@
|
|||||||
*/
|
*/
|
||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.Preference;
|
||||||
|
import android.preference.PreferenceActivity;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.contacts.ContactAccessor;
|
import org.thoughtcrime.securesms.contacts.ContactAccessor;
|
||||||
import org.thoughtcrime.securesms.crypto.IdentityKey;
|
import org.thoughtcrime.securesms.crypto.IdentityKey;
|
||||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
|
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
|
||||||
@ -24,18 +34,6 @@ import org.thoughtcrime.securesms.service.KeyCachingService;
|
|||||||
import org.thoughtcrime.securesms.util.Dialogs;
|
import org.thoughtcrime.securesms.util.Dialogs;
|
||||||
import org.thoughtcrime.securesms.util.MemoryCleaner;
|
import org.thoughtcrime.securesms.util.MemoryCleaner;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.preference.CheckBoxPreference;
|
|
||||||
import android.preference.Preference;
|
|
||||||
import android.preference.PreferenceActivity;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Activity for application preference display and management.
|
* The Activity for application preference display and management.
|
||||||
*
|
*
|
||||||
@ -55,10 +53,6 @@ public class ApplicationPreferencesActivity extends PreferenceActivity {
|
|||||||
public static final String LED_COLOR_PREF = "pref_led_color";
|
public static final String LED_COLOR_PREF = "pref_led_color";
|
||||||
public static final String LED_BLINK_PREF = "pref_led_blink";
|
public static final String LED_BLINK_PREF = "pref_led_blink";
|
||||||
public static final String LED_BLINK_PREF_CUSTOM = "pref_led_blink_custom";
|
public static final String LED_BLINK_PREF_CUSTOM = "pref_led_blink_custom";
|
||||||
public static final String DARK_THREADS_PREF = "pref_dark_threads";
|
|
||||||
public static final String DARK_CONVERSATION_PREF = "pref_dark_conversation";
|
|
||||||
public static final String CONVERSATION_ICONS_PREF = "pref_conversation_icons";
|
|
||||||
public static final String CONVERSATION_ICONS_LIST_PREF = "pref_conversation_list_icons";
|
|
||||||
public static final String IDENTITY_PREF = "pref_choose_identity";
|
public static final String IDENTITY_PREF = "pref_choose_identity";
|
||||||
public static final String SEND_IDENTITY_PREF = "pref_send_identity_key";
|
public static final String SEND_IDENTITY_PREF = "pref_send_identity_key";
|
||||||
public static final String ALL_MMS_PERF = "pref_all_mms";
|
public static final String ALL_MMS_PERF = "pref_all_mms";
|
||||||
@ -77,19 +71,6 @@ public class ApplicationPreferencesActivity extends PreferenceActivity {
|
|||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
addPreferencesFromResource(R.xml.preferences);
|
addPreferencesFromResource(R.xml.preferences);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.DONUT) {
|
|
||||||
CheckBoxPreference mmsPreference = (CheckBoxPreference)this.findPreference("pref_all_mms");
|
|
||||||
mmsPreference.setChecked(false);
|
|
||||||
mmsPreference.setEnabled(false);
|
|
||||||
mmsPreference.setSelectable(false);
|
|
||||||
|
|
||||||
CheckBoxPreference listIconPreference = (CheckBoxPreference)this.findPreference(CONVERSATION_ICONS_LIST_PREF);
|
|
||||||
listIconPreference.setDefaultValue(false);
|
|
||||||
|
|
||||||
CheckBoxPreference conversationIconPreference = (CheckBoxPreference)this.findPreference(CONVERSATION_ICONS_PREF);
|
|
||||||
conversationIconPreference.setDefaultValue(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.findPreference(IDENTITY_PREF).setOnPreferenceClickListener(new IdentityPreferenceClickListener());
|
this.findPreference(IDENTITY_PREF).setOnPreferenceClickListener(new IdentityPreferenceClickListener());
|
||||||
this.findPreference(VIEW_MY_IDENTITY_PREF).setOnPreferenceClickListener(new ViewMyIdentityClickListener());
|
this.findPreference(VIEW_MY_IDENTITY_PREF).setOnPreferenceClickListener(new ViewMyIdentityClickListener());
|
||||||
this.findPreference(EXPORT_MY_IDENTITY_PREF).setOnPreferenceClickListener(new ExportMyIdentityClickListener());
|
this.findPreference(EXPORT_MY_IDENTITY_PREF).setOnPreferenceClickListener(new ExportMyIdentityClickListener());
|
||||||
@ -132,10 +113,6 @@ public class ApplicationPreferencesActivity extends PreferenceActivity {
|
|||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean showIcon() {
|
|
||||||
return Build.VERSION.SDK_INT > Build.VERSION_CODES.DONUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleIdentitySelection(Intent data) {
|
private void handleIdentitySelection(Intent data) {
|
||||||
Uri contactData = data.getData();
|
Uri contactData = data.getData();
|
||||||
if (contactData != null)
|
if (contactData != null)
|
||||||
|
@ -20,6 +20,7 @@ import android.content.Context;
|
|||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -63,6 +64,7 @@ public class ConversationAdapter extends CursorAdapter {
|
|||||||
private final Recipients recipients;
|
private final Recipients recipients;
|
||||||
private final MasterSecret masterSecret;
|
private final MasterSecret masterSecret;
|
||||||
private final MasterCipher masterCipher;
|
private final MasterCipher masterCipher;
|
||||||
|
private final LayoutInflater inflater;
|
||||||
|
|
||||||
private boolean dataChanged;
|
private boolean dataChanged;
|
||||||
|
|
||||||
@ -76,6 +78,8 @@ public class ConversationAdapter extends CursorAdapter {
|
|||||||
this.dataChanged = false;
|
this.dataChanged = false;
|
||||||
this.failedIconClickHandler = failedIconClickHandler;
|
this.failedIconClickHandler = failedIconClickHandler;
|
||||||
this.messageRecordCache = initializeCache();
|
this.messageRecordCache = initializeCache();
|
||||||
|
this.inflater = (LayoutInflater)context
|
||||||
|
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
|
||||||
DatabaseFactory.getThreadDatabase(context).setRead(threadId);
|
DatabaseFactory.getThreadDatabase(context).setRead(threadId);
|
||||||
MessageNotifier.updateNotification(context, false);
|
MessageNotifier.updateNotification(context, false);
|
||||||
@ -107,12 +111,37 @@ public class ConversationAdapter extends CursorAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View newView(Context context, Cursor cursor, ViewGroup parent) {
|
public View newView(Context context, Cursor cursor, ViewGroup parent) {
|
||||||
ConversationItem view = new ConversationItem(context);
|
View view;
|
||||||
bindView(view, context, cursor);
|
|
||||||
|
|
||||||
|
int type = getItemViewType(cursor);
|
||||||
|
|
||||||
|
if (type == 0) view = inflater.inflate(R.layout.conversation_item_sent, parent, false);
|
||||||
|
else view = inflater.inflate(R.layout.conversation_item_received, parent, false);
|
||||||
|
|
||||||
|
bindView(view, context, cursor);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getViewTypeCount() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
Cursor cursor = (Cursor)getItem(position);
|
||||||
|
return getItemViewType(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getItemViewType(Cursor cursor) {
|
||||||
|
long id = cursor.getLong(cursor.getColumnIndexOrThrow(SmsDatabase.ID));
|
||||||
|
String type = cursor.getString(cursor.getColumnIndexOrThrow(SmsDatabase.TRANSPORT));
|
||||||
|
MessageRecord messageRecord = getMessageRecord(id, cursor, type);
|
||||||
|
|
||||||
|
if (messageRecord.isOutgoing()) return 0;
|
||||||
|
else return 1;
|
||||||
|
}
|
||||||
|
|
||||||
private MessageRecord getNewMmsMessageRecord(long messageId, Cursor cursor) {
|
private MessageRecord getNewMmsMessageRecord(long messageId, Cursor cursor) {
|
||||||
MessageRecord messageRecord = getNewSmsMessageRecord(messageId, cursor);
|
MessageRecord messageRecord = getNewSmsMessageRecord(messageId, cursor);
|
||||||
long mmsType = cursor.getLong(cursor.getColumnIndexOrThrow(MmsDatabase.MESSAGE_TYPE));
|
long mmsType = cursor.getLong(cursor.getColumnIndexOrThrow(MmsDatabase.MESSAGE_TYPE));
|
||||||
|
@ -16,13 +16,30 @@
|
|||||||
*/
|
*/
|
||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
import java.io.File;
|
import android.app.AlertDialog;
|
||||||
import java.io.FileOutputStream;
|
import android.app.ProgressDialog;
|
||||||
import java.io.IOException;
|
import android.content.Context;
|
||||||
import java.io.InputStream;
|
import android.content.DialogInterface;
|
||||||
import java.io.OutputStream;
|
import android.content.Intent;
|
||||||
import java.util.Iterator;
|
import android.media.MediaScannerConnection;
|
||||||
import java.util.List;
|
import android.net.Uri;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Message;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.telephony.TelephonyManager;
|
||||||
|
import android.text.Spannable;
|
||||||
|
import android.text.format.DateUtils;
|
||||||
|
import android.text.style.ForegroundColorSpan;
|
||||||
|
import android.text.style.StyleSpan;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||||
import org.thoughtcrime.securesms.database.MessageRecord;
|
import org.thoughtcrime.securesms.database.MessageRecord;
|
||||||
@ -35,31 +52,13 @@ import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
|||||||
import org.thoughtcrime.securesms.recipients.RecipientFormattingException;
|
import org.thoughtcrime.securesms.recipients.RecipientFormattingException;
|
||||||
import org.thoughtcrime.securesms.service.SendReceiveService;
|
import org.thoughtcrime.securesms.service.SendReceiveService;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import java.io.File;
|
||||||
import android.app.ProgressDialog;
|
import java.io.FileOutputStream;
|
||||||
import android.content.Context;
|
import java.io.IOException;
|
||||||
import android.content.DialogInterface;
|
import java.io.InputStream;
|
||||||
import android.content.Intent;
|
import java.io.OutputStream;
|
||||||
import android.graphics.Color;
|
import java.util.Iterator;
|
||||||
import android.media.MediaScannerConnection;
|
import java.util.List;
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Environment;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.telephony.TelephonyManager;
|
|
||||||
import android.text.Spannable;
|
|
||||||
import android.text.format.DateUtils;
|
|
||||||
import android.text.style.ForegroundColorSpan;
|
|
||||||
import android.text.style.StyleSpan;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A view that displays an individual conversation item within a conversation
|
* A view that displays an individual conversation item within a conversation
|
||||||
@ -75,17 +74,17 @@ public class ConversationItem extends LinearLayout {
|
|||||||
private MessageRecord messageRecord;
|
private MessageRecord messageRecord;
|
||||||
private MasterSecret masterSecret;
|
private MasterSecret masterSecret;
|
||||||
|
|
||||||
private final TextView bodyText;
|
private TextView bodyText;
|
||||||
private final TextView dateText;
|
private TextView dateText;
|
||||||
private final ImageView pendingImage;
|
private ImageView pendingImage;
|
||||||
private final ImageView secureImage;
|
private ImageView secureImage;
|
||||||
private final ImageView failedImage;
|
private ImageView failedImage;
|
||||||
private final ImageView keyImage;
|
private ImageView keyImage;
|
||||||
private final ImageView contactPhoto;
|
private ImageView contactPhoto;
|
||||||
|
|
||||||
private final ImageView mmsThumbnail;
|
private ImageView mmsThumbnail;
|
||||||
private final Button mmsDownloadButton;
|
private Button mmsDownloadButton;
|
||||||
private final TextView mmsDownloadingLabel;
|
private TextView mmsDownloadingLabel;
|
||||||
|
|
||||||
private final FailedIconClickListener failedIconClickListener = new FailedIconClickListener();
|
private final FailedIconClickListener failedIconClickListener = new FailedIconClickListener();
|
||||||
private final MmsDownloadClickListener mmsDownloadClickListener = new MmsDownloadClickListener();
|
private final MmsDownloadClickListener mmsDownloadClickListener = new MmsDownloadClickListener();
|
||||||
@ -94,11 +93,18 @@ public class ConversationItem extends LinearLayout {
|
|||||||
|
|
||||||
public ConversationItem(Context context) {
|
public ConversationItem(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
LayoutInflater li = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
li.inflate(R.layout.conversation_item, this);
|
|
||||||
|
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConversationItem(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onFinishInflate() {
|
||||||
|
super.onFinishInflate();
|
||||||
|
|
||||||
this.bodyText = (TextView) findViewById(R.id.conversation_item_body);
|
this.bodyText = (TextView) findViewById(R.id.conversation_item_body);
|
||||||
this.dateText = (TextView) findViewById(R.id.conversation_item_date);
|
this.dateText = (TextView) findViewById(R.id.conversation_item_date);
|
||||||
this.pendingImage = (ImageView)findViewById(R.id.sms_pending_indicator);
|
this.pendingImage = (ImageView)findViewById(R.id.sms_pending_indicator);
|
||||||
@ -113,11 +119,6 @@ public class ConversationItem extends LinearLayout {
|
|||||||
setOnClickListener(clickListener);
|
setOnClickListener(clickListener);
|
||||||
this.failedImage.setOnClickListener(failedIconClickListener);
|
this.failedImage.setOnClickListener(failedIconClickListener);
|
||||||
this.mmsDownloadButton.setOnClickListener(mmsDownloadClickListener);
|
this.mmsDownloadButton.setOnClickListener(mmsDownloadClickListener);
|
||||||
|
|
||||||
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(ApplicationPreferencesActivity.DARK_CONVERSATION_PREF, false)) {
|
|
||||||
this.bodyText.setTextColor(Color.WHITE);
|
|
||||||
this.dateText.setTextColor(Color.LTGRAY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(MasterSecret masterSecret, MessageRecord messageRecord, Handler failedIconHandler)
|
public void set(MasterSecret masterSecret, MessageRecord messageRecord, Handler failedIconHandler)
|
||||||
@ -209,34 +210,18 @@ public class ConversationItem extends LinearLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setBodyText(MessageRecord messageRecord) {
|
private void setBodyText(MessageRecord messageRecord) {
|
||||||
String address = "";
|
|
||||||
Recipient recipient = messageRecord.getMessageRecipient();
|
|
||||||
String body = messageRecord.getBody();
|
String body = messageRecord.getBody();
|
||||||
|
|
||||||
if (messageRecord.isKeyExchange() && messageRecord.isOutgoing()) body = "\nSent key exchange message";
|
if (messageRecord.isKeyExchange() && messageRecord.isOutgoing()) body = "\nSent key exchange message";
|
||||||
else if (messageRecord.isProcessedKeyExchange() && !messageRecord.isOutgoing()) body = "\nReceived and processed key exchange message.";
|
else if (messageRecord.isProcessedKeyExchange() && !messageRecord.isOutgoing()) body = "\nReceived and processed key exchange message.";
|
||||||
else if (messageRecord.isStaleKeyExchange()) body = "\nError, received stale key exchange message.";
|
else if (messageRecord.isStaleKeyExchange()) body = "\nError, received stale key exchange message.";
|
||||||
else if (messageRecord.isKeyExchange() && !messageRecord.isOutgoing()) body = "\nReceived key exchange message, click to process";
|
else if (messageRecord.isKeyExchange() && !messageRecord.isOutgoing()) body = "\nReceived key exchange message, click to process";
|
||||||
else if (messageRecord.isOutgoing()) address = "Me: ";
|
|
||||||
else address = (recipient.getName() == null ? recipient.getNumber() : recipient.getName()) + ": ";
|
|
||||||
|
|
||||||
bodyText.setText(address + body, TextView.BufferType.SPANNABLE);
|
bodyText.setText(body, TextView.BufferType.SPANNABLE);
|
||||||
|
|
||||||
if (messageRecord.isKeyExchange() || messageRecord.getEmphasis()) {
|
if (messageRecord.isKeyExchange() || messageRecord.getEmphasis()) {
|
||||||
((Spannable)bodyText.getText()).setSpan(new ForegroundColorSpan(context.getResources().getColor(android.R.color.darker_gray)), address.length(), address.length() + body.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
((Spannable)bodyText.getText()).setSpan(new ForegroundColorSpan(context.getResources().getColor(android.R.color.darker_gray)), 0, body.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
((Spannable)bodyText.getText()).setSpan(new StyleSpan(android.graphics.Typeface.ITALIC), 0, address.length() + body.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
((Spannable)bodyText.getText()).setSpan(new StyleSpan(android.graphics.Typeface.ITALIC), 0, body.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
} else {
|
|
||||||
((Spannable)bodyText.getText()).setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, address.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setBodyBackground(MessageRecord messageRecord) {
|
|
||||||
if (!PreferenceManager.getDefaultSharedPreferences(context).getBoolean(ApplicationPreferencesActivity.DARK_CONVERSATION_PREF, false)) {
|
|
||||||
if (messageRecord.isOutgoing()) setBackgroundResource(R.drawable.conversation_item_background_lightblue);
|
|
||||||
else setBackgroundResource(R.drawable.conversation_item_background);
|
|
||||||
} else {
|
|
||||||
if (messageRecord.isOutgoing()) setBackgroundResource(R.drawable.conversation_item_background_black);
|
|
||||||
else setBackgroundResource(R.drawable.conversation_item_background_lightgrey);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,8 +250,7 @@ public class ConversationItem extends LinearLayout {
|
|||||||
private void setBodyImage(MessageRecord messageRecord) {
|
private void setBodyImage(MessageRecord messageRecord) {
|
||||||
Recipient recipient = messageRecord.getMessageRecipient();
|
Recipient recipient = messageRecord.getMessageRecipient();
|
||||||
|
|
||||||
if (!PreferenceManager.getDefaultSharedPreferences(context).getBoolean(ApplicationPreferencesActivity.CONVERSATION_ICONS_PREF, ApplicationPreferencesActivity.showIcon()) ||
|
if (messageRecord.isKeyExchange())
|
||||||
messageRecord.isKeyExchange())
|
|
||||||
{
|
{
|
||||||
contactPhoto.setVisibility(View.GONE);
|
contactPhoto.setVisibility(View.GONE);
|
||||||
return;
|
return;
|
||||||
@ -280,7 +264,6 @@ public class ConversationItem extends LinearLayout {
|
|||||||
|
|
||||||
private void setBody(MessageRecord messageRecord) {
|
private void setBody(MessageRecord messageRecord) {
|
||||||
setBodyText(messageRecord);
|
setBodyText(messageRecord);
|
||||||
setBodyBackground(messageRecord);
|
|
||||||
setBodyImage(messageRecord);
|
setBodyImage(messageRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,7 +277,7 @@ public class ConversationItem extends LinearLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setDate(long date) {
|
private void setDate(long date) {
|
||||||
dateText.setText("Sent: " + DateUtils.getRelativeTimeSpanString(getContext(), date, false));
|
dateText.setText(DateUtils.getRelativeTimeSpanString(getContext(), date, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setStatusIcons(MessageRecord messageRecord) {
|
private void setStatusIcons(MessageRecord messageRecord) {
|
||||||
|
118
src/org/thoughtcrime/securesms/components/ImageDivet.java
Normal file
118
src/org/thoughtcrime/securesms/components/ImageDivet.java
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
package org.thoughtcrime.securesms.components;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.R;
|
||||||
|
|
||||||
|
public class ImageDivet extends ImageView {
|
||||||
|
private static final float CORNER_OFFSET = 12F;
|
||||||
|
private static final String[] POSITIONS = new String[] {"left", "right"};
|
||||||
|
|
||||||
|
private Drawable drawable;
|
||||||
|
|
||||||
|
private int drawableIntrinsicWidth;
|
||||||
|
private int drawableIntrinsicHeight;
|
||||||
|
private int position;
|
||||||
|
private float density;
|
||||||
|
|
||||||
|
public ImageDivet(Context context, AttributeSet attrs, int defStyle) {
|
||||||
|
super(context, attrs, defStyle);
|
||||||
|
initialize(attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImageDivet(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
initialize(attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImageDivet(Context context) {
|
||||||
|
super(context);
|
||||||
|
initialize(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initialize(AttributeSet attrs) {
|
||||||
|
if (attrs != null) {
|
||||||
|
position = attrs.getAttributeListValue(null, "position", POSITIONS, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
density = getContext().getResources().getDisplayMetrics().density;
|
||||||
|
setDrawable();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setDrawable() {
|
||||||
|
Resources r = getContext().getResources();
|
||||||
|
|
||||||
|
switch (position) {
|
||||||
|
case 0:
|
||||||
|
drawable = r.getDrawable(R.drawable.divet_right);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
drawable = r.getDrawable(R.drawable.divet_left);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
drawableIntrinsicWidth = drawable.getIntrinsicWidth();
|
||||||
|
drawableIntrinsicHeight = drawable.getIntrinsicHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDraw(Canvas c) {
|
||||||
|
super.onDraw(c);
|
||||||
|
c.save();
|
||||||
|
computeBounds(c);
|
||||||
|
drawable.draw(c);
|
||||||
|
c.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPosition(int position) {
|
||||||
|
this.position = position;
|
||||||
|
setDrawable();
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPosition() {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getCloseOffset() {
|
||||||
|
return CORNER_OFFSET * density;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImageView asImageView() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getFarOffset() {
|
||||||
|
return getCloseOffset() + drawableIntrinsicHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void computeBounds(Canvas c) {
|
||||||
|
final int left = 0;
|
||||||
|
final int top = 0;
|
||||||
|
final int right = getWidth();
|
||||||
|
|
||||||
|
final int cornerOffset = (int) getCloseOffset();
|
||||||
|
|
||||||
|
switch (position) {
|
||||||
|
case 1:
|
||||||
|
drawable.setBounds(
|
||||||
|
right - drawableIntrinsicWidth,
|
||||||
|
top + cornerOffset,
|
||||||
|
right,
|
||||||
|
top + cornerOffset + drawableIntrinsicHeight);
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
drawable.setBounds(
|
||||||
|
left,
|
||||||
|
top + cornerOffset,
|
||||||
|
left + drawableIntrinsicWidth,
|
||||||
|
top + cornerOffset + drawableIntrinsicHeight);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user