fix group member edit icons, improve design

This commit is contained in:
Haafingar 2020-06-22 15:49:18 +10:00
parent 6d615fbb9d
commit 40bfae9042
6 changed files with 32 additions and 24 deletions

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M6,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM18,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
</vector>

View File

@ -18,6 +18,15 @@
android:layout_marginTop="@dimen/small_spacing"
android:layout_marginRight="@dimen/large_spacing">
<ImageView
android:id="@+id/cancelEditButton"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_toLeftOf="@+id/groupNameEditText"
android:layout_centerVertical="true"
android:src="@drawable/ic_close_white_24dp"
android:visibility="gone" />
<EditText
style="@style/SessionEditText"
android:id="@+id/groupNameEditText"
@ -27,10 +36,10 @@
android:textAlignment="center"
android:paddingTop="12dp"
android:paddingBottom="@dimen/large_spacing"
android:paddingHorizontal="@dimen/large_spacing"
android:visibility="invisible"
android:hint="@string/activity_edit_closed_group_edit_text_hint" />
<TextView
android:id="@+id/displayNameTextView"
android:layout_width="wrap_content"
@ -42,6 +51,15 @@
android:drawableRight="@drawable/ic_edit_white_24dp"
android:drawablePadding="@dimen/small_spacing"/>
<ImageView
android:id="@+id/saveEditButton"
android:layout_width="36dp"
android:layout_height="36dp"
android:src="@drawable/ic_check_white_24dp"
android:layout_toRightOf="@+id/groupNameEditText"
android:layout_centerVertical="true"
android:visibility="gone" />
</RelativeLayout>
<LinearLayout
@ -52,22 +70,6 @@
android:layout_height="0px"
android:layout_width="@dimen/large_spacing"/>
<ImageView
android:id="@+id/cancelEditButton"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_weight="1"
android:src="@drawable/ic_close_white_24dp"
android:visibility="gone" />
<ImageView
android:id="@+id/saveEditButton"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_check_white_24dp"
android:layout_weight="1"
android:visibility="gone" />
<View
android:layout_weight="2"
android:layout_height="0px"

View File

@ -43,6 +43,6 @@ class EditClosedGroupAdapter(private val context: Context) : RecyclerView.Adapte
val member = members[position]
viewHolder.view.setOnClickListener { memberClickListener?.onMemberClick(member) }
val isSelected = selectedMembers.contains(member)
viewHolder.view.bind(Recipient.from(context, Address.fromSerialized(member), false), isSelected, glide)
viewHolder.view.bind(Recipient.from(context, Address.fromSerialized(member), false), isSelected, glide, true)
}
}

View File

@ -30,7 +30,7 @@ class SelectContactsAdapter(private val context: Context) : RecyclerView.Adapter
val member = members[position]
viewHolder.view.setOnClickListener { memberClickListener?.onMemberClick(member) }
val isSelected = selectedMembers.contains(member)
viewHolder.view.bind(Recipient.from(context, Address.fromSerialized(member), false), isSelected, glide)
viewHolder.view.bind(Recipient.from(context, Address.fromSerialized(member), false), isSelected, glide, false)
}
fun onMemberClick(member: String) {

View File

@ -52,7 +52,7 @@ class ContactSelectionListAdapter(private val context: Context, private val mult
item as ContactSelectionListItem.Contact
viewHolder.view.setOnClickListener { contactClickListener?.onContactClick(item.recipient) }
val isSelected = selectedContacts.contains(item.recipient)
viewHolder.view.bind(item.recipient, isSelected, glide)
viewHolder.view.bind(item.recipient, isSelected, glide, false)
viewHolder.view.setCheckBoxVisible(multiSelect)
} else if (viewHolder is DividerViewHolder) {
item as ContactSelectionListItem.Header

View File

@ -44,7 +44,7 @@ class UserView : LinearLayout {
tickImageView.visibility = if (visible) View.VISIBLE else View.GONE
}
fun bind(user: Recipient, isSelected: Boolean, glide: GlideRequests) {
fun bind(user: Recipient, isSelected: Boolean, glide: GlideRequests, isEditingGroup: Boolean) {
val address = user.address.serialize()
if (user.isGroupRecipient) {
if ("Session Public Chat" == user.name || user.address.isRSSFeed) {
@ -59,18 +59,19 @@ class UserView : LinearLayout {
profilePictureView.hexEncodedPublicKey = randomUsers.getOrNull(0) ?: ""
profilePictureView.additionalHexEncodedPublicKey = randomUsers.getOrNull(1) ?: ""
profilePictureView.isRSSFeed = false
}
} else {
profilePictureView.hexEncodedPublicKey = address
profilePictureView.additionalHexEncodedPublicKey = null
profilePictureView.isRSSFeed = false
}
tickImageView.setImageResource(R.drawable.ic_edit_white_24dp)
profilePictureView.glide = glide
profilePictureView.update()
nameTextView.text = user.name ?: "Unknown Contact"
if (user.isGroupRecipient) {
// this doesnt work, find out how to work out if the user is a part of the group)
tickImageView.setImageResource(R.drawable.ic_edit_white_24dp)
if (isEditingGroup) {
tickImageView.setImageResource(R.drawable.ic_more_horiz_white)
} else {
tickImageView.setImageResource(if (isSelected) R.drawable.ic_circle_check else R.drawable.ic_circle)
}