Update Target SDK #1

Merged
me merged 15 commits from dev into main 2025-07-20 19:37:14 -07:00
4 changed files with 74 additions and 22 deletions
Showing only changes of commit 35c2e800b3 - Show all commits

View File

@@ -1,6 +1,7 @@
package com.hyperling.carbupbeta; package com.hyperling.carbupbeta;
import android.content.Context; import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Color; import android.graphics.Color;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams; import android.widget.LinearLayout.LayoutParams;
@@ -56,14 +57,27 @@ public class List extends ListInfo{
setName(listInfo.getName()); setName(listInfo.getName());
// ========== Style the buttons ========== // ========== Style the buttons ==========
// Color! /* Color! */
linearLayout.setBackgroundColor(Color.BLACK); int currentNightMode =
btnDelete.setBackgroundColor(Color.LTGRAY); context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK
btnDelete.setTextColor(Color.BLACK); ;
btnEdit.setBackgroundColor(Color.LTGRAY); switch (currentNightMode) {
btnEdit.setTextColor(Color.BLACK); // Light Mode
btnItem.setBackgroundColor(Color.WHITE); case Configuration.UI_MODE_NIGHT_NO:
btnItem.setTextColor(getRandomColor()); 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! // Size!
//textSize = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth()/30; //textSize = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth()/30;
btnDelete.setTextSize(16); //textSize-10); btnDelete.setTextSize(16); //textSize-10);

View File

@@ -1,6 +1,7 @@
package com.hyperling.carbupbeta; package com.hyperling.carbupbeta;
import android.content.Context; import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Color; import android.graphics.Color;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.view.WindowManager; import android.view.WindowManager;
@@ -64,13 +65,26 @@ public class ListItem extends ListItemInfo {
setName(listItemInfo.getName ()); setName(listItemInfo.getName ());
// ========== Style the buttons ========== // ========== Style the buttons ==========
// Color! /* Color! */
linearLayout.setBackgroundColor(Color.BLACK); int currentNightMode =
btnDelete.setBackgroundColor(Color.LTGRAY); context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK
btnDelete.setTextColor(Color.BLACK); ;
btnEdit.setBackgroundColor(Color.LTGRAY); switch (currentNightMode) {
btnEdit.setTextColor(Color.BLACK); // Light Mode
btnItem.setBackgroundColor(Color.WHITE); 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); int[] colors = getColors(carbPerCal);
btnItem.setTextColor(Color.rgb(colors[0], colors[1], colors[2])); btnItem.setTextColor(Color.rgb(colors[0], colors[1], colors[2]));
// Size! // Size!

View File

@@ -10,6 +10,7 @@ import android.widget.RelativeLayout;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.Button; import android.widget.Button;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.TextView;
/** /**
* Created by ling on 1/1/16. * Created by ling on 1/1/16.
@@ -18,7 +19,7 @@ public class MySettingItem extends MySettingInfo{
private LinearLayout linearLayout; private LinearLayout linearLayout;
private RelativeLayout relativeLayout; private RelativeLayout relativeLayout;
Button btnItem; TextView btnItem;
CheckBox checkBox; CheckBox checkBox;
private int textSize; private int textSize;
@@ -27,7 +28,7 @@ public class MySettingItem extends MySettingInfo{
// Instantiate the Views // Instantiate the Views
linearLayout = new LinearLayout(context); linearLayout = new LinearLayout(context);
relativeLayout = new RelativeLayout(context); relativeLayout = new RelativeLayout(context);
btnItem = new Button(context); btnItem = new TextView(context);
checkBox = new CheckBox(context); checkBox = new CheckBox(context);
// Give the views their required attributes (Wrap Content) // 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); LayoutParams item_lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
RelativeLayout.LayoutParams check_lp = new RelativeLayout.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.setLayoutParams(lay_lp);
linearLayout.setOrientation(LinearLayout.HORIZONTAL); linearLayout.setOrientation(LinearLayout.HORIZONTAL);
@@ -55,15 +56,17 @@ public class MySettingItem extends MySettingInfo{
setName(info.getName()); setName(info.getName());
setEnabled(info.getEnabled()); setEnabled(info.getEnabled());
// ========== Style the buttons ========== /* ========== Style the buttons ========== */
// Color! /* Color! * /
linearLayout.setBackgroundColor(Color.LTGRAY); linearLayout.setBackgroundColor(Color.LTGRAY);
relativeLayout.setBackgroundColor(Color.LTGRAY); relativeLayout.setBackgroundColor(Color.DKGRAY);
btnItem.setBackgroundColor(Color.LTGRAY); btnItem.setBackgroundColor(Color.LTGRAY);
btnItem.setTextColor(Color.BLACK); btnItem.setTextColor(Color.BLACK);
/* */
// Size! // Size!
//textSize = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth()/30; //textSize = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth()/30;
btnItem.setTextSize(24); // textSize); btnItem.setTextSize(24); // textSize);
btnItem.setPadding(4,4,4,4);
// Add the items to the layout! // Add the items to the layout!
relativeLayout.addView(checkBox); relativeLayout.addView(checkBox);

View File

@@ -14,15 +14,36 @@
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
</style> </style>
<style name="CarbUp" parent="@android:style/Theme.Light.NoTitleBar"> <style name="OriginalTheme"
parent="@android:style/Theme.Light.NoTitleBar">
</style>
<style name="CarbUp" parent="Theme.AppCompat.DayNight.DarkActionBar">
<!--
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
<item name="android:windowActionBar">false</item> <item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>
-->
<!--
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
<item name="android:colorForeground">@color/colorPrimary</item> <item name="android:colorForeground">@color/colorPrimary</item>
-->
</style>
<style name="CarbUpTesting" parent="@android:style/Theme.DeviceDefault">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<!--
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:colorForeground">@color/colorPrimary</item>
-->
</style> </style>
</resources> </resources>