adding some placeholders if no contacts have been found

This commit is contained in:
tibbi 2020-04-13 15:55:36 +02:00
parent 078e8c4f14
commit e8205c7c44
4 changed files with 44 additions and 1 deletions

View File

@ -36,7 +36,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.25.12'
implementation 'com.simplemobiletools:commons:5.25.13'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'com.klinkerapps:android-smsmms:5.2.6'

View File

@ -34,6 +34,12 @@ class NewConversationActivity : SimpleActivity() {
}
}
override fun onResume() {
super.onResume()
no_contacts_placeholder_2.setTextColor(getAdjustedPrimaryColor())
no_contacts_placeholder_2.underlineText()
}
private fun initContacts() {
if (isThirdPartyIntent()) {
return
@ -80,6 +86,11 @@ class NewConversationActivity : SimpleActivity() {
}
private fun setupAdapter(contacts: ArrayList<Contact>) {
val hasContacts = contacts.isNotEmpty()
contacts_list.beVisibleIf(hasContacts)
no_contacts_placeholder.beVisibleIf(!hasContacts)
no_contacts_placeholder_2.beVisibleIf(!hasContacts)
ContactsAdapter(this, contacts, contacts_list, null) {
hideKeyboard()
launchThreadActivity((it as Contact).phoneNumber, it.name)

View File

@ -38,6 +38,35 @@
android:background="@color/divider_grey"
android:importantForAccessibility="no" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/no_contacts_placeholder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/bigger_margin"
android:alpha="0.8"
android:gravity="center"
android:paddingLeft="@dimen/activity_margin"
android:layout_below="@+id/message_divider_two"
android:paddingRight="@dimen/activity_margin"
android:text="@string/no_access_to_contacts"
android:textSize="@dimen/bigger_text_size"
android:textStyle="italic"
android:visibility="gone" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/no_contacts_placeholder_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/no_contacts_placeholder"
android:layout_centerHorizontal="true"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:padding="@dimen/activity_margin"
android:text="@string/request_the_required_permissions"
android:textSize="@dimen/bigger_text_size"
android:visibility="gone" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/suggestions_label"
android:layout_width="wrap_content"

View File

@ -4,6 +4,9 @@
<string name="type_a_message">Escreva uma mensagem…</string>
<string name="message_not_sent">Mensagem não enviada.</string>
<string name="add_person">Adicionar pessoa</string>
<string name="attachment">Attachment</string>
<string name="no_conversations_found">No stored conversations have been found</string>
<string name="start_conversation">Start a conversation</string>
<!-- New message -->
<string name="new_conversation">New conversation</string>