Merge branch 'master' into recyclerview_improvements
This commit is contained in:
commit
2d36794a17
25 changed files with 92 additions and 45 deletions
|
|
@ -6,6 +6,7 @@ import android.os.Build
|
|||
import android.os.Bundle
|
||||
import com.simplemobiletools.commons.activities.ManageBlockedNumbersActivity
|
||||
import com.simplemobiletools.commons.dialogs.ChangeDateTimeFormatDialog
|
||||
import com.simplemobiletools.commons.dialogs.FeatureLockedDialog
|
||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
|
|
@ -128,9 +129,17 @@ class SettingsActivity : SimpleActivity() {
|
|||
// support for device-wise blocking came on Android 7, rely only on that
|
||||
@TargetApi(Build.VERSION_CODES.N)
|
||||
private fun setupManageBlockedNumbers() {
|
||||
settings_manage_blocked_numbers.text = addLockedLabelIfNeeded(R.string.manage_blocked_numbers)
|
||||
settings_manage_blocked_numbers_holder.beVisibleIf(isNougatPlus())
|
||||
|
||||
settings_manage_blocked_numbers_holder.setOnClickListener {
|
||||
startActivity(Intent(this, ManageBlockedNumbersActivity::class.java))
|
||||
if (isOrWasThankYouInstalled()) {
|
||||
Intent(this, ManageBlockedNumbersActivity::class.java).apply {
|
||||
startActivity(this)
|
||||
}
|
||||
} else {
|
||||
FeatureLockedDialog(this) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import androidx.core.view.*
|
|||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||
import com.simplemobiletools.commons.dialogs.FeatureLockedDialog
|
||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
|
|
@ -182,6 +183,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
val firstPhoneNumber = participants.firstOrNull()?.phoneNumbers?.firstOrNull()?.value
|
||||
thread_toolbar.menu.apply {
|
||||
findItem(R.id.delete).isVisible = threadItems.isNotEmpty()
|
||||
findItem(R.id.block_number).title = addLockedLabelIfNeeded(R.string.block_number)
|
||||
findItem(R.id.block_number).isVisible = isNougatPlus()
|
||||
findItem(R.id.dial_number).isVisible = participants.size == 1
|
||||
findItem(R.id.mark_as_unread).isVisible = threadItems.isNotEmpty()
|
||||
|
|
@ -200,7 +202,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
when (menuItem.itemId) {
|
||||
R.id.block_number -> blockNumber()
|
||||
R.id.block_number -> tryBlocking()
|
||||
R.id.delete -> askConfirmDelete()
|
||||
R.id.add_number_to_contact -> addNumberToContact()
|
||||
R.id.dial_number -> dialNumber()
|
||||
|
|
@ -652,6 +654,14 @@ class ThreadActivity : SimpleActivity() {
|
|||
return userPreferredSimIdx ?: senderPreferredSimIdx ?: systemPreferredSimIdx ?: 0
|
||||
}
|
||||
|
||||
private fun tryBlocking() {
|
||||
if (isOrWasThankYouInstalled()) {
|
||||
blockNumber()
|
||||
} else {
|
||||
FeatureLockedDialog(this) { }
|
||||
}
|
||||
}
|
||||
|
||||
private fun blockNumber() {
|
||||
val numbers = participants.getAddresses()
|
||||
val numbersString = TextUtils.join(", ", numbers)
|
||||
|
|
@ -1219,7 +1229,9 @@ class ThreadActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
setupAdapter()
|
||||
setupSIMSelector()
|
||||
runOnUiThread {
|
||||
setupSIMSelector()
|
||||
}
|
||||
}
|
||||
|
||||
private fun isMmsMessage(text: String): Boolean {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue