added security indicator on every single message

This commit is contained in:
Daniel Gultsch 2014-03-15 00:19:42 +01:00
parent b0d57d01c4
commit 8f9712c64e
7 changed files with 84 additions and 36 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -23,20 +23,37 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi, how are you?"
android:autoLink="all"
android:autoLink="web"
android:textSize="16sp"
android:id="@+id/message_body"
android:textColor="#333333"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="1dp"
android:paddingRight="8dp"
android:text="@string/sending"
android:textColor="#8e8e8e"
android:textSize="12sp"
android:id="@+id/message_time"/>
android:id="@+id/message_time"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"/>
<ImageView
android:id="@+id/security_indicator"
android:layout_width="14sp"
android:layout_height="14sp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:paddingTop="2dp"
android:src="@drawable/ic_indicator"
android:visibility="gone"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ImageView

View File

@ -3,42 +3,61 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp">
android:padding="8dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/message_border"
android:layout_toLeftOf="@+id/message_photo"
android:layout_alignParentBottom="true"
android:minHeight="48dp"
>
<LinearLayout
android:layout_toLeftOf="@+id/message_photo"
android:background="@drawable/message_border"
android:minHeight="48dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#ededed"
android:padding="5dp">
android:orientation="vertical"
android:padding="5dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi, how are you?"
android:textSize="16sp"
android:id="@+id/message_body"
android:autoLink="all"
android:textColor="#333333"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="all"
android:textColor="#333333"
android:textSize="16sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/message_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:paddingRight="8dp"
android:paddingTop="1dp"
android:text="@string/sending"
android:textColor="#8e8e8e"
android:textSize="12sp"
android:id="@+id/message_time"/>
android:textSize="12sp" />
<ImageView
android:id="@+id/security_indicator"
android:layout_width="14sp"
android:layout_height="14sp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:paddingTop="2dp"
android:src="@drawable/ic_indicator"
android:visibility="gone"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/message_photo"
android:layout_width="48dp"
@ -47,7 +66,7 @@
android:layout_alignParentRight="true"
android:layout_marginLeft="-1.5dp"
android:padding="0dp"
android:src="@drawable/ic_profile"
android:scaleType="fitXY"/>
android:scaleType="fitXY"
android:src="@drawable/ic_profile" />
</RelativeLayout>

View File

@ -239,6 +239,7 @@ public class ConversationFragment extends Fragment {
.findViewById(R.id.message_body);
viewHolder.time = (TextView) view
.findViewById(R.id.message_time);
viewHolder.indicator = (ImageView) view.findViewById(R.id.security_indicator);
view.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) view.getTag();
@ -266,12 +267,22 @@ public class ConversationFragment extends Fragment {
viewHolder.messageBody.setTextColor(0xff33B5E5);
viewHolder.messageBody.setTypeface(null,
Typeface.ITALIC);
viewHolder.indicator.setVisibility(View.VISIBLE);
} else if ((item.getEncryption() == Message.ENCRYPTION_OTR)||(item.getEncryption() == Message.ENCRYPTION_DECRYPTED)) {
viewHolder.messageBody.setText(body.trim());
viewHolder.messageBody.setTextColor(0xff000000);
viewHolder.messageBody.setTypeface(null,
Typeface.NORMAL);
viewHolder.indicator.setVisibility(View.VISIBLE);
} else {
viewHolder.messageBody.setText(body.trim());
viewHolder.messageBody.setTextColor(0xff000000);
viewHolder.messageBody.setTypeface(null,
Typeface.NORMAL);
viewHolder.indicator.setVisibility(View.GONE);
}
} else {
viewHolder.indicator.setVisibility(View.GONE);
}
if (item.getStatus() == Message.STATUS_UNSEND) {
viewHolder.time.setTypeface(null, Typeface.ITALIC);
@ -554,6 +565,7 @@ public class ConversationFragment extends Fragment {
private static class ViewHolder {
protected ImageView indicator;
protected TextView time;
protected TextView messageBody;
protected ImageView imageView;