diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ArchivedConversationsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ArchivedConversationsActivity.kt index f0bd876f..4ac2acfd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ArchivedConversationsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ArchivedConversationsActivity.kt @@ -94,7 +94,13 @@ class ArchivedConversationsActivity : SimpleActivity() { } private fun removeAll() { - ConfirmationDialog(this, "", R.string.empty_archive_confirmation, R.string.yes, R.string.no) { + ConfirmationDialog( + activity = this, + message = "", + messageId = R.string.empty_archive_confirmation, + positive = com.simplemobiletools.commons.R.string.yes, + negative = com.simplemobiletools.commons.R.string.no + ) { removeAllArchivedConversations { loadArchivedConversations() } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ConversationDetailsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ConversationDetailsActivity.kt index 561c7ceb..e53c625a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ConversationDetailsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ConversationDetailsActivity.kt @@ -6,7 +6,6 @@ import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.NavigationIcon import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.models.SimpleContact -import com.simplemobiletools.smsmessenger.R import com.simplemobiletools.smsmessenger.adapters.ContactsAdapter import com.simplemobiletools.smsmessenger.databinding.ActivityConversationDetailsBinding import com.simplemobiletools.smsmessenger.dialogs.RenameConversationDialog @@ -63,7 +62,7 @@ class ConversationDetailsActivity : SimpleActivity() { private fun setupTextViews() { binding.conversationName.apply { - ResourcesCompat.getDrawable(resources, R.drawable.ic_edit_vector, theme)?.apply { + ResourcesCompat.getDrawable(resources, com.simplemobiletools.commons.R.drawable.ic_edit_vector, theme)?.apply { applyColorFilter(getProperTextColor()) setCompoundDrawablesWithIntrinsicBounds(null, null, this, null) } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt index cc41a769..398c40c9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt @@ -106,7 +106,7 @@ class MainActivity : SimpleActivity() { binding.conversationsProgressBar.trackColor = properPrimaryColor.adjustAlpha(LOWER_ALPHA) checkShortcut() (binding.conversationsFab.layoutParams as? CoordinatorLayout.LayoutParams)?.bottomMargin = - navigationBarHeight + resources.getDimension(R.dimen.activity_margin).toInt() + navigationBarHeight + resources.getDimension(com.simplemobiletools.commons.R.dimen.activity_margin).toInt() } override fun onPause() { @@ -222,7 +222,7 @@ class MainActivity : SimpleActivity() { startActivityForResult(intent, MAKE_DEFAULT_APP_REQUEST) } } else { - toast(R.string.unknown_error_occurred) + toast(com.simplemobiletools.commons.R.string.unknown_error_occurred) finish() } } else { @@ -247,7 +247,7 @@ class MainActivity : SimpleActivity() { if (!granted) { PermissionRequiredDialog( activity = this, - textId = R.string.allow_notifications_incoming_messages, + textId = com.simplemobiletools.commons.R.string.allow_notifications_incoming_messages, positiveActionCallback = { openNotificationSettings() }) } } @@ -480,8 +480,8 @@ class MainActivity : SimpleActivity() { @SuppressLint("NewApi") private fun getCreateNewContactShortcut(appIconColor: Int): ShortcutInfo { val newEvent = getString(R.string.new_conversation) - val drawable = resources.getDrawable(R.drawable.shortcut_plus) - (drawable as LayerDrawable).findDrawableByLayerId(R.id.shortcut_plus_background).applyColorFilter(appIconColor) + val drawable = resources.getDrawable(com.simplemobiletools.commons.R.drawable.shortcut_plus) + (drawable as LayerDrawable).findDrawableByLayerId(com.simplemobiletools.commons.R.id.shortcut_plus_background).applyColorFilter(appIconColor) val bmp = drawable.convertToBitmap() val intent = Intent(this, NewConversationActivity::class.java) @@ -580,12 +580,12 @@ class MainActivity : SimpleActivity() { val faqItems = arrayListOf( FAQItem(R.string.faq_2_title, R.string.faq_2_text), FAQItem(R.string.faq_3_title, R.string.faq_3_text), - FAQItem(R.string.faq_9_title_commons, R.string.faq_9_text_commons) + FAQItem(com.simplemobiletools.commons.R.string.faq_9_title_commons, com.simplemobiletools.commons.R.string.faq_9_text_commons) ) if (!resources.getBoolean(R.bool.hide_google_relations)) { - faqItems.add(FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons)) - faqItems.add(FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons)) + faqItems.add(FAQItem(com.simplemobiletools.commons.R.string.faq_2_title_commons, com.simplemobiletools.commons.R.string.faq_2_text_commons)) + faqItems.add(FAQItem(com.simplemobiletools.commons.R.string.faq_6_title_commons, com.simplemobiletools.commons.R.string.faq_6_text_commons)) } startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewConversationActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewConversationActivity.kt index 78c6e0a9..18910ae8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewConversationActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewConversationActivity.kt @@ -145,7 +145,12 @@ class NewConversationActivity : SimpleActivity() { binding.noContactsPlaceholder2.beVisibleIf(!hasContacts && !hasPermission(PERMISSION_READ_CONTACTS)) if (!hasContacts) { - val placeholderText = if (hasPermission(PERMISSION_READ_CONTACTS)) R.string.no_contacts_found else R.string.no_access_to_contacts + val placeholderText = if (hasPermission(PERMISSION_READ_CONTACTS)) { + com.simplemobiletools.commons.R.string.no_contacts_found + } else { + com.simplemobiletools.commons.R.string.no_access_to_contacts + } + binding.noContactsPlaceholder.text = getString(placeholderText) } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/RecycleBinConversationsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/RecycleBinConversationsActivity.kt index 0b6e5208..7ae7e34b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/RecycleBinConversationsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/RecycleBinConversationsActivity.kt @@ -94,7 +94,13 @@ class RecycleBinConversationsActivity : SimpleActivity() { } private fun removeAll() { - ConfirmationDialog(this, "", R.string.empty_recycle_bin_messages_confirmation, R.string.yes, R.string.no) { + ConfirmationDialog( + activity = this, + message = "", + messageId = R.string.empty_recycle_bin_messages_confirmation, + positive = com.simplemobiletools.commons.R.string.yes, + negative = com.simplemobiletools.commons.R.string.no + ) { ensureBackgroundThread { emptyMessagesRecycleBin() loadRecycleBinConversations() diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt index 371de74f..4a48f19b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SettingsActivity.kt @@ -99,7 +99,7 @@ class SettingsActivity : SimpleActivity() { private val saveDocument = registerForActivityResult(ActivityResultContracts.CreateDocument(messagesFileType)) { uri -> if (uri != null) { - toast(R.string.exporting) + toast(com.simplemobiletools.commons.R.string.exporting) exportMessages(uri) } } @@ -123,7 +123,7 @@ class SettingsActivity : SimpleActivity() { try { MessagesReader(this).getMessagesToExport(config.exportSms, config.exportMms) { messagesToExport -> if (messagesToExport.isEmpty()) { - toast(R.string.no_entries_for_exporting) + toast(com.simplemobiletools.commons.R.string.no_entries_for_exporting) return@getMessagesToExport } val json = Json { encodeDefaults = true } @@ -133,7 +133,7 @@ class SettingsActivity : SimpleActivity() { outputStream.use { it.write(jsonString.toByteArray()) } - toast(R.string.exporting_successful) + toast(com.simplemobiletools.commons.R.string.exporting_successful) } } catch (e: Exception) { showErrorToast(e) @@ -188,7 +188,7 @@ class SettingsActivity : SimpleActivity() { // support for device-wise blocking came on Android 7, rely only on that @TargetApi(Build.VERSION_CODES.N) private fun setupManageBlockedNumbers() = binding.apply { - settingsManageBlockedNumbers.text = addLockedLabelIfNeeded(R.string.manage_blocked_numbers) + settingsManageBlockedNumbers.text = addLockedLabelIfNeeded(com.simplemobiletools.commons.R.string.manage_blocked_numbers) settingsManageBlockedNumbersHolder.beVisibleIf(isNougatPlus()) settingsManageBlockedNumbersHolder.setOnClickListener { @@ -228,10 +228,10 @@ class SettingsActivity : SimpleActivity() { settingsFontSize.text = getFontSizeText() settingsFontSizeHolder.setOnClickListener { val items = arrayListOf( - RadioItem(FONT_SIZE_SMALL, getString(R.string.small)), - RadioItem(FONT_SIZE_MEDIUM, getString(R.string.medium)), - RadioItem(FONT_SIZE_LARGE, getString(R.string.large)), - RadioItem(FONT_SIZE_EXTRA_LARGE, getString(R.string.extra_large)) + RadioItem(FONT_SIZE_SMALL, getString(com.simplemobiletools.commons.R.string.small)), + RadioItem(FONT_SIZE_MEDIUM, getString(com.simplemobiletools.commons.R.string.medium)), + RadioItem(FONT_SIZE_LARGE, getString(com.simplemobiletools.commons.R.string.large)), + RadioItem(FONT_SIZE_EXTRA_LARGE, getString(com.simplemobiletools.commons.R.string.extra_large)) ) RadioGroupDialog(this@SettingsActivity, items, config.fontSize) { @@ -295,7 +295,7 @@ class SettingsActivity : SimpleActivity() { val items = arrayListOf( RadioItem(LOCK_SCREEN_SENDER_MESSAGE, getString(R.string.sender_and_message)), RadioItem(LOCK_SCREEN_SENDER, getString(R.string.sender_only)), - RadioItem(LOCK_SCREEN_NOTHING, getString(R.string.nothing)), + RadioItem(LOCK_SCREEN_NOTHING, getString(com.simplemobiletools.commons.R.string.nothing)), ) RadioGroupDialog(this@SettingsActivity, items, config.lockScreenVisibilitySetting) { @@ -309,7 +309,7 @@ class SettingsActivity : SimpleActivity() { when (config.lockScreenVisibilitySetting) { LOCK_SCREEN_SENDER_MESSAGE -> R.string.sender_and_message LOCK_SCREEN_SENDER -> R.string.sender_only - else -> R.string.nothing + else -> com.simplemobiletools.commons.R.string.nothing } ) @@ -359,9 +359,15 @@ class SettingsActivity : SimpleActivity() { settingsEmptyRecycleBinHolder.setOnClickListener { if (recycleBinMessages == 0) { - toast(R.string.recycle_bin_empty) + toast(com.simplemobiletools.commons.R.string.recycle_bin_empty) } else { - ConfirmationDialog(this@SettingsActivity, "", R.string.empty_recycle_bin_messages_confirmation, R.string.yes, R.string.no) { + ConfirmationDialog( + activity = this@SettingsActivity, + message = "", + messageId = R.string.empty_recycle_bin_messages_confirmation, + positive = com.simplemobiletools.commons.R.string.yes, + negative = com.simplemobiletools.commons.R.string.no + ) { ensureBackgroundThread { emptyMessagesRecycleBin() } @@ -386,9 +392,13 @@ class SettingsActivity : SimpleActivity() { config.appProtectionType = type if (config.isAppPasswordProtectionOn) { - val confirmationTextId = if (config.appProtectionType == PROTECTION_FINGERPRINT) - R.string.fingerprint_setup_successfully else R.string.protection_setup_successfully - ConfirmationDialog(this@SettingsActivity, "", confirmationTextId, R.string.ok, 0) { } + val confirmationTextId = if (config.appProtectionType == PROTECTION_FINGERPRINT) { + com.simplemobiletools.commons.R.string.fingerprint_setup_successfully + } else { + com.simplemobiletools.commons.R.string.protection_setup_successfully + } + + ConfirmationDialog(this@SettingsActivity, "", confirmationTextId, com.simplemobiletools.commons.R.string.ok, 0) { } } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt index d6f78b4d..4f3a90b0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt @@ -60,7 +60,6 @@ import com.simplemobiletools.smsmessenger.adapters.AutoCompleteTextViewAdapter import com.simplemobiletools.smsmessenger.adapters.ThreadAdapter import com.simplemobiletools.smsmessenger.databinding.ActivityThreadBinding import com.simplemobiletools.smsmessenger.databinding.ItemSelectedContactBinding -import com.simplemobiletools.smsmessenger.databinding.LayoutThreadSendMessageHolderBinding import com.simplemobiletools.smsmessenger.dialogs.InvalidNumberDialog import com.simplemobiletools.smsmessenger.dialogs.RenameConversationDialog import com.simplemobiletools.smsmessenger.dialogs.ScheduleMessageDialog @@ -132,7 +131,7 @@ class ThreadActivity : SimpleActivity() { val extras = intent.extras if (extras == null) { - toast(R.string.unknown_error_occurred) + toast(com.simplemobiletools.commons.R.string.unknown_error_occurred) finish() return } @@ -256,7 +255,7 @@ class ThreadActivity : SimpleActivity() { findItem(R.id.unarchive).isVisible = threadItems.isNotEmpty() && conversation?.isArchived == true && !isRecycleBin findItem(R.id.rename_conversation).isVisible = participants.size > 1 && conversation != null && !isRecycleBin findItem(R.id.conversation_details).isVisible = conversation != null && !isRecycleBin - findItem(R.id.block_number).title = addLockedLabelIfNeeded(R.string.block_number) + findItem(R.id.block_number).title = addLockedLabelIfNeeded(com.simplemobiletools.commons.R.string.block_number) findItem(R.id.block_number).isVisible = isNougatPlus() && !isRecycleBin findItem(R.id.dial_number).isVisible = participants.size == 1 && !isSpecialNumber() && !isRecycleBin findItem(R.id.manage_people).isVisible = !isSpecialNumber() && !isRecycleBin @@ -400,7 +399,7 @@ class ThreadActivity : SimpleActivity() { val name = intent.getStringExtra(THREAD_TITLE) ?: "" val number = intent.getStringExtra(THREAD_NUMBER) if (number == null) { - toast(R.string.unknown_error_occurred) + toast(com.simplemobiletools.commons.R.string.unknown_error_occurred) finish() return@ensureBackgroundThread } @@ -760,7 +759,7 @@ class ThreadActivity : SimpleActivity() { } else { PermissionRequiredDialog( activity = this, - textId = R.string.allow_alarm_scheduled_messages, + textId = com.simplemobiletools.commons.R.string.allow_alarm_scheduled_messages, positiveActionCallback = { openRequestExactAlarmSettings(BuildConfig.APPLICATION_ID) }, @@ -836,7 +835,7 @@ class ThreadActivity : SimpleActivity() { ) } if (isOreoPlus()) { - tooltipText = getString(R.string.more_info) + tooltipText = getString(com.simplemobiletools.commons.R.string.more_info) } } } @@ -935,7 +934,7 @@ class ThreadActivity : SimpleActivity() { private fun blockNumber() { val numbers = participants.getAddresses() val numbersString = TextUtils.join(", ", numbers) - val question = String.format(resources.getString(R.string.block_confirmation), numbersString) + val question = String.format(resources.getString(com.simplemobiletools.commons.R.string.block_confirmation), numbersString) ConfirmationDialog(this, question) { ensureBackgroundThread { @@ -1152,7 +1151,7 @@ class ThreadActivity : SimpleActivity() { return items } - private fun launchActivityForResult(intent: Intent, requestCode: Int, @StringRes error: Int = R.string.no_app_found) { + private fun launchActivityForResult(intent: Intent, requestCode: Int, @StringRes error: Int = com.simplemobiletools.commons.R.string.no_app_found) { hideKeyboard() try { startActivityForResult(intent, requestCode) @@ -1225,11 +1224,11 @@ class ThreadActivity : SimpleActivity() { addAttachment(vCardUri) } } else { - toast(R.string.unknown_error_occurred) + toast(com.simplemobiletools.commons.R.string.unknown_error_occurred) } } } else { - toast(R.string.unknown_error_occurred) + toast(com.simplemobiletools.commons.R.string.unknown_error_occurred) } } } @@ -1250,7 +1249,7 @@ class ThreadActivity : SimpleActivity() { val mimeType = contentResolver.getType(uri) if (mimeType == null) { - toast(R.string.unknown_error_occurred) + toast(com.simplemobiletools.commons.R.string.unknown_error_occurred) return } val isImage = mimeType.isImageMimeType() @@ -1301,7 +1300,7 @@ class ThreadActivity : SimpleActivity() { outputStream = contentResolver.openOutputStream(Uri.parse(resultData.dataString!!), "rwt") inputStream!!.copyTo(outputStream!!) outputStream.flush() - toast(R.string.file_saved) + toast(com.simplemobiletools.commons.R.string.file_saved) } catch (e: Exception) { showErrorToast(e) } finally { @@ -1330,7 +1329,7 @@ class ThreadActivity : SimpleActivity() { private fun sendMessage() { var text = binding.messageHolder.threadTypeMessage.value if (text.isEmpty() && getAttachmentSelections().isEmpty()) { - showErrorToast(getString(R.string.unknown_error_occurred)) + showErrorToast(getString(com.simplemobiletools.commons.R.string.unknown_error_occurred)) return } scrollToBottom() @@ -1378,7 +1377,7 @@ class ThreadActivity : SimpleActivity() { } } } catch (e: Exception) { - showErrorToast(e.localizedMessage ?: getString(R.string.unknown_error_occurred)) + showErrorToast(e.localizedMessage ?: getString(com.simplemobiletools.commons.R.string.unknown_error_occurred)) } } @@ -1402,7 +1401,7 @@ class ThreadActivity : SimpleActivity() { } catch (e: Exception) { showErrorToast(e) } catch (e: Error) { - showErrorToast(e.localizedMessage ?: getString(R.string.unknown_error_occurred)) + showErrorToast(e.localizedMessage ?: getString(com.simplemobiletools.commons.R.string.unknown_error_occurred)) } } @@ -1440,9 +1439,9 @@ class ThreadActivity : SimpleActivity() { newLinearLayout.orientation = LinearLayout.HORIZONTAL val sideMargin = (binding.selectedContacts.layoutParams as RelativeLayout.LayoutParams).leftMargin - val mediumMargin = resources.getDimension(R.dimen.medium_margin).toInt() + val mediumMargin = resources.getDimension(com.simplemobiletools.commons.R.dimen.medium_margin).toInt() val parentWidth = realScreenSize.x - sideMargin * 2 - val firstRowWidth = parentWidth - resources.getDimension(R.dimen.normal_icon_size).toInt() + sideMargin / 2 + val firstRowWidth = parentWidth - resources.getDimension(com.simplemobiletools.commons.R.dimen.normal_icon_size).toInt() + sideMargin / 2 var widthSoFar = 0 var isFirstRow = true @@ -1528,7 +1527,7 @@ class ThreadActivity : SimpleActivity() { type = mimeType addCategory(Intent.CATEGORY_OPENABLE) putExtra(Intent.EXTRA_TITLE, path.split("/").last()) - launchActivityForResult(this, PICK_SAVE_FILE_INTENT, error = R.string.system_service_disabled) + launchActivityForResult(this, PICK_SAVE_FILE_INTENT, error = com.simplemobiletools.commons.R.string.system_service_disabled) } } @@ -1596,7 +1595,7 @@ class ThreadActivity : SimpleActivity() { val items = arrayListOf( RadioItem(TYPE_EDIT, getString(R.string.update_message)), RadioItem(TYPE_SEND, getString(R.string.send_now)), - RadioItem(TYPE_DELETE, getString(R.string.delete)) + RadioItem(TYPE_DELETE, getString(com.simplemobiletools.commons.R.string.delete)) ) RadioGroupDialog(activity = this, items = items, titleId = R.string.scheduled_message) { any -> when (any as Int) { @@ -1732,14 +1731,14 @@ class ThreadActivity : SimpleActivity() { private fun setupAttachmentPickerView() = binding.messageHolder.attachmentPicker.apply { val buttonColors = arrayOf( - R.color.md_red_500, - R.color.md_brown_500, - R.color.md_pink_500, - R.color.md_purple_500, - R.color.md_teal_500, - R.color.md_green_500, - R.color.md_indigo_500, - R.color.md_blue_500 + com.simplemobiletools.commons.R.color.md_red_500, + com.simplemobiletools.commons.R.color.md_brown_500, + com.simplemobiletools.commons.R.color.md_pink_500, + com.simplemobiletools.commons.R.color.md_purple_500, + com.simplemobiletools.commons.R.color.md_teal_500, + com.simplemobiletools.commons.R.color.md_green_500, + com.simplemobiletools.commons.R.color.md_indigo_500, + com.simplemobiletools.commons.R.color.md_blue_500 ).map { ResourcesCompat.getColor(resources, it, theme) } arrayOf( choosePhotoIcon, @@ -1868,7 +1867,7 @@ class ThreadActivity : SimpleActivity() { } private fun getBottomBarColor() = if (baseConfig.isUsingSystemTheme) { - resources.getColor(R.color.you_bottom_bar_color) + resources.getColor(com.simplemobiletools.commons.R.color.you_bottom_bar_color) } else { getBottomNavigationBackgroundColor() } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ArchivedConversationsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ArchivedConversationsAdapter.kt index 1fcccf05..cef1bf56 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ArchivedConversationsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ArchivedConversationsAdapter.kt @@ -35,7 +35,7 @@ class ArchivedConversationsAdapter( val itemsCnt = selectedKeys.size val items = resources.getQuantityString(R.plurals.delete_conversations, itemsCnt, itemsCnt) - val baseString = R.string.deletion_confirmation + val baseString = com.simplemobiletools.commons.R.string.deletion_confirmation val question = String.format(resources.getString(baseString), items) ConfirmationDialog(activity, question) { diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/AttachmentsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/AttachmentsAdapter.kt index 28603e50..04521a80 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/AttachmentsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/AttachmentsAdapter.kt @@ -164,7 +164,7 @@ class AttachmentsAdapter( } private fun loadMediaPreview(binding: ItemAttachmentMediaPreviewBinding, attachment: AttachmentSelection) { - val roundedCornersRadius = resources.getDimension(R.dimen.activity_margin).toInt() + val roundedCornersRadius = resources.getDimension(com.simplemobiletools.commons.R.dimen.activity_margin).toInt() val size = resources.getDimension(R.dimen.attachment_preview_size).toInt() val options = RequestOptions() @@ -179,7 +179,7 @@ class AttachmentsAdapter( .listener(object : RequestListener { override fun onLoadFailed(e: GlideException?, model: Any?, target: Target?, isFirstResource: Boolean): Boolean { removeAttachment(attachment) - activity.toast(R.string.unknown_error_occurred) + activity.toast(com.simplemobiletools.commons.R.string.unknown_error_occurred) return false } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ConversationsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ConversationsAdapter.kt index 79abd34a..75129ea3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ConversationsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ConversationsAdapter.kt @@ -30,7 +30,7 @@ class ConversationsAdapter( val isGroupConversation = selectedConversation.isGroupConversation menu.apply { - findItem(R.id.cab_block_number).title = activity.addLockedLabelIfNeeded(R.string.block_number) + findItem(R.id.cab_block_number).title = activity.addLockedLabelIfNeeded(com.simplemobiletools.commons.R.string.block_number) findItem(R.id.cab_block_number).isVisible = isNougatPlus() findItem(R.id.cab_add_number_to_contact).isVisible = isSingleSelection && !isGroupConversation findItem(R.id.cab_dial_number).isVisible = isSingleSelection && !isGroupConversation && !isShortCodeWithLetters(selectedConversation.phoneNumber) @@ -74,7 +74,7 @@ class ConversationsAdapter( private fun askConfirmBlock() { val numbers = getSelectedItems().distinctBy { it.phoneNumber }.map { it.phoneNumber } val numbersString = TextUtils.join(", ", numbers) - val question = String.format(resources.getString(R.string.block_confirmation), numbersString) + val question = String.format(resources.getString(com.simplemobiletools.commons.R.string.block_confirmation), numbersString) ConfirmationDialog(activity, question) { blockNumbers() @@ -118,7 +118,7 @@ class ConversationsAdapter( val itemsCnt = selectedKeys.size val items = resources.getQuantityString(R.plurals.delete_conversations, itemsCnt, itemsCnt) - val baseString = R.string.deletion_confirmation + val baseString = com.simplemobiletools.commons.R.string.deletion_confirmation val question = String.format(resources.getString(baseString), items) ConfirmationDialog(activity, question) { diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/RecycleBinConversationsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/RecycleBinConversationsAdapter.kt index 2f1c3542..92befe8f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/RecycleBinConversationsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/RecycleBinConversationsAdapter.kt @@ -35,7 +35,7 @@ class RecycleBinConversationsAdapter( val itemsCnt = selectedKeys.size val items = resources.getQuantityString(R.plurals.delete_conversations, itemsCnt, itemsCnt) - val baseString = R.string.deletion_confirmation + val baseString = com.simplemobiletools.commons.R.string.deletion_confirmation val question = String.format(resources.getString(baseString), items) ConfirmationDialog(activity, question) { diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ThreadAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ThreadAdapter.kt index a436b71d..a2b0f769 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ThreadAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ThreadAdapter.kt @@ -203,9 +203,9 @@ class ThreadAdapter( } val baseString = if (activity.config.useRecycleBin && !isRecycleBin) { - R.string.move_to_recycle_bin_confirmation + com.simplemobiletools.commons.R.string.move_to_recycle_bin_confirmation } else { - R.string.deletion_confirmation + com.simplemobiletools.commons.R.string.deletion_confirmation } val question = String.format(resources.getString(baseString), items) @@ -384,7 +384,7 @@ class ThreadAdapter( if (message.isScheduled) { typeface = Typeface.create(Typeface.DEFAULT, Typeface.ITALIC) - val scheduledDrawable = AppCompatResources.getDrawable(activity, R.drawable.ic_clock_vector)?.apply { + val scheduledDrawable = AppCompatResources.getDrawable(activity, com.simplemobiletools.commons.R.drawable.ic_clock_vector)?.apply { applyColorFilter(contrastColor) val size = lineHeight setBounds(0, 0, size, size) @@ -523,7 +523,7 @@ class ThreadAdapter( private fun setupThreadSuccess(view: View, isDelivered: Boolean) { ItemThreadSuccessBinding.bind(view).apply { - threadSuccess.setImageResource(if (isDelivered) R.drawable.ic_check_double_vector else R.drawable.ic_check_vector) + threadSuccess.setImageResource(if (isDelivered) R.drawable.ic_check_double_vector else com.simplemobiletools.commons.R.drawable.ic_check_vector) threadSuccess.applyColorFilter(textColor) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/VCardViewerAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/VCardViewerAdapter.kt index b0d344bf..cbee6582 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/VCardViewerAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/VCardViewerAdapter.kt @@ -76,7 +76,7 @@ class VCardViewerAdapter( null } - val roundingRadius = resources.getDimensionPixelSize(R.dimen.big_margin) + val roundingRadius = resources.getDimensionPixelSize(com.simplemobiletools.commons.R.dimen.big_margin) val transformation = RoundedCorners(roundingRadius) val options = RequestOptions() .diskCacheStrategy(DiskCacheStrategy.RESOURCE) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/AddBlockedKeywordDialog.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/AddBlockedKeywordDialog.kt index 4d2ebdbf..81ec1bcd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/AddBlockedKeywordDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/AddBlockedKeywordDialog.kt @@ -6,7 +6,6 @@ import com.simplemobiletools.commons.extensions.getAlertDialogBuilder import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.showKeyboard import com.simplemobiletools.commons.extensions.value -import com.simplemobiletools.smsmessenger.R import com.simplemobiletools.smsmessenger.databinding.DialogAddBlockedKeywordBinding import com.simplemobiletools.smsmessenger.extensions.config @@ -19,8 +18,8 @@ class AddBlockedKeywordDialog(val activity: BaseSimpleActivity, private val orig } activity.getAlertDialogBuilder() - .setPositiveButton(R.string.ok, null) - .setNegativeButton(R.string.cancel, null) + .setPositiveButton(com.simplemobiletools.commons.R.string.ok, null) + .setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null) .apply { activity.setupDialogStuff(binding.root, this) { alertDialog -> alertDialog.showKeyboard(binding.addBlockedKeywordEdittext) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/DeleteConfirmationDialog.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/DeleteConfirmationDialog.kt index b1d7327d..8a9caba5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/DeleteConfirmationDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/DeleteConfirmationDialog.kt @@ -5,7 +5,6 @@ import androidx.appcompat.app.AlertDialog import com.simplemobiletools.commons.extensions.beGoneIf import com.simplemobiletools.commons.extensions.getAlertDialogBuilder import com.simplemobiletools.commons.extensions.setupDialogStuff -import com.simplemobiletools.smsmessenger.R import com.simplemobiletools.smsmessenger.databinding.DialogDeleteConfirmationBinding class DeleteConfirmationDialog( @@ -22,8 +21,8 @@ class DeleteConfirmationDialog( binding.deleteRememberTitle.text = message binding.skipTheRecycleBinCheckbox.beGoneIf(!showSkipRecycleBinOption) activity.getAlertDialogBuilder() - .setPositiveButton(R.string.yes) { _, _ -> dialogConfirmed() } - .setNegativeButton(R.string.no, null) + .setPositiveButton(com.simplemobiletools.commons.R.string.yes) { _, _ -> dialogConfirmed() } + .setNegativeButton(com.simplemobiletools.commons.R.string.no, null) .apply { activity.setupDialogStuff(binding.root, this) { alertDialog -> dialog = alertDialog diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/ExportMessagesDialog.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/ExportMessagesDialog.kt index 1c9c1a77..94f7c99b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/ExportMessagesDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/ExportMessagesDialog.kt @@ -23,8 +23,8 @@ class ExportMessagesDialog( } activity.getAlertDialogBuilder() - .setPositiveButton(R.string.ok, null) - .setNegativeButton(R.string.cancel, null) + .setPositiveButton(com.simplemobiletools.commons.R.string.ok, null) + .setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null) .apply { activity.setupDialogStuff(binding.root, this, R.string.export_messages) { alertDialog -> alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { @@ -32,13 +32,13 @@ class ExportMessagesDialog( config.exportMms = binding.exportMmsCheckbox.isChecked val filename = binding.exportMessagesFilename.value when { - filename.isEmpty() -> activity.toast(R.string.empty_name) + filename.isEmpty() -> activity.toast(com.simplemobiletools.commons.R.string.empty_name) filename.isAValidFilename() -> { callback(filename) alertDialog.dismiss() } - else -> activity.toast(R.string.invalid_name) + else -> activity.toast(com.simplemobiletools.commons.R.string.invalid_name) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/ImportMessagesDialog.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/ImportMessagesDialog.kt index e626d8be..b9fb4b68 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/ImportMessagesDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/ImportMessagesDialog.kt @@ -28,8 +28,8 @@ class ImportMessagesDialog( } activity.getAlertDialogBuilder() - .setPositiveButton(R.string.ok, null) - .setNegativeButton(R.string.cancel, null) + .setPositiveButton(com.simplemobiletools.commons.R.string.ok, null) + .setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null) .apply { activity.setupDialogStuff(binding.root, this, R.string.import_messages) { alertDialog -> alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { @@ -43,7 +43,7 @@ class ImportMessagesDialog( } ignoreClicks = true - activity.toast(R.string.importing) + activity.toast(com.simplemobiletools.commons.R.string.importing) config.importSms = binding.importSmsCheckbox.isChecked config.importMms = binding.importMmsCheckbox.isChecked ensureBackgroundThread { @@ -60,10 +60,10 @@ class ImportMessagesDialog( private fun handleParseResult(result: ImportResult) { activity.toast( when (result) { - ImportResult.IMPORT_OK -> R.string.importing_successful - ImportResult.IMPORT_PARTIAL -> R.string.importing_some_entries_failed - ImportResult.IMPORT_FAIL -> R.string.importing_failed - else -> R.string.no_items_found + ImportResult.IMPORT_OK -> com.simplemobiletools.commons.R.string.importing_successful + ImportResult.IMPORT_PARTIAL -> com.simplemobiletools.commons.R.string.importing_some_entries_failed + ImportResult.IMPORT_FAIL -> com.simplemobiletools.commons.R.string.importing_failed + else -> com.simplemobiletools.commons.R.string.no_items_found } ) } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/InvalidNumberDialog.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/InvalidNumberDialog.kt index c7b82677..0900b897 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/InvalidNumberDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/InvalidNumberDialog.kt @@ -3,7 +3,6 @@ package com.simplemobiletools.smsmessenger.dialogs import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.extensions.getAlertDialogBuilder import com.simplemobiletools.commons.extensions.setupDialogStuff -import com.simplemobiletools.smsmessenger.R import com.simplemobiletools.smsmessenger.databinding.DialogInvalidNumberBinding class InvalidNumberDialog(val activity: BaseSimpleActivity, val text: String) { @@ -13,7 +12,7 @@ class InvalidNumberDialog(val activity: BaseSimpleActivity, val text: String) { } activity.getAlertDialogBuilder() - .setPositiveButton(R.string.ok) { _, _ -> { } } + .setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> { } } .apply { activity.setupDialogStuff(binding.root, this) } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/MessageDetailsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/MessageDetailsDialog.kt index 5c846b9f..6bac6d0e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/MessageDetailsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/MessageDetailsDialog.kt @@ -23,7 +23,7 @@ class MessageDetailsDialog(val activity: BaseSimpleActivity, val message: Messag addProperty(message.getSentOrReceivedAtLabel(), message.getSentOrReceivedAt()) activity.getAlertDialogBuilder() - .setPositiveButton(R.string.ok) { _, _ -> } + .setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> } .apply { activity.setupDialogStuff(mDialogView.root, this, R.string.message_details) } @@ -56,7 +56,8 @@ class MessageDetailsDialog(val activity: BaseSimpleActivity, val message: Messag } private fun Message.getSIM(availableSIMs: List): String { - return availableSIMs.firstOrNull { it.subscriptionId == subscriptionId }?.displayName?.toString() ?: activity.getString(R.string.unknown) + return availableSIMs.firstOrNull { it.subscriptionId == subscriptionId }?.displayName?.toString() + ?: activity.getString(com.simplemobiletools.commons.R.string.unknown) } private fun Message.getSentOrReceivedAtLabel(): Int { diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/RenameConversationDialog.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/RenameConversationDialog.kt index 044944ea..78488504 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/RenameConversationDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/RenameConversationDialog.kt @@ -30,8 +30,8 @@ class RenameConversationDialog( } activity.getAlertDialogBuilder() - .setPositiveButton(R.string.ok, null) - .setNegativeButton(R.string.cancel, null) + .setPositiveButton(com.simplemobiletools.commons.R.string.ok, null) + .setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null) .apply { activity.setupDialogStuff(binding.root, this, R.string.rename_conversation) { alertDialog -> dialog = alertDialog @@ -40,7 +40,7 @@ class RenameConversationDialog( setOnClickListener { val newTitle = binding.renameConvEditText.text.toString() if (newTitle.isEmpty()) { - activity.toast(R.string.empty_name) + activity.toast(com.simplemobiletools.commons.R.string.empty_name) return@setOnClickListener } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/ScheduleMessageDialog.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/ScheduleMessageDialog.kt index b586a962..2c206c5f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/ScheduleMessageDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/ScheduleMessageDialog.kt @@ -66,8 +66,8 @@ class ScheduleMessageDialog( } activity.getAlertDialogBuilder() - .setPositiveButton(R.string.ok, null) - .setNegativeButton(R.string.cancel, null) + .setPositiveButton(com.simplemobiletools.commons.R.string.ok, null) + .setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null) .apply { previewShown = true activity.setupDialogStuff(binding.root, this, R.string.schedule_message) { dialog -> @@ -99,7 +99,7 @@ class ScheduleMessageDialog( datePicker.minDate = System.currentTimeMillis() show() getButton(AlertDialog.BUTTON_NEGATIVE).apply { - text = activity.getString(R.string.cancel) + text = activity.getString(com.simplemobiletools.commons.R.string.cancel) setOnClickListener { dismiss() } @@ -136,7 +136,7 @@ class ScheduleMessageDialog( ).apply { show() getButton(AlertDialog.BUTTON_NEGATIVE).apply { - text = activity.getString(R.string.cancel) + text = activity.getString(com.simplemobiletools.commons.R.string.cancel) setOnClickListener { dismiss() } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/SelectTextDialog.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/SelectTextDialog.kt index ff4ac882..2c4e8c75 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/SelectTextDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/dialogs/SelectTextDialog.kt @@ -3,7 +3,6 @@ package com.simplemobiletools.smsmessenger.dialogs import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.extensions.getAlertDialogBuilder import com.simplemobiletools.commons.extensions.setupDialogStuff -import com.simplemobiletools.smsmessenger.R import com.simplemobiletools.smsmessenger.databinding.DialogSelectTextBinding // helper dialog for selecting just a part of a message, not copying the whole into clipboard @@ -14,7 +13,7 @@ class SelectTextDialog(val activity: BaseSimpleActivity, val text: String) { } activity.getAlertDialogBuilder() - .setPositiveButton(R.string.ok) { _, _ -> { } } + .setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> { } } .apply { activity.setupDialogStuff(binding.root, this) } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Activity.kt index f4c7774a..e35fe22e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Activity.kt @@ -11,8 +11,7 @@ import com.simplemobiletools.commons.helpers.IS_PRIVATE import com.simplemobiletools.commons.helpers.SimpleContactsHelper import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.models.SimpleContact -import com.simplemobiletools.smsmessenger.R -import java.util.* +import java.util.Locale fun Activity.dialNumber(phoneNumber: String, callback: (() -> Unit)? = null) { hideKeyboard() @@ -23,7 +22,7 @@ fun Activity.dialNumber(phoneNumber: String, callback: (() -> Unit)? = null) { startActivity(this) callback?.invoke() } catch (e: ActivityNotFoundException) { - toast(R.string.no_app_found) + toast(com.simplemobiletools.commons.R.string.no_app_found) } catch (e: Exception) { showErrorToast(e) } @@ -44,7 +43,7 @@ fun Activity.launchViewIntent(uri: Uri, mimetype: String, filename: String) { if (newMimetype.isNotEmpty() && mimetype != newMimetype) { launchViewIntent(uri, newMimetype, filename) } else { - toast(R.string.no_app_found) + toast(com.simplemobiletools.commons.R.string.no_app_found) } } catch (e: Exception) { showErrorToast(e) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt index de7d6855..442aebce 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt @@ -631,7 +631,7 @@ fun Context.removeAllArchivedConversations(callback: (() -> Unit)? = null) { toast(R.string.archive_emptied_successfully) callback?.invoke() } catch (e: Exception) { - toast(R.string.unknown_error_occurred) + toast(com.simplemobiletools.commons.R.string.unknown_error_occurred) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/AttachmentPreviews.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/AttachmentPreviews.kt index 0f9a11a9..b928307a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/AttachmentPreviews.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/AttachmentPreviews.kt @@ -124,7 +124,7 @@ fun ItemAttachmentVcardBinding.setupVCardPreview( activity.runOnUiThread { if (vCards.isEmpty()) { vcardTitle.beVisible() - vcardTitle.text = context.getString(R.string.unknown_error_occurred) + vcardTitle.text = context.getString(com.simplemobiletools.commons.R.string.unknown_error_occurred) return@runOnUiThread } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/MessagesImporter.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/MessagesImporter.kt index af95f391..2cfae3ce 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/MessagesImporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/MessagesImporter.kt @@ -5,13 +5,11 @@ import android.util.Xml import com.simplemobiletools.commons.extensions.showErrorToast import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.helpers.ensureBackgroundThread -import com.simplemobiletools.smsmessenger.R import com.simplemobiletools.smsmessenger.activities.SimpleActivity import com.simplemobiletools.smsmessenger.dialogs.ImportMessagesDialog import com.simplemobiletools.smsmessenger.extensions.config import com.simplemobiletools.smsmessenger.models.* import kotlinx.serialization.SerializationException -import kotlinx.serialization.decodeFromString import kotlinx.serialization.json.Json import org.xmlpull.v1.XmlPullParser import java.io.InputStream @@ -29,7 +27,7 @@ class MessagesImporter(private val activity: SimpleActivity) { val fileType = activity.contentResolver.getType(uri).orEmpty() val isXml = isXmlMimeType(fileType) || (uri.path?.endsWith("txt") == true && isFileXml(uri)) if (isXml) { - activity.toast(R.string.importing) + activity.toast(com.simplemobiletools.commons.R.string.importing) getInputStreamFromUri(uri)!!.importXml() } else { importJson(uri) @@ -47,14 +45,14 @@ class MessagesImporter(private val activity: SimpleActivity) { val deserializedList = Json.decodeFromString>(jsonString) if (deserializedList.isEmpty()) { - activity.toast(R.string.no_entries_for_importing) + activity.toast(com.simplemobiletools.commons.R.string.no_entries_for_importing) return } ImportMessagesDialog(activity, deserializedList) } catch (e: SerializationException) { - activity.toast(R.string.invalid_file_format) + activity.toast(com.simplemobiletools.commons.R.string.invalid_file_format) } catch (e: IllegalArgumentException) { - activity.toast(R.string.invalid_file_format) + activity.toast(com.simplemobiletools.commons.R.string.invalid_file_format) } catch (e: Exception) { activity.showErrorToast(e) } @@ -134,12 +132,12 @@ class MessagesImporter(private val activity: SimpleActivity) { refreshMessages() } when { - messagesFailed > 0 && messagesImported > 0 -> activity.toast(R.string.importing_some_entries_failed) - messagesFailed > 0 -> activity.toast(R.string.importing_failed) - else -> activity.toast(R.string.importing_successful) + messagesFailed > 0 && messagesImported > 0 -> activity.toast(com.simplemobiletools.commons.R.string.importing_some_entries_failed) + messagesFailed > 0 -> activity.toast(com.simplemobiletools.commons.R.string.importing_failed) + else -> activity.toast(com.simplemobiletools.commons.R.string.importing_successful) } } catch (_: Exception) { - activity.toast(R.string.invalid_file_format) + activity.toast(com.simplemobiletools.commons.R.string.invalid_file_format) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/NotificationHelper.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/NotificationHelper.kt index 74bdd5fe..e5afd89a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/NotificationHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/NotificationHelper.kt @@ -36,7 +36,15 @@ class NotificationHelper(private val context: Context) { .build() @SuppressLint("NewApi") - fun showMessageNotification(messageId: Long, address: String, body: String, threadId: Long, bitmap: Bitmap?, sender: String?, alertOnlyOnce: Boolean = false) { + fun showMessageNotification( + messageId: Long, + address: String, + body: String, + threadId: Long, + bitmap: Bitmap?, + sender: String?, + alertOnlyOnce: Boolean = false + ) { maybeCreateChannel(name = context.getString(R.string.channel_received_sms)) val notificationId = threadId.hashCode() @@ -96,6 +104,7 @@ class NotificationHelper(private val context: Context) { setLargeIcon(largeIcon) setStyle(getMessagesStyle(address, body, notificationId, sender)) } + LOCK_SCREEN_SENDER -> { setContentTitle(sender) setLargeIcon(largeIcon) @@ -119,11 +128,14 @@ class NotificationHelper(private val context: Context) { builder.addAction(replyAction) } - builder.addAction(R.drawable.ic_check_vector, context.getString(R.string.mark_as_read), markAsReadPendingIntent) + builder.addAction(com.simplemobiletools.commons.R.drawable.ic_check_vector, context.getString(R.string.mark_as_read), markAsReadPendingIntent) .setChannelId(NOTIFICATION_CHANNEL) if (isNoReplySms) { - builder.addAction(R.drawable.ic_delete_vector, context.getString(R.string.delete), deleteSmsPendingIntent) - .setChannelId(NOTIFICATION_CHANNEL) + builder.addAction( + com.simplemobiletools.commons.R.drawable.ic_delete_vector, + context.getString(com.simplemobiletools.commons.R.string.delete), + deleteSmsPendingIntent + ).setChannelId(NOTIFICATION_CHANNEL) } notificationManager.notify(notificationId, builder.build()) } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/messaging/MessagingUtils.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/messaging/MessagingUtils.kt index 211efadf..fcc5331a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/messaging/MessagingUtils.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/messaging/MessagingUtils.kt @@ -166,7 +166,7 @@ class MessagingUtils(val context: Context) { } catch (e: Exception) { context.showErrorToast(e) } catch (e: Error) { - context.showErrorToast(e.localizedMessage ?: context.getString(R.string.unknown_error_occurred)) + context.showErrorToast(e.localizedMessage ?: context.getString(com.simplemobiletools.commons.R.string.unknown_error_occurred)) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/models/VCard.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/models/VCard.kt index 56f252b6..e6925986 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/models/VCard.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/models/VCard.kt @@ -2,7 +2,6 @@ package com.simplemobiletools.smsmessenger.models import android.content.Context import com.simplemobiletools.commons.extensions.normalizePhoneNumber -import com.simplemobiletools.smsmessenger.R import com.simplemobiletools.smsmessenger.extensions.config import com.simplemobiletools.smsmessenger.extensions.format import com.simplemobiletools.smsmessenger.helpers.parseNameFromVCard @@ -38,9 +37,9 @@ data class VCardPropertyWrapper(val value: String, val type: String, val propert private fun VCardProperty.getPropertyTypeString(context: Context): String { return when (parameters.type) { - CELL -> context.getString(R.string.mobile) - HOME -> context.getString(R.string.home) - WORK -> context.getString(R.string.work) + CELL -> context.getString(com.simplemobiletools.commons.R.string.mobile) + HOME -> context.getString(com.simplemobiletools.commons.R.string.home) + WORK -> context.getString(com.simplemobiletools.commons.R.string.work) else -> "" } } @@ -50,10 +49,22 @@ data class VCardPropertyWrapper(val value: String, val type: String, val propert when (this) { is Telephone -> VCardPropertyWrapper(text.normalizePhoneNumber(), getPropertyTypeString(context), property) is Email -> VCardPropertyWrapper(value, getPropertyTypeString(context), property) - is Organization -> VCardPropertyWrapper(values.joinToString(), context.getString(R.string.work), property) - is Birthday -> VCardPropertyWrapper(date.format(context.config.dateFormat), context.getString(R.string.birthday), property) - is Anniversary -> VCardPropertyWrapper(date.format(context.config.dateFormat), context.getString(R.string.anniversary), property) - is Note -> VCardPropertyWrapper(value, context.getString(R.string.notes), property) + is Organization -> VCardPropertyWrapper( + value = values.joinToString(), + type = context.getString(com.simplemobiletools.commons.R.string.work), + property = property + ) + is Birthday -> VCardPropertyWrapper( + value = date.format(context.config.dateFormat), + type = context.getString(com.simplemobiletools.commons.R.string.birthday), + property = property + ) + is Anniversary -> VCardPropertyWrapper( + value = date.format(context.config.dateFormat), + type = context.getString(com.simplemobiletools.commons.R.string.anniversary), + property = property + ) + is Note -> VCardPropertyWrapper(value, context.getString(com.simplemobiletools.commons.R.string.notes), property) else -> VCardPropertyWrapper("", "", property) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/ScheduledMessageReceiver.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/ScheduledMessageReceiver.kt index 13cb8c86..69e68537 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/ScheduledMessageReceiver.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/ScheduledMessageReceiver.kt @@ -8,7 +8,6 @@ import android.os.Looper import android.os.PowerManager import com.simplemobiletools.commons.extensions.showErrorToast import com.simplemobiletools.commons.helpers.ensureBackgroundThread -import com.simplemobiletools.smsmessenger.R import com.simplemobiletools.smsmessenger.extensions.conversationsDB import com.simplemobiletools.smsmessenger.extensions.deleteScheduledMessage import com.simplemobiletools.smsmessenger.extensions.getAddresses @@ -56,7 +55,7 @@ class ScheduledMessageReceiver : BroadcastReceiver() { } catch (e: Exception) { context.showErrorToast(e) } catch (e: Error) { - context.showErrorToast(e.localizedMessage ?: context.getString(R.string.unknown_error_occurred)) + context.showErrorToast(e.localizedMessage ?: context.getString(com.simplemobiletools.commons.R.string.unknown_error_occurred)) } } } diff --git a/gradle.properties b/gradle.properties index cfecf3f5..95e3e292 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,3 @@ android.enableJetifier=true android.useAndroidX=true org.gradle.jvmargs=-Xmx8192m -android.nonTransitiveRClass=false