diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 1756977..00b1c01 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -37,6 +37,7 @@ android { } buildFeatures { compose = true + viewBinding = true } } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 3ebe1af..ddad160 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -8,7 +8,6 @@ - @@ -29,6 +28,18 @@ android:theme="@style/Theme.ALN" tools:ignore="UnusedAttribute" tools:targetApi="31"> + + + + + + + + + @@ -64,6 +76,7 @@ + + if (event.action == MotionEvent.ACTION_DOWN) { + val touchY = event.rawY + val popupTop = mView.top + if (touchY < popupTop) { + close() + true + } else { + false + } + } else { + false + } + } mWindowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager } @@ -91,49 +124,6 @@ class Window (context: Context) { batteryCaseText.text = batteryStatus.find { it.component == BatteryComponent.CASE }?.let { "\uDBC3\uDE6C ${it.level}%" } ?: "" -// composeView.setContent { -// Row ( -// modifier = Modifier -// .fillMaxWidth(), -// horizontalArrangement = Arrangement.Center, -// verticalAlignment = Alignment.CenterVertically -// ) { -// Row ( -// modifier = Modifier -// .fillMaxWidth(0.5f), -// horizontalArrangement = Arrangement.SpaceBetween -// ){ -// val left = batteryStatus.find { it.component == BatteryComponent.LEFT } -// val right = batteryStatus.find { it.component == BatteryComponent.RIGHT } -// if ((right?.status == BatteryStatus.CHARGING && left?.status == BatteryStatus.CHARGING) || (left?.status == BatteryStatus.NOT_CHARGING && right?.status == BatteryStatus.NOT_CHARGING)) -// { -// BatteryIndicator(right.level.let { left.level.coerceAtMost(it) }, left.status == BatteryStatus.CHARGING) -// } -// else { -// Row { -// if (left?.status != BatteryStatus.DISCONNECTED) { -// Text(text = "\uDBC6\uDCE5", fontFamily = FontFamily(Font(R.font.sf_pro))) -// BatteryIndicator(left?.level ?: 0, left?.status == BatteryStatus.CHARGING) -// Spacer(modifier = Modifier.width(16.dp)) -// } -// if (right?.status != BatteryStatus.DISCONNECTED) { -// Text(text = "\uDBC6\uDCE8", fontFamily = FontFamily(Font(R.font.sf_pro))) -// BatteryIndicator(right?.level ?: 0, right?.status == BatteryStatus.CHARGING) -// } -// } -// } -// } -// Row ( -// modifier = Modifier -// .fillMaxWidth(), -// horizontalArrangement = Arrangement.Center -// ) { -// val case = -// batteryStatus.find { it.component == BatteryComponent.CASE } -// BatteryIndicator(case?.level ?: 0) -// } -// } -// } // Slide-up animation val displayMetrics = mView.context.resources.displayMetrics diff --git a/android/app/src/main/res/drawable-nodpi/example_appwidget_preview.png b/android/app/src/main/res/drawable-nodpi/example_appwidget_preview.png new file mode 100644 index 0000000..894b069 Binary files /dev/null and b/android/app/src/main/res/drawable-nodpi/example_appwidget_preview.png differ diff --git a/android/app/src/main/res/drawable-v21/app_widget_background.xml b/android/app/src/main/res/drawable-v21/app_widget_background.xml new file mode 100644 index 0000000..785445c --- /dev/null +++ b/android/app/src/main/res/drawable-v21/app_widget_background.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml b/android/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml new file mode 100644 index 0000000..007e287 --- /dev/null +++ b/android/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/shape.xml b/android/app/src/main/res/drawable/shape.xml index 91c5c9f..be9dd16 100644 --- a/android/app/src/main/res/drawable/shape.xml +++ b/android/app/src/main/res/drawable/shape.xml @@ -4,16 +4,16 @@ android:shape="rectangle" > + android:color="@color/popup_background" > + android:radius="56dp"> \ No newline at end of file diff --git a/android/app/src/main/res/layout/battery_widget.xml b/android/app/src/main/res/layout/battery_widget.xml new file mode 100644 index 0000000..5941dd5 --- /dev/null +++ b/android/app/src/main/res/layout/battery_widget.xml @@ -0,0 +1,19 @@ + + + + \ No newline at end of file diff --git a/android/app/src/main/res/layout/popup_window.xml b/android/app/src/main/res/layout/popup_window.xml index 6979d5b..0739664 100644 --- a/android/app/src/main/res/layout/popup_window.xml +++ b/android/app/src/main/res/layout/popup_window.xml @@ -25,7 +25,7 @@ android:fontFamily="@font/sf_pro" android:gravity="center" android:text="Kavish's AirPods Pro" - android:textColor="@color/white" + android:textColor="@color/popup_text" android:textSize="28sp" app:layout_constraintTop_toTopOf="parent" @@ -72,7 +72,7 @@ android:layout_marginTop="16dp" android:fontFamily="@font/sf_pro" android:text="" - android:textColor="@color/white" + android:textColor="@color/popup_text" android:textSize="20sp" android:id="@+id/left_battery" android:gravity="center" @@ -88,7 +88,7 @@ android:gravity="center" android:text="" android:id="@+id/right_battery" - android:textColor="@color/white" + android:textColor="@color/popup_text" android:textSize="20sp" /> @@ -103,7 +103,7 @@ android:fontFamily="@font/sf_pro" android:gravity="center" android:text="" - android:textColor="@color/white" + android:textColor="@color/popup_text" android:textSize="20sp" /> \ No newline at end of file diff --git a/android/app/src/main/res/raw-night/connected.mp4 b/android/app/src/main/res/raw-night/connected.mp4 new file mode 100644 index 0000000..de45f7b Binary files /dev/null and b/android/app/src/main/res/raw-night/connected.mp4 differ diff --git a/android/app/src/main/res/raw/connected.mp4 b/android/app/src/main/res/raw/connected.mp4 index c3d9874..4455eda 100644 Binary files a/android/app/src/main/res/raw/connected.mp4 and b/android/app/src/main/res/raw/connected.mp4 differ diff --git a/android/app/src/main/res/raw/connected_uncropped.mp4 b/android/app/src/main/res/raw/connected_uncropped.mp4 deleted file mode 100644 index e7e74ae..0000000 Binary files a/android/app/src/main/res/raw/connected_uncropped.mp4 and /dev/null differ diff --git a/android/app/src/main/res/raw/first_uncropped.mp4 b/android/app/src/main/res/raw/first_uncropped.mp4 deleted file mode 100644 index 5e57c0e..0000000 Binary files a/android/app/src/main/res/raw/first_uncropped.mp4 and /dev/null differ diff --git a/android/app/src/main/res/raw/loop_uncropped.mp4 b/android/app/src/main/res/raw/loop_uncropped.mp4 deleted file mode 100644 index 14e8efb..0000000 Binary files a/android/app/src/main/res/raw/loop_uncropped.mp4 and /dev/null differ diff --git a/android/app/src/main/res/values-night-v31/themes.xml b/android/app/src/main/res/values-night-v31/themes.xml new file mode 100644 index 0000000..4eb4c07 --- /dev/null +++ b/android/app/src/main/res/values-night-v31/themes.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/values-night/colors.xml b/android/app/src/main/res/values-night/colors.xml new file mode 100644 index 0000000..02f8b09 --- /dev/null +++ b/android/app/src/main/res/values-night/colors.xml @@ -0,0 +1,5 @@ + + + #1C1B1E + @color/white + \ No newline at end of file diff --git a/android/app/src/main/res/values-v21/styles.xml b/android/app/src/main/res/values-v21/styles.xml new file mode 100644 index 0000000..c47dddb --- /dev/null +++ b/android/app/src/main/res/values-v21/styles.xml @@ -0,0 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/values-v31/styles.xml b/android/app/src/main/res/values-v31/styles.xml new file mode 100644 index 0000000..78e249e --- /dev/null +++ b/android/app/src/main/res/values-v31/styles.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/values-v31/themes.xml b/android/app/src/main/res/values-v31/themes.xml new file mode 100644 index 0000000..30e6629 --- /dev/null +++ b/android/app/src/main/res/values-v31/themes.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/values/attrs.xml b/android/app/src/main/res/values/attrs.xml new file mode 100644 index 0000000..7781ac8 --- /dev/null +++ b/android/app/src/main/res/values/attrs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml index c8524cd..1f8c039 100644 --- a/android/app/src/main/res/values/colors.xml +++ b/android/app/src/main/res/values/colors.xml @@ -2,4 +2,10 @@ #FF000000 #FFFFFFFF + #FFFFFF + @color/black + #FFE1F5FE + #FF81D4FA + #FF039BE5 + #FF01579B \ No newline at end of file diff --git a/android/app/src/main/res/values/dimens.xml b/android/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..4db8c59 --- /dev/null +++ b/android/app/src/main/res/values/dimens.xml @@ -0,0 +1,10 @@ + + + + + 0dp + + \ No newline at end of file diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index aa643b1..6a9ee85 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -1,4 +1,7 @@ ALN GATT Testing + EXAMPLE + Add widget + This is an app widget description \ No newline at end of file diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..823075f --- /dev/null +++ b/android/app/src/main/res/values/styles.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/values/themes.xml b/android/app/src/main/res/values/themes.xml index af1de19..65fdb74 100644 --- a/android/app/src/main/res/values/themes.xml +++ b/android/app/src/main/res/values/themes.xml @@ -1,4 +1,20 @@ + + + \ No newline at end of file diff --git a/android/app/src/main/res/xml/battery_widget_info.xml b/android/app/src/main/res/xml/battery_widget_info.xml new file mode 100644 index 0000000..af4f4a5 --- /dev/null +++ b/android/app/src/main/res/xml/battery_widget_info.xml @@ -0,0 +1,14 @@ + + \ No newline at end of file