Migrate to non-transitive R Classes
This commit is contained in:
parent
166998f86e
commit
69ff590cf0
|
@ -94,7 +94,13 @@ class ArchivedConversationsActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun removeAll() {
|
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 {
|
removeAllArchivedConversations {
|
||||||
loadArchivedConversations()
|
loadArchivedConversations()
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.NavigationIcon
|
import com.simplemobiletools.commons.helpers.NavigationIcon
|
||||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||||
import com.simplemobiletools.commons.models.SimpleContact
|
import com.simplemobiletools.commons.models.SimpleContact
|
||||||
import com.simplemobiletools.smsmessenger.R
|
|
||||||
import com.simplemobiletools.smsmessenger.adapters.ContactsAdapter
|
import com.simplemobiletools.smsmessenger.adapters.ContactsAdapter
|
||||||
import com.simplemobiletools.smsmessenger.databinding.ActivityConversationDetailsBinding
|
import com.simplemobiletools.smsmessenger.databinding.ActivityConversationDetailsBinding
|
||||||
import com.simplemobiletools.smsmessenger.dialogs.RenameConversationDialog
|
import com.simplemobiletools.smsmessenger.dialogs.RenameConversationDialog
|
||||||
|
@ -63,7 +62,7 @@ class ConversationDetailsActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun setupTextViews() {
|
private fun setupTextViews() {
|
||||||
binding.conversationName.apply {
|
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())
|
applyColorFilter(getProperTextColor())
|
||||||
setCompoundDrawablesWithIntrinsicBounds(null, null, this, null)
|
setCompoundDrawablesWithIntrinsicBounds(null, null, this, null)
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ class MainActivity : SimpleActivity() {
|
||||||
binding.conversationsProgressBar.trackColor = properPrimaryColor.adjustAlpha(LOWER_ALPHA)
|
binding.conversationsProgressBar.trackColor = properPrimaryColor.adjustAlpha(LOWER_ALPHA)
|
||||||
checkShortcut()
|
checkShortcut()
|
||||||
(binding.conversationsFab.layoutParams as? CoordinatorLayout.LayoutParams)?.bottomMargin =
|
(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() {
|
override fun onPause() {
|
||||||
|
@ -222,7 +222,7 @@ class MainActivity : SimpleActivity() {
|
||||||
startActivityForResult(intent, MAKE_DEFAULT_APP_REQUEST)
|
startActivityForResult(intent, MAKE_DEFAULT_APP_REQUEST)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
toast(R.string.unknown_error_occurred)
|
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -247,7 +247,7 @@ class MainActivity : SimpleActivity() {
|
||||||
if (!granted) {
|
if (!granted) {
|
||||||
PermissionRequiredDialog(
|
PermissionRequiredDialog(
|
||||||
activity = this,
|
activity = this,
|
||||||
textId = R.string.allow_notifications_incoming_messages,
|
textId = com.simplemobiletools.commons.R.string.allow_notifications_incoming_messages,
|
||||||
positiveActionCallback = { openNotificationSettings() })
|
positiveActionCallback = { openNotificationSettings() })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -480,8 +480,8 @@ class MainActivity : SimpleActivity() {
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
private fun getCreateNewContactShortcut(appIconColor: Int): ShortcutInfo {
|
private fun getCreateNewContactShortcut(appIconColor: Int): ShortcutInfo {
|
||||||
val newEvent = getString(R.string.new_conversation)
|
val newEvent = getString(R.string.new_conversation)
|
||||||
val drawable = resources.getDrawable(R.drawable.shortcut_plus)
|
val drawable = resources.getDrawable(com.simplemobiletools.commons.R.drawable.shortcut_plus)
|
||||||
(drawable as LayerDrawable).findDrawableByLayerId(R.id.shortcut_plus_background).applyColorFilter(appIconColor)
|
(drawable as LayerDrawable).findDrawableByLayerId(com.simplemobiletools.commons.R.id.shortcut_plus_background).applyColorFilter(appIconColor)
|
||||||
val bmp = drawable.convertToBitmap()
|
val bmp = drawable.convertToBitmap()
|
||||||
|
|
||||||
val intent = Intent(this, NewConversationActivity::class.java)
|
val intent = Intent(this, NewConversationActivity::class.java)
|
||||||
|
@ -580,12 +580,12 @@ class MainActivity : SimpleActivity() {
|
||||||
val faqItems = arrayListOf(
|
val faqItems = arrayListOf(
|
||||||
FAQItem(R.string.faq_2_title, R.string.faq_2_text),
|
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_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)) {
|
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(com.simplemobiletools.commons.R.string.faq_2_title_commons, com.simplemobiletools.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_6_title_commons, com.simplemobiletools.commons.R.string.faq_6_text_commons))
|
||||||
}
|
}
|
||||||
|
|
||||||
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)
|
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)
|
||||||
|
|
|
@ -145,7 +145,12 @@ class NewConversationActivity : SimpleActivity() {
|
||||||
binding.noContactsPlaceholder2.beVisibleIf(!hasContacts && !hasPermission(PERMISSION_READ_CONTACTS))
|
binding.noContactsPlaceholder2.beVisibleIf(!hasContacts && !hasPermission(PERMISSION_READ_CONTACTS))
|
||||||
|
|
||||||
if (!hasContacts) {
|
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)
|
binding.noContactsPlaceholder.text = getString(placeholderText)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,13 @@ class RecycleBinConversationsActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun removeAll() {
|
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 {
|
ensureBackgroundThread {
|
||||||
emptyMessagesRecycleBin()
|
emptyMessagesRecycleBin()
|
||||||
loadRecycleBinConversations()
|
loadRecycleBinConversations()
|
||||||
|
|
|
@ -99,7 +99,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
|
|
||||||
private val saveDocument = registerForActivityResult(ActivityResultContracts.CreateDocument(messagesFileType)) { uri ->
|
private val saveDocument = registerForActivityResult(ActivityResultContracts.CreateDocument(messagesFileType)) { uri ->
|
||||||
if (uri != null) {
|
if (uri != null) {
|
||||||
toast(R.string.exporting)
|
toast(com.simplemobiletools.commons.R.string.exporting)
|
||||||
exportMessages(uri)
|
exportMessages(uri)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
try {
|
try {
|
||||||
MessagesReader(this).getMessagesToExport(config.exportSms, config.exportMms) { messagesToExport ->
|
MessagesReader(this).getMessagesToExport(config.exportSms, config.exportMms) { messagesToExport ->
|
||||||
if (messagesToExport.isEmpty()) {
|
if (messagesToExport.isEmpty()) {
|
||||||
toast(R.string.no_entries_for_exporting)
|
toast(com.simplemobiletools.commons.R.string.no_entries_for_exporting)
|
||||||
return@getMessagesToExport
|
return@getMessagesToExport
|
||||||
}
|
}
|
||||||
val json = Json { encodeDefaults = true }
|
val json = Json { encodeDefaults = true }
|
||||||
|
@ -133,7 +133,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
outputStream.use {
|
outputStream.use {
|
||||||
it.write(jsonString.toByteArray())
|
it.write(jsonString.toByteArray())
|
||||||
}
|
}
|
||||||
toast(R.string.exporting_successful)
|
toast(com.simplemobiletools.commons.R.string.exporting_successful)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
showErrorToast(e)
|
showErrorToast(e)
|
||||||
|
@ -188,7 +188,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
// support for device-wise blocking came on Android 7, rely only on that
|
// support for device-wise blocking came on Android 7, rely only on that
|
||||||
@TargetApi(Build.VERSION_CODES.N)
|
@TargetApi(Build.VERSION_CODES.N)
|
||||||
private fun setupManageBlockedNumbers() = binding.apply {
|
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.beVisibleIf(isNougatPlus())
|
||||||
|
|
||||||
settingsManageBlockedNumbersHolder.setOnClickListener {
|
settingsManageBlockedNumbersHolder.setOnClickListener {
|
||||||
|
@ -228,10 +228,10 @@ class SettingsActivity : SimpleActivity() {
|
||||||
settingsFontSize.text = getFontSizeText()
|
settingsFontSize.text = getFontSizeText()
|
||||||
settingsFontSizeHolder.setOnClickListener {
|
settingsFontSizeHolder.setOnClickListener {
|
||||||
val items = arrayListOf(
|
val items = arrayListOf(
|
||||||
RadioItem(FONT_SIZE_SMALL, getString(R.string.small)),
|
RadioItem(FONT_SIZE_SMALL, getString(com.simplemobiletools.commons.R.string.small)),
|
||||||
RadioItem(FONT_SIZE_MEDIUM, getString(R.string.medium)),
|
RadioItem(FONT_SIZE_MEDIUM, getString(com.simplemobiletools.commons.R.string.medium)),
|
||||||
RadioItem(FONT_SIZE_LARGE, getString(R.string.large)),
|
RadioItem(FONT_SIZE_LARGE, getString(com.simplemobiletools.commons.R.string.large)),
|
||||||
RadioItem(FONT_SIZE_EXTRA_LARGE, getString(R.string.extra_large))
|
RadioItem(FONT_SIZE_EXTRA_LARGE, getString(com.simplemobiletools.commons.R.string.extra_large))
|
||||||
)
|
)
|
||||||
|
|
||||||
RadioGroupDialog(this@SettingsActivity, items, config.fontSize) {
|
RadioGroupDialog(this@SettingsActivity, items, config.fontSize) {
|
||||||
|
@ -295,7 +295,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
val items = arrayListOf(
|
val items = arrayListOf(
|
||||||
RadioItem(LOCK_SCREEN_SENDER_MESSAGE, getString(R.string.sender_and_message)),
|
RadioItem(LOCK_SCREEN_SENDER_MESSAGE, getString(R.string.sender_and_message)),
|
||||||
RadioItem(LOCK_SCREEN_SENDER, getString(R.string.sender_only)),
|
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) {
|
RadioGroupDialog(this@SettingsActivity, items, config.lockScreenVisibilitySetting) {
|
||||||
|
@ -309,7 +309,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
when (config.lockScreenVisibilitySetting) {
|
when (config.lockScreenVisibilitySetting) {
|
||||||
LOCK_SCREEN_SENDER_MESSAGE -> R.string.sender_and_message
|
LOCK_SCREEN_SENDER_MESSAGE -> R.string.sender_and_message
|
||||||
LOCK_SCREEN_SENDER -> R.string.sender_only
|
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 {
|
settingsEmptyRecycleBinHolder.setOnClickListener {
|
||||||
if (recycleBinMessages == 0) {
|
if (recycleBinMessages == 0) {
|
||||||
toast(R.string.recycle_bin_empty)
|
toast(com.simplemobiletools.commons.R.string.recycle_bin_empty)
|
||||||
} else {
|
} 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 {
|
ensureBackgroundThread {
|
||||||
emptyMessagesRecycleBin()
|
emptyMessagesRecycleBin()
|
||||||
}
|
}
|
||||||
|
@ -386,9 +392,13 @@ class SettingsActivity : SimpleActivity() {
|
||||||
config.appProtectionType = type
|
config.appProtectionType = type
|
||||||
|
|
||||||
if (config.isAppPasswordProtectionOn) {
|
if (config.isAppPasswordProtectionOn) {
|
||||||
val confirmationTextId = if (config.appProtectionType == PROTECTION_FINGERPRINT)
|
val confirmationTextId = if (config.appProtectionType == PROTECTION_FINGERPRINT) {
|
||||||
R.string.fingerprint_setup_successfully else R.string.protection_setup_successfully
|
com.simplemobiletools.commons.R.string.fingerprint_setup_successfully
|
||||||
ConfirmationDialog(this@SettingsActivity, "", confirmationTextId, R.string.ok, 0) { }
|
} else {
|
||||||
|
com.simplemobiletools.commons.R.string.protection_setup_successfully
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfirmationDialog(this@SettingsActivity, "", confirmationTextId, com.simplemobiletools.commons.R.string.ok, 0) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,6 @@ import com.simplemobiletools.smsmessenger.adapters.AutoCompleteTextViewAdapter
|
||||||
import com.simplemobiletools.smsmessenger.adapters.ThreadAdapter
|
import com.simplemobiletools.smsmessenger.adapters.ThreadAdapter
|
||||||
import com.simplemobiletools.smsmessenger.databinding.ActivityThreadBinding
|
import com.simplemobiletools.smsmessenger.databinding.ActivityThreadBinding
|
||||||
import com.simplemobiletools.smsmessenger.databinding.ItemSelectedContactBinding
|
import com.simplemobiletools.smsmessenger.databinding.ItemSelectedContactBinding
|
||||||
import com.simplemobiletools.smsmessenger.databinding.LayoutThreadSendMessageHolderBinding
|
|
||||||
import com.simplemobiletools.smsmessenger.dialogs.InvalidNumberDialog
|
import com.simplemobiletools.smsmessenger.dialogs.InvalidNumberDialog
|
||||||
import com.simplemobiletools.smsmessenger.dialogs.RenameConversationDialog
|
import com.simplemobiletools.smsmessenger.dialogs.RenameConversationDialog
|
||||||
import com.simplemobiletools.smsmessenger.dialogs.ScheduleMessageDialog
|
import com.simplemobiletools.smsmessenger.dialogs.ScheduleMessageDialog
|
||||||
|
@ -132,7 +131,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
|
|
||||||
val extras = intent.extras
|
val extras = intent.extras
|
||||||
if (extras == null) {
|
if (extras == null) {
|
||||||
toast(R.string.unknown_error_occurred)
|
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
|
||||||
finish()
|
finish()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -256,7 +255,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
findItem(R.id.unarchive).isVisible = threadItems.isNotEmpty() && conversation?.isArchived == true && !isRecycleBin
|
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.rename_conversation).isVisible = participants.size > 1 && conversation != null && !isRecycleBin
|
||||||
findItem(R.id.conversation_details).isVisible = 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.block_number).isVisible = isNougatPlus() && !isRecycleBin
|
||||||
findItem(R.id.dial_number).isVisible = participants.size == 1 && !isSpecialNumber() && !isRecycleBin
|
findItem(R.id.dial_number).isVisible = participants.size == 1 && !isSpecialNumber() && !isRecycleBin
|
||||||
findItem(R.id.manage_people).isVisible = !isSpecialNumber() && !isRecycleBin
|
findItem(R.id.manage_people).isVisible = !isSpecialNumber() && !isRecycleBin
|
||||||
|
@ -400,7 +399,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
val name = intent.getStringExtra(THREAD_TITLE) ?: ""
|
val name = intent.getStringExtra(THREAD_TITLE) ?: ""
|
||||||
val number = intent.getStringExtra(THREAD_NUMBER)
|
val number = intent.getStringExtra(THREAD_NUMBER)
|
||||||
if (number == null) {
|
if (number == null) {
|
||||||
toast(R.string.unknown_error_occurred)
|
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
|
||||||
finish()
|
finish()
|
||||||
return@ensureBackgroundThread
|
return@ensureBackgroundThread
|
||||||
}
|
}
|
||||||
|
@ -760,7 +759,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
} else {
|
} else {
|
||||||
PermissionRequiredDialog(
|
PermissionRequiredDialog(
|
||||||
activity = this,
|
activity = this,
|
||||||
textId = R.string.allow_alarm_scheduled_messages,
|
textId = com.simplemobiletools.commons.R.string.allow_alarm_scheduled_messages,
|
||||||
positiveActionCallback = {
|
positiveActionCallback = {
|
||||||
openRequestExactAlarmSettings(BuildConfig.APPLICATION_ID)
|
openRequestExactAlarmSettings(BuildConfig.APPLICATION_ID)
|
||||||
},
|
},
|
||||||
|
@ -836,7 +835,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (isOreoPlus()) {
|
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() {
|
private fun blockNumber() {
|
||||||
val numbers = participants.getAddresses()
|
val numbers = participants.getAddresses()
|
||||||
val numbersString = TextUtils.join(", ", numbers)
|
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) {
|
ConfirmationDialog(this, question) {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
|
@ -1152,7 +1151,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
return items
|
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()
|
hideKeyboard()
|
||||||
try {
|
try {
|
||||||
startActivityForResult(intent, requestCode)
|
startActivityForResult(intent, requestCode)
|
||||||
|
@ -1225,11 +1224,11 @@ class ThreadActivity : SimpleActivity() {
|
||||||
addAttachment(vCardUri)
|
addAttachment(vCardUri)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
toast(R.string.unknown_error_occurred)
|
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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)
|
val mimeType = contentResolver.getType(uri)
|
||||||
if (mimeType == null) {
|
if (mimeType == null) {
|
||||||
toast(R.string.unknown_error_occurred)
|
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val isImage = mimeType.isImageMimeType()
|
val isImage = mimeType.isImageMimeType()
|
||||||
|
@ -1301,7 +1300,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
outputStream = contentResolver.openOutputStream(Uri.parse(resultData.dataString!!), "rwt")
|
outputStream = contentResolver.openOutputStream(Uri.parse(resultData.dataString!!), "rwt")
|
||||||
inputStream!!.copyTo(outputStream!!)
|
inputStream!!.copyTo(outputStream!!)
|
||||||
outputStream.flush()
|
outputStream.flush()
|
||||||
toast(R.string.file_saved)
|
toast(com.simplemobiletools.commons.R.string.file_saved)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
showErrorToast(e)
|
showErrorToast(e)
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1330,7 +1329,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
private fun sendMessage() {
|
private fun sendMessage() {
|
||||||
var text = binding.messageHolder.threadTypeMessage.value
|
var text = binding.messageHolder.threadTypeMessage.value
|
||||||
if (text.isEmpty() && getAttachmentSelections().isEmpty()) {
|
if (text.isEmpty() && getAttachmentSelections().isEmpty()) {
|
||||||
showErrorToast(getString(R.string.unknown_error_occurred))
|
showErrorToast(getString(com.simplemobiletools.commons.R.string.unknown_error_occurred))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
scrollToBottom()
|
scrollToBottom()
|
||||||
|
@ -1378,7 +1377,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} 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) {
|
} catch (e: Exception) {
|
||||||
showErrorToast(e)
|
showErrorToast(e)
|
||||||
} catch (e: Error) {
|
} 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
|
newLinearLayout.orientation = LinearLayout.HORIZONTAL
|
||||||
|
|
||||||
val sideMargin = (binding.selectedContacts.layoutParams as RelativeLayout.LayoutParams).leftMargin
|
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 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 widthSoFar = 0
|
||||||
var isFirstRow = true
|
var isFirstRow = true
|
||||||
|
|
||||||
|
@ -1528,7 +1527,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
type = mimeType
|
type = mimeType
|
||||||
addCategory(Intent.CATEGORY_OPENABLE)
|
addCategory(Intent.CATEGORY_OPENABLE)
|
||||||
putExtra(Intent.EXTRA_TITLE, path.split("/").last())
|
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(
|
val items = arrayListOf(
|
||||||
RadioItem(TYPE_EDIT, getString(R.string.update_message)),
|
RadioItem(TYPE_EDIT, getString(R.string.update_message)),
|
||||||
RadioItem(TYPE_SEND, getString(R.string.send_now)),
|
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 ->
|
RadioGroupDialog(activity = this, items = items, titleId = R.string.scheduled_message) { any ->
|
||||||
when (any as Int) {
|
when (any as Int) {
|
||||||
|
@ -1732,14 +1731,14 @@ class ThreadActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun setupAttachmentPickerView() = binding.messageHolder.attachmentPicker.apply {
|
private fun setupAttachmentPickerView() = binding.messageHolder.attachmentPicker.apply {
|
||||||
val buttonColors = arrayOf(
|
val buttonColors = arrayOf(
|
||||||
R.color.md_red_500,
|
com.simplemobiletools.commons.R.color.md_red_500,
|
||||||
R.color.md_brown_500,
|
com.simplemobiletools.commons.R.color.md_brown_500,
|
||||||
R.color.md_pink_500,
|
com.simplemobiletools.commons.R.color.md_pink_500,
|
||||||
R.color.md_purple_500,
|
com.simplemobiletools.commons.R.color.md_purple_500,
|
||||||
R.color.md_teal_500,
|
com.simplemobiletools.commons.R.color.md_teal_500,
|
||||||
R.color.md_green_500,
|
com.simplemobiletools.commons.R.color.md_green_500,
|
||||||
R.color.md_indigo_500,
|
com.simplemobiletools.commons.R.color.md_indigo_500,
|
||||||
R.color.md_blue_500
|
com.simplemobiletools.commons.R.color.md_blue_500
|
||||||
).map { ResourcesCompat.getColor(resources, it, theme) }
|
).map { ResourcesCompat.getColor(resources, it, theme) }
|
||||||
arrayOf(
|
arrayOf(
|
||||||
choosePhotoIcon,
|
choosePhotoIcon,
|
||||||
|
@ -1868,7 +1867,7 @@ class ThreadActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getBottomBarColor() = if (baseConfig.isUsingSystemTheme) {
|
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 {
|
} else {
|
||||||
getBottomNavigationBackgroundColor()
|
getBottomNavigationBackgroundColor()
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class ArchivedConversationsAdapter(
|
||||||
val itemsCnt = selectedKeys.size
|
val itemsCnt = selectedKeys.size
|
||||||
val items = resources.getQuantityString(R.plurals.delete_conversations, itemsCnt, itemsCnt)
|
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)
|
val question = String.format(resources.getString(baseString), items)
|
||||||
|
|
||||||
ConfirmationDialog(activity, question) {
|
ConfirmationDialog(activity, question) {
|
||||||
|
|
|
@ -164,7 +164,7 @@ class AttachmentsAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadMediaPreview(binding: ItemAttachmentMediaPreviewBinding, attachment: AttachmentSelection) {
|
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 size = resources.getDimension(R.dimen.attachment_preview_size).toInt()
|
||||||
|
|
||||||
val options = RequestOptions()
|
val options = RequestOptions()
|
||||||
|
@ -179,7 +179,7 @@ class AttachmentsAdapter(
|
||||||
.listener(object : RequestListener<Drawable> {
|
.listener(object : RequestListener<Drawable> {
|
||||||
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, isFirstResource: Boolean): Boolean {
|
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, isFirstResource: Boolean): Boolean {
|
||||||
removeAttachment(attachment)
|
removeAttachment(attachment)
|
||||||
activity.toast(R.string.unknown_error_occurred)
|
activity.toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class ConversationsAdapter(
|
||||||
val isGroupConversation = selectedConversation.isGroupConversation
|
val isGroupConversation = selectedConversation.isGroupConversation
|
||||||
|
|
||||||
menu.apply {
|
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_block_number).isVisible = isNougatPlus()
|
||||||
findItem(R.id.cab_add_number_to_contact).isVisible = isSingleSelection && !isGroupConversation
|
findItem(R.id.cab_add_number_to_contact).isVisible = isSingleSelection && !isGroupConversation
|
||||||
findItem(R.id.cab_dial_number).isVisible = isSingleSelection && !isGroupConversation && !isShortCodeWithLetters(selectedConversation.phoneNumber)
|
findItem(R.id.cab_dial_number).isVisible = isSingleSelection && !isGroupConversation && !isShortCodeWithLetters(selectedConversation.phoneNumber)
|
||||||
|
@ -74,7 +74,7 @@ class ConversationsAdapter(
|
||||||
private fun askConfirmBlock() {
|
private fun askConfirmBlock() {
|
||||||
val numbers = getSelectedItems().distinctBy { it.phoneNumber }.map { it.phoneNumber }
|
val numbers = getSelectedItems().distinctBy { it.phoneNumber }.map { it.phoneNumber }
|
||||||
val numbersString = TextUtils.join(", ", numbers)
|
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) {
|
ConfirmationDialog(activity, question) {
|
||||||
blockNumbers()
|
blockNumbers()
|
||||||
|
@ -118,7 +118,7 @@ class ConversationsAdapter(
|
||||||
val itemsCnt = selectedKeys.size
|
val itemsCnt = selectedKeys.size
|
||||||
val items = resources.getQuantityString(R.plurals.delete_conversations, itemsCnt, itemsCnt)
|
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)
|
val question = String.format(resources.getString(baseString), items)
|
||||||
|
|
||||||
ConfirmationDialog(activity, question) {
|
ConfirmationDialog(activity, question) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ class RecycleBinConversationsAdapter(
|
||||||
val itemsCnt = selectedKeys.size
|
val itemsCnt = selectedKeys.size
|
||||||
val items = resources.getQuantityString(R.plurals.delete_conversations, itemsCnt, itemsCnt)
|
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)
|
val question = String.format(resources.getString(baseString), items)
|
||||||
|
|
||||||
ConfirmationDialog(activity, question) {
|
ConfirmationDialog(activity, question) {
|
||||||
|
|
|
@ -203,9 +203,9 @@ class ThreadAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
val baseString = if (activity.config.useRecycleBin && !isRecycleBin) {
|
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 {
|
} else {
|
||||||
R.string.deletion_confirmation
|
com.simplemobiletools.commons.R.string.deletion_confirmation
|
||||||
}
|
}
|
||||||
val question = String.format(resources.getString(baseString), items)
|
val question = String.format(resources.getString(baseString), items)
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ class ThreadAdapter(
|
||||||
|
|
||||||
if (message.isScheduled) {
|
if (message.isScheduled) {
|
||||||
typeface = Typeface.create(Typeface.DEFAULT, Typeface.ITALIC)
|
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)
|
applyColorFilter(contrastColor)
|
||||||
val size = lineHeight
|
val size = lineHeight
|
||||||
setBounds(0, 0, size, size)
|
setBounds(0, 0, size, size)
|
||||||
|
@ -523,7 +523,7 @@ class ThreadAdapter(
|
||||||
|
|
||||||
private fun setupThreadSuccess(view: View, isDelivered: Boolean) {
|
private fun setupThreadSuccess(view: View, isDelivered: Boolean) {
|
||||||
ItemThreadSuccessBinding.bind(view).apply {
|
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)
|
threadSuccess.applyColorFilter(textColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class VCardViewerAdapter(
|
||||||
null
|
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 transformation = RoundedCorners(roundingRadius)
|
||||||
val options = RequestOptions()
|
val options = RequestOptions()
|
||||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||||
|
|
|
@ -6,7 +6,6 @@ import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||||
import com.simplemobiletools.commons.extensions.showKeyboard
|
import com.simplemobiletools.commons.extensions.showKeyboard
|
||||||
import com.simplemobiletools.commons.extensions.value
|
import com.simplemobiletools.commons.extensions.value
|
||||||
import com.simplemobiletools.smsmessenger.R
|
|
||||||
import com.simplemobiletools.smsmessenger.databinding.DialogAddBlockedKeywordBinding
|
import com.simplemobiletools.smsmessenger.databinding.DialogAddBlockedKeywordBinding
|
||||||
import com.simplemobiletools.smsmessenger.extensions.config
|
import com.simplemobiletools.smsmessenger.extensions.config
|
||||||
|
|
||||||
|
@ -19,8 +18,8 @@ class AddBlockedKeywordDialog(val activity: BaseSimpleActivity, private val orig
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok, null)
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this) { alertDialog ->
|
activity.setupDialogStuff(binding.root, this) { alertDialog ->
|
||||||
alertDialog.showKeyboard(binding.addBlockedKeywordEdittext)
|
alertDialog.showKeyboard(binding.addBlockedKeywordEdittext)
|
||||||
|
|
|
@ -5,7 +5,6 @@ import androidx.appcompat.app.AlertDialog
|
||||||
import com.simplemobiletools.commons.extensions.beGoneIf
|
import com.simplemobiletools.commons.extensions.beGoneIf
|
||||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||||
import com.simplemobiletools.smsmessenger.R
|
|
||||||
import com.simplemobiletools.smsmessenger.databinding.DialogDeleteConfirmationBinding
|
import com.simplemobiletools.smsmessenger.databinding.DialogDeleteConfirmationBinding
|
||||||
|
|
||||||
class DeleteConfirmationDialog(
|
class DeleteConfirmationDialog(
|
||||||
|
@ -22,8 +21,8 @@ class DeleteConfirmationDialog(
|
||||||
binding.deleteRememberTitle.text = message
|
binding.deleteRememberTitle.text = message
|
||||||
binding.skipTheRecycleBinCheckbox.beGoneIf(!showSkipRecycleBinOption)
|
binding.skipTheRecycleBinCheckbox.beGoneIf(!showSkipRecycleBinOption)
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.yes) { _, _ -> dialogConfirmed() }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.yes) { _, _ -> dialogConfirmed() }
|
||||||
.setNegativeButton(R.string.no, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.no, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this) { alertDialog ->
|
activity.setupDialogStuff(binding.root, this) { alertDialog ->
|
||||||
dialog = alertDialog
|
dialog = alertDialog
|
||||||
|
|
|
@ -23,8 +23,8 @@ class ExportMessagesDialog(
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok, null)
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this, R.string.export_messages) { alertDialog ->
|
activity.setupDialogStuff(binding.root, this, R.string.export_messages) { alertDialog ->
|
||||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||||
|
@ -32,13 +32,13 @@ class ExportMessagesDialog(
|
||||||
config.exportMms = binding.exportMmsCheckbox.isChecked
|
config.exportMms = binding.exportMmsCheckbox.isChecked
|
||||||
val filename = binding.exportMessagesFilename.value
|
val filename = binding.exportMessagesFilename.value
|
||||||
when {
|
when {
|
||||||
filename.isEmpty() -> activity.toast(R.string.empty_name)
|
filename.isEmpty() -> activity.toast(com.simplemobiletools.commons.R.string.empty_name)
|
||||||
filename.isAValidFilename() -> {
|
filename.isAValidFilename() -> {
|
||||||
callback(filename)
|
callback(filename)
|
||||||
alertDialog.dismiss()
|
alertDialog.dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> activity.toast(R.string.invalid_name)
|
else -> activity.toast(com.simplemobiletools.commons.R.string.invalid_name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,8 @@ class ImportMessagesDialog(
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok, null)
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this, R.string.import_messages) { alertDialog ->
|
activity.setupDialogStuff(binding.root, this, R.string.import_messages) { alertDialog ->
|
||||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||||
|
@ -43,7 +43,7 @@ class ImportMessagesDialog(
|
||||||
}
|
}
|
||||||
|
|
||||||
ignoreClicks = true
|
ignoreClicks = true
|
||||||
activity.toast(R.string.importing)
|
activity.toast(com.simplemobiletools.commons.R.string.importing)
|
||||||
config.importSms = binding.importSmsCheckbox.isChecked
|
config.importSms = binding.importSmsCheckbox.isChecked
|
||||||
config.importMms = binding.importMmsCheckbox.isChecked
|
config.importMms = binding.importMmsCheckbox.isChecked
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
|
@ -60,10 +60,10 @@ class ImportMessagesDialog(
|
||||||
private fun handleParseResult(result: ImportResult) {
|
private fun handleParseResult(result: ImportResult) {
|
||||||
activity.toast(
|
activity.toast(
|
||||||
when (result) {
|
when (result) {
|
||||||
ImportResult.IMPORT_OK -> R.string.importing_successful
|
ImportResult.IMPORT_OK -> com.simplemobiletools.commons.R.string.importing_successful
|
||||||
ImportResult.IMPORT_PARTIAL -> R.string.importing_some_entries_failed
|
ImportResult.IMPORT_PARTIAL -> com.simplemobiletools.commons.R.string.importing_some_entries_failed
|
||||||
ImportResult.IMPORT_FAIL -> R.string.importing_failed
|
ImportResult.IMPORT_FAIL -> com.simplemobiletools.commons.R.string.importing_failed
|
||||||
else -> R.string.no_items_found
|
else -> com.simplemobiletools.commons.R.string.no_items_found
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.simplemobiletools.smsmessenger.dialogs
|
||||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||||
import com.simplemobiletools.smsmessenger.R
|
|
||||||
import com.simplemobiletools.smsmessenger.databinding.DialogInvalidNumberBinding
|
import com.simplemobiletools.smsmessenger.databinding.DialogInvalidNumberBinding
|
||||||
|
|
||||||
class InvalidNumberDialog(val activity: BaseSimpleActivity, val text: String) {
|
class InvalidNumberDialog(val activity: BaseSimpleActivity, val text: String) {
|
||||||
|
@ -13,7 +12,7 @@ class InvalidNumberDialog(val activity: BaseSimpleActivity, val text: String) {
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> { } }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> { } }
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this)
|
activity.setupDialogStuff(binding.root, this)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ class MessageDetailsDialog(val activity: BaseSimpleActivity, val message: Messag
|
||||||
addProperty(message.getSentOrReceivedAtLabel(), message.getSentOrReceivedAt())
|
addProperty(message.getSentOrReceivedAtLabel(), message.getSentOrReceivedAt())
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> }
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(mDialogView.root, this, R.string.message_details)
|
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<SubscriptionInfo>): String {
|
private fun Message.getSIM(availableSIMs: List<SubscriptionInfo>): 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 {
|
private fun Message.getSentOrReceivedAtLabel(): Int {
|
||||||
|
|
|
@ -30,8 +30,8 @@ class RenameConversationDialog(
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok, null)
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this, R.string.rename_conversation) { alertDialog ->
|
activity.setupDialogStuff(binding.root, this, R.string.rename_conversation) { alertDialog ->
|
||||||
dialog = alertDialog
|
dialog = alertDialog
|
||||||
|
@ -40,7 +40,7 @@ class RenameConversationDialog(
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
val newTitle = binding.renameConvEditText.text.toString()
|
val newTitle = binding.renameConvEditText.text.toString()
|
||||||
if (newTitle.isEmpty()) {
|
if (newTitle.isEmpty()) {
|
||||||
activity.toast(R.string.empty_name)
|
activity.toast(com.simplemobiletools.commons.R.string.empty_name)
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,8 @@ class ScheduleMessageDialog(
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok, null)
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(com.simplemobiletools.commons.R.string.cancel, null)
|
||||||
.apply {
|
.apply {
|
||||||
previewShown = true
|
previewShown = true
|
||||||
activity.setupDialogStuff(binding.root, this, R.string.schedule_message) { dialog ->
|
activity.setupDialogStuff(binding.root, this, R.string.schedule_message) { dialog ->
|
||||||
|
@ -99,7 +99,7 @@ class ScheduleMessageDialog(
|
||||||
datePicker.minDate = System.currentTimeMillis()
|
datePicker.minDate = System.currentTimeMillis()
|
||||||
show()
|
show()
|
||||||
getButton(AlertDialog.BUTTON_NEGATIVE).apply {
|
getButton(AlertDialog.BUTTON_NEGATIVE).apply {
|
||||||
text = activity.getString(R.string.cancel)
|
text = activity.getString(com.simplemobiletools.commons.R.string.cancel)
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ class ScheduleMessageDialog(
|
||||||
).apply {
|
).apply {
|
||||||
show()
|
show()
|
||||||
getButton(AlertDialog.BUTTON_NEGATIVE).apply {
|
getButton(AlertDialog.BUTTON_NEGATIVE).apply {
|
||||||
text = activity.getString(R.string.cancel)
|
text = activity.getString(com.simplemobiletools.commons.R.string.cancel)
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.simplemobiletools.smsmessenger.dialogs
|
||||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||||
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
|
||||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||||
import com.simplemobiletools.smsmessenger.R
|
|
||||||
import com.simplemobiletools.smsmessenger.databinding.DialogSelectTextBinding
|
import com.simplemobiletools.smsmessenger.databinding.DialogSelectTextBinding
|
||||||
|
|
||||||
// helper dialog for selecting just a part of a message, not copying the whole into clipboard
|
// 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()
|
activity.getAlertDialogBuilder()
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> { } }
|
.setPositiveButton(com.simplemobiletools.commons.R.string.ok) { _, _ -> { } }
|
||||||
.apply {
|
.apply {
|
||||||
activity.setupDialogStuff(binding.root, this)
|
activity.setupDialogStuff(binding.root, this)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,7 @@ import com.simplemobiletools.commons.helpers.IS_PRIVATE
|
||||||
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
|
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
|
||||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||||
import com.simplemobiletools.commons.models.SimpleContact
|
import com.simplemobiletools.commons.models.SimpleContact
|
||||||
import com.simplemobiletools.smsmessenger.R
|
import java.util.Locale
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
fun Activity.dialNumber(phoneNumber: String, callback: (() -> Unit)? = null) {
|
fun Activity.dialNumber(phoneNumber: String, callback: (() -> Unit)? = null) {
|
||||||
hideKeyboard()
|
hideKeyboard()
|
||||||
|
@ -23,7 +22,7 @@ fun Activity.dialNumber(phoneNumber: String, callback: (() -> Unit)? = null) {
|
||||||
startActivity(this)
|
startActivity(this)
|
||||||
callback?.invoke()
|
callback?.invoke()
|
||||||
} catch (e: ActivityNotFoundException) {
|
} catch (e: ActivityNotFoundException) {
|
||||||
toast(R.string.no_app_found)
|
toast(com.simplemobiletools.commons.R.string.no_app_found)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
showErrorToast(e)
|
showErrorToast(e)
|
||||||
}
|
}
|
||||||
|
@ -44,7 +43,7 @@ fun Activity.launchViewIntent(uri: Uri, mimetype: String, filename: String) {
|
||||||
if (newMimetype.isNotEmpty() && mimetype != newMimetype) {
|
if (newMimetype.isNotEmpty() && mimetype != newMimetype) {
|
||||||
launchViewIntent(uri, newMimetype, filename)
|
launchViewIntent(uri, newMimetype, filename)
|
||||||
} else {
|
} else {
|
||||||
toast(R.string.no_app_found)
|
toast(com.simplemobiletools.commons.R.string.no_app_found)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
showErrorToast(e)
|
showErrorToast(e)
|
||||||
|
|
|
@ -631,7 +631,7 @@ fun Context.removeAllArchivedConversations(callback: (() -> Unit)? = null) {
|
||||||
toast(R.string.archive_emptied_successfully)
|
toast(R.string.archive_emptied_successfully)
|
||||||
callback?.invoke()
|
callback?.invoke()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
toast(R.string.unknown_error_occurred)
|
toast(com.simplemobiletools.commons.R.string.unknown_error_occurred)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ fun ItemAttachmentVcardBinding.setupVCardPreview(
|
||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
if (vCards.isEmpty()) {
|
if (vCards.isEmpty()) {
|
||||||
vcardTitle.beVisible()
|
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
|
return@runOnUiThread
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,11 @@ import android.util.Xml
|
||||||
import com.simplemobiletools.commons.extensions.showErrorToast
|
import com.simplemobiletools.commons.extensions.showErrorToast
|
||||||
import com.simplemobiletools.commons.extensions.toast
|
import com.simplemobiletools.commons.extensions.toast
|
||||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||||
import com.simplemobiletools.smsmessenger.R
|
|
||||||
import com.simplemobiletools.smsmessenger.activities.SimpleActivity
|
import com.simplemobiletools.smsmessenger.activities.SimpleActivity
|
||||||
import com.simplemobiletools.smsmessenger.dialogs.ImportMessagesDialog
|
import com.simplemobiletools.smsmessenger.dialogs.ImportMessagesDialog
|
||||||
import com.simplemobiletools.smsmessenger.extensions.config
|
import com.simplemobiletools.smsmessenger.extensions.config
|
||||||
import com.simplemobiletools.smsmessenger.models.*
|
import com.simplemobiletools.smsmessenger.models.*
|
||||||
import kotlinx.serialization.SerializationException
|
import kotlinx.serialization.SerializationException
|
||||||
import kotlinx.serialization.decodeFromString
|
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import org.xmlpull.v1.XmlPullParser
|
import org.xmlpull.v1.XmlPullParser
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
|
@ -29,7 +27,7 @@ class MessagesImporter(private val activity: SimpleActivity) {
|
||||||
val fileType = activity.contentResolver.getType(uri).orEmpty()
|
val fileType = activity.contentResolver.getType(uri).orEmpty()
|
||||||
val isXml = isXmlMimeType(fileType) || (uri.path?.endsWith("txt") == true && isFileXml(uri))
|
val isXml = isXmlMimeType(fileType) || (uri.path?.endsWith("txt") == true && isFileXml(uri))
|
||||||
if (isXml) {
|
if (isXml) {
|
||||||
activity.toast(R.string.importing)
|
activity.toast(com.simplemobiletools.commons.R.string.importing)
|
||||||
getInputStreamFromUri(uri)!!.importXml()
|
getInputStreamFromUri(uri)!!.importXml()
|
||||||
} else {
|
} else {
|
||||||
importJson(uri)
|
importJson(uri)
|
||||||
|
@ -47,14 +45,14 @@ class MessagesImporter(private val activity: SimpleActivity) {
|
||||||
|
|
||||||
val deserializedList = Json.decodeFromString<List<MessagesBackup>>(jsonString)
|
val deserializedList = Json.decodeFromString<List<MessagesBackup>>(jsonString)
|
||||||
if (deserializedList.isEmpty()) {
|
if (deserializedList.isEmpty()) {
|
||||||
activity.toast(R.string.no_entries_for_importing)
|
activity.toast(com.simplemobiletools.commons.R.string.no_entries_for_importing)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ImportMessagesDialog(activity, deserializedList)
|
ImportMessagesDialog(activity, deserializedList)
|
||||||
} catch (e: SerializationException) {
|
} catch (e: SerializationException) {
|
||||||
activity.toast(R.string.invalid_file_format)
|
activity.toast(com.simplemobiletools.commons.R.string.invalid_file_format)
|
||||||
} catch (e: IllegalArgumentException) {
|
} catch (e: IllegalArgumentException) {
|
||||||
activity.toast(R.string.invalid_file_format)
|
activity.toast(com.simplemobiletools.commons.R.string.invalid_file_format)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
activity.showErrorToast(e)
|
activity.showErrorToast(e)
|
||||||
}
|
}
|
||||||
|
@ -134,12 +132,12 @@ class MessagesImporter(private val activity: SimpleActivity) {
|
||||||
refreshMessages()
|
refreshMessages()
|
||||||
}
|
}
|
||||||
when {
|
when {
|
||||||
messagesFailed > 0 && messagesImported > 0 -> activity.toast(R.string.importing_some_entries_failed)
|
messagesFailed > 0 && messagesImported > 0 -> activity.toast(com.simplemobiletools.commons.R.string.importing_some_entries_failed)
|
||||||
messagesFailed > 0 -> activity.toast(R.string.importing_failed)
|
messagesFailed > 0 -> activity.toast(com.simplemobiletools.commons.R.string.importing_failed)
|
||||||
else -> activity.toast(R.string.importing_successful)
|
else -> activity.toast(com.simplemobiletools.commons.R.string.importing_successful)
|
||||||
}
|
}
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
activity.toast(R.string.invalid_file_format)
|
activity.toast(com.simplemobiletools.commons.R.string.invalid_file_format)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,15 @@ class NotificationHelper(private val context: Context) {
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@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))
|
maybeCreateChannel(name = context.getString(R.string.channel_received_sms))
|
||||||
|
|
||||||
val notificationId = threadId.hashCode()
|
val notificationId = threadId.hashCode()
|
||||||
|
@ -96,6 +104,7 @@ class NotificationHelper(private val context: Context) {
|
||||||
setLargeIcon(largeIcon)
|
setLargeIcon(largeIcon)
|
||||||
setStyle(getMessagesStyle(address, body, notificationId, sender))
|
setStyle(getMessagesStyle(address, body, notificationId, sender))
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCK_SCREEN_SENDER -> {
|
LOCK_SCREEN_SENDER -> {
|
||||||
setContentTitle(sender)
|
setContentTitle(sender)
|
||||||
setLargeIcon(largeIcon)
|
setLargeIcon(largeIcon)
|
||||||
|
@ -119,11 +128,14 @@ class NotificationHelper(private val context: Context) {
|
||||||
builder.addAction(replyAction)
|
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)
|
.setChannelId(NOTIFICATION_CHANNEL)
|
||||||
if (isNoReplySms) {
|
if (isNoReplySms) {
|
||||||
builder.addAction(R.drawable.ic_delete_vector, context.getString(R.string.delete), deleteSmsPendingIntent)
|
builder.addAction(
|
||||||
.setChannelId(NOTIFICATION_CHANNEL)
|
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())
|
notificationManager.notify(notificationId, builder.build())
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ class MessagingUtils(val context: Context) {
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
context.showErrorToast(e)
|
context.showErrorToast(e)
|
||||||
} catch (e: Error) {
|
} 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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.simplemobiletools.smsmessenger.models
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import com.simplemobiletools.commons.extensions.normalizePhoneNumber
|
import com.simplemobiletools.commons.extensions.normalizePhoneNumber
|
||||||
import com.simplemobiletools.smsmessenger.R
|
|
||||||
import com.simplemobiletools.smsmessenger.extensions.config
|
import com.simplemobiletools.smsmessenger.extensions.config
|
||||||
import com.simplemobiletools.smsmessenger.extensions.format
|
import com.simplemobiletools.smsmessenger.extensions.format
|
||||||
import com.simplemobiletools.smsmessenger.helpers.parseNameFromVCard
|
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 {
|
private fun VCardProperty.getPropertyTypeString(context: Context): String {
|
||||||
return when (parameters.type) {
|
return when (parameters.type) {
|
||||||
CELL -> context.getString(R.string.mobile)
|
CELL -> context.getString(com.simplemobiletools.commons.R.string.mobile)
|
||||||
HOME -> context.getString(R.string.home)
|
HOME -> context.getString(com.simplemobiletools.commons.R.string.home)
|
||||||
WORK -> context.getString(R.string.work)
|
WORK -> context.getString(com.simplemobiletools.commons.R.string.work)
|
||||||
else -> ""
|
else -> ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,10 +49,22 @@ data class VCardPropertyWrapper(val value: String, val type: String, val propert
|
||||||
when (this) {
|
when (this) {
|
||||||
is Telephone -> VCardPropertyWrapper(text.normalizePhoneNumber(), getPropertyTypeString(context), property)
|
is Telephone -> VCardPropertyWrapper(text.normalizePhoneNumber(), getPropertyTypeString(context), property)
|
||||||
is Email -> VCardPropertyWrapper(value, getPropertyTypeString(context), property)
|
is Email -> VCardPropertyWrapper(value, getPropertyTypeString(context), property)
|
||||||
is Organization -> VCardPropertyWrapper(values.joinToString(), context.getString(R.string.work), property)
|
is Organization -> VCardPropertyWrapper(
|
||||||
is Birthday -> VCardPropertyWrapper(date.format(context.config.dateFormat), context.getString(R.string.birthday), property)
|
value = values.joinToString(),
|
||||||
is Anniversary -> VCardPropertyWrapper(date.format(context.config.dateFormat), context.getString(R.string.anniversary), property)
|
type = context.getString(com.simplemobiletools.commons.R.string.work),
|
||||||
is Note -> VCardPropertyWrapper(value, context.getString(R.string.notes), property)
|
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)
|
else -> VCardPropertyWrapper("", "", property)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.os.Looper
|
||||||
import android.os.PowerManager
|
import android.os.PowerManager
|
||||||
import com.simplemobiletools.commons.extensions.showErrorToast
|
import com.simplemobiletools.commons.extensions.showErrorToast
|
||||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||||
import com.simplemobiletools.smsmessenger.R
|
|
||||||
import com.simplemobiletools.smsmessenger.extensions.conversationsDB
|
import com.simplemobiletools.smsmessenger.extensions.conversationsDB
|
||||||
import com.simplemobiletools.smsmessenger.extensions.deleteScheduledMessage
|
import com.simplemobiletools.smsmessenger.extensions.deleteScheduledMessage
|
||||||
import com.simplemobiletools.smsmessenger.extensions.getAddresses
|
import com.simplemobiletools.smsmessenger.extensions.getAddresses
|
||||||
|
@ -56,7 +55,7 @@ class ScheduledMessageReceiver : BroadcastReceiver() {
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
context.showErrorToast(e)
|
context.showErrorToast(e)
|
||||||
} catch (e: Error) {
|
} 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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
org.gradle.jvmargs=-Xmx8192m
|
org.gradle.jvmargs=-Xmx8192m
|
||||||
android.nonTransitiveRClass=false
|
|
||||||
|
|
Loading…
Reference in New Issue