truncate player name, not score

Try some funky layout shite to get, within a horizontal linear layout,
the first text field trucated if necessary so that the second (holding
the score) can be fully displayed. Tested on exactly one emulator so
far.
This commit is contained in:
Eric House 2018-02-03 20:08:55 -08:00
parent cf1f4a9114
commit 9c9a19d445
2 changed files with 9 additions and 3 deletions

View file

@ -305,7 +305,7 @@ public class GameListItem extends LinearLayout
TextView tview = (TextView)tmp.findViewById( R.id.item_name ); TextView tview = (TextView)tmp.findViewById( R.id.item_name );
tview.setText( summary.summarizePlayer( m_context, ii ) ); tview.setText( summary.summarizePlayer( m_context, ii ) );
tview = (TextView)tmp.findViewById( R.id.item_score ); tview = (TextView)tmp.findViewById( R.id.item_score );
tview.setText( String.format( " %d", summary.scores[ii] ) ); tview.setText( String.format( "%d", summary.scores[ii] ) );
boolean thisHasTurn = summary.isNextToPlay( ii, isLocal ); boolean thisHasTurn = summary.isNextToPlay( ii, isLocal );
if ( thisHasTurn ) { if ( thisHasTurn ) {
haveATurn = true; haveATurn = true;

View file

@ -3,19 +3,25 @@
<org.eehouse.android.xw4.ExpiringLinearLayout <org.eehouse.android.xw4.ExpiringLinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:weightSum="1"
> >
<TextView android:id="@+id/item_name" <TextView android:id="@+id/item_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"
android:gravity="left" android:gravity="left"
android:ellipsize="end"
android:singleLine="true"
android:layout_weight="1"
/> />
<TextView android:id="@+id/item_score" <TextView android:id="@+id/item_score"
android:layout_width="fill_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"
android:gravity="right" android:gravity="right"
android:singleLine="true"
android:layout_marginLeft="3dp"
/> />
</org.eehouse.android.xw4.ExpiringLinearLayout> </org.eehouse.android.xw4.ExpiringLinearLayout>