adding some more conversation details UI fixes

This commit is contained in:
tibbi 2023-01-01 23:10:12 +01:00
parent d42fa509b4
commit b0225c1693
3 changed files with 42 additions and 54 deletions

View File

@ -2,10 +2,10 @@ package com.simplemobiletools.smsmessenger.activities
import android.os.Bundle
import androidx.core.content.res.ResourcesCompat
import com.simplemobiletools.commons.extensions.adjustAlpha
import com.simplemobiletools.commons.extensions.applyColorFilter
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
import com.simplemobiletools.commons.extensions.getProperTextColor
import com.simplemobiletools.commons.helpers.HIGHER_ALPHA
import com.simplemobiletools.commons.extensions.updateTextColors
import com.simplemobiletools.commons.helpers.NavigationIcon
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.models.SimpleContact
@ -45,18 +45,17 @@ class ConversationDetailsActivity : SimpleActivity() {
override fun onResume() {
super.onResume()
setupToolbar(conversation_details_toolbar, NavigationIcon.Arrow)
updateTextColors(conversation_details_holder)
val primaryColor = getProperPrimaryColor()
conversation_name_heading.setTextColor(primaryColor)
members_heading.setTextColor(primaryColor)
}
private fun setupTextViews() {
val textColor = getProperTextColor()
val headingColor = textColor.adjustAlpha(HIGHER_ALPHA)
members_heading.setTextColor(headingColor)
conversation_name_heading.setTextColor(headingColor)
conversation_name.apply {
setTextColor(textColor)
ResourcesCompat.getDrawable(resources, R.drawable.ic_edit_vector, theme)?.apply {
applyColorFilter(textColor)
applyColorFilter(getProperTextColor())
setCompoundDrawablesWithIntrinsicBounds(null, null, this, null)
}

View File

@ -4,10 +4,10 @@ import android.app.Activity
import android.content.DialogInterface.BUTTON_POSITIVE
import android.view.ViewGroup
import androidx.appcompat.app.AlertDialog
import androidx.core.widget.doAfterTextChanged
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.extensions.showKeyboard
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.smsmessenger.R
import com.simplemobiletools.smsmessenger.models.Conversation
import kotlinx.android.synthetic.main.dialog_rename_conversation.view.*
@ -25,11 +25,8 @@ class RenameConversationDialog(
if (conversation.usesCustomTitle) {
setText(conversation.title)
}
hint = conversation.title
doAfterTextChanged {
dialog?.getButton(BUTTON_POSITIVE)?.isEnabled = !it.isNullOrEmpty()
}
hint = conversation.title
}
}
@ -41,11 +38,15 @@ class RenameConversationDialog(
dialog = alertDialog
alertDialog.showKeyboard(view.rename_conv_edit_text)
alertDialog.getButton(BUTTON_POSITIVE).apply {
val newTitle = view.rename_conv_edit_text.text.toString()
isEnabled = newTitle.isNotEmpty() && (newTitle != conversation.title)
setOnClickListener {
val newTitle = view.rename_conv_edit_text.text.toString()
if (newTitle.isEmpty()) {
activity.toast(R.string.empty_name)
return@setOnClickListener
}
callback(newTitle)
alertDialog.dismiss()
callback(view.rename_conv_edit_text.text.toString())
}
}
}

View File

@ -14,75 +14,63 @@
app:title="@string/conversation_details"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
<androidx.constraintlayout.widget.ConstraintLayout
<LinearLayout
android:id="@+id/conversation_details_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize">
android:layout_marginTop="?attr/actionBarSize"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/conversation_name_heading"
android:layout_width="0dp"
style="@style/MaterialSectionLabelStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"
android:layout_marginTop="@dimen/activity_margin"
android:layout_marginEnd="@dimen/activity_margin"
android:text="@string/conversation_name"
android:textSize="@dimen/normal_text_size"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:text="@string/conversation_name" />
<androidx.appcompat.widget.AppCompatTextView
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/conversation_name"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/small_margin"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:drawableEnd="@drawable/ic_edit_vector"
android:drawablePadding="@dimen/normal_margin"
android:drawablePadding="@dimen/bigger_margin"
android:ellipsize="end"
android:focusable="true"
android:maxLines="1"
android:paddingStart="@dimen/activity_margin"
android:paddingTop="@dimen/normal_margin"
android:paddingTop="@dimen/bigger_margin"
android:paddingEnd="@dimen/activity_margin"
android:paddingBottom="@dimen/normal_margin"
android:text="@string/members"
android:textSize="@dimen/big_text_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/conversation_name_heading" />
android:paddingBottom="@dimen/bigger_margin"
android:textSize="@dimen/bigger_text_size"
tools:text="Conversation name" />
<androidx.appcompat.widget.AppCompatTextView
<include
android:id="@+id/settings_conversation_name_divider"
layout="@layout/divider" />
<TextView
android:id="@+id/members_heading"
android:layout_width="0dp"
style="@style/MaterialSectionLabelStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"
android:layout_marginTop="@dimen/normal_margin"
android:layout_marginEnd="@dimen/activity_margin"
android:text="@string/members"
android:textSize="@dimen/normal_text_size"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/conversation_name" />
android:text="@string/members" />
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/participants_recyclerview"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/normal_margin"
android:clipToPadding="false"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/members_heading"
tools:itemCount="3"
tools:listitem="@layout/item_contact_with_number" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>