Merge pull request #68 from MilosKozak/dev

Dev
This commit is contained in:
AdrianLxM 2017-04-30 19:05:17 +02:00 committed by GitHub
commit e201dea662
10 changed files with 26 additions and 74 deletions

View file

@ -202,6 +202,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
loopStatusLayout = (LinearLayout) view.findViewById(R.id.overview_looplayout);
pumpStatusLayout = (LinearLayout) view.findViewById(R.id.overview_pumpstatuslayout);
pumpStatusView.setBackgroundColor(MainApp.sResources.getColor(R.color.colorInitializingBorder));
iobView = (TextView) view.findViewById(R.id.overview_iob);
apsModeView = (TextView) view.findViewById(R.id.overview_apsmode);
tempTargetView = (TextView) view.findViewById(R.id.overview_temptarget);
@ -772,7 +774,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
}
private void updatePumpStatus(String status) {
PumpInterface pump = MainApp.getConfigBuilder();
if (!status.equals("")) {
pumpStatusView.setText(status);
pumpStatusLayout.setVisibility(View.VISIBLE);
@ -838,19 +839,19 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun;
if (Config.APS && MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable) {
apsModeView.setVisibility(View.VISIBLE);
apsModeView.setBackgroundResource(R.drawable.loopmodeborder);
apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.loopenabled));
apsModeView.setTextColor(Color.BLACK);
final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
if (activeloop != null && activeloop.isEnabled(activeloop.getType()) && activeloop.isSuperBolus()) {
apsModeView.setBackgroundResource(R.drawable.loopmodesuspendedborder);
apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.looppumpsuspended));
apsModeView.setText(String.format(MainApp.sResources.getString(R.string.loopsuperbolusfor), activeloop.minutesToEndOfSuspend()));
apsModeView.setTextColor(Color.WHITE);
} else if (activeloop != null && activeloop.isEnabled(activeloop.getType()) && activeloop.isSuspended()) {
apsModeView.setBackgroundResource(R.drawable.loopmodesuspendedborder);
apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.looppumpsuspended));
apsModeView.setText(String.format(MainApp.sResources.getString(R.string.loopsuspendedfor), activeloop.minutesToEndOfSuspend()));
apsModeView.setTextColor(Color.WHITE);
} else if (pump.isSuspended()) {
apsModeView.setBackgroundResource(R.drawable.loopmodesuspendedborder);
apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.looppumpsuspended));
apsModeView.setText(MainApp.sResources.getString(R.string.pumpsuspended));
apsModeView.setTextColor(Color.WHITE);
} else if (activeloop != null && activeloop.isEnabled(activeloop.getType())) {
@ -860,7 +861,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
apsModeView.setText(MainApp.sResources.getString(R.string.openloop));
}
} else {
apsModeView.setBackgroundResource(R.drawable.loopmodedisabledborder);
apsModeView.setBackgroundColor(MainApp.sResources.getColor(R.color.loopdisabled));
apsModeView.setText(MainApp.sResources.getString(R.string.disabledloop));
apsModeView.setTextColor(Color.WHITE);
}
@ -875,7 +876,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
TempTarget tempTarget = tempTargetRangePlugin.getTempTargetInProgress(new Date().getTime());
if (tempTarget != null) {
tempTargetView.setTextColor(Color.BLACK);
tempTargetView.setBackgroundResource(R.drawable.temptargetborder);
tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetBackground));
tempTargetView.setVisibility(View.VISIBLE);
tempTargetView.setText(NSProfile.toUnitsString(tempTarget.low, NSProfile.fromMgdlToUnits(tempTarget.low, profile.getUnits()), profile.getUnits()) + " - " + NSProfile.toUnitsString(tempTarget.high, NSProfile.fromMgdlToUnits(tempTarget.high, profile.getUnits()), profile.getUnits()));
} else {
@ -887,7 +888,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
minBgDefault = Constants.MIN_BG_DEFAULT_MMOL;
}
tempTargetView.setTextColor(Color.WHITE);
tempTargetView.setBackgroundResource(R.drawable.temptargetborderdisabled);
tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetDisabledBackground));
tempTargetView.setText(SP.getDouble("openapsma_min_bg", minBgDefault) + " - " + SP.getDouble("openapsma_max_bg", maxBgDefault));
tempTargetView.setVisibility(View.VISIBLE);
}
@ -933,8 +934,10 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
basalLayout.setVisibility(View.GONE);
}
if (profile != null && profile.getActiveProfile() != null)
if (profile != null && profile.getActiveProfile() != null) {
activeProfileView.setText(profile.getActiveProfile());
activeProfileView.setBackgroundColor(Color.GRAY);
}
activeProfileView.setOnLongClickListener(new View.OnLongClickListener() {
@Override

View file

@ -1,7 +0,0 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/colorInitializingBorder" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >
</corners>
</shape>

View file

@ -1,7 +0,0 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/loopenabled" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >
</corners>
</shape>

View file

@ -1,7 +0,0 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/loopdisabled" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >
</corners>
</shape>

View file

@ -1,7 +0,0 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/looppumpsuspended" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >
</corners>
</shape>

View file

@ -1,7 +0,0 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/colorWizardButton" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >
</corners>
</shape>

View file

@ -1,7 +0,0 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/colorPrimaryDark" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >
</corners>
</shape>

View file

@ -35,7 +35,7 @@
android:layout_gravity="right"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:background="@drawable/loopmodeborder"
android:background="@drawable/pillborder"
android:gravity="center_horizontal"
android:text="DanaR History" />

View file

@ -32,13 +32,9 @@
android:id="@+id/overview_apsmode"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="0.1"
android:background="@drawable/loopmodeborder"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:gravity="center_vertical|center_horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="Open Loop"
android:textAppearance="?android:attr/textAppearanceSmall" />
@ -48,29 +44,21 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:layout_weight="0.5"
android:background="@drawable/pillborder"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:gravity="center_vertical|center_horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="Profile"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/colorProfileSwitchButton" />
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/overview_temptarget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:layout_weight="0.2"
android:background="@drawable/temptargetborder"
android:layout_weight="1"
android:gravity="center_vertical|center_horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="TempTarget"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/mdtp_white" />
</LinearLayout>
@ -86,9 +74,8 @@
android:id="@+id/overview_pumpstatus"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/initializingborder"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:gravity="center_vertical|center_horizontal"
android:text="@string/initializing"
android:textAppearance="?android:attr/textAppearanceMedium" />

View file

@ -10,6 +10,10 @@
<color name="listdelimiter">#505050</color>
<color name="tabBgColor">#f0003f59</color>
<color name="tempTargetBackground">#77dd77</color>
<color name="tempTargetDisabledBackground">#303F9F</color>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>