Skip to content

Commit

Permalink
[CHORE] Updated the translations of Spanish
Browse files Browse the repository at this point in the history
 - Special thanks to @KeXxDumb for contributing the Spanish translations.

[UPDATE] Updated the implementation of `Folders` screen.
 - It now utilizes a blur effect.

[FIX] Fixed various places where ActionMenu had erroneous padding.
 - [FEAT] Added `Filters` to extensions.kt
 - [UPDATE] Updated the implementation of ListHeader
 - [FIX] The `lastModified` of Folder was returning time in seconds instead of milliseconds.
 - [FIX] When the view was in selection mode, the TopBar was becoming invisible; removed that logic. It now stays on.

[REFACTOR] Renamed `MenuItem` to `Action`

[FEAT] Properly mapped `es-r419` (Spanish Latin America) to `b+es+419`

[UPDATE] Enhanced the layout of settings.
 - Replaced each settings summary and title with a single resource; this will make handling resources more robust.
 - Replaced the old settings layout with a new multi-form factor support layout.

[CHORE] Copied translation of `Spanish` from `es-rES` to `es-r419`
 - This was because the translator mistakenly added his dialect in another one.
[CHORE] Updated Gradle to `8.7.3`
  • Loading branch information
iZakirSheikh committed Dec 3, 2024
1 parent 06a1b1f commit 643e274
Show file tree
Hide file tree
Showing 29 changed files with 1,432 additions and 900 deletions.
1 change: 1 addition & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId = "com.googol.android.apps.photos"
minSdk = 24
targetSdk = 35
versionCode = 35
versionName = "0.2.4-dev"
versionCode = 37
versionName = "0.2.5-dev"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
17 changes: 11 additions & 6 deletions app/src/main/java/com/zs/gallery/Gallery.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import com.google.accompanist.permissions.ExperimentalPermissionsApi
import com.primex.core.MetroGreen
import com.primex.core.OrientRed
import com.primex.core.plus
import com.primex.core.textResource
import com.primex.material2.Label
Expand Down Expand Up @@ -134,7 +136,7 @@ private const val TAG = "Gallery"
private val NAV_RAIL_MIN_WIDTH = 106.dp
private val BOTTOM_NAV_MIN_HEIGHT = 56.dp

private val LightAccentColor = Color(0xFF514700)
private val LightAccentColor = Color.OrientRed
private val DarkAccentColor = Color(0xFFD8A25E)

/**
Expand Down Expand Up @@ -314,8 +316,8 @@ private fun NavigationBar(
val current by navController.current()
val color = LocalContentColor.current
val colors = NavigationItemDefaults.navigationItemColors(
selectedContentColor = color,
selectedBackgroundColor = color.copy(0.12f)
selectedContentColor = if (AppTheme.colors.isLight) AppTheme.colors.accent else color,
selectedBackgroundColor =if (AppTheme.colors.isLight) AppTheme.colors.accent.copy(alpha = 0.12f) else color.copy(alpha = 0.12f),
)
val domain = current?.destination?.domain
val facade = LocalSystemFacade.current
Expand Down Expand Up @@ -546,10 +548,11 @@ fun Gallery(
}
)

// Observe the state of the IMMERSE_VIEW setting
// Observe the state of the IMMERSE_VIEW setting
val immersiveView by activity.observeAsState(Settings.KEY_IMMERSIVE_VIEW)
val translucentBg by activity.observeAsState(Settings.KEY_TRANSPARENT_SYSTEM_BARS)
LaunchedEffect(immersiveView, style, isDark, translucentBg) {
val transparentSystemBars by activity.observeAsState(Settings.KEY_TRANSPARENT_SYSTEM_BARS)
LaunchedEffect(immersiveView, style, isDark, transparentSystemBars) {
// Get the WindowInsetsController for managing system bars
val window = activity.window
val controller = WindowCompat.getInsetsController(window, window.decorView)
Expand All @@ -570,11 +573,13 @@ fun Gallery(
else -> !isDark // If not explicitly set, use the isDark setting
}
// Configure the system bars background color based on the current style settings
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM)
return@LaunchedEffect // No supported from here.
window.apply {
val color = when (style.flagSystemBarBackground) {
WindowStyle.FLAG_SYSTEM_BARS_BG_TRANSLUCENT -> Color(0x20000000).toArgb() // Translucent background
WindowStyle.FLAG_SYSTEM_BARS_BG_TRANSPARENT -> Color.Transparent.toArgb() // Transparent background
else -> (if (translucentBg) Color(0x20000000) else Color.Transparent).toArgb()// automate using the setting
else -> (if (!transparentSystemBars) Color(0x20000000) else Color.Transparent).toArgb()// automate using the setting
}
// Set the status and navigation bar colors
statusBarColor = color
Expand Down
97 changes: 47 additions & 50 deletions app/src/main/java/com/zs/gallery/bin/Trash.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@ import android.annotation.SuppressLint
import androidx.activity.compose.BackHandler
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.ExperimentalSharedTransitionApi
import androidx.compose.animation.animateContentSize
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.lazy.grid.GridCells
Expand All @@ -60,20 +61,19 @@ import com.primex.core.textResource
import com.primex.material2.Button
import com.primex.material2.IconButton
import com.primex.material2.Label
import com.primex.material2.OutlinedButton
import com.primex.material2.TextButton
import com.primex.material2.appbar.LargeTopAppBar
import com.primex.material2.appbar.TopAppBarDefaults
import com.primex.material2.appbar.TopAppBarScrollBehavior
import com.zs.foundation.AppTheme
import com.zs.foundation.ContentPadding
import com.zs.foundation.LocalWindowSize
import com.zs.foundation.None
import com.zs.foundation.VerticalDivider
import com.zs.foundation.adaptive.TwoPane
import com.zs.foundation.adaptive.VerticalTwoPaneStrategy
import com.zs.foundation.adaptive.contentInsets
import com.zs.gallery.R
import com.zs.foundation.menu.FloatingActionMenu
import com.zs.gallery.R
import com.zs.gallery.common.LocalNavController
import com.zs.gallery.common.emit
import com.zs.gallery.common.items
Expand All @@ -87,49 +87,44 @@ private fun TopAppBar(
behavior: TopAppBarScrollBehavior? = null,
insets: WindowInsets = WindowInsets.None
) {
AnimatedVisibility(
visible = !viewState.isInSelectionMode,
enter = slideInVertically() + fadeIn(),
exit = slideOutVertically() + fadeOut(),
modifier = Modifier.animateContentSize(),
content = {
LargeTopAppBar(
navigationIcon = {
val navController = LocalNavController.current
IconButton(
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
onClick = navController::navigateUp
)
},
title = { Label(text = textResource(id = R.string.trash)) },
scrollBehavior = behavior,
windowInsets = insets,
modifier = modifier,
style = TopAppBarDefaults.largeAppBarStyle(
containerColor = AppTheme.colors.background,
scrolledContainerColor = AppTheme.colors.background(elevation = 1.dp),
scrolledContentColor = AppTheme.colors.onBackground,
contentColor = AppTheme.colors.onBackground
),
actions = {
val context = LocalContext.current
Button(
label = stringResource(R.string.restore),
onClick = { viewState.restoreAll(context.findActivity()) },
colors = ButtonDefaults.buttonColors(backgroundColor = AppTheme.colors.background(2.dp)),
shape = CircleShape,
elevation = null,
modifier = Modifier.scale(0.9f)
)
Button(
label = stringResource(R.string.empty_bin),
onClick = { viewState.empty(context.findActivity()) },
colors = ButtonDefaults.buttonColors(backgroundColor = AppTheme.colors.background(2.dp)),
shape = CircleShape,
elevation = null,
modifier = Modifier.scale(0.9f)
)
}

LargeTopAppBar(
navigationIcon = {
val navController = LocalNavController.current
IconButton(
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
onClick = navController::navigateUp
)
},
title = { Label(text = textResource(id = R.string.trash)) },
scrollBehavior = behavior,
windowInsets = insets,
modifier = modifier,
style = TopAppBarDefaults.largeAppBarStyle(
containerColor = AppTheme.colors.background,
scrolledContainerColor = AppTheme.colors.background(elevation = 1.dp),
scrolledContentColor = AppTheme.colors.onBackground,
contentColor = AppTheme.colors.onBackground
),
actions = {
val context = LocalContext.current
Button(
label = stringResource(R.string.restore),
onClick = { viewState.restoreAll(context.findActivity()) },
colors = ButtonDefaults.buttonColors(backgroundColor = AppTheme.colors.background(2.dp)),
shape = CircleShape,
elevation = null,
modifier = Modifier.scale(0.9f),
enabled = !viewState.isInSelectionMode
)
Button(
label = stringResource(R.string.empty_bin),
onClick = { viewState.empty(context.findActivity()) },
colors = ButtonDefaults.buttonColors(backgroundColor = AppTheme.colors.background(2.dp)),
shape = CircleShape,
elevation = null,
modifier = Modifier.scale(0.9f),
enabled = !viewState.isInSelectionMode
)
}
)
Expand Down Expand Up @@ -157,7 +152,9 @@ fun Actions(
val context = LocalContext.current
IconButton(
imageVector = Icons.Default.Restore,
onClick = { viewState.restore(context.findActivity()) })
onClick = { viewState.restore(context.findActivity()) }

)
IconButton(
imageVector = Icons.Default.DeleteSweep,
onClick = { viewState.delete(context.findActivity()) })
Expand Down Expand Up @@ -194,7 +191,7 @@ fun Trash(viewState: TrashViewState) {
visible = viewState.isInSelectionMode,
enter = fadeIn() + slideInVertically(),
exit = fadeOut() + slideOutVertically(),
modifier = Modifier.padding(navInsets),
modifier = Modifier.padding(navInsets).navigationBarsPadding().padding(bottom = ContentPadding.medium),
content = {
Actions(viewState = viewState)
}
Expand All @@ -209,7 +206,7 @@ fun Trash(viewState: TrashViewState) {
columns = GridCells.Adaptive(MIN_TILE_SIZE * multiplier),
horizontalArrangement = GridItemsArrangement,
verticalArrangement = GridItemsArrangement,
contentPadding = WindowInsets.contentInsets + navInsets,
contentPadding = WindowInsets.contentInsets + navInsets + PaddingValues(horizontal = ContentPadding.medium),
content = {
// emit the state;
val data = emit(values) ?: return@LazyVerticalGrid
Expand Down
38 changes: 38 additions & 0 deletions app/src/main/java/com/zs/gallery/common/Common.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2024 Zakir Sheikh
*
* Created by Zakir Sheikh on 02-12-2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.zs.gallery.common

import com.zs.foundation.menu.Action

private const val TAG = "Common"

/**
* Represents a sorting order and associated grouping or ordering action.
*
* @property first Specifies whether the sorting is ascending or descending.
* @property second Specifies the action to group by or order by.
*/
typealias Filter = Pair<Boolean, Action>

/**
* Represents a mapping from a string key to a list of items of type T.
*
* @param T The type of items in the list.
*/
typealias Mapped<T> = Map<CharSequence, List<T>>
Loading

0 comments on commit 643e274

Please sign in to comment.