Skip to content

[WIP] Add glance widget #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
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
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ dependencies {
implementation(projects.core.data)
implementation(projects.core.sync)
implementation(projects.core.opml)
implementation(projects.widget)
implementation(projects.ui.resources)
implementation(projects.ui.preview)
implementation(projects.ui.designSystem)
Expand Down
9 changes: 9 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ compose-bom = "2024.06.00"
compose-bom-alpha = "2024.07.00-alpha01"
compose-htmlconverter = "0.9.5"
kmpalette = "3.1.0"
glance = "1.1.0"
lyricist = "1.7.0"
navigation = "2.8.0-beta05"
molecule = "2.0.0"
Expand Down Expand Up @@ -77,6 +78,9 @@ lyricist = { group = "cafe.adriel.lyricist", name = "lyricist", version.ref = "l
lyricist-processor = { group = "cafe.adriel.lyricist", name = "lyricist-processor", version.ref = "lyricist" }
ui = { group = "androidx.compose.ui", name = "ui" }
ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
glance = { module = "androidx.glance:glance", version.ref = "glance" }
glance-appwidget = { module = "androidx.glance:glance-appwidget", version.ref = "glance" }
glance-material3 = { module = "androidx.glance:glance-material3", version.ref = "glance" }
ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
Expand Down Expand Up @@ -179,6 +183,11 @@ compose = [
"aboutlibraries-m3",
"compose-htmlconverter"
]
glance = [
"glance",
"glance-appwidget",
"glance-material3"
]
navigation = [
"navigation",
"hilt-navigation-compose"
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ include(":core:opml")
include(":ui:resources")
include(":ui:preview")
include(":ui:design-system")
include(":widget")
24 changes: 24 additions & 0 deletions widget/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
plugins {
alias(libs.plugins.podcaster.compose.android.lib)
alias(libs.plugins.hilt)
alias(libs.plugins.ksp)
}

android {
namespace = "com.mr3y.podcaster.widget"
}

dependencies {
ksp(libs.hilt.compiler)
implementation(libs.hilt.runtime)

implementation(libs.bundles.glance)
implementation(libs.material3)
implementation(libs.coil.mp)

implementation(projects.core.data)
implementation(projects.core.logger)
implementation(projects.core.model)
implementation(projects.ui.resources)
implementation(projects.ui.designSystem)
}
20 changes: 20 additions & 0 deletions widget/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<receiver
android:name="com.mr3y.podcaster.widget.PodcasterAppWidgetReceiver"
android:enabled="true"
android:label="@string/app_widget_description"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>

<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/podcaster_widget_info" />
</receiver>
</application>

</manifest>
126 changes: 126 additions & 0 deletions widget/src/main/kotlin/com/mr3y/podcaster/widget/Color.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
package com.mr3y.podcaster.widget

import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import com.mr3y.podcaster.ui.theme.md_theme_dark_background
import com.mr3y.podcaster.ui.theme.md_theme_dark_error
import com.mr3y.podcaster.ui.theme.md_theme_dark_errorContainer
import com.mr3y.podcaster.ui.theme.md_theme_dark_inverseOnSurface
import com.mr3y.podcaster.ui.theme.md_theme_dark_inversePrimary
import com.mr3y.podcaster.ui.theme.md_theme_dark_inverseSurface
import com.mr3y.podcaster.ui.theme.md_theme_dark_onBackground
import com.mr3y.podcaster.ui.theme.md_theme_dark_onError
import com.mr3y.podcaster.ui.theme.md_theme_dark_onErrorContainer
import com.mr3y.podcaster.ui.theme.md_theme_dark_onPrimary
import com.mr3y.podcaster.ui.theme.md_theme_dark_onPrimaryContainer
import com.mr3y.podcaster.ui.theme.md_theme_dark_onSecondary
import com.mr3y.podcaster.ui.theme.md_theme_dark_onSecondaryContainer
import com.mr3y.podcaster.ui.theme.md_theme_dark_onSurface
import com.mr3y.podcaster.ui.theme.md_theme_dark_onSurfaceVariant
import com.mr3y.podcaster.ui.theme.md_theme_dark_onTertiary
import com.mr3y.podcaster.ui.theme.md_theme_dark_onTertiaryContainer
import com.mr3y.podcaster.ui.theme.md_theme_dark_outline
import com.mr3y.podcaster.ui.theme.md_theme_dark_outlineVariant
import com.mr3y.podcaster.ui.theme.md_theme_dark_primary
import com.mr3y.podcaster.ui.theme.md_theme_dark_primaryContainer
import com.mr3y.podcaster.ui.theme.md_theme_dark_scrim
import com.mr3y.podcaster.ui.theme.md_theme_dark_secondary
import com.mr3y.podcaster.ui.theme.md_theme_dark_secondaryContainer
import com.mr3y.podcaster.ui.theme.md_theme_dark_surface
import com.mr3y.podcaster.ui.theme.md_theme_dark_surfaceTint
import com.mr3y.podcaster.ui.theme.md_theme_dark_surfaceVariant
import com.mr3y.podcaster.ui.theme.md_theme_dark_tertiary
import com.mr3y.podcaster.ui.theme.md_theme_dark_tertiaryContainer
import com.mr3y.podcaster.ui.theme.md_theme_light_background
import com.mr3y.podcaster.ui.theme.md_theme_light_error
import com.mr3y.podcaster.ui.theme.md_theme_light_errorContainer
import com.mr3y.podcaster.ui.theme.md_theme_light_inverseOnSurface
import com.mr3y.podcaster.ui.theme.md_theme_light_inversePrimary
import com.mr3y.podcaster.ui.theme.md_theme_light_inverseSurface
import com.mr3y.podcaster.ui.theme.md_theme_light_onBackground
import com.mr3y.podcaster.ui.theme.md_theme_light_onError
import com.mr3y.podcaster.ui.theme.md_theme_light_onErrorContainer
import com.mr3y.podcaster.ui.theme.md_theme_light_onPrimary
import com.mr3y.podcaster.ui.theme.md_theme_light_onPrimaryContainer
import com.mr3y.podcaster.ui.theme.md_theme_light_onSecondary
import com.mr3y.podcaster.ui.theme.md_theme_light_onSecondaryContainer
import com.mr3y.podcaster.ui.theme.md_theme_light_onSurface
import com.mr3y.podcaster.ui.theme.md_theme_light_onSurfaceVariant
import com.mr3y.podcaster.ui.theme.md_theme_light_onTertiary
import com.mr3y.podcaster.ui.theme.md_theme_light_onTertiaryContainer
import com.mr3y.podcaster.ui.theme.md_theme_light_outline
import com.mr3y.podcaster.ui.theme.md_theme_light_outlineVariant
import com.mr3y.podcaster.ui.theme.md_theme_light_primary
import com.mr3y.podcaster.ui.theme.md_theme_light_primaryContainer
import com.mr3y.podcaster.ui.theme.md_theme_light_scrim
import com.mr3y.podcaster.ui.theme.md_theme_light_secondary
import com.mr3y.podcaster.ui.theme.md_theme_light_secondaryContainer
import com.mr3y.podcaster.ui.theme.md_theme_light_surface
import com.mr3y.podcaster.ui.theme.md_theme_light_surfaceTint
import com.mr3y.podcaster.ui.theme.md_theme_light_surfaceVariant
import com.mr3y.podcaster.ui.theme.md_theme_light_tertiary
import com.mr3y.podcaster.ui.theme.md_theme_light_tertiaryContainer

internal val LightColors = lightColorScheme(
primary = md_theme_light_primary,
onPrimary = md_theme_light_onPrimary,
primaryContainer = md_theme_light_primaryContainer,
onPrimaryContainer = md_theme_light_onPrimaryContainer,
secondary = md_theme_light_secondary,
onSecondary = md_theme_light_onSecondary,
secondaryContainer = md_theme_light_secondaryContainer,
onSecondaryContainer = md_theme_light_onSecondaryContainer,
tertiary = md_theme_light_tertiary,
onTertiary = md_theme_light_onTertiary,
tertiaryContainer = md_theme_light_tertiaryContainer,
onTertiaryContainer = md_theme_light_onTertiaryContainer,
error = md_theme_light_error,
errorContainer = md_theme_light_errorContainer,
onError = md_theme_light_onError,
onErrorContainer = md_theme_light_onErrorContainer,
background = md_theme_light_background,
onBackground = md_theme_light_onBackground,
surface = md_theme_light_surface,
onSurface = md_theme_light_onSurface,
surfaceVariant = md_theme_light_surfaceVariant,
onSurfaceVariant = md_theme_light_onSurfaceVariant,
outline = md_theme_light_outline,
inverseOnSurface = md_theme_light_inverseOnSurface,
inverseSurface = md_theme_light_inverseSurface,
inversePrimary = md_theme_light_inversePrimary,
surfaceTint = md_theme_light_surfaceTint,
outlineVariant = md_theme_light_outlineVariant,
scrim = md_theme_light_scrim,
)

internal val DarkColors = darkColorScheme(
primary = md_theme_dark_primary,
onPrimary = md_theme_dark_onPrimary,
primaryContainer = md_theme_dark_primaryContainer,
onPrimaryContainer = md_theme_dark_onPrimaryContainer,
secondary = md_theme_dark_secondary,
onSecondary = md_theme_dark_onSecondary,
secondaryContainer = md_theme_dark_secondaryContainer,
onSecondaryContainer = md_theme_dark_onSecondaryContainer,
tertiary = md_theme_dark_tertiary,
onTertiary = md_theme_dark_onTertiary,
tertiaryContainer = md_theme_dark_tertiaryContainer,
onTertiaryContainer = md_theme_dark_onTertiaryContainer,
error = md_theme_dark_error,
errorContainer = md_theme_dark_errorContainer,
onError = md_theme_dark_onError,
onErrorContainer = md_theme_dark_onErrorContainer,
background = md_theme_dark_background,
onBackground = md_theme_dark_onBackground,
surface = md_theme_dark_surface,
onSurface = md_theme_dark_onSurface,
surfaceVariant = md_theme_dark_surfaceVariant,
onSurfaceVariant = md_theme_dark_onSurfaceVariant,
outline = md_theme_dark_outline,
inverseOnSurface = md_theme_dark_inverseOnSurface,
inverseSurface = md_theme_dark_inverseSurface,
inversePrimary = md_theme_dark_inversePrimary,
surfaceTint = md_theme_dark_surfaceTint,
outlineVariant = md_theme_dark_outlineVariant,
scrim = md_theme_dark_scrim,
)
Loading
Loading