diff --git a/app/src/main/java/com/hyperling/carbupbeta/List.java b/app/src/main/java/com/hyperling/carbupbeta/List.java
index 31103ea..2f9dc24 100755
--- a/app/src/main/java/com/hyperling/carbupbeta/List.java
+++ b/app/src/main/java/com/hyperling/carbupbeta/List.java
@@ -1,6 +1,7 @@
package com.hyperling.carbupbeta;
import android.content.Context;
+import android.content.res.Configuration;
import android.graphics.Color;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
@@ -56,14 +57,27 @@ public class List extends ListInfo{
setName(listInfo.getName());
// ========== Style the buttons ==========
- // Color!
- linearLayout.setBackgroundColor(Color.BLACK);
- btnDelete.setBackgroundColor(Color.LTGRAY);
- btnDelete.setTextColor(Color.BLACK);
- btnEdit.setBackgroundColor(Color.LTGRAY);
- btnEdit.setTextColor(Color.BLACK);
- btnItem.setBackgroundColor(Color.WHITE);
- btnItem.setTextColor(getRandomColor());
+ /* Color! */
+ int currentNightMode =
+ context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK
+ ;
+ switch (currentNightMode) {
+ // Light Mode
+ case Configuration.UI_MODE_NIGHT_NO:
+ linearLayout.setBackgroundColor(Color.BLACK);
+ btnDelete.setBackgroundColor(Color.LTGRAY);
+ btnDelete.setTextColor(Color.BLACK);
+ btnEdit.setBackgroundColor(Color.LTGRAY);
+ btnEdit.setTextColor(Color.BLACK);
+ btnItem.setBackgroundColor(Color.WHITE);
+ btnItem.setTextColor(getRandomColor());
+ break;// Dark Mode
+ case Configuration.UI_MODE_NIGHT_YES:
+ // Night mode is active, we're using dark theme
+ btnItem.setBackgroundColor(Color.DKGRAY);
+ break;
+ }
+ /* */
// Size!
//textSize = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth()/30;
btnDelete.setTextSize(16); //textSize-10);
diff --git a/app/src/main/java/com/hyperling/carbupbeta/ListItem.java b/app/src/main/java/com/hyperling/carbupbeta/ListItem.java
index b57bc57..f9d7b53 100755
--- a/app/src/main/java/com/hyperling/carbupbeta/ListItem.java
+++ b/app/src/main/java/com/hyperling/carbupbeta/ListItem.java
@@ -1,6 +1,7 @@
package com.hyperling.carbupbeta;
import android.content.Context;
+import android.content.res.Configuration;
import android.graphics.Color;
import android.widget.LinearLayout;
import android.view.WindowManager;
@@ -64,13 +65,26 @@ public class ListItem extends ListItemInfo {
setName(listItemInfo.getName ());
// ========== Style the buttons ==========
- // Color!
- linearLayout.setBackgroundColor(Color.BLACK);
- btnDelete.setBackgroundColor(Color.LTGRAY);
- btnDelete.setTextColor(Color.BLACK);
- btnEdit.setBackgroundColor(Color.LTGRAY);
- btnEdit.setTextColor(Color.BLACK);
- btnItem.setBackgroundColor(Color.WHITE);
+ /* Color! */
+ int currentNightMode =
+ context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK
+ ;
+ switch (currentNightMode) {
+ // Light Mode
+ case Configuration.UI_MODE_NIGHT_NO:
+ linearLayout.setBackgroundColor(Color.BLACK);
+ btnDelete.setBackgroundColor(Color.LTGRAY);
+ btnDelete.setTextColor(Color.BLACK);
+ btnEdit.setBackgroundColor(Color.LTGRAY);
+ btnEdit.setTextColor(Color.BLACK);
+ btnItem.setBackgroundColor(Color.WHITE);
+ break;
+ // Dark Mode
+ case Configuration.UI_MODE_NIGHT_YES:
+ btnItem.setBackgroundColor(Color.DKGRAY);
+ break;
+ }
+ /* */
int[] colors = getColors(carbPerCal);
btnItem.setTextColor(Color.rgb(colors[0], colors[1], colors[2]));
// Size!
diff --git a/app/src/main/java/com/hyperling/carbupbeta/MySettingItem.java b/app/src/main/java/com/hyperling/carbupbeta/MySettingItem.java
index fe0469f..2f645e8 100755
--- a/app/src/main/java/com/hyperling/carbupbeta/MySettingItem.java
+++ b/app/src/main/java/com/hyperling/carbupbeta/MySettingItem.java
@@ -10,6 +10,7 @@ import android.widget.RelativeLayout;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;
+import android.widget.TextView;
/**
* Created by ling on 1/1/16.
@@ -18,7 +19,7 @@ public class MySettingItem extends MySettingInfo{
private LinearLayout linearLayout;
private RelativeLayout relativeLayout;
- Button btnItem;
+ TextView btnItem;
CheckBox checkBox;
private int textSize;
@@ -27,7 +28,7 @@ public class MySettingItem extends MySettingInfo{
// Instantiate the Views
linearLayout = new LinearLayout(context);
relativeLayout = new RelativeLayout(context);
- btnItem = new Button(context);
+ btnItem = new TextView(context);
checkBox = new CheckBox(context);
// Give the views their required attributes (Wrap Content)
@@ -36,7 +37,7 @@ public class MySettingItem extends MySettingInfo{
LayoutParams item_lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
RelativeLayout.LayoutParams check_lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
- lay_lp.setMargins(1, 1, 1, 1);
+ lay_lp.setMargins(4,4,4,4);
linearLayout.setLayoutParams(lay_lp);
linearLayout.setOrientation(LinearLayout.HORIZONTAL);
@@ -55,15 +56,17 @@ public class MySettingItem extends MySettingInfo{
setName(info.getName());
setEnabled(info.getEnabled());
- // ========== Style the buttons ==========
- // Color!
+ /* ========== Style the buttons ========== */
+ /* Color! * /
linearLayout.setBackgroundColor(Color.LTGRAY);
- relativeLayout.setBackgroundColor(Color.LTGRAY);
+ relativeLayout.setBackgroundColor(Color.DKGRAY);
btnItem.setBackgroundColor(Color.LTGRAY);
btnItem.setTextColor(Color.BLACK);
+ /* */
// Size!
//textSize = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth()/30;
btnItem.setTextSize(24); // textSize);
+ btnItem.setPadding(4,4,4,4);
// Add the items to the layout!
relativeLayout.addView(checkBox);
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 3c3b923..88c34d9 100755
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -14,15 +14,36 @@
- true
-
+
+
+
+