Refactor & match design

This commit is contained in:
nielsandriesse 2020-09-09 13:57:22 +10:00
parent 49d344f7f7
commit ff21d760f6
17 changed files with 88 additions and 72 deletions

View File

@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="@color/unimportant" /> <solid android:color="@color/profile_picture_background" />
<corners android:radius="38dp" /> <corners android:radius="38dp" />

View File

@ -7,5 +7,5 @@
<corners android:radius="38dp" /> <corners android:radius="38dp" />
<stroke android:width="@dimen/profile_picture_border_thickness" android:color="@color/border" /> <stroke android:width="@dimen/profile_picture_border_thickness" android:color="@color/profile_picture_border" />
</shape> </shape>

View File

@ -3,7 +3,9 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="@color/unimportant" /> <solid android:color="@color/profile_picture_background" />
<corners android:radius="23dp" /> <corners android:radius="23dp" />
<stroke android:width="@dimen/profile_picture_border_thickness" android:color="@color/profile_picture_border" />
</shape> </shape>

View File

@ -7,5 +7,5 @@
<corners android:radius="23dp" /> <corners android:radius="23dp" />
<stroke android:width="@dimen/profile_picture_border_thickness" android:color="@color/border" /> <stroke android:width="@dimen/profile_picture_border_thickness" android:color="@color/profile_picture_border" />
</shape> </shape>

View File

@ -3,7 +3,9 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="#353535" /> <solid android:color="@color/profile_picture_background" />
<corners android:radius="23dp" /> <corners android:radius="23dp" />
<stroke android:width="@dimen/profile_picture_border_thickness" android:color="@color/profile_picture_border" />
</shape> </shape>

View File

@ -3,7 +3,9 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="@color/unimportant" /> <solid android:color="@color/profile_picture_background" />
<corners android:radius="18dp" /> <corners android:radius="18dp" />
<stroke android:width="@dimen/profile_picture_border_thickness" android:color="@color/profile_picture_border" />
</shape> </shape>

View File

@ -7,5 +7,5 @@
<corners android:radius="18dp" /> <corners android:radius="18dp" />
<stroke android:width="@dimen/profile_picture_border_thickness" android:color="@color/border" /> <stroke android:width="@dimen/profile_picture_border_thickness" android:color="@color/profile_picture_border" />
</shape> </shape>

View File

@ -34,8 +34,7 @@
android:layout_height="@dimen/small_profile_picture_size" android:layout_height="@dimen/small_profile_picture_size"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="9dp" android:layout_marginLeft="9dp" />
android:foreground="@drawable/circle_touch_highlight_background"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -24,8 +24,7 @@
android:id="@+id/profilePictureView" android:id="@+id/profilePictureView"
android:layout_width="@dimen/large_profile_picture_size" android:layout_width="@dimen/large_profile_picture_size"
android:layout_height="@dimen/large_profile_picture_size" android:layout_height="@dimen/large_profile_picture_size"
android:layout_marginTop="@dimen/medium_spacing" android:layout_marginTop="@dimen/medium_spacing" />
android:foreground="@drawable/circle_touch_highlight_background" />
<RelativeLayout <RelativeLayout
android:id="@+id/ctnGroupNameSection" android:id="@+id/ctnGroupNameSection"

View File

@ -19,9 +19,13 @@
android:id="@+id/doubleModeImageView1" android:id="@+id/doubleModeImageView1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:alpha="0.65"
android:background="@drawable/profile_picture_view_small_background" /> android:background="@drawable/profile_picture_view_small_background" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/profile_picture_view_small_foreground" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
@ -36,6 +40,11 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/profile_picture_view_small_background" /> android:background="@drawable/profile_picture_view_small_background" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/profile_picture_view_small_foreground" />
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>
@ -51,6 +60,11 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/profile_picture_view_medium_background" /> android:background="@drawable/profile_picture_view_medium_background" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/profile_picture_view_medium_foreground" />
</RelativeLayout> </RelativeLayout>
<ImageView <ImageView
@ -73,6 +87,11 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/profile_picture_view_large_background" /> android:background="@drawable/profile_picture_view_large_background" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/profile_picture_view_large_foreground" />
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -7,6 +7,8 @@
<color name="text">#000000</color> <color name="text">#000000</color>
<color name="destructive">#f26f55</color> <color name="destructive">#f26f55</color>
<color name="unimportant">#606060</color> <color name="unimportant">#606060</color>
<color name="profile_picture_border">#23000000</color>
<color name="profile_picture_background">#B0B0B0</color>
<color name="cell_background">#FCFCFC</color> <color name="cell_background">#FCFCFC</color>
<color name="cell_selected">#DFDFDF</color> <color name="cell_selected">#DFDFDF</color>
<color name="navigation_bar_background">#FCFCFC</color> <color name="navigation_bar_background">#FCFCFC</color>

View File

@ -7,6 +7,8 @@
<color name="text">#FFFFFF</color> <color name="text">#FFFFFF</color>
<color name="destructive">#FF453A</color> <color name="destructive">#FF453A</color>
<color name="unimportant">#D8D8D8</color> <color name="unimportant">#D8D8D8</color>
<color name="profile_picture_border">#23FFFFFF</color>
<color name="profile_picture_background">#353535</color>
<color name="border">#979797</color> <color name="border">#979797</color>
<color name="cell_background">#1B1B1B</color> <color name="cell_background">#1B1B1B</color>
<color name="cell_selected">#0C0C0C</color> <color name="cell_selected">#0C0C0C</color>
@ -29,6 +31,13 @@
<color name="pn_option_background">#1B1B1B</color> <color name="pn_option_background">#1B1B1B</color>
<color name="pn_option_border">#212121</color> <color name="pn_option_border">#212121</color>
<color name="paths_building">#FFCE3A</color> <color name="paths_building">#FFCE3A</color>
<array name="profile_picture_placeholder_colors">
<item>#5ff8b0</item>
<item>#26cdb9</item>
<item>#f3c615</item>
<item>#fcac5a</item>
</array>
<!-- Session --> <!-- Session -->
<!-- Loki --> <!-- Loki -->
@ -108,11 +117,4 @@
<color name="default_background_start">#121212</color> <color name="default_background_start">#121212</color>
<color name="default_background_end">#171717</color> <color name="default_background_end">#171717</color>
<array name="user_pic_placeholder_primary">
<item>#2bca81</item>
<item>#ee7117</item>
<item>#239edf</item>
<item>#bb35e9</item>
</array>
</resources> </resources>

View File

