adding a Manage Blocked Numbers settings item

This commit is contained in:
tibbi 2020-04-08 11:59:34 +02:00
parent 4c7cecbe4e
commit 04152492a5
6 changed files with 44 additions and 3 deletions

View File

@ -36,7 +36,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.24.19'
implementation 'com.simplemobiletools:commons:5.25.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
implementation 'org.greenrobot:eventbus:3.2.0'
}

View File

@ -80,6 +80,11 @@
android:label="@string/frequently_asked_questions"
android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity" />
<activity
android:name="com.simplemobiletools.commons.activities.ManageBlockedNumbersActivity"
android:label="@string/blocked_numbers"
android:parentActivityName=".activities.SettingsActivity"/>
<service
android:name=".services.HeadlessSmsSendService"
android:exported="true"

View File

@ -1,11 +1,16 @@
package com.simplemobiletools.smsmessenger.activities
import android.annotation.TargetApi
import android.content.Intent
import android.os.Build
import android.os.Bundle
import com.simplemobiletools.commons.activities.ManageBlockedNumbersActivity
import com.simplemobiletools.commons.dialogs.ChangeDateTimeFormatDialog
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.isThankYouInstalled
import com.simplemobiletools.commons.extensions.launchPurchaseThankYouIntent
import com.simplemobiletools.commons.extensions.updateTextColors
import com.simplemobiletools.commons.helpers.isNougatPlus
import com.simplemobiletools.smsmessenger.R
import com.simplemobiletools.smsmessenger.extensions.config
import com.simplemobiletools.smsmessenger.helpers.refreshMessages
@ -25,6 +30,7 @@ class SettingsActivity : SimpleActivity() {
setupPurchaseThankYou()
setupCustomizeColors()
setupUseEnglish()
setupManageBlockedNumbers()
setupChangeDateTimeFormat()
updateTextColors(settings_scrollview)
}
@ -52,6 +58,15 @@ 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_holder.beVisibleIf(isNougatPlus())
settings_manage_blocked_numbers_holder.setOnClickListener {
startActivity(Intent(this, ManageBlockedNumbersActivity::class.java))
}
}
private fun setupChangeDateTimeFormat() {
settings_change_date_time_format_holder.setOnClickListener {
ChangeDateTimeFormatDialog(this) {

View File

@ -72,7 +72,7 @@ class MessagesAdapter(
val itemsCnt = selectedKeys.size
val items = resources.getQuantityString(R.plurals.delete_conversations, itemsCnt, itemsCnt)
val baseString = R.string.delete_confirmation
val baseString = R.string.deletion_confirmation
val question = String.format(resources.getString(baseString), items)
ConfirmationDialog(activity, question) {

View File

@ -114,7 +114,7 @@ class ThreadAdapter(
val itemsCnt = selectedKeys.size
val items = resources.getQuantityString(R.plurals.delete_messages, itemsCnt, itemsCnt)
val baseString = R.string.delete_confirmation
val baseString = R.string.deletion_confirmation
val question = String.format(resources.getString(baseString), items)
ConfirmationDialog(activity, question) {

View File

@ -53,6 +53,27 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_manage_blocked_numbers_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_manage_blocked_numbers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingStart="@dimen/medium_margin"
android:text="@string/manage_blocked_numbers" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_change_date_time_format_holder"
android:layout_width="match_parent"