Skip to content

Commit

Permalink
Added per-app language support with Google-translated strings.xml
Browse files Browse the repository at this point in the history
Removed unused imports
Refactored code for adding and removing wallpapers and folders
  • Loading branch information
Anthonyy232 committed May 13, 2024
1 parent 8eb9cb2 commit df1bc64
Show file tree
Hide file tree
Showing 127 changed files with 15,600 additions and 62 deletions.
6 changes: 5 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
minSdk = 26
targetSdk = 34
versionCode = 9
versionName = "1.1.1"
versionName = "1.2.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down Expand Up @@ -50,6 +50,10 @@ android {
composeOptions {
kotlinCompilerExtensionVersion = "1.5.10"
}

androidResources {
generateLocaleConfig = true
}
}

androidComponents {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.anthonyla.paperize.feature.wallpaper.data.data_source

import androidx.room.TypeConverter
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken

/**
* Converters for Room database to convert list of strings to json string and vice versa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package com.anthonyla.paperize.feature.wallpaper.data.repository

import com.anthonyla.paperize.feature.wallpaper.data.data_source.SelectedAlbumDao
import com.anthonyla.paperize.feature.wallpaper.domain.model.Album
import com.anthonyla.paperize.feature.wallpaper.domain.model.AlbumWithWallpaperAndFolder
import com.anthonyla.paperize.feature.wallpaper.domain.model.Folder
import com.anthonyla.paperize.feature.wallpaper.domain.model.SelectedAlbum
import com.anthonyla.paperize.feature.wallpaper.domain.model.Wallpaper
import com.anthonyla.paperize.feature.wallpaper.domain.repository.SelectedAlbumRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.anthonyla.paperize.feature.wallpaper.presentation.add_album_screen.components.AddAlbumAnimatedFab
import com.anthonyla.paperize.feature.wallpaper.presentation.add_album_screen.components.AddAlbumFabMenuOptions
import com.anthonyla.paperize.feature.wallpaper.presentation.add_album_screen.components.AddAlbumSmallTopBar
import com.anthonyla.paperize.feature.wallpaper.presentation.album.components.FolderItem
import com.anthonyla.paperize.feature.wallpaper.presentation.album.components.WallpaperItem
Expand Down Expand Up @@ -137,7 +136,6 @@ fun AddAlbumScreen(
exit = scaleOut(tween(400, 50, FastOutSlowInEasing)),
) {
AddAlbumAnimatedFab(
menuOptions = AddAlbumFabMenuOptions(),
onImageClick = {
selectionMode = false
imagePickerLauncher.launch(arrayOf("image/*"))
Expand All @@ -152,7 +150,6 @@ fun AddAlbumScreen(
}
else {
AddAlbumAnimatedFab(
menuOptions = AddAlbumFabMenuOptions(),
onImageClick = {
selectionMode = false
imagePickerLauncher.launch(arrayOf("image/*"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Folder
import androidx.compose.material.icons.filled.PhotoLibrary
import androidx.compose.material.icons.filled.Remove
import androidx.compose.material3.CardColors
import androidx.compose.material3.ElevatedCard
Expand Down Expand Up @@ -49,7 +51,6 @@ import com.anthonyla.paperize.feature.wallpaper.presentation.library_screen.comp
*/
@Composable
fun AddAlbumAnimatedFab(
menuOptions: AddAlbumFabMenuOptions,
animate: Boolean,
onImageClick: () -> Unit,
onFolderClick: () -> Unit
Expand Down Expand Up @@ -108,17 +109,17 @@ fun AddAlbumAnimatedFab(
Surface(tonalElevation = 5.dp) {
Column(modifier = Modifier.height(menuHeight)) {
MenuRow(
text = menuOptions.imageOption.text,
icon = menuOptions.imageOption.icon,
text = stringResource(R.string.add_images_btn),
icon = Icons.Filled.PhotoLibrary,
horizontalExpansion = expandHorizontally,
onClick = {
expanded = false
onImageClick()
}
)
MenuRow(
text = menuOptions.folderOption.text,
icon = menuOptions.folderOption.icon,
text = stringResource(R.string.add_folder_btn),
icon = Icons.Filled.Folder,
horizontalExpansion = expandHorizontally,
onClick = {
expanded = false
Expand Down Expand Up @@ -174,17 +175,17 @@ fun AddAlbumAnimatedFab(
Surface(tonalElevation = 5.dp) {
Column(modifier = Modifier.height(if (expanded) menuHeightSize.first else menuHeightSize.second)) {
MenuRow(
text = menuOptions.imageOption.text,
icon = menuOptions.imageOption.icon,
text = stringResource(R.string.add_images_btn),
icon = Icons.Filled.PhotoLibrary,
horizontalExpansion = if (expanded) expandHorizontalSize.first else expandHorizontalSize.second,
onClick = {
expanded = false
onImageClick()
}
)
MenuRow(
text = menuOptions.folderOption.text,
icon = menuOptions.folderOption.icon,
text = stringResource(R.string.add_folder_btn),
icon = Icons.Filled.Folder,
horizontalExpansion = if (expanded) expandHorizontalSize.first else expandHorizontalSize.second,
onClick = {
expanded = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fun AddAlbumDialog(
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text(
text = "New Album",
text = stringResource(R.string.new_album),
modifier = Modifier.padding(20.dp),
fontSize = 25.sp
)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,11 @@ fun FolderItem(
.clip(RoundedCornerShape(roundedCornerShapeTransition))
.combinedClickable(
onClick = {
if (!selectionMode) { onFolderViewClick() }
else { onItemSelection() }
if (!selectionMode) {
onFolderViewClick()
} else {
onItemSelection()
}
},
onLongClick = {
if (!selectionMode) {
Expand Down Expand Up @@ -171,7 +174,7 @@ fun FolderItem(
)
}
Text(
text = folder.wallpapers.size.toString().plus(" wallpapers"),
text = folder.wallpapers.size.toString().plus(" " + stringResource(R.string.wallpapers)),
modifier = Modifier
.padding(horizontal = 24.dp)
.align(Alignment.Start),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.anthonyla.paperize.feature.wallpaper.domain.model.AlbumWithWallpaperAndFolder
import com.anthonyla.paperize.feature.wallpaper.presentation.add_album_screen.components.AddAlbumAnimatedFab
import com.anthonyla.paperize.feature.wallpaper.presentation.add_album_screen.components.AddAlbumFabMenuOptions
import com.anthonyla.paperize.feature.wallpaper.presentation.album.components.FolderItem
import com.anthonyla.paperize.feature.wallpaper.presentation.album.components.WallpaperItem
import com.anthonyla.paperize.feature.wallpaper.presentation.album_view_screen.components.AlbumViewTopBar
Expand Down Expand Up @@ -129,7 +128,6 @@ fun AlbumViewScreen(
exit = scaleOut(tween(400, 50, FastOutSlowInEasing)),
) {
AddAlbumAnimatedFab(
menuOptions = AddAlbumFabMenuOptions(),
onImageClick = {
selectionMode = false
imagePickerLauncher.launch(arrayOf("image/*"))
Expand All @@ -144,7 +142,6 @@ fun AlbumViewScreen(
}
else {
AddAlbumAnimatedFab(
menuOptions = AddAlbumFabMenuOptions(),
onImageClick = {
selectionMode = false
imagePickerLauncher.launch(arrayOf("image/*"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
package com.anthonyla.paperize.feature.wallpaper.presentation.licenses_screen.components

import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.State
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,17 @@ fun NotificationScreen(
content = { it
Column (modifier = Modifier.padding(32.dp)) {
Spacer(modifier = Modifier.height(120.dp))
Text(text = "Notifications", style = MaterialTheme.typography.headlineLarge)
Text(text = stringResource(id = R.string.notifications), style = MaterialTheme.typography.headlineLarge)
Spacer(modifier = Modifier.height(16.dp))
LottieAnimation(
composition = composition,
progress = { progress },
modifier = Modifier
.fillMaxHeight(0.5f)
.semantics { contentDescription = context.getString(R.string.notification_bell_animation) },
.semantics {
contentDescription =
context.getString(R.string.notification_bell_animation)
},
safeMode = true,
enableMergePaths = true
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.ArrowCircleRight
import androidx.compose.material.icons.outlined.Email
import androidx.compose.material.icons.outlined.PrivacyTip
import androidx.compose.material.icons.outlined.SubdirectoryArrowRight
import androidx.compose.material3.Icon
import androidx.compose.material3.ListItem
import androidx.compose.material3.MaterialTheme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ fun PaperizeListItem(onGitHubClick: () -> Unit, onPlaystoreClick: () -> Unit, on
Icon(
imageVector = ImageVector.vectorResource(id = R.drawable.app_icon_foreground),
contentDescription = stringResource(id = R.string.app_name),
modifier = Modifier.size(160.dp).scale(1.5f),
modifier = Modifier
.size(160.dp)
.scale(1.5f),
tint = MaterialTheme.colorScheme.primary,
)
Text(
Expand All @@ -63,7 +65,7 @@ fun PaperizeListItem(onGitHubClick: () -> Unit, onPlaystoreClick: () -> Unit, on
fontSize = MaterialTheme.typography.titleLarge.fontSize
)
Text(
text = "Version: 1.1.1",
text = stringResource(R.string.version) + " " + "1.2.0",
style = MaterialTheme.typography.bodySmall,
fontSize = MaterialTheme.typography.bodyMedium.fontSize
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.anthonyla.paperize.R
import com.anthonyla.paperize.data.Contact
import com.anthonyla.paperize.feature.wallpaper.presentation.settings_screen.SettingsState
import kotlinx.coroutines.flow.StateFlow
Expand Down Expand Up @@ -90,7 +92,7 @@ fun SettingsScrollableSettings(

Spacer(modifier = Modifier.height(16.dp))

ListSectionTitle("Appearance")
ListSectionTitle(stringResource(R.string.appearance))
Spacer(modifier = Modifier.height(16.dp))
DarkModeListItem(
darkMode = state.value.darkMode,
Expand All @@ -109,7 +111,7 @@ fun SettingsScrollableSettings(
)

Spacer(modifier = Modifier.height(16.dp))
ListSectionTitle("About")
ListSectionTitle(stringResource(R.string.about))
Spacer(modifier = Modifier.height(16.dp))
PrivacyPolicyListItem (onPrivacyPolicyClick = onPrivacyClick)
Spacer(modifier = Modifier.height(16.dp))
Expand All @@ -127,8 +129,8 @@ fun SettingsScrollableSettings(
coroutineScope.launch {
snackbarHostState.currentSnackbarData?.dismiss()
snackbarHostState.showSnackbar(
message = "Coming soon",
actionLabel = "Dismiss",
message = context.getString(R.string.coming_soon),
actionLabel = context.getString(R.string.dismiss),
duration = SnackbarDuration.Short
)
}
Expand All @@ -137,8 +139,8 @@ fun SettingsScrollableSettings(
coroutineScope.launch {
snackbarHostState.currentSnackbarData?.dismiss()
snackbarHostState.showSnackbar(
message = "Coming soon",
actionLabel = "Dismiss",
message = context.getString(R.string.coming_soon),
actionLabel = context.getString(R.string.dismiss),
duration = SnackbarDuration.Short
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen

import com.anthonyla.paperize.feature.wallpaper.domain.model.AlbumWithWallpaperAndFolder
import com.anthonyla.paperize.feature.wallpaper.domain.model.SelectedAlbum
import com.anthonyla.paperize.feature.wallpaper.domain.model.Wallpaper

sealed class WallpaperEvent {
data class UpdateSelectedAlbum(val selectedAlbum: SelectedAlbum): WallpaperEvent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.QueuePlayNext
import androidx.compose.material.icons.outlined.RemoveFromQueue
import androidx.compose.material3.Card
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.Intent
import android.util.Log
import com.anthonyla.paperize.core.SettingsConstants
import com.anthonyla.paperize.data.settings.SettingsDataStore
import com.anthonyla.paperize.feature.wallpaper.presentation.settings_screen.SettingsViewModel
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.runBlocking
import javax.inject.Inject
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/resources.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
unqualifiedResLocale=en-US
Loading

0 comments on commit df1bc64

Please sign in to comment.