Build out blocking client for pre api 24 devices

This commit is contained in:
moezbhatti
2019-06-26 02:01:46 -04:00
parent c04a368cc8
commit 83090452b5
19 changed files with 624 additions and 38 deletions
@@ -23,25 +23,22 @@ import android.content.Intent
import android.os.Build
import android.provider.BlockedNumberContract
import android.telecom.TelecomManager
import android.telephony.PhoneNumberUtils
import androidx.core.content.contentValuesOf
import com.moez.QKSMS.extensions.anyOf
import com.moez.QKSMS.model.BlockedNumber
import com.moez.QKSMS.repository.BlockingRepository
import io.reactivex.Completable
import io.reactivex.Single
import io.realm.Realm
import javax.inject.Inject
class QkBlockingClient @Inject constructor(private val context: Context) : BlockingClient {
class QkBlockingClient @Inject constructor(
private val context: Context,
private val blockingRepo: BlockingRepository
) : BlockingClient {
override fun isBlocked(address: String): Single<Boolean> = Single.fromCallable {
when {
Build.VERSION.SDK_INT >= 24 -> BlockedNumberContract.isBlocked(context, address)
else -> Realm.getDefaultInstance()
.where(BlockedNumber::class.java)
.findAll()
.any { number -> PhoneNumberUtils.compare(number.address, address) }
else -> blockingRepo.isBlocked(address)
}
}
@@ -54,14 +51,7 @@ class QkBlockingClient @Inject constructor(private val context: Context) : Block
context.contentResolver.insert(BlockedNumberContract.BlockedNumbers.CONTENT_URI, cv)
}
else -> Realm.getDefaultInstance().use { realm ->
val maxId = realm.where(BlockedNumber::class.java)
.max("id")?.toLong() ?: -1
realm.executeTransaction {
realm.insert(addresses.mapIndexed { index, address -> BlockedNumber(maxId + 1 + index, address) })
}
}
else -> blockingRepo.blockNumber(*addresses.toTypedArray())
}
}
@@ -73,21 +63,7 @@ class QkBlockingClient @Inject constructor(private val context: Context) : Block
BlockedNumberContract.unblock(context, address)
}
else -> Realm.getDefaultInstance().use { realm ->
val ids = realm
.where(BlockedNumber::class.java)
.findAll()
.filter { number ->
addresses.any { address -> PhoneNumberUtils.compare(number.address, address) }
}
.map { number -> number.id }
.toLongArray()
realm.executeTransaction {
realm.where(BlockedNumber::class.java)
.anyOf("id", ids)
}
}
else -> blockingRepo.unblockNumbers(*addresses.toTypedArray())
}
}
@@ -100,7 +76,7 @@ class QkBlockingClient @Inject constructor(private val context: Context) : Block
context.startActivity(intent)
}
else -> {} // TODO
else -> {} // TODO: Do this here once we implement AndroidX navigation
}
}
@@ -0,0 +1,87 @@
/*
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
*
* This file is part of QKSMS.
*
* QKSMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QKSMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.moez.QKSMS.repository
import android.telephony.PhoneNumberUtils
import com.moez.QKSMS.extensions.anyOf
import com.moez.QKSMS.model.BlockedNumber
import io.realm.Realm
import io.realm.RealmResults
import javax.inject.Inject
class BlockingRepositoryImpl @Inject constructor() : BlockingRepository {
override fun blockNumber(vararg addresses: String) {
val newAddresses = addresses.filter { address -> !isBlocked(address) }
Realm.getDefaultInstance().use { realm ->
val maxId = realm.where(BlockedNumber::class.java)
.max("id")?.toLong() ?: -1
realm.executeTransaction {
realm.insert(newAddresses.mapIndexed { index, address -> BlockedNumber(maxId + 1 + index, address) })
}
}
}
override fun getBlockedNumbers(): RealmResults<BlockedNumber> {
val realm = Realm.getDefaultInstance()
return realm.where(BlockedNumber::class.java)
.findAllAsync()
}
override fun isBlocked(address: String): Boolean {
return Realm.getDefaultInstance().use { realm ->
realm.where(BlockedNumber::class.java)
.findAll()
.any { number -> PhoneNumberUtils.compare(number.address, address) }
}
}
override fun unblockNumber(id: Long) {
Realm.getDefaultInstance().use { realm ->
realm.executeTransaction {
realm.where(BlockedNumber::class.java)
.equalTo("id", id)
.findAll()
.deleteAllFromRealm()
}
}
}
override fun unblockNumbers(vararg addresses: String) {
Realm.getDefaultInstance().use { realm ->
val ids = realm.where(BlockedNumber::class.java)
.findAll()
.filter { number ->
addresses.any { address -> PhoneNumberUtils.compare(number.address, address) }
}
.map { number -> number.id }
.toLongArray()
realm.executeTransaction {
realm.where(BlockedNumber::class.java)
.anyOf("id", ids)
.findAll()
.deleteAllFromRealm()
}
}
}
}
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
*
* This file is part of QKSMS.
*
* QKSMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QKSMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.moez.QKSMS.repository
import com.moez.QKSMS.model.BlockedNumber
import io.realm.RealmResults
interface BlockingRepository {
fun blockNumber(vararg addresses: String)
fun getBlockedNumbers(): RealmResults<BlockedNumber>
fun isBlocked(address: String): Boolean
fun unblockNumber(id: Long)
fun unblockNumbers(vararg addresses: String)
}
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
*
* This file is part of QKSMS.
*
* QKSMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QKSMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.moez.QKSMS.feature.blocking
import android.view.View
@@ -10,6 +28,7 @@ import com.moez.QKSMS.common.base.QkController
import com.moez.QKSMS.common.util.Colors
import com.moez.QKSMS.common.util.extensions.setTint
import com.moez.QKSMS.feature.blocking.manager.BlockingManagerController
import com.moez.QKSMS.feature.blocking.numbers.BlockedNumbersController
import com.moez.QKSMS.injection.appComponent
import io.reactivex.Observable
import kotlinx.android.synthetic.main.blocking_controller.*
@@ -61,4 +80,10 @@ class BlockingController : QkController<BlockingView, BlockingState, BlockingPre
.popChangeHandler(QkChangeHandler()))
}
override fun openBlockedNumbers() {
router.pushController(RouterTransaction.with(BlockedNumbersController())
.pushChangeHandler(QkChangeHandler())
.popChangeHandler(QkChangeHandler()))
}
}
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
*
* This file is part of QKSMS.
*
* QKSMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QKSMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.moez.QKSMS.feature.blocking
import android.app.Activity
@@ -51,7 +69,7 @@ class BlockingDialog @Inject constructor(
val manager = context.getString(when (prefs.blockingManager.get()) {
Preferences.BLOCKING_MANAGER_SIA -> R.string.blocking_manager_sia_title
Preferences.BLOCKING_MANAGER_CC -> R.string.blocking_manager_call_control_title
else -> R.string.blocking_manager_android
else -> R.string.app_name
})
val message = context.resources.getQuantityString(res, addresses.size, manager)
@@ -1,6 +1,25 @@
/*
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
*
* This file is part of QKSMS.
*
* QKSMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QKSMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.moez.QKSMS.feature.blocking
import android.content.Context
import android.os.Build
import com.moez.QKSMS.R
import com.moez.QKSMS.blocking.BlockingManager
import com.moez.QKSMS.common.Navigator
@@ -31,7 +50,7 @@ class BlockingPresenter @Inject constructor(
}
}
.map(context::getString)
.subscribe { manager -> newState { copy(blockingManager = manager) }}
.subscribe { manager -> newState { copy(blockingManager = manager) } }
disposables += prefs.drop.asObservable()
.subscribe { enabled -> newState { copy(dropEnabled = enabled) } }
@@ -46,7 +65,15 @@ class BlockingPresenter @Inject constructor(
view.settingsClicks
.autoDisposable(view.scope())
.subscribe { blockingManager.openSettings() }
.subscribe {
// TODO: This is a hack, get rid of it once we implement AndroidX navigation
val client = prefs.blockingManager.get()
if (client == Preferences.BLOCKING_MANAGER_QKSMS && Build.VERSION.SDK_INT < 24) {
view.openBlockedNumbers()
} else {
blockingManager.openSettings()
}
}
view.dropClickedIntent
.autoDisposable(view.scope())
@@ -29,4 +29,5 @@ interface BlockingView : QkViewContract<BlockingState> {
val conversationClicks: Observable<Long>
fun openBlockingManager()
fun openBlockedNumbers()
}
@@ -0,0 +1,52 @@
/*
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
*
* This file is part of QKSMS.
*
* QKSMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QKSMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.moez.QKSMS.feature.blocking.numbers
import android.view.LayoutInflater
import android.view.ViewGroup
import com.moez.QKSMS.R
import com.moez.QKSMS.common.base.QkRealmAdapter
import com.moez.QKSMS.common.base.QkViewHolder
import com.moez.QKSMS.model.BlockedNumber
import io.reactivex.subjects.PublishSubject
import io.reactivex.subjects.Subject
import kotlinx.android.synthetic.main.blocked_number_list_item.*
import kotlinx.android.synthetic.main.blocked_number_list_item.view.*
class BlockedNumbersAdapter : QkRealmAdapter<BlockedNumber>() {
val unblockAddress: Subject<Long> = PublishSubject.create()
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder {
val view = LayoutInflater.from(parent.context).inflate(R.layout.blocked_number_list_item, parent, false)
return QkViewHolder(view).apply {
containerView.unblock.setOnClickListener {
val number = getItem(adapterPosition) ?: return@setOnClickListener
unblockAddress.onNext(number.id)
}
}
}
override fun onBindViewHolder(holder: QkViewHolder, position: Int) {
val item = getItem(position)!!
holder.number.text = item.address
}
}
@@ -0,0 +1,87 @@
/*
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
*
* This file is part of QKSMS.
*
* QKSMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QKSMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.moez.QKSMS.feature.blocking.numbers
import android.view.LayoutInflater
import android.view.View
import androidx.appcompat.app.AlertDialog
import com.jakewharton.rxbinding2.view.clicks
import com.moez.QKSMS.R
import com.moez.QKSMS.common.base.QkController
import com.moez.QKSMS.common.util.Colors
import com.moez.QKSMS.common.util.extensions.setBackgroundTint
import com.moez.QKSMS.common.util.extensions.setTint
import com.moez.QKSMS.injection.appComponent
import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject
import io.reactivex.subjects.Subject
import kotlinx.android.synthetic.main.blocked_numbers_add_dialog.view.*
import kotlinx.android.synthetic.main.blocked_numbers_controller.*
import javax.inject.Inject
class BlockedNumbersController : QkController<BlockedNumbersView, BlockedNumbersState, BlockedNumbersPresenter>(),
BlockedNumbersView {
@Inject override lateinit var presenter: BlockedNumbersPresenter
@Inject lateinit var colors: Colors
private val adapter = BlockedNumbersAdapter()
private val saveAddressSubject: Subject<String> = PublishSubject.create()
init {
appComponent.inject(this)
retainViewMode = RetainViewMode.RETAIN_DETACH
layoutRes = R.layout.blocked_numbers_controller
}
override fun onAttach(view: View) {
super.onAttach(view)
presenter.bindIntents(this)
setTitle(R.string.blocked_numbers_title)
showBackButton(true)
}
override fun onViewCreated() {
super.onViewCreated()
add.setBackgroundTint(colors.theme().theme)
add.setTint(colors.theme().textPrimary)
adapter.emptyView = empty
numbers.adapter = adapter
}
override fun render(state: BlockedNumbersState) {
adapter.updateData(state.numbers)
}
override fun unblockAddress(): Observable<Long> = adapter.unblockAddress
override fun addAddress(): Observable<*> = add.clicks()
override fun saveAddress(): Observable<String> = saveAddressSubject
override fun showAddDialog() {
val layout = LayoutInflater.from(activity).inflate(R.layout.blocked_numbers_add_dialog, null)
val dialog = AlertDialog.Builder(activity!!)
.setView(layout)
.setPositiveButton(R.string.blocked_numbers_dialog_block) { _, _ ->
saveAddressSubject.onNext(layout.input.text.toString())
}
.setNegativeButton(R.string.button_cancel) { _, _ -> }
dialog.show()
}
}
@@ -0,0 +1,49 @@
/*
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
*
* This file is part of QKSMS.
*
* QKSMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QKSMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.moez.QKSMS.feature.blocking.numbers
import com.moez.QKSMS.common.base.QkPresenter
import com.moez.QKSMS.repository.BlockingRepository
import com.uber.autodispose.kotlin.autoDisposable
import javax.inject.Inject
class BlockedNumbersPresenter @Inject constructor(
private val blockingRepo: BlockingRepository
) : QkPresenter<BlockedNumbersView, BlockedNumbersState>(
BlockedNumbersState(numbers = blockingRepo.getBlockedNumbers())
) {
override fun bindIntents(view: BlockedNumbersView) {
super.bindIntents(view)
view.unblockAddress()
.doOnNext(blockingRepo::unblockNumber)
.autoDisposable(view.scope())
.subscribe()
view.addAddress()
.autoDisposable(view.scope())
.subscribe { view.showAddDialog() }
view.saveAddress()
.autoDisposable(view.scope())
.subscribe{ address -> blockingRepo.blockNumber(address) }
}
}
@@ -0,0 +1,27 @@
/*
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
*
* This file is part of QKSMS.
*
* QKSMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QKSMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.moez.QKSMS.feature.blocking.numbers
import com.moez.QKSMS.model.BlockedNumber
import io.realm.RealmList
import io.realm.RealmResults
data class BlockedNumbersState(
val numbers: RealmResults<BlockedNumber>? = null
)
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
*
* This file is part of QKSMS.
*
* QKSMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QKSMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.moez.QKSMS.feature.blocking.numbers
import com.moez.QKSMS.common.base.QkViewContract
import io.reactivex.Observable
interface BlockedNumbersView : QkViewContract<BlockedNumbersState> {
fun unblockAddress(): Observable<Long>
fun addAddress(): Observable<*>
fun saveAddress(): Observable<String>
fun showAddDialog()
}
@@ -31,6 +31,7 @@ import com.moez.QKSMS.common.widget.RadioPreferenceView
import com.moez.QKSMS.feature.backup.BackupController
import com.moez.QKSMS.feature.blocking.BlockingController
import com.moez.QKSMS.feature.blocking.manager.BlockingManagerController
import com.moez.QKSMS.feature.blocking.numbers.BlockedNumbersController
import com.moez.QKSMS.feature.compose.DetailedChipView
import com.moez.QKSMS.feature.conversationinfo.injection.ConversationInfoComponent
import com.moez.QKSMS.feature.settings.SettingsController
@@ -62,6 +63,7 @@ interface AppComponent {
fun inject(controller: AboutController)
fun inject(controller: BackupController)
fun inject(controller: BlockedNumbersController)
fun inject(controller: BlockingController)
fun inject(controller: BlockingManagerController)
fun inject(controller: SettingsController)
@@ -1,4 +1,3 @@
/*
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
*
@@ -64,6 +63,8 @@ import com.moez.QKSMS.mapper.CursorToRecipientImpl
import com.moez.QKSMS.mapper.RatingManagerImpl
import com.moez.QKSMS.repository.BackupRepository
import com.moez.QKSMS.repository.BackupRepositoryImpl
import com.moez.QKSMS.repository.BlockingRepository
import com.moez.QKSMS.repository.BlockingRepositoryImpl
import com.moez.QKSMS.repository.ContactRepository
import com.moez.QKSMS.repository.ContactRepositoryImpl
import com.moez.QKSMS.repository.ConversationRepository
@@ -174,6 +175,9 @@ class AppModule(private var application: Application) {
@Provides
fun provideBackupRepository(repository: BackupRepositoryImpl): BackupRepository = repository
@Provides
fun provideBlockingRepository(repository: BlockingRepositoryImpl): BlockingRepository = repository
@Provides
fun provideContactRepository(repository: ContactRepositoryImpl): ContactRepository = repository
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="48dp"
android:orientation="horizontal">
<com.moez.QKSMS.common.widget.QkTextView
android:id="@+id/number"
style="@style/TextPrimary"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingStart="24dp"
tools:text="(123) 456-7890" />
<ImageView
android:id="@+id/unblock"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:background="?android:attr/selectableItemBackground"
android:padding="12dp"
android:src="@drawable/ic_close_black_24dp"
android:tint="?android:attr/textColorSecondary" />
</LinearLayout>
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.moez.QKSMS.common.widget.QkTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="24dp"
android:text="@string/blocked_numbers_dialog_title"
app:textColor="primary"
app:textSize="dialog" />
<com.moez.QKSMS.common.widget.QkEditText
android:id="@+id/input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:hint="@string/blocked_numbers_dialog_hint"
android:paddingStart="24dp"
android:inputType="phone"
android:paddingTop="16dp"
android:paddingEnd="24dp"
android:paddingBottom="16dp"
android:textColorHint="?android:attr/textColorTertiary"
app:textSize="primary" />
</LinearLayout>
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/windowBackground"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/numbers"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dp"
android:paddingBottom="8dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<com.moez.QKSMS.common.widget.QkTextView
android:id="@+id/empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/blocked_numbers_empty"
app:textColor="tertiary" />
<ImageView
android:id="@+id/add"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:background="@drawable/circle_ripple"
android:contentDescription="@string/blocked_numbers_add_cd"
android:elevation="8dp"
android:padding="16dp"
android:src="@drawable/ic_add_black_24dp"
android:tint="@color/white"
tools:backgroundTint="@color/tools_theme" />
</FrameLayout>
@@ -57,6 +57,7 @@
android:layout_width="72dp"
android:layout_height="72dp"
android:background="?attr/selectableItemBackground"
android:contentDescription="@string/blocking_manager_settings_cd"
android:padding="24dp"
android:src="@drawable/ic_settings_black_24dp"
app:layout_constraintBottom_toBottomOf="@id/blockingManager"
+8 -1
View File
@@ -252,6 +252,7 @@
<string name="settings_delay_duration_hint">Enter duration (seconds)</string>
<string name="blocking_title">Blocking</string>
<string name="blocking_manager_settings_cd">Open settings for selected blocking manager</string>
<string name="blocking_drop_title">Drop messages</string>
<string name="blocking_drop_summary">Drop incoming messages from blocked senders instead of hiding them</string>
<string name="blocking_conversations">Blocked conversations</string>
@@ -259,7 +260,6 @@
<string name="blocking_manager_title">Blocking Manager</string>
<string name="blocking_manager_qksms_summary">Built-in blocking functionality in QKSMS</string>
<string name="blocking_manager_android">Android Blocking Manager</string>
<!-- Do not translate -->
<string name="blocking_manager_call_control_title">Call Control</string>
<string name="blocking_manager_call_control_summary">Automatically filter your calls and messages in one convenient place! Community IQ™ allows you to prevent unwanted messages from community known spammers</string>
@@ -267,6 +267,13 @@
<string name="blocking_manager_sia_title">Should I Answer?</string>
<string name="blocking_manager_sia_summary">Automatically filter messages from unsolicited numbers by using the \"Should I Answer\" app</string>
<string name="blocked_numbers_title">Blocked numbers</string>
<string name="blocked_numbers_empty">Your blocked numbers will appear here</string>
<string name="blocked_numbers_add_cd">Block a new number</string>
<string name="blocked_numbers_dialog_title">Block texts from</string>
<string name="blocked_numbers_dialog_hint">Phone number</string>
<string name="blocked_numbers_dialog_block">Block</string>
<plurals name="blocking_block_external">
<item quantity="one">Would you also like to block this number in %s?</item>
<item quantity="other">Would you also like to block these numbers in %s?</item>