Skip to content

Commit

Permalink
[FIX] Removed common fields referenced by &fieldname; from string res…
Browse files Browse the repository at this point in the history
…ource, as I believe these might be hard to translate.

[FIX] Fixed issue with the top bar of the Timeline screen.
[CHORE] Updated the names of string resources to reflect the rules of defining strings.
  • Loading branch information
iZakirSheikh committed Nov 27, 2024
1 parent d06946e commit 352c25c
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .idea/compiler.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 = 31
versionName = "0.2.0-dev"
versionCode = 32
versionName = "0.2.1-dev"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/java/com/zs/gallery/Gallery.kt
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ private fun Permission() {
// If the permissions are not granted, show the permission screen.
com.zs.gallery.common.Placeholder(
iconResId = R.raw.lt_permission,
title = stringResource(R.string.permission_screen_title).toString(),
message = textResource(R.string.permission_screen_desc),
title = stringResource(R.string.permission_scr_title).toString(),
message = textResource(R.string.permission_scr_desc),
vertical = LocalWindowSize.current.widthRange == Range.Compact
) {
OutlinedButton(
Expand Down Expand Up @@ -322,7 +322,7 @@ private fun NavigationBar(

// Timeline
NavItem(
label = { Label(text = textResource(R.string.photos)) },
label = { Label(text = textResource(R.string.timeline)) },
icon = { Icon(imageVector = Icons.Filled.PhotoLibrary, contentDescription = null) },
checked = domain == RouteTimeline.domain,
onClick = { facade.launchReviewFlow(); navController.toRoute(RouteTimeline) },
Expand Down Expand Up @@ -400,7 +400,8 @@ private fun NavigationBar(
if (colors.isLight) colors.background(2.dp) else Color.Gray.copy(0.24f),
Color.Transparent,
Color.Transparent,
if (colors.isLight) colors.background(2.dp) else Color.Gray.copy(0.24f),
Color.Transparent,
Color.Transparent,
)
),
BottomNavShape
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/zs/gallery/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class MainActivity : ComponentActivity(), SystemFacade, NavController.OnDestinat
Log.d(TAG, "preparing to show authentication dialog.")
// Build the BiometricPrompt
val prompt = BiometricPrompt.Builder(this).apply {
setTitle(getString(R.string.scr_lock_screen_title))
setTitle(getString(R.string.lock_scr_title))
if (subtitle != null) setSubtitle(subtitle)
if (desc != null) setDescription(desc)
// Set allowed authenticators for Android R and above
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/zs/gallery/common/Backdrop.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private val MistCachedPaint = Paint().apply {
* @return A Modifier with the applied mist effect.
*/
private fun Modifier.mist(containerColor: Color, accent: Color) =
this then drawBehind {
drawBehind {
// Determine if the container color is light based on its luminance.
val isLight = containerColor.luminance() >= 0.5f

Expand Down
9 changes: 5 additions & 4 deletions app/src/main/java/com/zs/gallery/files/Timeline.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import com.primex.core.findActivity
import com.primex.core.plus
import com.primex.material2.IconButton
import com.primex.material2.Label
import com.primex.material2.appbar.TopAppBarDefaults
import com.zs.domain.store.MediaFile
import com.zs.foundation.AppTheme
import com.zs.foundation.ListHeader
Expand Down Expand Up @@ -142,7 +143,7 @@ private fun FloatingTopAppBar(
)
),
content = {
androidx.compose.material.TopAppBar(
com.primex.material2.appbar.TopAppBar(
navigationIcon = {
val facade = LocalSystemFacade.current
IconButton(
Expand Down Expand Up @@ -185,8 +186,9 @@ private fun FloatingTopAppBar(
onClick = { facade.launch(Settings.TelegramIntent) }
)
},
backgroundColor = Color.Transparent,
elevation = 0.dp,
style = TopAppBarDefaults.topAppBarStyle(
containerColor = Color.Transparent
),
modifier = Modifier
.widthIn(max = 550.dp)
.windowInsetsPadding(insets)
Expand All @@ -206,7 +208,6 @@ private fun FloatingTopAppBar(
),
FloatingTopBarShape
)
.height(48.dp)
.dynamicBackdrop(
backdropProvider,
HazeStyle.Regular(colors.background),
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/zs/gallery/folders/Folder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ fun Folder(
// More Info
Label(
text = textResource(
id = R.string.folders_formatted_folder_name_sds, value.count,
id = R.string.folders_scr_folder_name_sds, value.count,
ctx.formattedFileSize(value.size.toLong())
),
style = AppTheme.typography.caption.copy(fontSize = 10.sp),
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/zs/gallery/impl/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ abstract class MainViewModel<T>(
// If the user performs the action, proceed with deletion
// Otherwise, return -3 to indicate user cancellation
val action = showToast(
message = R.string.msg_files_deletion_confirm,
message = R.string.msg_files_confirm_deletion,
action = R.string.delete,
icon = Icons.Outlined.NearbyError,
accent = Color.Rose,
Expand Down
7 changes: 2 additions & 5 deletions app/src/main/java/com/zs/gallery/lockscreen/LockScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,15 @@ package com.zs.gallery.lockscreen
import android.annotation.SuppressLint
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.ButtonDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.primex.core.findActivity
import com.primex.core.textResource
import com.primex.material2.Button
import com.primex.material2.OutlinedButton
import com.zs.foundation.AppTheme
import com.zs.foundation.LocalWindowSize
import com.zs.foundation.Range
Expand All @@ -54,8 +51,8 @@ fun LockScreen() {

com.zs.gallery.common.Placeholder(
iconResId = R.raw.lt_app_lock,
title = stringResource(R.string.scr_lock_screen_title),
message = textResource(R.string.src_lock_screen_desc),
title = stringResource(R.string.lock_scr_title),
message = textResource(R.string.lock_scr_desc),
vertical = LocalWindowSize.current.widthRange == Range.Compact,
) {
Button(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ object Settings {
val KEY_APP_LOCK_TIME_OUT =
intPreferenceKey("${PREFIX}_app_lock_time_out", -1)
val KEY_USE_ACCENT_IN_NAV_BAR =
booleanPreferenceKey("use_accent_in_nav_bar", true)
booleanPreferenceKey("use_accent_in_nav_bar", false)

val DefaultFontFamily get() = FontFamily.Default

Expand Down
59 changes: 36 additions & 23 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
<!DOCTYPE resources [<!ENTITY appname "Gallery"><!ENTITY author "Zakir Sheikh"><!ENTITY version_name "0.0.1-dev"> <!ENTITY beta "<sup><font color = '#ae1c27' size= '10'><b>Beta</b></font></sup>">]><!--The string resources should follow the above rules strictly-->

<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--Some common variables-->
<string name="app_name">&appname;</string>
<string name="app_name_real">&appname;</string>
<string name="permission_screen_title">Storage Permission</string>
<!--
Naming convention for string resources:
- The string can be styled following the rules of styling without CDATA, as the toolkit does not support CDATA.
- The string resources should be named as follows:
1. If the string is simple, like Delete, its name should be R.string.delete.
2. If the string contains complex text, the name should be in this format: screen_name_purpose_variables
(optional; if no variables, omit this). For example, timeline_scr_items_d
3. General message (snackbar) messages should be named as msg_add_to_playlist_error_s (optional).
The message can be styled as bold or experimental, like alpha superscript. The message
can have any length.
4. Snackbar messages that belong to a specific screen should be named as msg_screen_name_s
(optional). E.g., msg_preference_permission_s
5. The snackbar message should have this structure: Title\n bold + experimental + message.
The string resources should follow the above rules strictly
-->
<string name="app_name">Gallery</string>
<string name="permission_scr_title">Storage Permission</string>
<string name="allow">Allow</string>
<string name="permission_screen_desc"><b>&appname;</b> requires permission to access your
<string name="permission_scr_desc"><b>Gallery</b> requires permission to access your
device\'s storage to display images and videos.
\n<b>If permission is denied:</b>
<font color='grey'>
\n 1. You won\'t be able to view your images and videos within the app.
\n 2. You\'ll need to manually grant access in your device settings.
</font>
\n<b>On Android 14 or higher:</b>
<b>\n\nOn Android 14 or higher:</b>
<font color='grey'>
\n 1. Please select <b>Allow all</b> in the permission dialog for the app to function correctly.
</font>
Expand All @@ -23,7 +30,8 @@
<string name="folders">Folders</string>
<string name="loading">Loading</string>
<string name="oops_empty">Oops Empty!!</string>
<string name="folders_formatted_folder_name_sds">%1$d Files - %2$s</string>
<!--E.g., Facebook \n 306 Files - 24.42MB-->
<string name="folders_scr_folder_name_sds">%1$d Files - %2$s</string>
<string name="size">Size</string>
<string name="name">Name</string>
<string name="recent">Recent</string>
Expand Down Expand Up @@ -66,7 +74,7 @@
<string name="pref_secure_mode_summery">Secure Mode obscures app content in the app preview,
protecting user privacy when the app is not in active use.
</string>
<!--A string res that returns a new formatted string with x added at the end; like 1.2x-->
<!--returns a string with multiplied x e.g., 1.3x-->
<string name="times_factor_x_f">%1$sx</string>
<string name="last_modified">Last modified</string>
<string name="msg_error_sharing_files">Oops, something went wrong while sharing the files. Please try again.</string>
Expand All @@ -88,7 +96,7 @@
<string name="title">Title</string>
<string name="path">Path</string>
<string name="metadata">MetaData</string>
<string name="msg_files_deletion_confirm"><b>Delete</b>
<string name="msg_files_confirm_deletion"><b>Delete</b>
<font color='grey'>\nAre you sure you want to delete this? You won\'t be able to get it back
</font>
</string>
Expand All @@ -97,16 +105,21 @@
<string name="msg_new_update_downloaded">Update ready! Installation can proceed now.</string>
<string name="install">Install</string>
<string name="pref_app_version">App Version</string>
<string name="scr_lock_screen_title">Verify Your Identity</string>
<string name="scr_lock_screen_subtitle">Authenticate with Biometrics</string>
<string name="src_lock_screen_desc">Authenticate with your fingerprint or facial recognition to continue. This step is crucial for safeguarding your data.</string>
<string name="lock_scr_title">Verify Your Identity</string>
<string name="lock_scr_subtitle">Authenticate with Biometrics</string>
<string name="lock_scr_desc">Authenticate with your fingerprint or facial recognition
to continue. This step is crucial for safeguarding your data.
</string>
<string name="msg_enroll_biometric">Enable biometric authentication in settings.</string>
<string name="pref_app_lock">App Lock &beta;</string>
<string name="pref_app_lock_summery"><b>Unlock with biometrics</b>\nWhen enabled, you\'ll need to use the fingerprint, face or other unique identifiers to open &appname;.</string>
<string name="pref_app_lock">App Lock<sup>beta</sup></string>
<string name="pref_app_lock_summery"><b>Unlock with biometrics</b>\nWhen enabled, you\'ll need
to use the fingerprint, face or other unique identifiers to open Gallery.
</string>
<string name="msg_favourites_updated">Favorites updated!</string>
<string name="msg_media_player_promotion"><b>New Media Player App!</b>
<font color ='gray'>\n🎶 Check out our new <b>Media Player!</b> Enjoy your favorite tunes and videos effortlessly. Give it a try! 🎥</font>
<font color='gray'>\n🎶 Check out our new <b>Media Player!</b> Enjoy your favorite tunes
and videos effortlessly. Give it a try! 🎥
</font>
</string>
<string name="get">Get</string>

</resources>
2 changes: 0 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coil"
coil-svg = {module = "io.coil-kt.coil3:coil-svg", version.ref = "coil"}
avif-coder-coil = { module = "com.github.awxkee:avif-coder-coil", version = "2.0.8" }



[bundles]
compose = [
"androidx-activity-compose",
Expand Down

0 comments on commit 352c25c

Please sign in to comment.