Add notice about Contacts to blacklist editor

This commit is contained in:
xynngh 2020-09-05 13:13:13 +04:00
parent 6ee9653e2e
commit 6578b8eb1a
4 changed files with 24 additions and 1 deletions

View File

@ -76,7 +76,6 @@ public class EditBlacklistItemActivity extends AppCompatActivity {
nameTextField = findViewById(R.id.nameTextField);
patternTextField = findViewById(R.id.patternTextField);
TextView statsTextView = findViewById(R.id.stats);
EditText patternEditText = Objects.requireNonNull(patternTextField.getEditText());
patternEditText.addTextChangedListener(new TextWatcher() {
@ -132,6 +131,7 @@ public class EditBlacklistItemActivity extends AppCompatActivity {
setString(patternTextField, pattern);
}
TextView statsTextView = findViewById(R.id.stats);
if (blacklistItem != null) {
String statsString;
if (blacklistItem.getNumberOfCalls() > 0) {
@ -155,6 +155,15 @@ public class EditBlacklistItemActivity extends AppCompatActivity {
statsTextView.setVisibility(View.GONE);
}
TextView contactsNoticeTextView = findViewById(R.id.contactsNotBlockedNotice);
if (App.getSettings().getUseContacts()) {
if (!PermissionHelper.hasContactsPermission(this)) {
contactsNoticeTextView.setText(R.string.contacts_are_not_blocked_no_permission);
}
} else {
contactsNoticeTextView.setText(R.string.contacts_are_not_blocked_not_enabled);
}
patternTextField.requestFocus();
}

View File

@ -55,6 +55,14 @@
android:textAppearance="?android:attr/textAppearanceMedium"
tools:text="3 calls, last: Aug 01, 2020 10:10" />
<TextView
android:id="@+id/contactsNotBlockedNotice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/item_padding"
android:text="@string/contacts_are_not_blocked_blacklist_notice"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</ScrollView>

View File

@ -140,6 +140,9 @@
<string name="number_pattern_incorrect">Некорректный шаблон</string>
<string name="number_pattern_empty">Пустой шаблон</string>
<string name="number_pattern_hint">Введите номер в формате +СТРАНА-НОМЕР (как Android показал бы в списке вызовов). Используйте \"*\" как подстановку для нуля и более цифр и \"#\" для одной цифры.</string>
<string name="contacts_are_not_blocked_blacklist_notice">Звонки от контактов никогда не блокируются (даже если номер совпадает с шаблоном из чёрного списка)</string>
<string name="contacts_are_not_blocked_not_enabled">Звонки от контактов могут быть заблокированы, т.к. опция "Доступ к контактам" не включена!</string>
<string name="contacts_are_not_blocked_no_permission">Звонки от контактов могут быть заблокированы, т.к. разрешение на доступ к контактам не предоставлено!</string>
<string name="info_in_blacklist">В чёрном списке</string>
<string name="info_in_blacklist_contact">В чёрном списке (контакты не блокируются)</string>
<string name="add_to_blacklist">Добавить в чёрный список</string>

View File

@ -155,6 +155,9 @@
<string name="number_pattern_incorrect">Incorrect pattern</string>
<string name="number_pattern_empty">Empty pattern</string>
<string name="number_pattern_hint">Enter the number in +COUNTRY-NUMBER format (as Android would show in your dialer). Use \"*\" as a wildcard for zero or more digits, and \"#\" for exactly one digit.</string>
<string name="contacts_are_not_blocked_blacklist_notice">Calls from contacts are never blocked (even if the number matches the blacklist pattern)</string>
<string name="contacts_are_not_blocked_not_enabled">Calls from contacts may be blocked because the \"Use contacts\" option is not enabled!</string>
<string name="contacts_are_not_blocked_no_permission">Calls from contacts may be blocked because the \"Contacts\" permission is not granted!</string>
<string name="info_in_blacklist">In blacklist</string>
<string name="info_in_blacklist_contact">In blacklist (contacts are not blocked)</string>
<string name="add_to_blacklist">Add to blacklist</string>