Display turn start time in game summary. This is definitely not its

final form!
This commit is contained in:
Eric House 2012-09-27 07:48:30 -07:00
parent 2c89f13383
commit ebaa22594d
3 changed files with 22 additions and 5 deletions

View file

@ -91,6 +91,11 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
/>
<TextView android:id="@+id/timeleft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
/>
</LinearLayout>
</LinearLayout>

View file

@ -2111,4 +2111,6 @@
<!-- -->
<string name="new_app_avail">Tap to download</string>
<!-- Used in GameListAdapter to show when turn started -->
<string name="turn_start">Current turn began: %s</string>
</resources>

View file

@ -19,23 +19,23 @@
*/
package org.eehouse.android.xw4;
import android.widget.ListAdapter;
import android.content.Context;
import android.database.DataSetObserver;
import android.os.AsyncTask;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.database.DataSetObserver;
import android.view.LayoutInflater;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.TextView;
import java.io.FileInputStream;
import java.text.DateFormat;
import java.util.Date;
import java.util.HashMap; // class is not synchronized
import java.util.Random;
import java.text.DateFormat;
import junit.framework.Assert;
@ -242,6 +242,16 @@ public class GameListAdapter extends XWListAdapter {
view.setVisibility( View.GONE );
}
view = (TextView)layout.findViewById( R.id.timeleft );
long startTime = summary.lastMoveTime;
if ( 0 == startTime ) {
view.setVisibility( View.GONE );
} else {
String time = m_df.format( new Date( startTime * 1000 ) );
view.setText( m_context.getString( R.string.turn_start,
time ) );
}
boolean expanded = DBUtils.getExpanded( m_context, m_rowid );
ViewInfo vi = new ViewInfo( layout, m_rowid,
expanded, haveTurn, haveTurnLocal );