use of com.eveningoutpost.dexdrip.ui.MicroStatusImpl in project xDrip-plus by jamorham.
the class SystemStatusFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
// Injectors.getMicroStatusComponent().inject(this);
requestWearCollectorStatus();
serviceDataReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context ctx, Intent intent) {
final String action = intent.getAction();
// final String msg = intent.getStringExtra("data");
Bundle bundle = intent.getBundleExtra("data");
if (bundle != null) {
DataMap dataMap = DataMap.fromBundle(bundle);
String lastState = dataMap.getString("lastState", "");
long last_timestamp = dataMap.getLong("timestamp", 0);
UserError.Log.d(TAG, "serviceDataReceiver onReceive:" + action + " :: " + lastState + " last_timestamp :: " + last_timestamp);
switch(action) {
case WatchUpdaterService.ACTION_BLUETOOTH_COLLECTION_SERVICE_UPDATE:
switch(DexCollectionType.getDexCollectionType()) {
case DexcomG5:
// msg, last_timestamp
G5CollectionService.setWatchStatus(dataMap);
break;
case DexcomShare:
if (lastState != null && !lastState.isEmpty()) {
// TODO getLastState() in non-G5 Services
setConnectionStatus(lastState);
}
break;
default:
// msg, last_timestamp
DexCollectionService.setWatchStatus(dataMap);
if (lastState != null && !lastState.isEmpty()) {
setConnectionStatus(lastState);
}
break;
}
break;
}
}
}
};
final ActivitySystemStatusBinding binding = DataBindingUtil.inflate(inflater, R.layout.activity_system_status, container, false);
microStatus = new MicroStatusImpl();
binding.setMs(microStatus);
return binding.getRoot();
}
use of com.eveningoutpost.dexdrip.ui.MicroStatusImpl in project xDrip by NightscoutFoundation.
the class Home method showInitialStatusHelper.
private synchronized void showInitialStatusHelper() {
if (checkBatteryOptimization()) {
// update
initialDataQuality = ProcessInitialDataQuality.getInitialDataQuality();
if ((helper_dialog != null) && (helper_dialog.isShowing()))
helper_dialog.dismiss();
if ((status_helper_dialog != null) && (status_helper_dialog.isShowing())) {
if (initial_status_binding != null)
// update data
initial_status_binding.setIdq(initialDataQuality);
return;
}
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.collecting_initial_readings);
initial_status_binding = PopupInitialStatusHelperBinding.inflate(getLayoutInflater());
initial_status_binding.setIdq(initialDataQuality);
if (microStatus == null)
microStatus = new MicroStatusImpl();
initial_status_binding.setMs(microStatus);
initial_status_binding.setPrefs(new PrefsViewImpl());
builder.setView(initial_status_binding.getRoot());
status_helper_dialog = builder.create();
status_helper_dialog.setCanceledOnTouchOutside(true);
try {
status_helper_dialog.show();
} catch (Exception e) {
UserError.Log.e(TAG, "Could not display calibration prompt helper: " + e);
}
keepScreenOn();
}
}
use of com.eveningoutpost.dexdrip.ui.MicroStatusImpl in project xDrip-plus by jamorham.
the class Home method showInitialStatusHelper.
private synchronized void showInitialStatusHelper() {
if (checkBatteryOptimization()) {
// update
initialDataQuality = ProcessInitialDataQuality.getInitialDataQuality();
if ((helper_dialog != null) && (helper_dialog.isShowing()))
helper_dialog.dismiss();
if ((status_helper_dialog != null) && (status_helper_dialog.isShowing())) {
if (initial_status_binding != null)
// update data
initial_status_binding.setIdq(initialDataQuality);
return;
}
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.collecting_initial_readings);
initial_status_binding = PopupInitialStatusHelperBinding.inflate(getLayoutInflater());
initial_status_binding.setIdq(initialDataQuality);
if (microStatus == null)
microStatus = new MicroStatusImpl();
initial_status_binding.setMs(microStatus);
initial_status_binding.setPrefs(new PrefsViewImpl());
builder.setView(initial_status_binding.getRoot());
status_helper_dialog = builder.create();
status_helper_dialog.setCanceledOnTouchOutside(true);
try {
status_helper_dialog.show();
} catch (Exception e) {
UserError.Log.e(TAG, "Could not display calibration prompt helper: " + e);
}
keepScreenOn();
}
}
use of com.eveningoutpost.dexdrip.ui.MicroStatusImpl in project xDrip by NightscoutFoundation.
the class SystemStatusFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
// Injectors.getMicroStatusComponent().inject(this);
requestWearCollectorStatus();
serviceDataReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context ctx, Intent intent) {
final String action = intent.getAction();
// final String msg = intent.getStringExtra("data");
Bundle bundle = intent.getBundleExtra("data");
if (bundle != null) {
DataMap dataMap = DataMap.fromBundle(bundle);
String lastState = dataMap.getString("lastState", "");
long last_timestamp = dataMap.getLong("timestamp", 0);
UserError.Log.d(TAG, "serviceDataReceiver onReceive:" + action + " :: " + lastState + " last_timestamp :: " + last_timestamp);
switch(action) {
case WatchUpdaterService.ACTION_BLUETOOTH_COLLECTION_SERVICE_UPDATE:
switch(DexCollectionType.getDexCollectionType()) {
case DexcomG5:
// msg, last_timestamp
G5CollectionService.setWatchStatus(dataMap);
break;
case DexcomShare:
if (lastState != null && !lastState.isEmpty()) {
// TODO getLastState() in non-G5 Services
setConnectionStatus(lastState);
}
break;
default:
// msg, last_timestamp
DexCollectionService.setWatchStatus(dataMap);
if (lastState != null && !lastState.isEmpty()) {
setConnectionStatus(lastState);
}
break;
}
break;
}
}
}
};
final ActivitySystemStatusBinding binding = DataBindingUtil.inflate(inflater, R.layout.activity_system_status, container, false);
microStatus = new MicroStatusImpl();
binding.setMs(microStatus);
return binding.getRoot();
}
Aggregations