mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-12 15:43:38 +00:00
Add action bar subtitle
This commit is contained in:
parent
62cee715a7
commit
e4292a3db5
@ -43,6 +43,8 @@ import org.thoughtcrime.securesms.database.DraftDatabase.Drafts
|
|||||||
import org.thoughtcrime.securesms.database.model.MessageRecord
|
import org.thoughtcrime.securesms.database.model.MessageRecord
|
||||||
import org.thoughtcrime.securesms.loki.utilities.toPx
|
import org.thoughtcrime.securesms.loki.utilities.toPx
|
||||||
import org.thoughtcrime.securesms.mms.GlideApp
|
import org.thoughtcrime.securesms.mms.GlideApp
|
||||||
|
import org.thoughtcrime.securesms.util.DateUtils
|
||||||
|
import java.util.*
|
||||||
import kotlin.math.*
|
import kotlin.math.*
|
||||||
|
|
||||||
class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDelegate,
|
class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDelegate,
|
||||||
@ -109,6 +111,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
scrollToBottomButton.setOnClickListener { conversationRecyclerView.smoothScrollToPosition(0) }
|
scrollToBottomButton.setOnClickListener { conversationRecyclerView.smoothScrollToPosition(0) }
|
||||||
updateUnreadCount()
|
updateUnreadCount()
|
||||||
setUpTypingObserver()
|
setUpTypingObserver()
|
||||||
|
updateSubtitle()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpRecyclerView() {
|
private fun setUpRecyclerView() {
|
||||||
@ -352,6 +355,24 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
unreadCountTextView.setTypeface(Typeface.DEFAULT, if (unreadCount < 100) Typeface.BOLD else Typeface.NORMAL)
|
unreadCountTextView.setTypeface(Typeface.DEFAULT, if (unreadCount < 100) Typeface.BOLD else Typeface.NORMAL)
|
||||||
unreadCountIndicator.isVisible = (unreadCount != 0)
|
unreadCountIndicator.isVisible = (unreadCount != 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun updateSubtitle() {
|
||||||
|
muteIconImageView.isVisible = thread.isMuted
|
||||||
|
conversationSubtitleView.isVisible = true
|
||||||
|
if (thread.isMuted) {
|
||||||
|
conversationSubtitleView.text = getString(R.string.ConversationActivity_muted_until_date, DateUtils.getFormattedDateTime(thread.mutedUntil, "EEE, MMM d, yyyy HH:mm", Locale.getDefault()))
|
||||||
|
} else if (thread.isGroupRecipient) {
|
||||||
|
val openGroup = DatabaseFactory.getLokiThreadDatabase(this).getOpenGroupChat(threadID)
|
||||||
|
if (openGroup != null) {
|
||||||
|
val userCount = DatabaseFactory.getLokiAPIDatabase(this).getUserCount(openGroup.room, openGroup.server) ?: 0
|
||||||
|
conversationSubtitleView.text = getString(R.string.ConversationActivity_member_count, userCount)
|
||||||
|
} else {
|
||||||
|
conversationSubtitleView.isVisible = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
conversationSubtitleView.isVisible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region Interaction
|
// region Interaction
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
@ -11,16 +12,57 @@
|
|||||||
android:layout_width="@dimen/small_profile_picture_size"
|
android:layout_width="@dimen/small_profile_picture_size"
|
||||||
android:layout_height="@dimen/small_profile_picture_size" />
|
android:layout_height="@dimen/small_profile_picture_size" />
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/conversationTitleView"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginTop="-2dp"
|
||||||
android:text="Elon"
|
android:orientation="vertical">
|
||||||
android:textColor="@color/text"
|
|
||||||
android:textStyle="bold"
|
<TextView
|
||||||
android:textSize="@dimen/very_large_font_size"
|
android:id="@+id/conversationTitleView"
|
||||||
android:maxLines="1"
|
android:layout_width="wrap_content"
|
||||||
android:ellipsize="end" />
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginBottom="-4dp"
|
||||||
|
android:text="Elon"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="@dimen/very_large_font_size"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:ellipsize="end" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/muteIconImageView"
|
||||||
|
android:layout_width="14dp"
|
||||||
|
android:layout_height="14dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:src="@drawable/ic_outline_notifications_off_24"
|
||||||
|
app:tint="@color/text"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/conversationSubtitleView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Muted"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:textSize="@dimen/very_small_font_size"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:ellipsize="end" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
Loading…
x
Reference in New Issue
Block a user