Merge branch 'master' into fix/dropdown-colors

This commit is contained in:
Ensar Sarajčić 2023-10-11 12:41:01 +02:00
commit 4e3b6b4084
5 changed files with 132 additions and 58 deletions

View file

@ -1,7 +1,19 @@
package com.simplemobiletools.commons.dialogs
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.sp
import com.simplemobiletools.commons.R
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.compose.alert_dialog.AlertDialogState
import com.simplemobiletools.commons.compose.alert_dialog.rememberAlertDialogState
import com.simplemobiletools.commons.compose.extensions.MyDevices
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
import com.simplemobiletools.commons.databinding.DialogOpenDeviceSettingsBinding
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
import com.simplemobiletools.commons.extensions.openDeviceSettings
@ -23,3 +35,54 @@ class OpenDeviceSettingsDialog(val activity: BaseSimpleActivity, message: String
}
}
}
@Composable
fun OpenDeviceSettingsAlertDialog(
alertDialogState: AlertDialogState,
modifier: Modifier = Modifier,
message: String
) {
val context = LocalContext.current
AlertDialog(
containerColor = dialogContainerColor,
modifier = modifier
.dialogBorder,
onDismissRequest = alertDialogState::hide,
shape = dialogShape,
tonalElevation = dialogElevation,
text = {
Text(
fontSize = 16.sp,
text = message,
color = dialogTextColor
)
},
dismissButton = {
TextButton(onClick = {
alertDialogState.hide()
}) {
Text(text = stringResource(id = R.string.close))
}
},
confirmButton = {
TextButton(onClick = {
context.openDeviceSettings()
alertDialogState.hide()
}) {
Text(text = stringResource(id = R.string.go_to_settings))
}
},
)
}
@Composable
@MyDevices
private fun OpenDeviceSettingsAlertDialogPreview() {
AppThemeSurface {
OpenDeviceSettingsAlertDialog(
alertDialogState = rememberAlertDialogState(),
message = "Test dialog"
)
}
}

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="ok">باشه</string>
<string name="ok">تایید</string>
<string name="cancel">لغو</string>
<string name="close">Close</string>
<string name="back">Back</string>
<string name="nothing">Nothing</string>
<string name="close">بستن</string>
<string name="back">بازگشت</string>
<string name="nothing">هیچ‌چیز</string>
<string name="later">بعدا</string>
<string name="save_as">ذخیره به عنوان</string>
<string name="file_saved">پرونده با موفقیت ذخیره شد</string>
@ -347,14 +347,14 @@
<string name="default_color">پیش‌گزیده</string>
<string name="change_color">تغییر رنگ</string>
<string name="theme">شِما</string>
<string name="changing_color_description">تغییر یک رنگ آن را به شِما سفارشی تعویض خواهد میکند</string>
<string name="changing_color_description">تغییر یک رنگ آن را به شِما سفارشی تعویض میکند</string>
<string name="save">ذخیره</string>
<string name="discard">دورانداختن</string>
<string name="undo_changes">برگرداندن تغییرات</string>
<string name="undo_changes_confirmation">آیا از برگرداندن تغییرات خود مطمئنید؟</string>
<string name="cannot_be_undone">This action cannot be undone.</string>
<string name="cannot_be_undone">این کار قابل برگشت نیست.</string>
<string name="save_before_closing">شما تغییرات ذخیره نشده دارید. قبل از خروج ذخیره شوند؟</string>
<string name="apply_to_all_apps">اعمال رنگ‌ها به همه برنامه‌های آسان</string>
<string name="apply_to_all_apps">اعمال رنگ‌ها به همه برنامه‌های ساده</string>
<string name="app_icon_color_warning">WARNING: Some launchers do not handle app icon customization properly. In case the icon will disappear, try launching the app via Google Play or some widget, if available.
Once launched, just set back the default orange icon #F57C00. You might have to reinstall the app in the worst case.</string>
<string name="share_colors_success">Colors updated successfully. A new Theme called \'Shared\' has been added, please use that for updating all app colors in the future.</string>
@ -367,15 +367,15 @@
<!-- Themes -->
<string name="light_theme">روشن</string>
<string name="dark_theme">تاریک</string>
<string name="auto_theme">Auto</string>
<string name="auto_light_dark_theme">Auto light / dark</string>
<string name="auto_theme">خودکار</string>
<string name="auto_light_dark_theme">روشن / تاریک خودکار</string>
<string name="solarized">آفتابی</string>
<string name="dark_red">قرمز تاریک</string>
<string name="white">سفید</string>
<string name="black_white">سیاه &amp; سفید</string>
<string name="black_white">سیاه و سفید</string>
<string name="custom">سفارشی</string>
<string name="shared">اشتراک گذاری شد</string>
<string name="system_default">System default</string>
<string name="system_default">پیش‌فرض سامانه</string>
<!-- What's new -->
<string name="whats_new">چه چیز جدید است</string>
<string name="whats_new_disclaimer">* only the bigger updates are listed here, there are always some smaller improvements too</string>
@ -385,7 +385,7 @@
<string name="rename">تغییر نام</string>
<string name="share">اشتراک گذاری</string>
<string name="share_via">اشتراک گذاری به وسیلهٔ</string>
<string name="resize">Resize</string>
<string name="resize">تغيير اندازه</string>
<string name="select_all">گزینش همه</string>
<string name="select_text">گزینش متن</string>
<string name="hide">مخفی</string>
@ -401,7 +401,7 @@
<string name="redo">انجام دوباره</string>
<string name="print">چاپ</string>
<string name="print_pro">چاپ (Pro)</string>
<string name="shortcut">Shortcut</string>
<string name="shortcut">میانبر</string>
<string name="create_shortcut">ساخت میانبر</string>
<string name="create_shortcut_pro">ساخت میانبر (Pro)</string>
<string name="add_number_to_contact">افزودن شماره به مخاطبین</string>
@ -413,9 +413,9 @@
<string name="move_to_bottom">جابه‌جایی به پایین</string>
<string name="pin_item">Pin item</string>
<string name="unpin_item">Unpin item</string>
<string name="send_sms">Send SMS</string>
<string name="send_email">Send email</string>
<string name="call">Call</string>
<string name="send_sms">ارسال پیامک</string>
<string name="send_email">ارسال ایمیل</string>
<string name="call">تماس</string>
<string name="contact_details">Contact details</string>
<string name="add_contact">Add contact</string>
<string name="wallpapers">Wallpapers</string>
@ -428,14 +428,14 @@
<string name="name">نام</string>
<string name="size">اندازه</string>
<string name="last_modified">اخرین اصلاح</string>
<string name="date_created">Date created</string>
<string name="date_created">تاریخ ایجاد</string>
<string name="date_taken">تاریخ گرفتن</string>
<string name="date_added">Date added</string>
<string name="date_added">تاریخ افزودن</string>
<string name="title">عنوان</string>
<string name="filename">نام پرونده</string>
<string name="extension">پسوند</string>
<string name="random">تصادفی</string>
<string name="sort_randomly">Sort randomly</string>
<string name="sort_randomly">ترتیب تصادفی</string>
<string name="ascending">Ascending</string>
<string name="descending">Descending</string>
<string name="use_for_this_folder">Use for this folder only</string>
@ -842,31 +842,31 @@
<string name="upgraded_from_free_notes">Hello,\n\nseems like you just upgraded from the free version. If you want to migrate your notes over, you have to do it manually by exporting them into a file in the free app version and importing here through the top menu. \n\nOnce you are satisfied with your setup in the Pro version, you can uninstall the old free one as you won\'t need it anymore.\n\nThanks!</string>
<!-- About -->
<string name="about">درباره</string>
<string name="website">Website</string>
<string name="website">وب‌سایت</string>
<string name="website_label">For the source codes visit</string>
<string name="email_label">Send your feedback or suggestions to</string>
<string name="upgrade_to_pro">Upgrade to Pro</string>
<string name="more_apps">More apps</string>
<string name="more_apps_from_us">More apps from us</string>
<string name="invite_friends">Invite friends</string>
<string name="email_label">پیشنهادات و بازخوردهایتان را بفرستید به</string>
<string name="upgrade_to_pro">ارتقا به Pro</string>
<string name="more_apps">سایر برنامه‌ها</string>
<string name="more_apps_from_us">برنامه‌های دیگر ما</string>
<string name="invite_friends">دعوت دوستان</string>
<string name="share_text">Hey, come check out %1$s at %2$s</string>
<string name="invite_via">Invite via</string>
<string name="invite_via">دعوت با</string>
<string name="rate_us">امتیاز به ما</string>
<string name="rate">امتیاز</string>
<string name="donate">اهدا</string>
<string name="follow_us">پیگیری ما</string>
<string name="copyright">v %1$s\nCopyright © Simple Mobile Tools %2$d</string>
<string name="support">Support</string>
<string name="help_us">Help us</string>
<string name="social">Social</string>
<string name="other">Other</string>
<string name="privacy_policy">Privacy policy</string>
<string name="version_placeholder">Version %s</string>
<string name="hello">Hello :)</string>
<string name="about_footer">Made with ❤️ in Slovakia</string>
<string name="support">حمایت</string>
<string name="help_us">کمک به ما</string>
<string name="social">شبکه‌های اجتماعی</string>
<string name="other">سایر</string>
<string name="privacy_policy">سیاست حفظ حریم خصوصی</string>
<string name="version_placeholder">نسخهٔ %s</string>
<string name="hello">سلام :)</string>
<string name="about_footer">ساخته‌شده با ❤️ در اسلواکی</string>
<string name="additional_info">اطلاعات اضافی</string>
<string name="app_version">نسخه برنامه: %s</string>
<string name="device_os">سیستم عامل دستگاه: %s</string>
<string name="app_version">نسخهٔ برنامه: %s</string>
<string name="device_os">سیستمعامل دستگاه: %s</string>
<string name="donate_please">
<![CDATA[
Hello,<br><br>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="ok">OK</string>
<string name="ok">Valider</string>
<string name="cancel">Annuler</string>
<string name="close">Fermer</string>
<string name="back">Retour</string>
@ -95,7 +95,7 @@
<!-- View types -->
<string name="change_view_type">Modifier le mode d\'affichage</string>
<string name="grid">Grille</string>
<string name="grid_pro">Grille (Pro)</string>
<string name="grid_pro">Grille (version \"Pro\")</string>
<string name="uneven_grid">Grille irrégulière</string>
<string name="list">Liste</string>
<string name="increase_column_count">Ajouter une colonne</string>
@ -124,7 +124,7 @@
<string name="block_numbers">Bloquer les numéros</string>
<string name="blocked_numbers">Numéros bloqués</string>
<string name="export_blocked_numbers">Exporter les numéros bloqués</string>
<string name="import_blocked_numbers">Importer les numéros bloqués</string>
<string name="import_blocked_numbers">Importer des numéros bloqués</string>
<string name="must_make_default_dialer">Vous devez définir cette application comme application de numérotation par défaut afin de pouvoir utiliser les numéros bloqués.</string>
<string name="set_as_default">Définir par défaut</string>
<string name="block_confirmation">Voulez-vous vraiment bloquer "%s" \?</string>
@ -150,11 +150,11 @@
<string name="search_in_placeholder">Rechercher dans %s</string>
<string name="type_2_characters">Saisissez au moins deux caractères pour lancer la recherche.</string>
<string name="show_search">Afficher une barre de recherche</string>
<string name="search_contacts">Rechercher des contacts</string>
<string name="search_favorites">Rechercher des favoris</string>
<string name="search_contacts">Rechercher parmi les contacts</string>
<string name="search_favorites">Rechercher parmi les favoris</string>
<string name="search_apps">Rechercher des applications</string>
<string name="search_events">Rechercher des évènements</string>
<string name="search_groups">Rechercher des groupes</string>
<string name="search_groups">Rechercher parmi les groupes</string>
<string name="search_history">Rechercher dans l\'historique</string>
<string name="search_calls">Rechercher des appels</string>
<string name="search_files">Rechercher des fichiers</string>
@ -169,7 +169,7 @@
<string name="search_recordings">Rechercher des enregistrements</string>
<!-- Filters -->
<string name="filter">Filtrer</string>
<string name="filter_pro">Filtrer (Pro)</string>
<string name="filter_pro">Filtrer (version \"Pro\")</string>
<string name="no_items_found">Aucun élément n\'a été trouvé.</string>
<string name="change_filter">Modifier le filtre</string>
<!-- Permissions -->
@ -408,10 +408,10 @@
<string name="undo">Annuler</string>
<string name="redo">Rétablir</string>
<string name="print">Imprimer</string>
<string name="print_pro">Imprimer (Pro)</string>
<string name="print_pro">Imprimer (version \"Pro\")</string>
<string name="shortcut">Raccourci</string>
<string name="create_shortcut">Créer un raccourci</string>
<string name="create_shortcut_pro">Créer un raccourci (Pro)</string>
<string name="create_shortcut_pro">Créer un raccourci (version \"Pro\")</string>
<string name="add_number_to_contact">Ajouter un numéro au contact</string>
<string name="view_contact_details">Afficher les détails du contact</string>
<string name="call_from_sim_1">Appeler depuis la carte SIM 1</string>
@ -500,7 +500,7 @@
<string name="protection_setup_successfully">Configuration du mot de passe réussie. Veuillez réinstaller l\'application en cas d\'oubli.</string>
<string name="fingerprint_setup_successfully">Configuration de la protection réussie. Veuillez réinstaller l\'application en cas de problèmes de réinitialisation.</string>
<string name="lock_folder">Verrouiller le dossier</string>
<string name="lock_folder_pro">Verrouiller le dossier (Pro)</string>
<string name="lock_folder_pro">Verrouiller le dossier (version \"Pro\")</string>
<string name="unlock_folder">Déverrouiller le dossier</string>
<string name="lock_folder_notice">Le verrouillage ne fonctionne que dans cette application. Cette protection ne remplace pas un véritable chiffrage système.</string>
<string name="enter_password">Saisir le mot de passe</string>
@ -729,7 +729,7 @@
<string name="empty_recycle_bin">Vider la corbeille</string>
<string name="force_portrait_mode">Forcer le mode portrait</string>
<string name="export_settings">Exporter les paramètres</string>
<string name="import_settings">Importer les paramètres</string>
<string name="import_settings">Importer des paramètres</string>
<string name="settings_exported_successfully">Exportation des paramètres réussie</string>
<string name="settings_imported_successfully">Importation des paramètres réussie</string>
<string name="start_name_with_surname">Positionner le prénom avant le nom de famille</string>
@ -876,11 +876,11 @@
<string name="saturday_short">Sam.</string>
<string name="sunday_short">Dim.</string>
<!-- Pro version -->
<string name="upgrade_to_pro_long">La version de votre application ne sera plus mise à jour. Veuillez passer à la version Pro pour recevoir de nouveaux correctifs et bénéficier d\'autres améliorations.</string>
<string name="upgrade_to_pro_long_click">La version de votre application ne sera plus mise à jour. Veuillez passer à la version Pro pour recevoir de nouveaux correctifs et bénéficier d\'autres améliorations en cliquant ici.</string>
<string name="upgrade_to_pro_long">La version de votre application ne sera plus mise à jour. Veuillez passer à la version \"Pro\" pour recevoir de nouveaux correctifs et bénéficier d\'autres améliorations.</string>
<string name="upgrade_to_pro_long_click">La version de votre application ne sera plus mise à jour. Veuillez passer à la version \"Pro\" pour recevoir de nouveaux correctifs et bénéficier d\'autres améliorations en cliquant ici.</string>
<string name="it_is_free">Elle est gratuite jusqu\'au : %s. Si vous la téléchargez avant cette date, vous pourrez l\'utiliser gratuitement à vie.</string>
<string name="more_info">Plus d\'informations</string>
<string name="upgrade">Passer à la version Pro</string>
<string name="upgrade">Mettre à jour</string>
<string name="upgrade_calendar">Vous devez migrer manuellement les évènements stockés localement en les exportant dans un fichier \".ics\", puis en les important. Vous trouverez les boutons d\'exportation/importation dans le menu de l\'écran principal.</string>
<string name="upgraded_from_free_gallery">Bonjour,
\n
@ -930,7 +930,7 @@
<string name="email_label">Envoyez vos commentaires ou suggestions à</string>
<string name="upgrade_to_pro">Passer à la version \"Pro\"</string>
<string name="more_apps">Plus d\'applications</string>
<string name="more_apps_from_us">Plus d\'applications</string>
<string name="more_apps_from_us">Plus d\'applications simples</string>
<string name="invite_friends">Inviter des amis</string>
<string name="share_text">Salut, viens voir %1$s sur %2$s</string>
<string name="invite_via">Inviter via</string>
@ -947,7 +947,7 @@
<string name="privacy_policy">Politique de confidentialité</string>
<string name="version_placeholder">Version %s</string>
<string name="hello">Bonjour :)</string>
<string name="about_footer">Codé avec ❤️ en Slovaquie</string>
<string name="about_footer">Codée avec ❤️ en Slovaquie</string>
<string name="additional_info">Informations supplémentaires</string>
<string name="app_version">Version de l\'application : %s</string>
<string name="device_os">Système d\'exploitation de l\'appareil : %s</string>

View file

@ -2,7 +2,7 @@
<resources>
<string name="ok">OK</string>
<string name="cancel">Prekliči</string>
<string name="close">Close</string>
<string name="close">Zapri</string>
<string name="back">Nazaj</string>
<string name="nothing">Nič</string>
<string name="later">Pozneje</string>
@ -100,7 +100,7 @@
<string name="increase_column_count">Povečaj število stolpcev</string>
<string name="reduce_column_count">Zmanjšaj število stolpcev</string>
<string name="column_count">Število stolpcev</string>
<string name="row_count">Row count</string>
<string name="row_count">Število vrstic</string>
<string name="portrait_column_count">Število pokončnih stolpcev</string>
<string name="landscape_column_count">Ležeče število stolpcev</string>
<string name="change_cover_image">Spremeni naslovno fotografijo</string>
@ -319,7 +319,7 @@
<string name="select_storage">Izberi shrambo</string>
<string name="storage">Shramba</string>
<string name="internal">Notranja shramba</string>
<string name="internal_storage">Internal Storage</string>
<string name="internal_storage">Notranja shramba</string>
<string name="sd_card">SD kartica</string>
<string name="root">Korenska mapa</string>
<string name="wrong_root_selected">Izbrali ste napačno mapo. Izbrati morate korensko mapo SD kartice</string>

View file

@ -54,6 +54,7 @@ class TestDialogActivity : ComponentActivity() {
ShowButton(getFeatureLockedAlertDialogState(), text = "Feature Locked")
ShowButton(getPurchaseThankYouAlertDialogState(), text = "Purchase thank you")
ShowButton(getLineColorPickerAlertDialogState(), text = "Line color picker")
ShowButton(getOpenDeviceSettingsAlertDialogState(), text = "Open device settings")
ShowButton(getColorPickerAlertDialogState(), text = "Color picker")
ShowButton(getCallConfirmationAlertDialogState(), text = "Call confirmation")
ShowButton(getChangeDateTimeFormatAlertDialogState(), text = "Change date time")
@ -176,6 +177,16 @@ class TestDialogActivity : ComponentActivity() {
}
}
@Composable
private fun getOpenDeviceSettingsAlertDialogState() = rememberAlertDialogState().apply {
DialogMember {
OpenDeviceSettingsAlertDialog(
alertDialogState = this,
message = "Test message"
)
}
}
@Composable
private fun getColorPickerAlertDialogState() = rememberAlertDialogState().apply {
DialogMember {