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 <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Hi, how are you?" android:autoLink="web"
android:autoLink="all"
android:textSize="16sp" android:textSize="16sp"
android:id="@+id/message_body" android:id="@+id/message_body"
android:textColor="#333333"/> android:textColor="#333333"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="1dp" android:paddingTop="1dp"
android:paddingRight="8dp"
android:text="@string/sending" android:text="@string/sending"
android:textColor="#8e8e8e" android:textColor="#8e8e8e"
android:textSize="12sp" 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>
</LinearLayout> </LinearLayout>
<ImageView <ImageView

View file

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

View file

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