@ -52,10 +52,8 @@ import java.security.SecureRandom
import java.util.* import java.util.*
class SettingsActivity : PassphraseRequiredActionBarActivity() { class SettingsActivity : PassphraseRequiredActionBarActivity() {
private var displayNameEditActionMode: ActionMode? = null private var displayNameEditActionMode: ActionMode? = null
set(value) { field = value; handleDisplayNameEditActionModeChanged() } set(value) { field = value; handleDisplayNameEditActionModeChanged() }
private lateinit var glide: GlideRequests private lateinit var glide: GlideRequests
private var displayNameToBeUploaded: String? = null private var displayNameToBeUploaded: String? = null
private var profilePictureToBeUploaded: ByteArray? = null private var profilePictureToBeUploaded: ByteArray? = null
@ -71,20 +69,17 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
// region Lifecycle // region Lifecycle
override fun onCreate(savedInstanceState: Bundle?, isReady: Boolean) { override fun onCreate(savedInstanceState: Bundle?, isReady: Boolean) {
super.onCreate(savedInstanceState, isReady) super.onCreate(savedInstanceState, isReady)
setContentView(R.layout.activity_settings) setContentView(R.layout.activity_settings)
val displayName = DatabaseFactory.getLokiUserDatabase(this).getDisplayName(hexEncodedPublicKey)
val origUserDisplayName = DatabaseFactory.getLokiUserDatabase(this).getDisplayName(hexEncodedPublicKey)
glide = GlideApp.with(this) glide = GlideApp.with(this)
profilePictureView.glide = glide profilePictureView.glide = glide
profilePictureView.publicKey = hexEncodedPublicKey profilePictureView.publicKey = hexEncodedPublicKey
profilePictureView.displayName = origUserDisplayName profilePictureView.displayName = displayName
profilePictureView.isLarge = true profilePictureView.isLarge = true
profilePictureView.update() profilePictureView.update()
profilePictureView.setOnClickListener { showEditProfilePictureUI() } profilePictureView.setOnClickListener { showEditProfilePictureUI() }
ctnGroupNameSection.setOnClickListener { startActionMode(DisplayNameEditActionModeCallback()) } ctnGroupNameSection.setOnClickListener { startActionMode(DisplayNameEditActionModeCallback()) }
btnGroupNameDisplay.text = origUserDisplayName btnGroupNameDisplay.text = displayName
publicKeyTextView.text = hexEncodedPublicKey publicKeyTextView.text = hexEncodedPublicKey
copyButton.setOnClickListener { copyPublicKey() } copyButton.setOnClickListener { copyPublicKey() }
shareButton.setOnClickListener { sharePublicKey() } shareButton.setOnClickListener { sharePublicKey() }
@ -106,12 +101,9 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.settings_general, menu) menuInflater.inflate(R.menu.settings_general, menu)
// Update UI mode menu icon
// Update UI mode menu icon.
// It uses three-level selector where each level corresponds to the related UiMode ordinal value.
val uiMode = UiModeUtilities.getUserSelectedUiMode(this) val uiMode = UiModeUtilities.getUserSelectedUiMode(this)
menu.findItem(R.id.action_change_theme).icon!!.level = uiMode.ordinal menu.findItem(R.id.action_change_theme).icon!!.level = uiMode.ordinal
return true return true
} }

View File

@ -11,11 +11,10 @@ import network.loki.messenger.R
import java.util.* import java.util.*
object AvatarPlaceholderGenerator { object AvatarPlaceholderGenerator {
private val tmpFloatArray = FloatArray(3)
private const val EMPTY_LABEL = "0"; private const val EMPTY_LABEL = "0";
private val tmpFloatArray = FloatArray(3)
fun generate(context: Context, pixelSize: Int, hashString: String, displayName: String?): BitmapDrawable { fun generate(context: Context, pixelSize: Int, hashString: String, displayName: String?): BitmapDrawable {
//TODO That should be replaced with a proper hash extraction code. //TODO That should be replaced with a proper hash extraction code.
val hash: Long val hash: Long
@ -26,7 +25,7 @@ object AvatarPlaceholderGenerator {
} }
// Do not cache color array, it may be different depends on the current theme. // Do not cache color array, it may be different depends on the current theme.
val colorArray = context.resources.getIntArray(R.array.user_pic_placeholder_primary) val colorArray = context.resources.getIntArray(R.array.profile_picture_placeholder_colors)
val colorPrimary = colorArray[(hash % colorArray.size).toInt()] val colorPrimary = colorArray[(hash % colorArray.size).toInt()]
val colorSecondary = changeColorHueBy(colorPrimary, 12f) val colorSecondary = changeColorHueBy(colorPrimary, 12f)
@ -43,7 +42,7 @@ object AvatarPlaceholderGenerator {
val paint = Paint(Paint.ANTI_ALIAS_FLAG) val paint = Paint(Paint.ANTI_ALIAS_FLAG)
paint.shader = LinearGradient(0f, 0f, 0f, pixelSize.toFloat(), paint.shader = LinearGradient(0f, 0f, 0f, pixelSize.toFloat(),
colorPrimary, colorPrimary,
colorSecondary, colorPrimary,
Shader.TileMode.REPEAT) Shader.TileMode.REPEAT)
canvas.drawCircle(pixelSize.toFloat() / 2, pixelSize.toFloat() / 2, pixelSize.toFloat() / 2, paint) canvas.drawCircle(pixelSize.toFloat() / 2, pixelSize.toFloat() / 2, pixelSize.toFloat() / 2, paint)

View File

@ -1,7 +1,6 @@
package org.thoughtcrime.securesms.loki.views package org.thoughtcrime.securesms.loki.views
import android.content.Context import android.content.Context
import android.text.TextUtils
import android.util.AttributeSet import android.util.AttributeSet
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@ -9,7 +8,6 @@ import android.widget.ImageView
import android.widget.RelativeLayout import android.widget.RelativeLayout
import androidx.annotation.DimenRes import androidx.annotation.DimenRes
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
import kotlinx.android.synthetic.main.view_conversation.view.*
import kotlinx.android.synthetic.main.view_profile_picture.view.* import kotlinx.android.synthetic.main.view_profile_picture.view.*
import network.loki.messenger.R import network.loki.messenger.R
import org.thoughtcrime.securesms.contacts.avatars.ProfileContactPhoto import org.thoughtcrime.securesms.contacts.avatars.ProfileContactPhoto
@ -79,10 +77,12 @@ class ProfilePictureView : RelativeLayout {
users.remove(masterPublicKey) users.remove(masterPublicKey)
} }
val randomUsers = users.sorted() // Sort to provide a level of stability val randomUsers = users.sorted() // Sort to provide a level of stability
publicKey = randomUsers.getOrNull(0) ?: "" val pk = randomUsers.getOrNull(0) ?: ""
displayName = getUserDisplayName(randomUsers.getOrNull(0) ?: "") publicKey = pk
additionalPublicKey = randomUsers.getOrNull(1) ?: "" displayName = getUserDisplayName(pk)
additionalDisplayName = getUserDisplayName(randomUsers.getOrNull(1) ?: "") val apk = randomUsers.getOrNull(1) ?: ""
additionalPublicKey = apk
additionalDisplayName = getUserDisplayName(apk)
isRSSFeed = recipient.name == "Loki News" || recipient.name == "Session Updates" isRSSFeed = recipient.name == "Loki News" || recipient.name == "Session Updates"
} }
} else { } else {
@ -101,7 +101,6 @@ class ProfilePictureView : RelativeLayout {
singleModeImageViewContainer.visibility = if (additionalPublicKey == null && !isRSSFeed && !isLarge) View.VISIBLE else View.INVISIBLE singleModeImageViewContainer.visibility = if (additionalPublicKey == null && !isRSSFeed && !isLarge) View.VISIBLE else View.INVISIBLE
largeSingleModeImageViewContainer.visibility = if (additionalPublicKey == null && !isRSSFeed && isLarge) View.VISIBLE else View.INVISIBLE largeSingleModeImageViewContainer.visibility = if (additionalPublicKey == null && !isRSSFeed && isLarge) View.VISIBLE else View.INVISIBLE
rssImageView.visibility = if (isRSSFeed) View.VISIBLE else View.INVISIBLE rssImageView.visibility = if (isRSSFeed) View.VISIBLE else View.INVISIBLE
setProfilePictureIfNeeded( setProfilePictureIfNeeded(
doubleModeImageView1, doubleModeImageView1,
publicKey, publicKey,
@ -124,21 +123,21 @@ class ProfilePictureView : RelativeLayout {
R.dimen.large_profile_picture_size) R.dimen.large_profile_picture_size)
} }
private fun setProfilePictureIfNeeded(imageView: ImageView, hexEncodedPublicKey: String, displayName: String?, @DimenRes sizeResId: Int) { private fun setProfilePictureIfNeeded(imageView: ImageView, publicKey: String, displayName: String?, @DimenRes sizeResId: Int) {
glide.clear(imageView) glide.clear(imageView)
if (hexEncodedPublicKey.isNotEmpty()) { if (publicKey.isNotEmpty()) {
val recipient = Recipient.from(context, Address.fromSerialized(hexEncodedPublicKey), false); val recipient = Recipient.from(context, Address.fromSerialized(publicKey), false);
val signalProfilePicture = recipient.contactPhoto val signalProfilePicture = recipient.contactPhoto
if (signalProfilePicture != null && (signalProfilePicture as? ProfileContactPhoto)?.avatarObject != "0" && (signalProfilePicture as? ProfileContactPhoto)?.avatarObject != "") { if (signalProfilePicture != null && (signalProfilePicture as? ProfileContactPhoto)?.avatarObject != "0"
&& (signalProfilePicture as? ProfileContactPhoto)?.avatarObject != "") {
glide.load(signalProfilePicture).diskCacheStrategy(DiskCacheStrategy.ALL).circleCrop().into(imageView) glide.load(signalProfilePicture).diskCacheStrategy(DiskCacheStrategy.ALL).circleCrop().into(imageView)
} else { } else {
val sizePx = resources.getDimensionPixelSize(sizeResId) val sizeInPX = resources.getDimensionPixelSize(sizeResId)
val masterHexEncodedPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(context) val masterPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(context)
val hepk = if (recipient.isLocalNumber && masterHexEncodedPublicKey != null) masterHexEncodedPublicKey else hexEncodedPublicKey val hepk = if (recipient.isLocalNumber && masterPublicKey != null) masterPublicKey else publicKey
// val jazzIcon = JazzIdenticonDrawable(size, size, hepk)
glide.load(AvatarPlaceholderGenerator.generate( glide.load(AvatarPlaceholderGenerator.generate(
context, context,
sizePx, sizeInPX,
hepk, hepk,
displayName displayName
)).diskCacheStrategy(DiskCacheStrategy.ALL).circleCrop().into(imageView) )).diskCacheStrategy(DiskCacheStrategy.ALL).circleCrop().into(imageView)

View File

@ -49,6 +49,13 @@ class UserView : LinearLayout {
// region Updating // region Updating
fun bind(user: Recipient, glide: GlideRequests, actionIndicator: ActionIndicator, isSelected: Boolean = false) { fun bind(user: Recipient, glide: GlideRequests, actionIndicator: ActionIndicator, isSelected: Boolean = false) {
fun getUserDisplayName(publicKey: String?): String? {
if (publicKey == null || publicKey.isBlank()) {
return null
} else {
return DatabaseFactory.getLokiUserDatabase(context).getDisplayName(publicKey!!)
}
}
val address = user.address.serialize() val address = user.address.serialize()
if (user.isGroupRecipient) { if (user.isGroupRecipient) {
if ("Session Public Chat" == user.name || user.address.isRSSFeed) { if ("Session Public Chat" == user.name || user.address.isRSSFeed) {
@ -58,15 +65,14 @@ class UserView : LinearLayout {
profilePictureView.isRSSFeed = true profilePictureView.isRSSFeed = true
} else { } else {
val threadID = GroupManager.getThreadIDFromGroupID(address, context) val threadID = GroupManager.getThreadIDFromGroupID(address, context)
val userKeys = MentionsManager.shared.userPublicKeyCache[threadID]?.toList() ?: listOf() val users = MentionsManager.shared.userPublicKeyCache[threadID]?.toList() ?: listOf()
val sortedUserKeys = userKeys.sorted() // Sort to provide a level of stability val randomUsers = users.sorted() // Sort to provide a level of stability
val userKey0 = sortedUserKeys.getOrNull(0) ?: "" val pk = randomUsers.getOrNull(0) ?: ""
val userKey1 = sortedUserKeys.getOrNull(1) ?: "" profilePictureView.publicKey = pk
profilePictureView.displayName = getUserDisplayName(pk)
profilePictureView.publicKey = userKey0 val apk = randomUsers.getOrNull(1) ?: ""
profilePictureView.displayName = getUserDisplayName(userKey0) profilePictureView.additionalPublicKey = apk
profilePictureView.additionalPublicKey = userKey1 profilePictureView.additionalDisplayName = getUserDisplayName(apk)
profilePictureView.additionalDisplayName = getUserDisplayName(userKey1)
profilePictureView.isRSSFeed = false profilePictureView.isRSSFeed = false
} }
} else { } else {
@ -93,10 +99,5 @@ class UserView : LinearLayout {
} }
} }
} }
private fun getUserDisplayName(publicKey: String?): String? {
if (TextUtils.isEmpty(publicKey)) return null
return DatabaseFactory.getLokiUserDatabase(context).getDisplayName(publicKey!!)
}
// endregion // endregion
} }

View File

@ -14,19 +14,19 @@ import android.graphics.RectF;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.text.SpannableStringBuilder;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.StringRes; import androidx.annotation.StringRes;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationCompat.Action; import androidx.core.app.NotificationCompat.Action;
import androidx.core.app.RemoteInput; import androidx.core.app.RemoteInput;
import android.text.SpannableStringBuilder;
import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.engine.DiskCacheStrategy;
import org.thoughtcrime.securesms.contacts.avatars.ContactColors; import org.thoughtcrime.securesms.contacts.avatars.ContactColors;
import org.thoughtcrime.securesms.contacts.avatars.ContactPhoto; import org.thoughtcrime.securesms.contacts.avatars.ContactPhoto;
import org.thoughtcrime.securesms.contacts.avatars.FallbackContactPhoto;
import org.thoughtcrime.securesms.contacts.avatars.GeneratedContactPhoto; import org.thoughtcrime.securesms.contacts.avatars.GeneratedContactPhoto;
import org.thoughtcrime.securesms.logging.Log; import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.loki.todo.AvatarPlaceholderGenerator; import org.thoughtcrime.securesms.loki.todo.AvatarPlaceholderGenerator;
@ -93,10 +93,10 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
.get()); .get());
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException | ExecutionException e) {
Log.w(TAG, e); Log.w(TAG, e);
setLargeIcon(obtainAvatarPlaceholderDrawable(context, recipient)); setLargeIcon(getPlaceholderDrawable(context, recipient));
} }
} else { } else {
setLargeIcon(obtainAvatarPlaceholderDrawable(context, recipient)); setLargeIcon(getPlaceholderDrawable(context, recipient));
} }
} else { } else {
@ -320,9 +320,7 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
return content; return content;
} }
private static Drawable obtainAvatarPlaceholderDrawable(Context context, Recipient recipient) { private static Drawable getPlaceholderDrawable(Context context, Recipient recipient) {
//TODO Copied from ProfilePictureView#setProfilePictureIfNeeded
// Refactor this code to use the same recipient placeholder generator method across the app.
String publicKey = recipient.getAddress().serialize(); String publicKey = recipient.getAddress().serialize();
String hepk = (recipient.isLocalNumber() && publicKey != null) String hepk = (recipient.isLocalNumber() && publicKey != null)
? TextSecurePreferences.getMasterHexEncodedPublicKey(context) ? TextSecurePreferences.getMasterHexEncodedPublicKey(context)