Skip to content

Commit

Permalink
Merge branch 'rmbatindicator' into wip/offlinepebble
Browse files Browse the repository at this point in the history
Conflicts:
	app/src/main/java/com/nightscout/android/MainActivity.java
	app/src/main/java/com/nightscout/android/preferences/PreferenceKeys.java
  • Loading branch information
ktind committed Dec 8, 2014
2 parents a936e1c + 2457784 commit 1b0b6fa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
21 changes: 20 additions & 1 deletion app/src/main/java/com/nightscout/android/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.android.gms.analytics.Tracker;
import com.nightscout.android.dexcom.SyncingService;
import com.nightscout.android.preferences.AndroidPreferences;
import com.nightscout.android.preferences.PreferenceKeys;
import com.nightscout.android.settings.SettingsActivity;
import com.nightscout.android.wearables.Pebble;
import com.nightscout.core.dexcom.Constants;
Expand Down Expand Up @@ -226,6 +227,10 @@ protected void onResume() {
mWebView.loadUrl("javascript:updateUnits(" + Boolean.toString(currentUnits == Constants.MG_DL_TO_MMOL_L) + ")");

mHandler.post(updateTimeAgo);
// FIXME: (klee) need to find a better way to do this. Too many things are hooking in here.
if (statusBarIcons != null) {
statusBarIcons.checkForRootOptionChanged();
}
}

private String getSGVStringByUnit(int sgv, TrendArrow trend){
Expand Down Expand Up @@ -459,22 +464,36 @@ public class StatusBarIcons {
private ImageView mImageViewUpload;
private ImageView mImageViewTimeIndicator;
private ImageView mImageRcvrBattery;
private TextView mRcvrBatteryLabel;
private boolean usbActive;
private boolean uploadActive;
private boolean displayTimeSync;
private int batteryLevel;

StatusBarIcons(){
StatusBarIcons() {
mImageViewUSB = (ImageView) findViewById(R.id.imageViewUSB);
mImageViewUpload = (ImageView) findViewById(R.id.imageViewUploadStatus);
mImageViewTimeIndicator = (ImageView) findViewById(R.id.imageViewTimeIndicator);

mImageRcvrBattery = (ImageView) findViewById(R.id.imageViewRcvrBattery);
mImageRcvrBattery.setImageResource(R.drawable.battery);
mRcvrBatteryLabel = (TextView) findViewById(R.id.rcvrBatteryLabel);

setDefaults();
}

public void checkForRootOptionChanged() {
if (!PreferenceManager.getDefaultSharedPreferences(
getApplicationContext()).getBoolean(PreferenceKeys.ROOT_ENABLED, false)) {
mImageRcvrBattery.setVisibility(View.GONE);
mRcvrBatteryLabel.setVisibility(View.GONE);
} else {
mImageRcvrBattery.setVisibility(View.VISIBLE);
mRcvrBatteryLabel.setVisibility(View.VISIBLE);
}
}


public void setDefaults() {
setUSB(false);
setUpload(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public final class PreferenceKeys {
public static final String MONGO_COLLECTION = "cloud_storage_mongodb_collection";
public static final String MONGO_DEVICE_STATUS_COLLECTION =
"cloud_storage_mongodb_device_status_collection";
public static final String ROOT_ENABLED = "root_support_enabled";
public static final String PREFERRED_UNITS = "display_options_units";
public static final String PWD_NAME = "pwd_name";
}
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/rcvrBatteryLabel"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/DexBatteryLabelText"
android:textSize="12sp"
Expand Down

0 comments on commit 1b0b6fa

Please sign in to comment.