mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-04 20:46:28 +01:00
tweak chat layout; use better timestamp format
This commit is contained in:
parent
3aefa3a566
commit
0b2920102b
2 changed files with 19 additions and 18 deletions
|
@ -38,7 +38,7 @@ import android.widget.TableRow;
|
|||
import android.widget.TextView;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
import android.text.format.DateUtils;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
|
@ -176,10 +176,12 @@ public class ChatDelegate extends DelegateBase {
|
|||
m_names[playerIndx] ) );
|
||||
|
||||
if ( tsSeconds > 0 ) {
|
||||
view = (TextView)row.findViewById( R.id.chat_row_time );
|
||||
DateFormat df = DateFormat.getDateTimeInstance( DateFormat.SHORT,
|
||||
DateFormat.SHORT );
|
||||
view.setText( df.format( new Date( 1000L * tsSeconds ) ) );
|
||||
long now = 1000L * Utils.getCurSeconds();
|
||||
String str = DateUtils
|
||||
.formatSameDayTime( 1000L * tsSeconds, now, DateFormat.MEDIUM,
|
||||
DateFormat.MEDIUM )
|
||||
.toString();
|
||||
((TextView)row.findViewById( R.id.chat_row_time )).setText( str );
|
||||
}
|
||||
|
||||
m_layout.addView( row );
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<TableRow xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<TextView android:id="@+id/chat_row_name"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_marginRight="8dp"
|
||||
/>
|
||||
<TextView android:id="@+id/chat_row_text"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:singleLine="false"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
<TextView android:id="@+id/chat_row_time"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:singleLine="true"
|
||||
android:layout_marginRight="8dp"
|
||||
android:maxLines="1"
|
||||
/>
|
||||
<TextView android:id="@+id/chat_row_name"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_marginRight="8dp"
|
||||
android:maxLines="1"
|
||||
/>
|
||||
<TextView android:id="@+id/chat_row_text"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
|
|
Loading…
Add table
Reference in a new issue