summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a533ea5)
This lets you quickly identify stale data
Signed-off-by: Keith Packard <keithp@keithp.com>
import android.app.AlertDialog;
import android.location.Location;
import android.hardware.usb.*;
import android.app.AlertDialog;
import android.location.Location;
import android.hardware.usb.*;
+import android.graphics.*;
+import android.graphics.drawable.*;
import org.altusmetrum.altoslib_7.*;
import org.altusmetrum.altoslib_7.*;
private RelativeLayout mStateLayout;
private TextView mStateView;
private TextView mAgeView;
private RelativeLayout mStateLayout;
private TextView mStateView;
private TextView mAgeView;
+ private boolean mAgeViewOld;
+ private int mAgeNewColor;
+ private int mAgeOldColor;
// field to display the version at the bottom of the screen
private TextView mVersion;
// field to display the version at the bottom of the screen
private TextView mVersion;
- if (saved_state != null)
- mAgeView.setText(String.format("%d", (System.currentTimeMillis() - saved_state.received_time + 500) / 1000));
+ if (saved_state != null) {
+ int age = (int) ((System.currentTimeMillis() - saved_state.received_time + 500) / 1000);
+ boolean old = age >= 10;
+ if (old != mAgeViewOld) {
+ if (old)
+ mAgeView.setTextColor(mAgeOldColor);
+ else
+ mAgeView.setTextColor(mAgeNewColor);
+ mAgeViewOld = old;
+ }
+ mAgeView.setText(String.format("%d", age));
+ }
}
void update_ui(AltosState state, Location location) {
}
void update_ui(AltosState state, Location location) {
mStateLayout = (RelativeLayout) findViewById(R.id.state_container);
mStateView = (TextView) findViewById(R.id.state_value);
mAgeView = (TextView) findViewById(R.id.age_value);
mStateLayout = (RelativeLayout) findViewById(R.id.state_container);
mStateView = (TextView) findViewById(R.id.state_value);
mAgeView = (TextView) findViewById(R.id.age_value);
+ mAgeNewColor = mAgeView.getTextColors().getDefaultColor();
+ mAgeOldColor = getResources().getColor(R.color.old_color);
}
private boolean ensureBluetooth() {
}
private boolean ensureBluetooth() {