mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-30 13:35:18 +00:00
Better styling
This commit is contained in:
parent
4bb583e7d9
commit
6fff1e1832
@ -39,17 +39,20 @@ object AvatarSelection {
|
||||
launcher: ActivityResultLauncher<CropImageContractOptions>,
|
||||
inputFile: Uri?,
|
||||
outputFile: Uri?,
|
||||
@StringRes title: Int
|
||||
@StringRes title: Int,
|
||||
bgColor: Int
|
||||
) {
|
||||
launcher.launch(
|
||||
options(inputFile) {
|
||||
setGuidelines(CropImageView.Guidelines.ON)
|
||||
setAspectRatio(1, 1)
|
||||
setCropShape(if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) CropImageView.CropShape.RECTANGLE else CropImageView.CropShape.OVAL)
|
||||
setCropShape(CropImageView.CropShape.OVAL)
|
||||
setOutputUri(outputFile)
|
||||
setAllowRotation(true)
|
||||
setAllowFlipping(true)
|
||||
setBackgroundColor(ContextCompat.getColor(activity, R.color.avatar_background))
|
||||
setToolbarColor(bgColor)
|
||||
setActivityBackgroundColor(bgColor)
|
||||
setActivityTitle(activity.getString(title))
|
||||
}
|
||||
)
|
||||
|
@ -61,6 +61,7 @@ import org.session.libsession.utilities.ProfileKeyUtil
|
||||
import org.session.libsession.utilities.ProfilePictureUtilities
|
||||
import org.session.libsession.utilities.SSKEnvironment.ProfileManagerProtocol
|
||||
import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.session.libsession.utilities.getColorFromAttr
|
||||
import org.session.libsession.utilities.recipients.Recipient
|
||||
import org.session.libsession.utilities.truncateIdForDisplay
|
||||
import org.session.libsignal.utilities.Log
|
||||
@ -111,6 +112,8 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
||||
|
||||
private val hexEncodedPublicKey: String get() = TextSecurePreferences.getLocalNumber(this)!!
|
||||
|
||||
private val bgColor by lazy { getColorFromAttr(android.R.attr.colorPrimary) }
|
||||
|
||||
private val onAvatarCropped = registerForActivityResult(CropImageContract()) { result ->
|
||||
when {
|
||||
result.isSuccessful -> {
|
||||
@ -226,7 +229,8 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
||||
launcher = onAvatarCropped,
|
||||
inputFile = inputFile,
|
||||
outputFile = outputFile,
|
||||
title = R.string.CropImageActivity_profile_avatar
|
||||
title = R.string.CropImageActivity_profile_avatar,
|
||||
bgColor = bgColor
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user