mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-07 20:46:17 +01:00
cleanup connection status display text
Get rid of treating 0 as a legit date (1970 being illegit). Tweak formatting. It's not perfect, but few people see it so we'll see how it goes during development.
This commit is contained in:
parent
1a36f3286b
commit
24a38c8f46
2 changed files with 30 additions and 13 deletions
|
@ -84,14 +84,24 @@ public class ConnStatusHandler {
|
|||
|
||||
public String newerStr( Context context )
|
||||
{
|
||||
s_time.set( successNewer? lastSuccess : lastFailure );
|
||||
return format( context, s_time );
|
||||
String result = null;
|
||||
long time = successNewer? lastSuccess : lastFailure;
|
||||
if ( time > 0 ) {
|
||||
s_time.set( time );
|
||||
result = format( context, s_time );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public String olderStr( Context context )
|
||||
{
|
||||
s_time.set( successNewer? lastFailure : lastSuccess );
|
||||
return format( context, s_time );
|
||||
String result = null;
|
||||
long time = successNewer? lastFailure : lastSuccess;
|
||||
if ( time > 0 ) {
|
||||
s_time.set( time );
|
||||
result = format( context, s_time );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void update( boolean success )
|
||||
|
@ -175,13 +185,20 @@ public class ConnStatusHandler {
|
|||
String did = addDebugInfo( context, typ );
|
||||
sb.append( String.format( "\n\n*** %s %s***\n",
|
||||
typ.longName( context ), did ) );
|
||||
|
||||
// For sends we list failures too.
|
||||
SuccessRecord record = recordFor( typ, false );
|
||||
tmp = LocUtils.getString( context, record.successNewer?
|
||||
R.string.connstat_succ :
|
||||
R.string.connstat_unsucc );
|
||||
sb.append( LocUtils
|
||||
.getString( context, R.string.connstat_lastsend_fmt,
|
||||
tmp, record.newerStr( context ) ) );
|
||||
|
||||
String timeStr = record.newerStr( context );
|
||||
if ( null != timeStr ) {
|
||||
sb.append( LocUtils
|
||||
.getString( context, R.string.connstat_lastsend_fmt,
|
||||
tmp, timeStr ) )
|
||||
.append( "\n" );
|
||||
}
|
||||
|
||||
int fmtId = 0;
|
||||
if ( record.successNewer ) {
|
||||
|
@ -193,11 +210,12 @@ public class ConnStatusHandler {
|
|||
fmtId = R.string.connstat_lastother_unsucc_fmt;
|
||||
}
|
||||
}
|
||||
if ( 0 != fmtId ) {
|
||||
sb.append( LocUtils.getString( context, fmtId,
|
||||
record.olderStr( context )));
|
||||
timeStr = record.olderStr( context );
|
||||
if ( 0 != fmtId && null != timeStr ) {
|
||||
sb.append( LocUtils.getString( context, fmtId, timeStr ))
|
||||
.append( "\n" );
|
||||
}
|
||||
sb.append( "\n\n" );
|
||||
sb.append( "\n" );
|
||||
|
||||
record = recordFor( typ, true );
|
||||
if ( record.haveSuccess() ) {
|
||||
|
|
|
@ -511,8 +511,7 @@ public class Utils {
|
|||
new ObjectInputStream( new ByteArrayInputStream(bytes) );
|
||||
result = ois.readObject();
|
||||
} catch ( Exception ex ) {
|
||||
Log.ex( TAG, ex );
|
||||
Assert.assertFalse( BuildConfig.DEBUG );
|
||||
Log.d( TAG, ex.getMessage() );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue