Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ fun AppEntry(
contextContent = {
DropdownMenu(
expanded = dropdownExpanded, onDismissRequest = { dropdownExpanded = false }) {
val textLauncherNotSupportPinned: String =
stringResource(R.string.launcher_not_support_pinned)
DropdownMenuItem(
onClick = {
if (ShortcutManagerCompat.isRequestPinShortcutSupported(context)) {
Expand All @@ -269,7 +271,7 @@ fun AppEntry(
} else {
Toast.makeText(
context,
context.getString(R.string.launcher_not_support_pinned),
textLauncherNotSupportPinned,
Toast.LENGTH_LONG
).show()
}
Expand All @@ -280,21 +282,23 @@ fun AppEntry(
Text(stringResource(R.string.add_shortcut))
})
app.overlyingListType?.let {
val appRemovedFormat: String = stringResource(R.string.app_removed)
val textCouldntRemoveApp: String = stringResource(R.string.couldnt_remove_app)
DropdownMenuItem(
onClick = {
if (Datasource.removePackage(context, app.packageName, it)) {
dropdownExpanded = false

AndroidUtil.asyncToastMakeText(
context,
String.format(context.getString(R.string.app_removed), app.name),
String.format(appRemovedFormat, app.name),
Toast.LENGTH_SHORT
)
// TODO: refresh app list (+ there are other actions/code locations that need to trigger a list refresh)
} else {
Toast.makeText(
context,
context.getString(R.string.couldnt_remove_app),
textCouldntRemoveApp,
Toast.LENGTH_LONG
).show()
}
Expand Down Expand Up @@ -333,8 +337,6 @@ fun AppList(
onSelectedValueChangeAsWell: (App, Boolean) -> Unit = { _, _ -> },
sortByName: Boolean = false
) {
val context = LocalContext.current

Column(modifier = modifier) {
var text by rememberSaveable { mutableStateOf("") }
TextField( // TODO: https://developer.android.com/jetpack/compose/text#enter-modify-text
Expand All @@ -348,7 +350,7 @@ fun AppList(
onClick = { text = "" }) {
Icon(
imageVector = Icons.Default.Clear,
contentDescription = context.getString(R.string.clear_search)
contentDescription = stringResource(R.string.clear_search)
)
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalResources
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.core.graphics.drawable.toBitmap
Expand All @@ -25,7 +26,7 @@ import de.redno.disabledlauncher.ui.theme.DisabledLauncherTheme
@Preview(showBackground = true, showSystemUi = true)
@Composable
private fun SelectMultipleAppsPreview() {
val context = LocalContext.current
val resources = LocalResources.current

DisabledLauncherTheme {
SelectMultipleAppsScreen(
Expand All @@ -36,7 +37,10 @@ private fun SelectMultipleAppsPreview() {
packageName = "test.p1",
isEnabled = true,
isInstalled = true,
icon = context.getDrawable(R.drawable.ic_launcher_background)!!
icon = resources.getDrawable(
R.drawable.ic_launcher_background,
null
)!!
.toBitmap()
)
),
Expand Down Expand Up @@ -69,12 +73,13 @@ fun SelectMultipleAppsScreen(
)
},
floatingActionButton = {
val textNoAppsSelected: String = stringResource(R.string.no_apps_selected)
FloatingActionButton(onClick = {
Thread {
if (selectedAppList.isEmpty()) {
AndroidUtil.asyncToastMakeText(
context,
context.getString(R.string.no_apps_selected),
textNoAppsSelected,
Toast.LENGTH_SHORT
)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ private fun SettingsList(modifier: Modifier = Modifier) {
})
}

val textFailedAddingApps: String = stringResource(R.string.failed_adding_apps)
Box {
val addDirectAppsTitle = stringResource(R.string.add_direct_apps_title)
val addDirectAppsDialogOpen = remember { mutableStateOf(false) }
Expand Down Expand Up @@ -119,7 +120,7 @@ private fun SettingsList(modifier: Modifier = Modifier) {
) {
AndroidUtil.asyncToastMakeText(
context,
context.getString(R.string.failed_adding_apps),
textFailedAddingApps,
Toast.LENGTH_SHORT
)
}
Expand Down Expand Up @@ -157,7 +158,7 @@ private fun SettingsList(modifier: Modifier = Modifier) {
) {
AndroidUtil.asyncToastMakeText(
context,
context.getString(R.string.failed_adding_apps),
textFailedAddingApps,
Toast.LENGTH_SHORT
)
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ espressoCore = "3.7.0"
lifecycleRuntimeKtx = "2.10.0"
activityCompose = "1.12.3"
kotlin = "2.3.10"
composeBom = "2025.04.01"
composeBom = "2025.12.01"
navVersion = "2.9.7"
shizukuVersion = "13.1.0"
jacksonVersion = "2.19.4"
Expand Down