AndroidAPS/wear/src/main/java/info/nightscout/androidaps/LargeHome.java

110 lines
5.4 KiB
Java
Raw Normal View History

2016-11-17 15:17:02 +01:00
package info.nightscout.androidaps;
import android.graphics.Color;
import android.support.v4.content.ContextCompat;
2016-11-17 15:17:02 +01:00
import android.view.LayoutInflater;
2016-11-25 21:29:46 +01:00
import com.ustwo.clockwise.common.WatchMode;
2016-11-17 15:17:02 +01:00
public class LargeHome extends BaseWatchFace {
@Override
public void onCreate() {
super.onCreate();
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
layoutView = inflater.inflate(R.layout.activity_home_large, null);
performViewSetup();
}
@Override
protected void setColorDark(){
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mLinearLayout));
mTime.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mTime));
mRelativeLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mRelativeLayout));
2016-11-17 15:17:02 +01:00
if (sgvLevel == 1) {
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_highColor));
mDelta.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_highColor));
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_highColor));
2016-11-17 15:17:02 +01:00
} else if (sgvLevel == 0) {
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mDelta.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
2016-11-17 15:17:02 +01:00
} else if (sgvLevel == -1) {
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_lowColor));
mDelta.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_lowColor));
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_lowColor));
2016-11-17 15:17:02 +01:00
}
2016-11-17 15:17:02 +01:00
if (ageLevel == 1) {
mTimestamp.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mTimestamp1_home));
2016-11-17 15:17:02 +01:00
} else {
mTimestamp.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mTimestamp));
2016-11-17 15:17:02 +01:00
}
if (batteryLevel == 1) {
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mUploaderBattery1_home));
2016-11-17 15:17:02 +01:00
} else {
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mUploaderBattery_home));
2016-11-17 15:17:02 +01:00
}
mStatus.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mStatus_home));
2016-11-17 15:17:02 +01:00
}
@Override
protected void setColorBright() {
if (getCurrentWatchMode() == WatchMode.INTERACTIVE) {
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.light_mLinearLayout));
mRelativeLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.light_mRelativeLayout));
2016-11-17 15:17:02 +01:00
if (sgvLevel == 1) {
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_highColor));
mDelta.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_highColor));
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_highColor));
2016-11-17 15:17:02 +01:00
} else if (sgvLevel == 0) {
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_midColor));
mDelta.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_midColor));
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_midColor));
2016-11-17 15:17:02 +01:00
} else if (sgvLevel == -1) {
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_lowColor));
mDelta.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_lowColor));
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_lowColor));
2016-11-17 15:17:02 +01:00
}
if (ageLevel == 1) {
mTimestamp.setTextColor(Color.WHITE);
} else {
mTimestamp.setTextColor(Color.RED);
}
if (batteryLevel == 1) {
mUploaderBattery.setTextColor(Color.WHITE);
} else {
mUploaderBattery.setTextColor(Color.RED);
}
mStatus.setTextColor(Color.WHITE);
mTime.setTextColor(Color.BLACK);
} else {
mRelativeLayout.setBackgroundColor(Color.BLACK);
mLinearLayout.setBackgroundColor(Color.LTGRAY);
if (sgvLevel == 1) {
mSgv.setTextColor(Color.YELLOW);
mDirection.setTextColor(Color.YELLOW);
mDelta.setTextColor(Color.YELLOW);
} else if (sgvLevel == 0) {
mSgv.setTextColor(Color.WHITE);
mDirection.setTextColor(Color.WHITE);
mDelta.setTextColor(Color.WHITE);
} else if (sgvLevel == -1) {
mSgv.setTextColor(Color.RED);
mDirection.setTextColor(Color.RED);
mDelta.setTextColor(Color.RED);
}
mUploaderBattery.setTextColor(Color.BLACK);
mTimestamp.setTextColor(Color.BLACK);
mStatus.setTextColor(Color.BLACK);
mTime.setTextColor(Color.WHITE);
}
}
}