Merge branch 'android:main' into loading-progress-for-image

pull/850/head
Qamar A. Safadi 1 year ago committed by GitHub
commit 5abc69fb49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -15,7 +15,7 @@ follows Android design and development best practices and is intended to be a us
for developers. As a running app, it's intended to help developers keep up-to-date with the world for developers. As a running app, it's intended to help developers keep up-to-date with the world
of Android development by providing regular news updates. of Android development by providing regular news updates.
The app is currently in development. The `demoRelease` variant is [available on the Play Store in open beta](https://play.google.com/store/apps/details?id=com.google.samples.apps.nowinandroid). The app is currently in development. The `prodRelease` variant is [available on the Play Store](https://play.google.com/store/apps/details?id=com.google.samples.apps.nowinandroid).
# Features # Features

@ -55,7 +55,7 @@ fun NiaLoadingWheel(
contentDesc: String, contentDesc: String,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
val infiniteTransition = rememberInfiniteTransition() val infiniteTransition = rememberInfiniteTransition(label = "wheel transition")
// Specifies the float animation for slowly drawing out the lines on entering // Specifies the float animation for slowly drawing out the lines on entering
val startValue = if (LocalInspectionMode.current) 0F else 1F val startValue = if (LocalInspectionMode.current) 0F else 1F
@ -82,6 +82,7 @@ fun NiaLoadingWheel(
animationSpec = infiniteRepeatable( animationSpec = infiniteRepeatable(
animation = tween(durationMillis = ROTATION_TIME, easing = LinearEasing), animation = tween(durationMillis = ROTATION_TIME, easing = LinearEasing),
), ),
label = "wheel rotation animation",
) )
// Specifies the color animation for the base-to-progress line color change // Specifies the color animation for the base-to-progress line color change
@ -100,6 +101,7 @@ fun NiaLoadingWheel(
repeatMode = RepeatMode.Restart, repeatMode = RepeatMode.Restart,
initialStartOffset = StartOffset(ROTATION_TIME / NUM_OF_LINES / 2 * index), initialStartOffset = StartOffset(ROTATION_TIME / NUM_OF_LINES / 2 * index),
), ),
label = "wheel color animation",
) )
} }

@ -57,10 +57,10 @@ private interface RetrofitNiaNetworkApi {
): List<NetworkChangeList> ): List<NetworkChangeList>
} }
private const val NiaBaseUrl = BuildConfig.BACKEND_URL private const val NIA_BASE_URL = BuildConfig.BACKEND_URL
/** /**
* Wrapper for data provided from the [NiaBaseUrl] * Wrapper for data provided from the [NIA_BASE_URL]
*/ */
@Serializable @Serializable
private data class NetworkResponse<T>( private data class NetworkResponse<T>(
@ -77,7 +77,7 @@ class RetrofitNiaNetwork @Inject constructor(
) : NiaNetworkDataSource { ) : NiaNetworkDataSource {
private val networkApi = Retrofit.Builder() private val networkApi = Retrofit.Builder()
.baseUrl(NiaBaseUrl) .baseUrl(NIA_BASE_URL)
.callFactory(okhttpCallFactory) .callFactory(okhttpCallFactory)
.addConverterFactory( .addConverterFactory(
networkJson.asConverterFactory("application/json".toMediaType()), networkJson.asConverterFactory("application/json".toMediaType()),

@ -23,11 +23,11 @@ import androidx.navigation.compose.composable
import androidx.navigation.navigation import androidx.navigation.navigation
import com.google.samples.apps.nowinandroid.feature.interests.InterestsRoute import com.google.samples.apps.nowinandroid.feature.interests.InterestsRoute
private const val interestsGraphRoutePattern = "interests_graph" private const val INTERESTS_GRAPH_ROUTE_PATTERN = "interests_graph"
const val interestsRoute = "interests_route" const val interestsRoute = "interests_route"
fun NavController.navigateToInterestsGraph(navOptions: NavOptions? = null) { fun NavController.navigateToInterestsGraph(navOptions: NavOptions? = null) {
this.navigate(interestsGraphRoutePattern, navOptions) this.navigate(INTERESTS_GRAPH_ROUTE_PATTERN, navOptions)
} }
fun NavGraphBuilder.interestsGraph( fun NavGraphBuilder.interestsGraph(
@ -35,7 +35,7 @@ fun NavGraphBuilder.interestsGraph(
nestedGraphs: NavGraphBuilder.() -> Unit, nestedGraphs: NavGraphBuilder.() -> Unit,
) { ) {
navigation( navigation(
route = interestsGraphRoutePattern, route = INTERESTS_GRAPH_ROUTE_PATTERN,
startDestination = interestsRoute, startDestination = interestsRoute,
) { ) {
composable(route = interestsRoute) { composable(route = interestsRoute) {

@ -28,8 +28,8 @@ import androidx.work.NetworkType
import com.google.samples.apps.nowinandroid.sync.R import com.google.samples.apps.nowinandroid.sync.R
const val SYNC_TOPIC = "sync" const val SYNC_TOPIC = "sync"
private const val SyncNotificationId = 0 private const val SYNC_NOTIFICATION_ID = 0
private const val SyncNotificationChannelID = "SyncNotificationChannel" private const val SYNC_NOTIFICATION_CHANNEL_ID = "SyncNotificationChannel"
// All sync work needs an internet connectionS // All sync work needs an internet connectionS
val SyncConstraints val SyncConstraints
@ -42,7 +42,7 @@ val SyncConstraints
* run with a foreground service * run with a foreground service
*/ */
fun Context.syncForegroundInfo() = ForegroundInfo( fun Context.syncForegroundInfo() = ForegroundInfo(
SyncNotificationId, SYNC_NOTIFICATION_ID,
syncWorkNotification(), syncWorkNotification(),
) )
@ -53,7 +53,7 @@ fun Context.syncForegroundInfo() = ForegroundInfo(
private fun Context.syncWorkNotification(): Notification { private fun Context.syncWorkNotification(): Notification {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel( val channel = NotificationChannel(
SyncNotificationChannelID, SYNC_NOTIFICATION_CHANNEL_ID,
getString(R.string.sync_notification_channel_name), getString(R.string.sync_notification_channel_name),
NotificationManager.IMPORTANCE_DEFAULT, NotificationManager.IMPORTANCE_DEFAULT,
).apply { ).apply {
@ -68,7 +68,7 @@ private fun Context.syncWorkNotification(): Notification {
return NotificationCompat.Builder( return NotificationCompat.Builder(
this, this,
SyncNotificationChannelID, SYNC_NOTIFICATION_CHANNEL_ID,
) )
.setSmallIcon( .setSmallIcon(
com.google.samples.apps.nowinandroid.core.common.R.drawable.ic_nia_notification, com.google.samples.apps.nowinandroid.core.common.R.drawable.ic_nia_notification,

Loading…
Cancel
Save