mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-31 13:16:16 +00:00
Fix profile picture size issue
This commit is contained in:
@@ -18,8 +18,10 @@ import android.util.Log
|
||||
import android.util.Pair
|
||||
import android.util.TypedValue
|
||||
import android.view.*
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.DimenRes
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.Observer
|
||||
@@ -281,6 +283,14 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
actionBar.setCustomView(R.layout.activity_conversation_v2_action_bar)
|
||||
actionBar.setDisplayShowCustomEnabled(true)
|
||||
conversationTitleView.text = thread.toShortString()
|
||||
@DimenRes val sizeID: Int
|
||||
if (thread.isClosedGroupRecipient) {
|
||||
sizeID = R.dimen.medium_profile_picture_size
|
||||
} else {
|
||||
sizeID = R.dimen.small_profile_picture_size
|
||||
}
|
||||
val size = resources.getDimension(sizeID).roundToInt()
|
||||
profilePictureView.layoutParams = LinearLayout.LayoutParams(size, size)
|
||||
profilePictureView.glide = glide
|
||||
profilePictureView.update(thread, threadID)
|
||||
}
|
||||
|
||||
@@ -31,23 +31,12 @@ class ProfilePictureView : RelativeLayout {
|
||||
private val profilePicturesCache = mutableMapOf<String, String?>()
|
||||
|
||||
// region Lifecycle
|
||||
constructor(context: Context) : super(context) {
|
||||
setUpViewHierarchy()
|
||||
}
|
||||
constructor(context: Context) : super(context) { initialize() }
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { initialize() }
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { initialize() }
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) { initialize() }
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
||||
setUpViewHierarchy()
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
setUpViewHierarchy()
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
|
||||
setUpViewHierarchy()
|
||||
}
|
||||
|
||||
private fun setUpViewHierarchy() {
|
||||
private fun initialize() {
|
||||
val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||
val contentView = inflater.inflate(R.layout.view_profile_picture, null)
|
||||
addView(contentView)
|
||||
|
||||
Reference in New Issue
Block a user