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