Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ android {
buildFeatures {
compose = true
}

composeOptions {
kotlinCompilerExtensionVersion = "1.5.15"
}
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<activity
android:name=".widget.config.WeatherWidgetConfigActivity"
android:exported="true"
android:theme="@android:style/Theme.Material3.DayNight">
android:theme="@style/Theme.Material3.DayNight">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
Expand Down
18 changes: 9 additions & 9 deletions android/app/src/main/assets/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="apple-mobile-web-app-title" content="Misty">

<link rel="manifest" href="/manifest.json">
<link rel="icon" type="image/png" href="/icon-192.png">
<link rel="apple-touch-icon" href="/icon-180.png">
<link rel="apple-touch-icon" sizes="120x120" href="/icon-120.png">
<link rel="apple-touch-icon" sizes="152x152" href="/icon-152.png">
<link rel="apple-touch-icon" sizes="167x167" href="/icon-167.png">
<link rel="apple-touch-icon" sizes="180x180" href="/icon-180.png">
<link rel="manifest" href="/Misty/manifest.json">
<link rel="icon" type="image/png" href="/Misty/icon-192.png">
<link rel="apple-touch-icon" href="/Misty/icon-180.png">
<link rel="apple-touch-icon" sizes="120x120" href="/Misty/icon-120.png">
<link rel="apple-touch-icon" sizes="152x152" href="/Misty/icon-152.png">
<link rel="apple-touch-icon" sizes="167x167" href="/Misty/icon-167.png">
<link rel="apple-touch-icon" sizes="180x180" href="/Misty/icon-180.png">

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<script type="module" crossorigin src="/assets/index-COUjo-RT.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-kTU6UcrP.css">
<script type="module" crossorigin src="/Misty/assets/index-CEDFm5zn.js"></script>
<link rel="stylesheet" crossorigin href="/Misty/assets/index-kTU6UcrP.css">
</head>

<body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private fun WeatherWidgetContent(
.fillMaxSize()
.background(backgroundColor)
.padding(16.dp)
.clickable(actionStartActivity<MainActivity>()),
.clickable(actionStartActivity(Intent(context, MainActivity::class.java))),
contentAlignment = Alignment.Center
) {
if (weatherData != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.appwidget.AppWidgetManager
import android.content.Context
import android.util.Log
import androidx.glance.appwidget.GlanceAppWidget
import androidx.glance.appwidget.GlanceAppWidgetManager
import androidx.glance.appwidget.GlanceAppWidgetReceiver
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -33,10 +34,13 @@ class WeatherWidgetReceiver : GlanceAppWidgetReceiver() {
// This method is called from WorkManager to trigger updates
val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
scope.launch {
val glanceManager = GlanceAppWidgetManager(context)
val weatherWidget = WeatherWidget()
appWidgetIds.forEach { widgetId ->
try {
// Glance will handle the update through the WeatherWidget instance
WeatherWidget().update(context, AppWidgetManager.getInstance(context))
// Get GlanceId for this widget and update
val glanceId = glanceManager.getGlanceIdBy(widgetId)
weatherWidget.update(context, glanceId)
} catch (e: Exception) {
Log.e(TAG, "Error updating widget $widgetId", e)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.glance.appwidget.GlanceAppWidgetManager
import androidx.lifecycle.lifecycleScope
import com.luminlynx.misty.widget.WeatherWidget
import com.luminlynx.misty.widget.WeatherWidgetWorker
Expand Down Expand Up @@ -68,8 +69,9 @@ class WeatherWidgetConfigActivity : ComponentActivity() {
private fun saveConfiguration() {
lifecycleScope.launch {
// Update widget
val appWidgetManager = AppWidgetManager.getInstance(this@WeatherWidgetConfigActivity)
WeatherWidget().update(this@WeatherWidgetConfigActivity, appWidgetManager)
val glanceManager = GlanceAppWidgetManager(this@WeatherWidgetConfigActivity)
val glanceId = glanceManager.getGlanceIdBy(appWidgetId)
WeatherWidget().update(this@WeatherWidgetConfigActivity, glanceId)

// Get update frequency and schedule worker
val config = preferences.widgetConfig.first()
Expand Down
Binary file removed android/app/src/main/res/drawable/splash.png
Binary file not shown.
4 changes: 4 additions & 0 deletions android/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="splashBackground">#FFFFFF</color>
</resources>
1 change: 1 addition & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Misty Weather Widget</string>
<string name="title_activity_main">Misty</string>
<string name="widget_description">Display current weather conditions on your home screen</string>
<string name="widget_loading">Loading weather data...</string>
<string name="widget_error">Unable to load weather</string>
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
buildscript {
ext.kotlin_version = '2.0.0'
ext {
compileSdkVersion = 34
compileSdkVersion = 35
minSdkVersion = 24
targetSdkVersion = 34
targetSdkVersion = 35
androidxAppCompatVersion = '1.6.1'
androidxCoordinatorLayoutVersion = '1.2.0'
coreSplashScreenVersion = '1.0.1'
Expand All @@ -18,7 +18,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.5.2'
classpath 'com.android.tools.build:gradle:8.7.3'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0'
classpath 'org.jetbrains.kotlin:compose-compiler-gradle-plugin:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
Expand Down
Loading