Skip to content

Commit

Permalink
8.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
j-kaltes committed Oct 8, 2024
1 parent 7a9bbb4 commit 37d0ed7
Show file tree
Hide file tree
Showing 12 changed files with 150,280 additions and 130,534 deletions.
8 changes: 4 additions & 4 deletions Common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ android {
manifestPlaceholders["debuggable"] = "true"
manifestPlaceholders["requireWatch"] = "false"

versionName '8.2.1'
versionName '8.2.2'
// multiDexEnabled true

buildConfigField 'String', 'BUILD_TIME', 'new java.text.SimpleDateFormat("HH:mm:ss dd-MMM-yyyy").format(new java.util.Date(' + System.currentTimeMillis() + 'L))'
Expand Down Expand Up @@ -110,7 +110,7 @@ android {
//****** Zet op rollout op 100% ******
dimension 'libreVersion'
versionCode 480 //LIBRE2ONLY
// versionName '8.2.1-no3'
// versionName '8.2.2-no3'
versionNameSuffix '-no3'
buildConfigField 'int', 'libreVersion', '2'
externalNativeBuild.cmake {
Expand Down Expand Up @@ -170,7 +170,7 @@ android {
buildConfigField 'int', 'minSDK', "$minSdk"
versionCode 480 //WATCH
//****** Zet op rollout op 100% ******
//versionName '8.2.1-wear'
//versionName '8.2.2-wear'
versionNameSuffix '-wear'
signingConfig signingConfigs.alg

Expand All @@ -192,7 +192,7 @@ android {
// minSdk 19
dimension 'wearos'
versionCode 480 //WATCH
//versionName '8.2.1-small'
//versionName '8.2.2-small'
versionNameSuffix '-small'
signingConfig signingConfigs.alg

Expand Down
280,686 changes: 150,194 additions & 130,492 deletions Common/printmappingout.txt

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion Common/src/main/java/tk/glucodata/Applic.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ public void onConfigurationChanged(Configuration newConfig) {

static private void setjavahour24(boolean val) {
Applic.hour24=val;
Notify.timef = java.text.DateFormat.getTimeInstance(java.text.DateFormat.SHORT);
hasSystemtimeformat=DateFormat.is24HourFormat(app)==hour24;
if(!isWearable) {
var main=MainActivity.thisone;
Expand Down Expand Up @@ -595,7 +596,11 @@ static void updatescreen() {

boolean needsnatives() {
final var res=getResources();
GlucoseCurve.metrics= res.getDisplayMetrics();
var metrics=GlucoseCurve.metrics= res.getDisplayMetrics();
MainActivity.screenheight= metrics.heightPixels;
MainActivity.screenwidth= metrics.widthPixels;
Log.i(LOG_ID,"heightPixels="+GlucoseCurve.metrics.heightPixels+" widthPixels="+GlucoseCurve.metrics.widthPixels);

var newinitscreenwidth= Math.max(GlucoseCurve.metrics.heightPixels,GlucoseCurve.metrics.widthPixels);
if(newinitscreenwidth==initscreenwidth)
return false;
Expand Down
29 changes: 19 additions & 10 deletions Common/src/main/java/tk/glucodata/CommonCanvas.kt
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ private fun paintArrow( canvas: Canvas, paint: Paint, density: Float, rate: Floa
val rate=0.0f;
paintArrow(canvas, paint, density, rate, 0.0, half, height, half);
}

/*{{x -> -((2 h w)/Sqrt[16 h^2 + 9 rate^2 w^2]),
y -> -((3 h rate w)/(2 Sqrt[16 h^2 + 9 rate^2 w^2]))}, {x -> (
2 h w)/Sqrt[16 h^2 + 9 rate^2 w^2],
y -> (3 h rate w)/(2 Sqrt[16 h^2 + 9 rate^2 w^2])}} */

@JvmStatic
public fun drawarrowcircle(
canvas: Canvas,
Expand All @@ -152,16 +158,19 @@ private fun paintArrow( canvas: Canvas, paint: Paint, density: Float, rate: Floa
ratein: Float
): Boolean {
if (!ratein.isNaN()) {
val height: Double = canvas.height.toDouble(); //assume square
val rate = Natives.thresholdchange(ratein);
val common = 1.0 / sqrt(16.0 + 9.0 * rate.pow(2));
val xcom = (2.0 * height * common);
val half = height * .5;
val x1 = half - xcom;
val ycom = (3 * half * rate * common);
val y1 = half + ycom;
val x2 = half + xcom;
val y2 = half - ycom;
val height: Double = canvas.height.toDouble();
val width: Double = canvas.width.toDouble()
val rate = Natives.thresholdchange(ratein)
// val common = 1.0 / sqrt(16.0 + 9.0 * rate.pow(2));
val common = width*height/sqrt(16*height.pow(2.0)+9 * rate.pow(2)*width.pow(2))
val xcom = (2.0 * common);
val halfW = width * .5;
val x1 = halfW - xcom;
val x2 = halfW + xcom;
val ycom = (1.5 * rate * common);
val halfH = height * .5;
val y1 = halfH + ycom;
val y2 = halfH - ycom;
paintArrow(canvas, paint, density, rate, x1, y1, x2, y2);
return true
}
Expand Down
1 change: 1 addition & 0 deletions Common/src/main/java/tk/glucodata/TODO
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Look at order complication types
Geen notification icons in Juggluco voor hogere versie. //Probleem worden te klein

Verander alarm zonder save?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import tk.glucodata.Natives
import tk.glucodata.Notify

class ArrowDataSourceService: SuspendingComplicationDataSourceService() {
private val glview= GlucoseValue()
private val glview= GlucoseValue(100,100)

override fun onComplicationActivated( complicationInstanceId: Int, type: ComplicationType) {
Log.d(LOG_ID, "onComplicationActivated(): $complicationInstanceId")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,42 @@ import androidx.wear.watchface.complications.datasource.ComplicationRequest
import androidx.wear.watchface.complications.datasource.SuspendingComplicationDataSourceService
import tk.glucodata.Applic
import tk.glucodata.Log
import tk.glucodata.MainActivity
import tk.glucodata.Natives
import tk.glucodata.Notify
import java.lang.Math.min

class ArrowValueDataSourceService: SuspendingComplicationDataSourceService() {
private val glview= GlucoseValue()
private var glview: GlucoseValue? =null

override fun onComplicationActivated( complicationInstanceId: Int, type: ComplicationType) {
Log.d(LOG_ID, "onComplicationActivated(): $complicationInstanceId")
}
override fun onComplicationDeactivated(complicationInstanceId: Int) {
Log.d(LOG_ID, "onComplicationDeactivated(): $complicationInstanceId")
}

fun getview(type: ComplicationType):GlucoseValue {
if(glview==null) {
val width:Int
val height:Int
if(type==PHOTO_IMAGE ) {
val size= kotlin.math.min(MainActivity.screenheight, MainActivity.screenwidth)
height=size
width=size
// height= MainActivity.screenheight
// width=MainActivity.screenwidth
}
else {
width = 100
height = 100
}
glview= GlucoseValue(width,height)
}
return glview as GlucoseValue;
}
override fun getPreviewData(type: ComplicationType): ComplicationData {
val icon=Icon.createWithBitmap( glview.previewbitmap())

val icon=Icon.createWithBitmap( getview(type).previewbitmap())
return when (type) {
/*
MONOCHROMATIC_IMAGE -> {
Expand Down Expand Up @@ -73,20 +94,20 @@ private val glview= GlucoseValue()
Log.d(LOG_ID, "onComplicationRequest() id: ${request.complicationInstanceId}")

val complicationPendingIntent = Notify.mkpending();

val type= request.complicationType
val glucose = Natives.lastglucose()
val bitmap=
if(glucose==null) {
Log.i(LOG_ID,"glucose==null")
glview.getnovalue()
getview(type).getnovalue()
}
else {
Log.i(LOG_ID,"glucose==${glucose.value}")
glview.getArrowValueBitmap(glucose.value,glucose.time*1000L,glucose.index,glucose.rate)
getview(type).getArrowValueBitmap(glucose.value,glucose.time*1000L,glucose.index,glucose.rate)
}

val image=Icon.createWithBitmap(bitmap)
return when (request.complicationType) {
return when (type) {
/* MONOCHROMATIC_IMAGE -> {
Log.i(LOG_ID,"MonochromaticImage")
MonochromaticImageComplicationData.Builder(
Expand All @@ -102,7 +123,7 @@ private val glview= GlucoseValue()
// setAmbientImage(Icon ambientImage) ??
}
else -> {
Log.w(LOG_ID, "Unexpected complication type ${request.complicationType}")
Log.w(LOG_ID, "Unexpected complication type $type")
null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static public void show(MainActivity context, View view) {
};

static public void showcolors(MainActivity act,CheckBox def) {
var glview=new GlucoseValue();
var glview=new GlucoseValue(150,150);
int coltype=radiosel;
int initialColor=getcolordef(coltype);
int height= GlucoseCurve.getheight();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@
public class GlucoseValue {
final private static String LOG_ID="GlucoseValue";
//64 good
final static float mapwidth=100,mapheight=100;
final static float half=0.5f*mapwidth;
final static private float density= mapheight/70.0f;
//final static float mapwidth=512,mapheight=512;
//final static float mapwidth=100,mapheight=100;
final float mapwidth;
final float mapheight;
final float half;
final private float density;
final private float timeoffy;
final private float numoffy;
final private float timesize;
Expand All @@ -53,20 +56,24 @@ public class GlucoseValue {
final private Paint glucosePaint=new Paint();
final private Typeface normaltype, boldtype;
// final private Paint agePaint=new Paint();
GlucoseValue() {
GlucoseValue(int w,int h) {
mapwidth=w;
mapheight=h;
half=0.5f*mapwidth;
density= mapheight/70.0f;
fontsize=mapwidth*0.63f;
glucosePaint.setTextAlign(Paint.Align.CENTER);
glucosePaint.setTextSize(fontsize);
//agePaint.setARGB(0xFF,0xFF,0,0xFF);
timesize=mapwidth*0.15f;
numoffy=mapwidth*0.12f;
if(Applic.hour24) {
timesize=mapwidth*0.15f;
timeoffy=mapwidth*0.036f;
numoffy=mapwidth*0.12f;
}
else {
timesize=mapwidth*0.11f;
timeoffy=mapwidth*0.048f;
numoffy=mapwidth*0.1f;
// timesize=mapwidth*0.11f;
timeoffy=mapwidth*0.066f;
// numoffy=mapwidth*0.1f;
}

Log.i(LOG_ID,"fontsize="+fontsize+" timesize="+timesize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import tk.glucodata.Natives
import tk.glucodata.Notify

class NumberDataSourceService: SuspendingComplicationDataSourceService() {
private val glview= GlucoseValue()
private val glview= GlucoseValue(100,100)

override fun onComplicationActivated( complicationInstanceId: Int, type: ComplicationType) {
Log.d(LOG_ID, "onComplicationActivated(): $complicationInstanceId")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ sealed class ComplicationConfig(val id: Int, val supportedTypes: List<Complicati
listOf(
ComplicationType.EMPTY,
ComplicationType.LONG_TEXT,
ComplicationType.SHORT_TEXT,
ComplicationType.PHOTO_IMAGE,
ComplicationType.RANGED_VALUE,
ComplicationType.SMALL_IMAGE,
ComplicationType.SHORT_TEXT,
ComplicationType.MONOCHROMATIC_IMAGE
)
)
Expand All @@ -91,8 +91,8 @@ sealed class ComplicationConfig(val id: Int, val supportedTypes: List<Complicati
listOf(
ComplicationType.EMPTY,
ComplicationType.RANGED_VALUE,
ComplicationType.MONOCHROMATIC_IMAGE,
ComplicationType.SHORT_TEXT,
ComplicationType.MONOCHROMATIC_IMAGE,
ComplicationType.SMALL_IMAGE,
ComplicationType.LONG_TEXT,
ComplicationType.PHOTO_IMAGE,
Expand All @@ -104,10 +104,10 @@ sealed class ComplicationConfig(val id: Int, val supportedTypes: List<Complicati
listOf(
ComplicationType.EMPTY,
ComplicationType.RANGED_VALUE,
ComplicationType.MONOCHROMATIC_IMAGE,
ComplicationType.SMALL_IMAGE,
ComplicationType.PHOTO_IMAGE,
ComplicationType.SHORT_TEXT,
ComplicationType.PHOTO_IMAGE,
ComplicationType.SMALL_IMAGE,
ComplicationType.MONOCHROMATIC_IMAGE,
ComplicationType.LONG_TEXT
)
)
Expand Down
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ android.nonFinalResIds=false
#thekeyfile=everyone.keystore


ndkver = '27.0.11902837 rc2'
ndkver = '28.0.12433566'
APPCOMPAT = '1.7.0'
GMSWEAR = '18.2.0'
GMSBASE = '18.5.0'
CPPSTD = "-std=gnu++23"
MINSDK = 21
CPPSTD = "-std=gnu++26"

android.suppressUnsupportedCompileSdk=35

Expand Down

0 comments on commit 37d0ed7

Please sign in to comment.