show groups placeholder at Groups tab, if necessary

This commit is contained in:
tibbi 2018-03-20 16:28:20 +01:00
parent c572a83bb1
commit 0b3acdf518
12 changed files with 82 additions and 1 deletions

View file

@ -5,6 +5,9 @@ import android.content.Intent
import android.support.design.widget.CoordinatorLayout
import android.util.AttributeSet
import android.view.ViewGroup
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
import com.simplemobiletools.commons.extensions.underlineText
import com.simplemobiletools.commons.extensions.updateTextColors
import com.simplemobiletools.contacts.activities.GroupContactsActivity
import com.simplemobiletools.contacts.activities.MainActivity
@ -32,6 +35,13 @@ class GroupsFragment(context: Context, attributeSet: AttributeSet) : Coordinator
}
}
groups_placeholder_2.setOnClickListener {
CreateNewGroupDialog(activity) {
refreshContacts(lastContacts)
}
}
groups_placeholder_2.underlineText()
updateViewStuff()
}
}
@ -62,7 +72,11 @@ class GroupsFragment(context: Context, attributeSet: AttributeSet) : Coordinator
}
}
storedGroups = storedGroups.sortedWith(compareBy { it.title }).toList() as ArrayList<Group>
groups_placeholder_2.beVisibleIf(storedGroups.isEmpty())
groups_placeholder.beVisibleIf(storedGroups.isEmpty())
groups_list.beVisibleIf(storedGroups.isNotEmpty())
storedGroups = storedGroups.sortedWith(compareBy { it.title }) as? ArrayList<Group> ?: ArrayList()
val currAdapter = groups_list.adapter
if (currAdapter == null) {
GroupsAdapter(activity as SimpleActivity, storedGroups, groups_list, groups_fastscroller) {
@ -117,5 +131,6 @@ class GroupsFragment(context: Context, attributeSet: AttributeSet) : Coordinator
context.updateTextColors(groups_wrapper.parent as ViewGroup)
groups_fastscroller.updateBubbleColors()
groups_fastscroller.allowBubbleDisplay = context.config.showInfoBubble
groups_placeholder_2.setTextColor(context.getAdjustedPrimaryColor())
}
}

View file

@ -11,6 +11,32 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/groups_placeholder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/activity_margin"
android:gravity="center"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:text="@string/no_group_created"
android:textSize="@dimen/bigger_text_size"
android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/groups_placeholder_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/groups_placeholder"
android:layout_centerHorizontal="true"
android:gravity="center"
android:paddingBottom="@dimen/medium_margin"
android:paddingTop="@dimen/medium_margin"
android:text="@string/create_group"
android:textSize="@dimen/bigger_text_size"
android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/groups_list"
android:layout_width="match_parent"

View file

@ -19,6 +19,10 @@
<string name="no_groups">No groups</string>
<string name="create_new_group">Create a new group</string>
<string name="remove_from_group">Remove from group</string>
<string name="no_group_participants">This group is empty</string>
<string name="add_contacts">Add contacts</string>
<string name="no_group_created">There are no contact groups on the device</string>
<string name="create_group">Create group</string>
<!-- Photo -->
<string name="take_photo">Foto machen</string>

View file

@ -19,6 +19,10 @@
<string name="no_groups">No groups</string>
<string name="create_new_group">Create a new group</string>
<string name="remove_from_group">Remove from group</string>
<string name="no_group_participants">This group is empty</string>
<string name="add_contacts">Add contacts</string>
<string name="no_group_created">There are no contact groups on the device</string>
<string name="create_group">Create group</string>
<!-- Photo -->
<string name="take_photo">Prendre une photo</string>

View file

@ -19,6 +19,10 @@
<string name="no_groups">No groups</string>
<string name="create_new_group">Create a new group</string>
<string name="remove_from_group">Remove from group</string>
<string name="no_group_participants">This group is empty</string>
<string name="add_contacts">Add contacts</string>
<string name="no_group_created">There are no contact groups on the device</string>
<string name="create_group">Create group</string>
<!-- Photo -->
<string name="take_photo">사진 촬영</string>

View file

@ -19,6 +19,10 @@
<string name="no_groups">Nėra grupių</string>
<string name="create_new_group">Sukurti naują grupę</string>
<string name="remove_from_group">Remove from group</string>
<string name="no_group_participants">This group is empty</string>
<string name="add_contacts">Add contacts</string>
<string name="no_group_created">There are no contact groups on the device</string>
<string name="create_group">Create group</string>
<!-- Photo -->
<string name="take_photo">Nufotografuoti</string>

View file

@ -19,6 +19,10 @@
<string name="no_groups">No groups</string>
<string name="create_new_group">Create a new group</string>
<string name="remove_from_group">Remove from group</string>
<string name="no_group_participants">This group is empty</string>
<string name="add_contacts">Add contacts</string>
<string name="no_group_created">There are no contact groups on the device</string>
<string name="create_group">Create group</string>
<!-- Photo -->
<string name="take_photo">Tirar foto</string>

View file

@ -19,6 +19,10 @@
<string name="no_groups">Нет групп</string>
<string name="create_new_group">Создать новую группу</string>
<string name="remove_from_group">Remove from group</string>
<string name="no_group_participants">This group is empty</string>
<string name="add_contacts">Add contacts</string>
<string name="no_group_created">There are no contact groups on the device</string>
<string name="create_group">Create group</string>
<!-- Photo -->
<string name="take_photo">Снять фото</string>

View file

@ -19,6 +19,10 @@
<string name="no_groups">Žiadne skupiny</string>
<string name="create_new_group">Vytvoriť novú skupinu</string>
<string name="remove_from_group">Odstrániť zo skupiny</string>
<string name="no_group_participants">Skupina je prázdna</string>
<string name="add_contacts">Pridať kontakty</string>
<string name="no_group_created">Nemáte v zariadení vytvorené žiadne skupiny kontaktov</string>
<string name="create_group">Vytvoriť skupinu</string>
<!-- Photo -->
<string name="take_photo">Vytvoriť foto</string>

View file

@ -19,6 +19,10 @@
<string name="no_groups">No groups</string>
<string name="create_new_group">Create a new group</string>
<string name="remove_from_group">Remove from group</string>
<string name="no_group_participants">This group is empty</string>
<string name="add_contacts">Add contacts</string>
<string name="no_group_created">There are no contact groups on the device</string>
<string name="create_group">Create group</string>
<!-- Photo -->
<string name="take_photo">Ta foto</string>

View file

@ -19,6 +19,10 @@
<string name="no_groups">沒有群組</string>
<string name="create_new_group">Create a new group</string>
<string name="remove_from_group">Remove from group</string>
<string name="no_group_participants">This group is empty</string>
<string name="add_contacts">Add contacts</string>
<string name="no_group_created">There are no contact groups on the device</string>
<string name="create_group">Create group</string>
<!-- Photo -->
<string name="take_photo">拍照</string>

View file

@ -19,6 +19,10 @@
<string name="no_groups">No groups</string>
<string name="create_new_group">Create a new group</string>
<string name="remove_from_group">Remove from group</string>
<string name="no_group_participants">This group is empty</string>
<string name="add_contacts">Add contacts</string>
<string name="no_group_created">There are no contact groups on the device</string>
<string name="create_group">Create group</string>
<!-- Photo -->
<string name="take_photo">Take photo</string>