adding a settings button for managing blocked numbers

This commit is contained in:
tibbi 2018-11-30 10:42:08 +01:00
parent 1e6f001b02
commit 267a4c01c6
2 changed files with 35 additions and 0 deletions

View File

@ -1,14 +1,18 @@
package com.simplemobiletools.contacts.pro.activities
import android.annotation.TargetApi
import android.os.Build
import android.os.Bundle
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.updateTextColors
import com.simplemobiletools.commons.helpers.isNougatPlus
import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.dialogs.ManageVisibleFieldsDialog
import com.simplemobiletools.contacts.pro.dialogs.ManageVisibleTabsDialog
import com.simplemobiletools.contacts.pro.extensions.config
import com.simplemobiletools.contacts.pro.extensions.telecomManager
import com.simplemobiletools.contacts.pro.helpers.ON_CLICK_CALL_CONTACT
import com.simplemobiletools.contacts.pro.helpers.ON_CLICK_EDIT_CONTACT
import com.simplemobiletools.contacts.pro.helpers.ON_CLICK_VIEW_CONTACT
@ -27,6 +31,7 @@ class SettingsActivity : SimpleActivity() {
setupCustomizeColors()
setupManageShownContactFields()
setupManageShownTabs()
setupManageBlockedNumbers()
setupUseEnglish()
setupShowInfoBubble()
setupShowContactThumbnails()
@ -59,6 +64,14 @@ class SettingsActivity : SimpleActivity() {
}
}
@TargetApi(Build.VERSION_CODES.N)
private fun setupManageBlockedNumbers() {
settings_manage_blocked_numbers.beVisibleIf(isNougatPlus())
settings_manage_blocked_numbers.setOnClickListener {
startActivity(telecomManager.createManageBlockedNumbersIntent())
}
}
private fun setupUseEnglish() {
settings_use_english_holder.beVisibleIf(config.wasUseEnglishToggled || Locale.getDefault().language != "en")
settings_use_english.isChecked = config.useEnglish

View File

@ -78,6 +78,28 @@
</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:paddingLeft="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingRight="@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:paddingLeft="@dimen/medium_margin"
android:text="@string/manage_blocked_numbers"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_use_english_holder"
android:layout_width="match_parent"