Skip to content

Commit 56d8f4e

Browse files
committed
Update dependencies
1 parent e4c558c commit 56d8f4e

File tree

20 files changed

+243
-181
lines changed

20 files changed

+243
-181
lines changed

.idea/codeStyles/Project.xml

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/kotlinc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

appwidget-configuration/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,4 @@ apply plugin: "me.tylerbwong.gradle.metalava"
126126
metalava {
127127
filename = "api/current.api"
128128
reportLintsAsErrors = true
129-
}
129+
}

appwidget-configuration/src/main/java/com/google/android/glance/appwidget/configuration/AppWidgetConfigurationScaffold.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ import com.google.android.glance.appwidget.host.rememberAppWidgetHostState
7070
* @param instance
7171
* @param state Current state for the configuration. Use [getCurrentState] and [updateCurrentState] instead.
7272
*/
73-
class AppWidgetConfigurationState(
73+
public class AppWidgetConfigurationState(
7474
state: Any?,
75-
val glanceId: GlanceId?,
76-
val providerInfo: AppWidgetProviderInfo?,
77-
val instance: GlanceAppWidget,
75+
public val glanceId: GlanceId?,
76+
public val providerInfo: AppWidgetProviderInfo?,
77+
public val instance: GlanceAppWidget,
7878
private val activity: Activity
7979
) {
8080

@@ -91,7 +91,7 @@ class AppWidgetConfigurationState(
9191
*
9292
* @see updateCurrentState
9393
*/
94-
inline fun <reified T> getCurrentState(): T? = internalState as? T
94+
public inline fun <reified T> getCurrentState(): T? = internalState as? T
9595

9696
/**
9797
* Updates the [GlanceAppWidget] state for the configuration preview without modifying the
@@ -104,7 +104,7 @@ class AppWidgetConfigurationState(
104104
* @see getCurrentState
105105
* @see androidx.glance.appwidget.state.updateAppWidgetState
106106
*/
107-
inline fun <reified T> updateCurrentState(update: (T) -> T) {
107+
public inline fun <reified T> updateCurrentState(update: (T) -> T) {
108108
requireNotNull(internalState)
109109
internalState = update(internalState as T)
110110
}
@@ -116,7 +116,7 @@ class AppWidgetConfigurationState(
116116
* This method will persist the latest value provided by [updateCurrentState] as defined by the
117117
* [GlanceAppWidget.stateDefinition] and calls [GlanceAppWidget.update].
118118
*/
119-
suspend fun applyConfiguration() {
119+
public suspend fun applyConfiguration() {
120120
checkNotNull(glanceId) { "Cannot apply configuration in a null GlanceId" }
121121

122122
// Set result ok to tell the launcher the configuration was a success
@@ -143,7 +143,7 @@ class AppWidgetConfigurationState(
143143
*
144144
* Note: this will be the same result as if users performs a back-press action.
145145
*/
146-
fun discardConfiguration() {
146+
public fun discardConfiguration() {
147147
activity.setResult(Activity.RESULT_CANCELED)
148148
activity.finish()
149149
}
@@ -159,7 +159,7 @@ class AppWidgetConfigurationState(
159159
* @return a new or cached [AppWidgetConfigurationState] instance
160160
*/
161161
@Composable
162-
fun rememberAppWidgetConfigurationState(configurationInstance: GlanceAppWidget): AppWidgetConfigurationState {
162+
public fun rememberAppWidgetConfigurationState(configurationInstance: GlanceAppWidget): AppWidgetConfigurationState {
163163
val activity = (LocalContext.current as Activity).apply {
164164
// Set the result to canceled in case the configuration does not finish
165165
setResult(Activity.RESULT_CANCELED)
@@ -230,7 +230,7 @@ fun rememberAppWidgetConfigurationState(configurationInstance: GlanceAppWidget):
230230
@ExperimentalGlanceRemoteViewsApi
231231
@ExperimentalMaterial3Api
232232
@Composable
233-
fun AppWidgetConfigurationScaffold(
233+
public fun AppWidgetConfigurationScaffold(
234234
appWidgetConfigurationState: AppWidgetConfigurationState,
235235
modifier: Modifier = Modifier,
236236
topBar: @Composable () -> Unit = {},

appwidget-host/src/main/java/com/google/android/glance/appwidget/host/AppWidgetHost.kt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ import java.util.concurrent.Executors
5959
*
6060
* @see AppWidgetHost
6161
*/
62-
class AppWidgetHostState(
63-
val providerInfo: AppWidgetProviderInfo?,
62+
public class AppWidgetHostState(
63+
public val providerInfo: AppWidgetProviderInfo?,
6464
private val state: MutableState<AppWidgetHostView?>
6565
) {
6666

6767
/**
6868
* The current [AppWidgetHostView] instance or null if not laid out yet.
6969
*/
70-
var value: AppWidgetHostView?
70+
public var value: AppWidgetHostView?
7171
get() = state.value
7272
internal set(value) {
7373
state.value = value
@@ -76,27 +76,29 @@ class AppWidgetHostState(
7676
/**
7777
* True if the host is ready to display RemoteViews, false otherwise
7878
*/
79-
val isReady: Boolean
79+
public val isReady: Boolean
8080
get() = state.value != null
8181

8282
/**
8383
* Holds the last snapshot provided to the host or null if none
8484
*/
85-
var snapshot: RemoteViews? = null
85+
public var snapshot: RemoteViews? = null
8686
internal set
8787

8888
/**
8989
* Update the current host (if available) to display the provided [RemoteViews]
9090
*/
91-
fun updateAppWidget(remoteViews: RemoteViews) {
91+
public fun updateAppWidget(remoteViews: RemoteViews) {
9292
val host = value ?: return
9393
snapshot = remoteViews
9494
host.updateAppWidget(remoteViews)
9595
}
9696
}
9797

9898
@Composable
99-
fun rememberAppWidgetHostState(providerInfo: AppWidgetProviderInfo? = null) = remember(providerInfo) {
99+
public fun rememberAppWidgetHostState(providerInfo: AppWidgetProviderInfo? = null): AppWidgetHostState = remember(
100+
providerInfo
101+
) {
100102
AppWidgetHostState(providerInfo, mutableStateOf(null))
101103
}
102104

@@ -110,7 +112,7 @@ fun rememberAppWidgetHostState(providerInfo: AppWidgetProviderInfo? = null) = re
110112
* @param gridColor - The color of the grid and widget area lines or null for none.
111113
*/
112114
@Composable
113-
fun AppWidgetHost(
115+
public fun AppWidgetHost(
114116
modifier: Modifier = Modifier,
115117
displaySize: DpSize,
116118
state: AppWidgetHostState,

appwidget-host/src/main/java/com/google/android/glance/appwidget/host/AppWidgetHostPreview.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import kotlinx.coroutines.launch
4141
* @param content a suspend lambda returning the actual RemoteViews
4242
*/
4343
@Composable
44-
fun AppWidgetHostPreview(
44+
public fun AppWidgetHostPreview(
4545
modifier: Modifier = Modifier,
4646
displaySize: DpSize = DpSize.Unspecified,
4747
provider: AppWidgetProviderInfo? = null,

appwidget-host/src/main/java/com/google/android/glance/appwidget/host/AppWidgetHostUtils.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private const val SNAPSHOTS_FOLDER = "appwidget-snapshots"
4848
*
4949
* @see AppWidgetManager.requestPinAppWidget
5050
*/
51-
fun AppWidgetHostState.requestPin(
51+
public fun AppWidgetHostState.requestPin(
5252
target: ComponentName = value!!.appWidgetInfo.provider,
5353
successCallback: PendingIntent? = null
5454
): Boolean {
@@ -71,7 +71,7 @@ fun AppWidgetHostState.requestPin(
7171
* @return the result of the operation with the image URI if successful
7272
*/
7373
@RequiresApi(Build.VERSION_CODES.Q)
74-
suspend fun AppWidgetHostView.exportSnapshot(fileName: String? = null): Result<Uri> {
74+
public suspend fun AppWidgetHostView.exportSnapshot(fileName: String? = null): Result<Uri> {
7575
return runCatching {
7676
withContext(Dispatchers.IO) {
7777
val bitmap = (this@exportSnapshot as View).toBitmap()

appwidget-host/src/main/java/com/google/android/glance/appwidget/host/AppWidgetSizeUtils.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,23 @@ import androidx.compose.ui.unit.DpSize
2929
import androidx.compose.ui.unit.dp
3030
import kotlin.math.min
3131

32-
fun DpSize.toSizeF(): SizeF = SizeF(width.value, height.value)
32+
public fun DpSize.toSizeF(): SizeF = SizeF(width.value, height.value)
3333

34-
fun Dp.toPixels(context: Context) = toPixels(context.resources.displayMetrics)
34+
public fun Dp.toPixels(context: Context): Int = toPixels(context.resources.displayMetrics)
3535

36-
fun Dp.toPixels(displayMetrics: DisplayMetrics) =
36+
public fun Dp.toPixels(displayMetrics: DisplayMetrics): Int =
3737
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value, displayMetrics).toInt()
3838

3939
internal fun Int.pixelsToDp(context: Context) = pixelsToDp(context.resources.displayMetrics)
4040

4141
internal fun Int.pixelsToDp(displayMetrics: DisplayMetrics) = (this / displayMetrics.density).dp
4242

43-
fun AppWidgetProviderInfo.getTargetSize(context: Context): DpSize = DpSize(
43+
public fun AppWidgetProviderInfo.getTargetSize(context: Context): DpSize = DpSize(
4444
minWidth.pixelsToDp(context),
4545
minHeight.pixelsToDp(context)
4646
)
4747

48-
fun AppWidgetProviderInfo.getMaxSize(context: Context): DpSize =
48+
public fun AppWidgetProviderInfo.getMaxSize(context: Context): DpSize =
4949
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && maxResizeWidth > 0) {
5050
DpSize(
5151
maxResizeWidth.pixelsToDp(context),
@@ -55,12 +55,12 @@ fun AppWidgetProviderInfo.getMaxSize(context: Context): DpSize =
5555
DpSize(Int.MAX_VALUE.dp, Int.MAX_VALUE.dp)
5656
}
5757

58-
fun AppWidgetProviderInfo.getMinSize(context: Context): DpSize = DpSize(
58+
public fun AppWidgetProviderInfo.getMinSize(context: Context): DpSize = DpSize(
5959
width = minResizeWidth.pixelsToDp(context),
6060
height = minResizeHeight.pixelsToDp(context)
6161
)
6262

63-
fun AppWidgetProviderInfo.getSingleSize(context: Context): DpSize {
63+
public fun AppWidgetProviderInfo.getSingleSize(context: Context): DpSize {
6464
val minWidth = min(
6565
minWidth,
6666
if (resizeMode and AppWidgetProviderInfo.RESIZE_HORIZONTAL != 0) {
@@ -83,7 +83,7 @@ fun AppWidgetProviderInfo.getSingleSize(context: Context): DpSize {
8383
)
8484
}
8585

86-
val Context.appwidgetBackgroundRadius: Dp
86+
public val Context.appwidgetBackgroundRadius: Dp
8787
get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
8888
val size = resources.getDimensionPixelSize(
8989
android.R.dimen.system_app_widget_background_radius
@@ -93,7 +93,7 @@ val Context.appwidgetBackgroundRadius: Dp
9393
16.dp
9494
}
9595

96-
val Context.appwidgetBackgroundRadiusPixels: Float
96+
public val Context.appwidgetBackgroundRadiusPixels: Float
9797
get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
9898
resources.getDimensionPixelSize(
9999
android.R.dimen.system_app_widget_background_radius
@@ -102,7 +102,7 @@ val Context.appwidgetBackgroundRadiusPixels: Float
102102
(16 * resources.displayMetrics.density)
103103
}
104104

105-
fun AppWidgetProviderInfo.toSizeExtras(context: Context, availableSize: DpSize): Bundle {
105+
public fun AppWidgetProviderInfo.toSizeExtras(context: Context, availableSize: DpSize): Bundle {
106106
return Bundle().apply {
107107
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
108108
putInt(

appwidget-host/src/main/java/com/google/android/glance/appwidget/host/glance/GlanceAppWidgetHostPreview.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import kotlinx.coroutines.launch
4646
*/
4747
@ExperimentalGlanceRemoteViewsApi
4848
@Composable
49-
fun GlanceAppWidgetHostPreview(
49+
public fun GlanceAppWidgetHostPreview(
5050
glanceAppWidget: GlanceAppWidget,
5151
modifier: Modifier = Modifier,
5252
state: Any? = null,

appwidget-viewer/src/main/java/com/google/android/glance/tools/viewer/GlanceSnapshot.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ import androidx.glance.appwidget.GlanceAppWidget
2222
* Data class containing a snapshot of the [GlanceAppWidget] and the associated state as defined
2323
* by the [GlanceAppWidget.stateDefinition] of the provided instance.
2424
*/
25-
data class GlanceSnapshot(val instance: GlanceAppWidget, val state: Any? = null)
25+
public data class GlanceSnapshot(val instance: GlanceAppWidget, val state: Any? = null)

appwidget-viewer/src/main/java/com/google/android/glance/tools/viewer/GlanceViewerActivity.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ import kotlinx.coroutines.withContext
4545
/**
4646
* Base class to display AppWidgets.
4747
*/
48-
abstract class AppWidgetViewerActivity : ComponentActivity() {
48+
public abstract class AppWidgetViewerActivity : ComponentActivity() {
4949

5050
/**
5151
* The list of [AppWidgetProvider] to display in the viewer
5252
*/
53-
abstract fun getProviders(): List<Class<out AppWidgetProvider>>
53+
public abstract fun getProviders(): List<Class<out AppWidgetProvider>>
5454

5555
/**
5656
* Provides the [RemoteViews] snapshot of the given [AppWidgetProviderInfo] for the given size
@@ -60,7 +60,7 @@ abstract class AppWidgetViewerActivity : ComponentActivity() {
6060
*
6161
* @return the [RemoteViews] instance to use for the viewer.
6262
*/
63-
abstract suspend fun getAppWidgetSnapshot(
63+
public abstract suspend fun getAppWidgetSnapshot(
6464
info: AppWidgetProviderInfo,
6565
size: DpSize
6666
): RemoteViews
@@ -110,14 +110,14 @@ abstract class AppWidgetViewerActivity : ComponentActivity() {
110110
* Extend this activity to provide a set of GlanceAppWidget snapshots to display.
111111
*/
112112
@ExperimentalGlanceRemoteViewsApi
113-
abstract class GlanceViewerActivity : AppWidgetViewerActivity() {
113+
public abstract class GlanceViewerActivity : AppWidgetViewerActivity() {
114114

115115
/**
116116
* Provides an instance of [GlanceAppWidget] to display inside the viewer.
117117
*
118118
* @param receiver - The selected [GlanceAppWidgetReceiver] to display
119119
*/
120-
abstract suspend fun getGlanceSnapshot(receiver: Class<out GlanceAppWidgetReceiver>): GlanceSnapshot
120+
public abstract suspend fun getGlanceSnapshot(receiver: Class<out GlanceAppWidgetReceiver>): GlanceSnapshot
121121

122122
/**
123123
* Only override this method to directly provide [RemoteViews] instead of [GlanceAppWidget]

appwidget-viewer/src/main/java/com/google/android/glance/tools/viewer/ui/ViewerScreen.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,18 @@ import androidx.compose.material.ExperimentalMaterialApi
2828
import androidx.compose.material.ModalBottomSheetLayout
2929
import androidx.compose.material.ModalBottomSheetValue
3030
import androidx.compose.material.icons.Icons
31+
import androidx.compose.material.icons.automirrored.rounded.KeyboardArrowRight
3132
import androidx.compose.material.icons.outlined.Description
3233
import androidx.compose.material.icons.outlined.PushPin
3334
import androidx.compose.material.icons.outlined.Refresh
3435
import androidx.compose.material.icons.outlined.Tune
3536
import androidx.compose.material.icons.rounded.Done
36-
import androidx.compose.material.icons.rounded.KeyboardArrowRight
3737
import androidx.compose.material.icons.rounded.Menu
3838
import androidx.compose.material.icons.rounded.Share
3939
import androidx.compose.material.rememberModalBottomSheetState
4040
import androidx.compose.material3.BottomAppBar
4141
import androidx.compose.material3.DrawerState
4242
import androidx.compose.material3.DrawerValue
43-
import androidx.compose.material3.ExperimentalMaterial3Api
4443
import androidx.compose.material3.FloatingActionButton
4544
import androidx.compose.material3.Icon
4645
import androidx.compose.material3.IconButton
@@ -74,7 +73,7 @@ import com.google.android.glance.appwidget.host.requestPin
7473
import kotlinx.coroutines.delay
7574
import kotlinx.coroutines.launch
7675

77-
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterialApi::class)
76+
@OptIn(ExperimentalMaterialApi::class)
7877
@Composable
7978
internal fun ViewerScreen(
8079
providers: List<AppWidgetProviderInfo>,
@@ -130,6 +129,7 @@ internal fun ViewerScreen(
130129
currentSize = currentSize,
131130
onSizeChange = onResize
132131
)
132+
133133
ViewerPanel.Info -> ViewerInfoPanel(selectedProvider)
134134
}
135135
}
@@ -230,7 +230,6 @@ private suspend fun doExport(
230230
}
231231
}
232232

233-
@OptIn(ExperimentalMaterial3Api::class)
234233
@Composable
235234
private fun ViewerBottomBar(
236235
drawerState: DrawerState,
@@ -318,7 +317,6 @@ private fun ViewerBottomBar(
318317
}
319318

320319
@Composable
321-
@OptIn(ExperimentalMaterial3Api::class)
322320
private fun ViewerDrawer(
323321
providers: List<AppWidgetProviderInfo>,
324322
selectedProvider: AppWidgetProviderInfo,
@@ -339,7 +337,7 @@ private fun ViewerDrawer(
339337
imageVector = if (selectedProvider == item) {
340338
Icons.Rounded.Done
341339
} else {
342-
Icons.Rounded.KeyboardArrowRight
340+
Icons.AutoMirrored.Rounded.KeyboardArrowRight
343341
},
344342
contentDescription = null
345343
)

0 commit comments

Comments
 (0)