mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
[SES-569] Merge branch 'fix-pic' into bluetooth-manager-crash
This commit is contained in:
commit
f21100eff7
@ -26,8 +26,10 @@ import nl.komponents.kovenant.all
|
||||
import nl.komponents.kovenant.ui.alwaysUi
|
||||
import nl.komponents.kovenant.ui.successUi
|
||||
import org.session.libsession.avatars.AvatarHelper
|
||||
import org.session.libsession.avatars.ProfileContactPhoto
|
||||
import org.session.libsession.utilities.*
|
||||
import org.session.libsession.utilities.SSKEnvironment.ProfileManagerProtocol
|
||||
import org.session.libsession.utilities.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
||||
import org.thoughtcrime.securesms.avatar.AvatarSelection
|
||||
import org.thoughtcrime.securesms.components.ProfilePictureView
|
||||
@ -100,10 +102,12 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
||||
|
||||
private fun setupProfilePictureView(view: ProfilePictureView) {
|
||||
view.glide = glide
|
||||
view.publicKey = hexEncodedPublicKey
|
||||
view.displayName = getDisplayName()
|
||||
view.isLarge = true
|
||||
view.update()
|
||||
view.apply {
|
||||
publicKey = hexEncodedPublicKey
|
||||
displayName = getDisplayName()
|
||||
isLarge = true
|
||||
update()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
@ -273,7 +277,17 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
||||
}
|
||||
}
|
||||
.show().apply {
|
||||
findViewById<ProfilePictureView>(R.id.profile_picture_view)?.let(::setupProfilePictureView)
|
||||
val profilePic = findViewById<ProfilePictureView>(R.id.profile_picture_view)
|
||||
?.also(::setupProfilePictureView)
|
||||
|
||||
val pictureIcon = findViewById<View>(R.id.ic_pictures)
|
||||
|
||||
val recipient = Recipient.from(context, Address.fromSerialized(hexEncodedPublicKey), false)
|
||||
|
||||
val photoSet = (recipient.contactPhoto as ProfileContactPhoto).avatarObject !in setOf("0", "")
|
||||
|
||||
profilePic?.isVisible = photoSet
|
||||
pictureIcon?.isVisible = !photoSet
|
||||
}
|
||||
}
|
||||
|
||||
|
18
app/src/main/res/drawable/ic_pictures.xml
Normal file
18
app/src/main/res/drawable/ic_pictures.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="44dp"
|
||||
android:height="35dp"
|
||||
android:viewportWidth="44"
|
||||
android:viewportHeight="35">
|
||||
<path
|
||||
android:pathData="M35.45,23.4L27.129,17.313C27.074,17.269 27.007,17.245 26.937,17.245C26.867,17.245 26.799,17.269 26.744,17.313L19.283,23.49C19.226,23.532 19.156,23.555 19.084,23.555C19.013,23.555 18.943,23.532 18.885,23.49L15.135,20.433C15.082,20.393 15.017,20.371 14.949,20.371C14.882,20.371 14.817,20.393 14.763,20.433L4.606,27.65C4.567,27.681 4.535,27.72 4.513,27.764C4.49,27.808 4.478,27.857 4.477,27.907V30.244C4.481,30.437 4.559,30.621 4.695,30.758C4.832,30.895 5.016,30.973 5.209,30.976H34.847C35.041,30.976 35.227,30.899 35.364,30.762C35.501,30.624 35.579,30.438 35.579,30.244V23.644C35.58,23.595 35.569,23.548 35.546,23.505C35.524,23.462 35.491,23.426 35.45,23.4Z"
|
||||
android:fillColor="#A1A2A1"/>
|
||||
<path
|
||||
android:pathData="M11.63,18.25C13.226,18.25 14.519,16.957 14.519,15.361C14.519,13.765 13.226,12.472 11.63,12.472C10.034,12.472 8.741,13.765 8.741,15.361C8.741,16.957 10.034,18.25 11.63,18.25Z"
|
||||
android:fillColor="#A1A2A1"/>
|
||||
<path
|
||||
android:pathData="M40.895,4.125L8.728,0.375C8.306,0.324 7.879,0.356 7.47,0.471C7.062,0.587 6.68,0.782 6.348,1.046C6.016,1.31 5.739,1.638 5.535,2.01C5.331,2.382 5.202,2.791 5.158,3.213L5.004,4.6H7.572L7.7,3.509C7.711,3.425 7.738,3.345 7.78,3.272C7.822,3.199 7.878,3.136 7.944,3.085C8.054,2.997 8.189,2.947 8.33,2.944H8.394L22.686,4.6H36.221C37.011,4.605 37.789,4.791 38.495,5.145C39.201,5.499 39.815,6.012 40.291,6.642H40.599C40.768,6.661 40.922,6.746 41.028,6.879C41.133,7.011 41.183,7.18 41.165,7.348L41.075,8.08C41.254,8.597 41.349,9.139 41.357,9.685V27.997L43.72,7.682C43.814,6.836 43.57,5.988 43.04,5.321C42.511,4.655 41.74,4.225 40.895,4.125Z"
|
||||
android:fillColor="#A1A2A1"/>
|
||||
<path
|
||||
android:pathData="M36.221,34.803H3.835C2.984,34.803 2.167,34.464 1.565,33.862C0.963,33.26 0.625,32.444 0.625,31.592V9.762C0.625,8.911 0.963,8.094 1.565,7.492C2.167,6.89 2.984,6.552 3.835,6.552H36.221C37.072,6.552 37.889,6.89 38.491,7.492C39.093,8.094 39.431,8.911 39.431,9.762V31.592C39.431,32.444 39.093,33.26 38.491,33.862C37.889,34.464 37.072,34.803 36.221,34.803ZM3.835,9.095C3.665,9.095 3.502,9.162 3.381,9.283C3.261,9.403 3.193,9.566 3.193,9.737V31.567C3.193,31.737 3.261,31.9 3.381,32.021C3.502,32.141 3.665,32.209 3.835,32.209H36.221C36.391,32.209 36.554,32.141 36.675,32.021C36.795,31.9 36.863,31.737 36.863,31.567V9.737C36.863,9.566 36.795,9.403 36.675,9.283C36.554,9.162 36.391,9.095 36.221,9.095H3.835Z"
|
||||
android:fillColor="#A1A2A1"/>
|
||||
</vector>
|
@ -5,5 +5,5 @@
|
||||
|
||||
<solid android:color="@color/profile_picture_background" />
|
||||
|
||||
<corners android:radius="38dp" />
|
||||
<corners android:radius="40dp" />
|
||||
</shape>
|
@ -2,9 +2,48 @@
|
||||
<FrameLayout
|
||||
android:orientation="vertical"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/ic_pictures"
|
||||
android:background="@drawable/circle_tintable"
|
||||
android:backgroundTint="@color/classic_dark_3"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:layout_width="@dimen/large_profile_picture_size"
|
||||
android:layout_height="@dimen/large_profile_picture_size">
|
||||
|
||||
<ImageView
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/transparent"
|
||||
android:src="@drawable/ic_pictures"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_gravity="bottom|end"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/circle_tintable"
|
||||
android:backgroundTint="?attr/accentColor"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingLeft="1dp"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
tools:backgroundTint="@color/accent_green">
|
||||
<View
|
||||
android:background="@drawable/ic_plus"
|
||||
android:backgroundTint="@color/black"
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<include layout="@layout/view_profile_picture"
|
||||
android:layout_margin="30dp"
|
||||
android:id="@+id/profile_picture_view"
|
||||
@ -12,6 +51,7 @@
|
||||
android:layout_width="@dimen/large_profile_picture_size"
|
||||
android:layout_height="@dimen/large_profile_picture_size"
|
||||
android:layout_marginTop="@dimen/medium_spacing"
|
||||
android:contentDescription="@string/AccessibilityId_profile_picture" />
|
||||
android:contentDescription="@string/AccessibilityId_profile_picture"
|
||||
tools:visibility="gone"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
@ -28,6 +28,7 @@
|
||||
<attr name="ic_visibility_on" format="reference" />
|
||||
<attr name="ic_visibility_off" format="reference" />
|
||||
|
||||
<attr name="accentColor" format="reference|color"/>
|
||||
<attr name="prominentButtonColor" format="reference|color"/>
|
||||
<attr name="elementBorderColor" format="reference|color"/>
|
||||
<attr name="conversation_background" format="reference|color"/>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<dimen name="very_small_profile_picture_size">26dp</dimen>
|
||||
<dimen name="small_profile_picture_size">36dp</dimen>
|
||||
<dimen name="medium_profile_picture_size">46dp</dimen>
|
||||
<dimen name="large_profile_picture_size">76dp</dimen>
|
||||
<dimen name="large_profile_picture_size">80dp</dimen>
|
||||
<dimen name="conversation_view_status_indicator_size">14dp</dimen>
|
||||
<dimen name="border_thickness">1dp</dimen>
|
||||
<dimen name="new_conversation_button_collapsed_size">60dp</dimen>
|
||||
|
@ -54,6 +54,7 @@
|
||||
<item name="menu_unpin_icon">@drawable/ic_outline_pin_off_24</item>
|
||||
<item name="menu_mark_all_as_read">@drawable/ic_outline_mark_chat_read_24</item>
|
||||
<item name="emoji_show_less_icon">@drawable/ic_chevron_up_light</item>
|
||||
<item name="accentColor">?colorAccent</item>
|
||||
<item name="prominentButtonColor">?colorAccent</item>
|
||||
<item name="attachment_document_icon_small">@drawable/ic_document_small_dark</item>
|
||||
<item name="attachment_document_icon_large">@drawable/ic_document_large_dark</item>
|
||||
@ -342,6 +343,7 @@
|
||||
<item name="actionBarWidgetTheme">@null</item>
|
||||
<item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
|
||||
<item name="actionBarStyle">@style/Widget.Session.ActionBar</item>
|
||||
<item name="accentColor">?colorAccent</item>
|
||||
<item name="prominentButtonColor">?colorAccent</item>
|
||||
<item name="elementBorderColor">@color/classic_dark_3</item>
|
||||
|
||||
@ -417,6 +419,7 @@
|
||||
<item name="actionBarWidgetTheme">@null</item>
|
||||
<item name="actionBarTheme">@style/ThemeOverlay.AppCompat.ActionBar</item>
|
||||
<item name="actionBarStyle">@style/Widget.Session.ActionBar</item>
|
||||
<item name="accentColor">?colorAccent</item>
|
||||
<item name="prominentButtonColor">?android:textColorPrimary</item>
|
||||
<item name="elementBorderColor">@color/classic_light_3</item>
|
||||
|
||||
@ -503,6 +506,7 @@
|
||||
<item name="actionBarWidgetTheme">@null</item>
|
||||
<item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
|
||||
<item name="actionBarStyle">@style/Widget.Session.ActionBar</item>
|
||||
<item name="accentColor">?colorAccent</item>
|
||||
<item name="prominentButtonColor">?colorAccent</item>
|
||||
<item name="elementBorderColor">@color/ocean_dark_4</item>
|
||||
|
||||
@ -583,6 +587,7 @@
|
||||
<item name="actionBarWidgetTheme">@null</item>
|
||||
<item name="actionBarTheme">@style/ThemeOverlay.AppCompat.ActionBar</item>
|
||||
<item name="actionBarStyle">@style/Widget.Session.ActionBar</item>
|
||||
<item name="accentColor">?colorAccent</item>
|
||||
<item name="prominentButtonColor">?android:textColorPrimary</item>
|
||||
<item name="elementBorderColor">@color/ocean_light_3</item>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user