From 969393a737e4e6ff750c9997dfe5bcb5bb7206d5 Mon Sep 17 00:00:00 2001 From: Jeong Taehun Date: Sun, 10 Sep 2023 11:59:15 +0900 Subject: [PATCH] =?UTF-8?q?[#259,=20=EC=9C=84=EC=A0=AF=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EB=B3=B4=EC=99=84]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 2 +- .../app2023/feature/main/MainActivity.kt | 2 +- .../app2023/feature/main/MainViewModel.kt | 2 +- .../app2023/feature/session/SessionDetailScreen.kt | 2 +- gradle/libs.versions.toml | 2 ++ widget/build.gradle.kts | 1 + .../com/droidknights/app2023/{ => widget}/Action.kt | 2 +- .../com/droidknights/app2023/{ => widget}/Command.kt | 2 +- .../app2023/{ => widget}/DroidKnightsWidget.kt | 6 +++--- .../{ => widget}/DroidKnightsWidgetReceiver.kt | 12 ++++++------ .../app2023/{ => widget}/WidgetSessionCard.kt | 3 ++- .../droidknights/app2023/{ => widget}/WidgetTitle.kt | 3 +-- .../app2023/{ => widget}/di/WidgetModule.kt | 2 +- 13 files changed, 22 insertions(+), 19 deletions(-) rename widget/src/main/kotlin/com/droidknights/app2023/{ => widget}/Action.kt (94%) rename widget/src/main/kotlin/com/droidknights/app2023/{ => widget}/Command.kt (89%) rename widget/src/main/kotlin/com/droidknights/app2023/{ => widget}/DroidKnightsWidget.kt (93%) rename widget/src/main/kotlin/com/droidknights/app2023/{ => widget}/DroidKnightsWidgetReceiver.kt (96%) rename widget/src/main/kotlin/com/droidknights/app2023/{ => widget}/WidgetSessionCard.kt (96%) rename widget/src/main/kotlin/com/droidknights/app2023/{ => widget}/WidgetTitle.kt (90%) rename widget/src/main/kotlin/com/droidknights/app2023/{ => widget}/di/WidgetModule.kt (91%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b5a9f67c..35ed7519 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -17,7 +17,7 @@ tools:targetApi="31"> diff --git a/feature/main/src/main/java/com/droidknights/app2023/feature/main/MainActivity.kt b/feature/main/src/main/java/com/droidknights/app2023/feature/main/MainActivity.kt index 63a1ea10..00723510 100644 --- a/feature/main/src/main/java/com/droidknights/app2023/feature/main/MainActivity.kt +++ b/feature/main/src/main/java/com/droidknights/app2023/feature/main/MainActivity.kt @@ -8,7 +8,7 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.core.view.WindowCompat import androidx.lifecycle.compose.collectAsStateWithLifecycle -import com.droidknights.app2023.DroidKnightsWidget.Companion.KEY_SESSION_ID +import com.droidknights.app2023.widget.DroidKnightsWidget.Companion.KEY_SESSION_ID import com.droidknights.app2023.core.designsystem.theme.KnightsTheme import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.flow.MutableStateFlow diff --git a/feature/main/src/main/java/com/droidknights/app2023/feature/main/MainViewModel.kt b/feature/main/src/main/java/com/droidknights/app2023/feature/main/MainViewModel.kt index 494c3fd4..5dacbbad 100644 --- a/feature/main/src/main/java/com/droidknights/app2023/feature/main/MainViewModel.kt +++ b/feature/main/src/main/java/com/droidknights/app2023/feature/main/MainViewModel.kt @@ -4,7 +4,7 @@ import android.app.Application import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.droidknights.app2023.core.data.repository.SettingsRepository -import com.droidknights.app2023.sendWidgetUpdateCommand +import com.droidknights.app2023.widget.sendWidgetUpdateCommand import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.launch import javax.inject.Inject diff --git a/feature/session/src/main/java/com/droidknights/app2023/feature/session/SessionDetailScreen.kt b/feature/session/src/main/java/com/droidknights/app2023/feature/session/SessionDetailScreen.kt index 2a4f4122..ba733624 100644 --- a/feature/session/src/main/java/com/droidknights/app2023/feature/session/SessionDetailScreen.kt +++ b/feature/session/src/main/java/com/droidknights/app2023/feature/session/SessionDetailScreen.kt @@ -51,7 +51,7 @@ import com.droidknights.app2023.core.model.Room import com.droidknights.app2023.core.model.Session import com.droidknights.app2023.core.model.Speaker import com.droidknights.app2023.core.model.Tag -import com.droidknights.app2023.sendWidgetUpdateCommand +import com.droidknights.app2023.widget.sendWidgetUpdateCommand import kotlinx.collections.immutable.PersistentList import kotlinx.collections.immutable.toPersistentList import kotlinx.coroutines.delay diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b8a23c27..c7d8f9ef 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -42,6 +42,7 @@ ossLicenses = "17.0.1" ossLicensesPlugin = "0.10.6" androidxGlance = "1.0.0-beta01" +glanceExperimentalTools = "0.2.2" [libraries] android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" } @@ -114,6 +115,7 @@ oss-licenses-plugin = { group = "com.google.android.gms", name = "oss-licenses-p androidx-glance = { group = "androidx.glance", name = "glance", version.ref = "androidxGlance" } androidx-glance-appwidget = { group = "androidx.glance", name = "glance-appwidget", version.ref = "androidxGlance" } +glance-tools-appwidget-host = { group = "com.google.android.glance.tools", name = "appwidget-host", version.ref = "glanceExperimentalTools"} [bundles] diff --git a/widget/build.gradle.kts b/widget/build.gradle.kts index 897f9247..cb1782f7 100644 --- a/widget/build.gradle.kts +++ b/widget/build.gradle.kts @@ -10,6 +10,7 @@ android { dependencies { implementation(libs.androidx.glance) implementation(libs.androidx.glance.appwidget) + implementation(libs.glance.tools.appwidget.host) implementation(projects.core.designsystem) diff --git a/widget/src/main/kotlin/com/droidknights/app2023/Action.kt b/widget/src/main/kotlin/com/droidknights/app2023/widget/Action.kt similarity index 94% rename from widget/src/main/kotlin/com/droidknights/app2023/Action.kt rename to widget/src/main/kotlin/com/droidknights/app2023/widget/Action.kt index 98f87b2c..e9aa13f3 100644 --- a/widget/src/main/kotlin/com/droidknights/app2023/Action.kt +++ b/widget/src/main/kotlin/com/droidknights/app2023/widget/Action.kt @@ -1,4 +1,4 @@ -package com.droidknights.app2023 +package com.droidknights.app2023.widget import android.content.Context import android.content.Intent diff --git a/widget/src/main/kotlin/com/droidknights/app2023/Command.kt b/widget/src/main/kotlin/com/droidknights/app2023/widget/Command.kt similarity index 89% rename from widget/src/main/kotlin/com/droidknights/app2023/Command.kt rename to widget/src/main/kotlin/com/droidknights/app2023/widget/Command.kt index e53a4b98..0160a2e8 100644 --- a/widget/src/main/kotlin/com/droidknights/app2023/Command.kt +++ b/widget/src/main/kotlin/com/droidknights/app2023/widget/Command.kt @@ -1,4 +1,4 @@ -package com.droidknights.app2023 +package com.droidknights.app2023.widget import android.appwidget.AppWidgetManager import android.content.Context diff --git a/widget/src/main/kotlin/com/droidknights/app2023/DroidKnightsWidget.kt b/widget/src/main/kotlin/com/droidknights/app2023/widget/DroidKnightsWidget.kt similarity index 93% rename from widget/src/main/kotlin/com/droidknights/app2023/DroidKnightsWidget.kt rename to widget/src/main/kotlin/com/droidknights/app2023/widget/DroidKnightsWidget.kt index cb8d8a79..abe94986 100644 --- a/widget/src/main/kotlin/com/droidknights/app2023/DroidKnightsWidget.kt +++ b/widget/src/main/kotlin/com/droidknights/app2023/widget/DroidKnightsWidget.kt @@ -1,4 +1,4 @@ -package com.droidknights.app2023 +package com.droidknights.app2023.widget import android.content.Context import androidx.compose.runtime.LaunchedEffect @@ -23,10 +23,10 @@ import androidx.glance.layout.Spacer import androidx.glance.layout.fillMaxSize import androidx.glance.layout.height import androidx.glance.layout.padding -import com.droidknights.app2023.DroidKnightsWidgetReceiver.Companion.KEY_SESSION_IDS +import com.droidknights.app2023.widget.DroidKnightsWidgetReceiver.Companion.KEY_SESSION_IDS import com.droidknights.app2023.core.designsystem.theme.KnightsGlanceTheme import com.droidknights.app2023.core.model.Session -import com.droidknights.app2023.di.WidgetModule +import com.droidknights.app2023.widget.di.WidgetModule import dagger.hilt.EntryPoints class DroidKnightsWidget : GlanceAppWidget() { diff --git a/widget/src/main/kotlin/com/droidknights/app2023/DroidKnightsWidgetReceiver.kt b/widget/src/main/kotlin/com/droidknights/app2023/widget/DroidKnightsWidgetReceiver.kt similarity index 96% rename from widget/src/main/kotlin/com/droidknights/app2023/DroidKnightsWidgetReceiver.kt rename to widget/src/main/kotlin/com/droidknights/app2023/widget/DroidKnightsWidgetReceiver.kt index 56138a57..b347c207 100644 --- a/widget/src/main/kotlin/com/droidknights/app2023/DroidKnightsWidgetReceiver.kt +++ b/widget/src/main/kotlin/com/droidknights/app2023/widget/DroidKnightsWidgetReceiver.kt @@ -1,4 +1,4 @@ -package com.droidknights.app2023 +package com.droidknights.app2023.widget import android.appwidget.AppWidgetManager import android.content.Context @@ -10,7 +10,7 @@ import androidx.glance.appwidget.GlanceAppWidgetReceiver import androidx.glance.appwidget.state.updateAppWidgetState import androidx.glance.appwidget.updateAll import androidx.glance.state.PreferencesGlanceStateDefinition -import com.droidknights.app2023.di.WidgetModule +import com.droidknights.app2023.widget.di.WidgetModule import dagger.hilt.EntryPoints import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.CoroutineScope @@ -20,10 +20,6 @@ import kotlinx.coroutines.launch @AndroidEntryPoint class DroidKnightsWidgetReceiver : GlanceAppWidgetReceiver() { - companion object { - const val KEY_SESSION_IDS = "SESSION_IDS" - } - override val glanceAppWidget: GlanceAppWidget = DroidKnightsWidget() override fun onUpdate( @@ -39,6 +35,10 @@ class DroidKnightsWidgetReceiver : GlanceAppWidgetReceiver() { getBookmarkedSessionAndUpdateWidget(context, glanceAppWidget) super.onReceive(context, intent) } + + companion object { + const val KEY_SESSION_IDS = "SESSION_IDS" + } } private fun getBookmarkedSessionAndUpdateWidget( diff --git a/widget/src/main/kotlin/com/droidknights/app2023/WidgetSessionCard.kt b/widget/src/main/kotlin/com/droidknights/app2023/widget/WidgetSessionCard.kt similarity index 96% rename from widget/src/main/kotlin/com/droidknights/app2023/WidgetSessionCard.kt rename to widget/src/main/kotlin/com/droidknights/app2023/widget/WidgetSessionCard.kt index 80c54c5c..4effc462 100644 --- a/widget/src/main/kotlin/com/droidknights/app2023/WidgetSessionCard.kt +++ b/widget/src/main/kotlin/com/droidknights/app2023/widget/WidgetSessionCard.kt @@ -1,4 +1,4 @@ -package com.droidknights.app2023 +package com.droidknights.app2023.widget import androidx.compose.runtime.Composable import androidx.compose.ui.unit.dp @@ -6,6 +6,7 @@ import androidx.compose.ui.unit.sp import androidx.glance.GlanceModifier import androidx.glance.GlanceTheme import androidx.glance.LocalContext +import androidx.glance.LocalGlanceId import androidx.glance.action.clickable import androidx.glance.appwidget.cornerRadius import androidx.glance.background diff --git a/widget/src/main/kotlin/com/droidknights/app2023/WidgetTitle.kt b/widget/src/main/kotlin/com/droidknights/app2023/widget/WidgetTitle.kt similarity index 90% rename from widget/src/main/kotlin/com/droidknights/app2023/WidgetTitle.kt rename to widget/src/main/kotlin/com/droidknights/app2023/widget/WidgetTitle.kt index 24ca2ad4..0f71b68a 100644 --- a/widget/src/main/kotlin/com/droidknights/app2023/WidgetTitle.kt +++ b/widget/src/main/kotlin/com/droidknights/app2023/widget/WidgetTitle.kt @@ -1,4 +1,4 @@ -package com.droidknights.app2023 +package com.droidknights.app2023.widget import androidx.compose.runtime.Composable import androidx.compose.ui.unit.sp @@ -8,7 +8,6 @@ import androidx.glance.LocalContext import androidx.glance.action.clickable import androidx.glance.text.Text import androidx.glance.text.TextDefaults -import com.droidknights.app2023.widget.R @Composable fun WidgetTitle() { diff --git a/widget/src/main/kotlin/com/droidknights/app2023/di/WidgetModule.kt b/widget/src/main/kotlin/com/droidknights/app2023/widget/di/WidgetModule.kt similarity index 91% rename from widget/src/main/kotlin/com/droidknights/app2023/di/WidgetModule.kt rename to widget/src/main/kotlin/com/droidknights/app2023/widget/di/WidgetModule.kt index 5a094033..7a0b3e7b 100644 --- a/widget/src/main/kotlin/com/droidknights/app2023/di/WidgetModule.kt +++ b/widget/src/main/kotlin/com/droidknights/app2023/widget/di/WidgetModule.kt @@ -1,4 +1,4 @@ -package com.droidknights.app2023.di +package com.droidknights.app2023.widget.di import com.droidknights.app2023.core.domain.usecase.GetBookmarkedSessionsUseCase import com.droidknights.app2023.core.domain.usecase.GetSessionUseCase