mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 18:35:40 +03:00
Cleanup and copy wording from Riot-Web
This commit is contained in:
parent
56b140fcb4
commit
28db05e509
5 changed files with 22 additions and 8 deletions
|
@ -43,11 +43,14 @@ abstract class ProfileActionItem : VectorEpoxyModel<ProfileActionItem.Holder>()
|
||||||
@EpoxyAttribute
|
@EpoxyAttribute
|
||||||
var destructive: Boolean = false
|
var destructive: Boolean = false
|
||||||
@EpoxyAttribute
|
@EpoxyAttribute
|
||||||
lateinit var listener: View.OnClickListener
|
var listener: View.OnClickListener? = null
|
||||||
|
|
||||||
override fun bind(holder: Holder) {
|
override fun bind(holder: Holder) {
|
||||||
super.bind(holder)
|
super.bind(holder)
|
||||||
holder.view.setOnClickListener(listener)
|
holder.view.setOnClickListener(listener)
|
||||||
|
if (listener == null) {
|
||||||
|
holder.view.isClickable = false
|
||||||
|
}
|
||||||
holder.editable.isVisible = editable
|
holder.editable.isVisible = editable
|
||||||
holder.title.text = title
|
holder.title.text = title
|
||||||
val tintColor = if (destructive) {
|
val tintColor = if (destructive) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ package im.vector.riotx.core.epoxy.profiles
|
||||||
|
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import com.airbnb.epoxy.EpoxyController
|
import com.airbnb.epoxy.EpoxyController
|
||||||
|
import im.vector.riotx.core.epoxy.ClickListener
|
||||||
import im.vector.riotx.core.epoxy.dividerItem
|
import im.vector.riotx.core.epoxy.dividerItem
|
||||||
|
|
||||||
fun EpoxyController.buildProfileSection(title: String) {
|
fun EpoxyController.buildProfileSection(title: String) {
|
||||||
|
@ -37,7 +38,7 @@ fun EpoxyController.buildProfileAction(
|
||||||
@DrawableRes icon: Int = 0,
|
@DrawableRes icon: Int = 0,
|
||||||
destructive: Boolean = false,
|
destructive: Boolean = false,
|
||||||
divider: Boolean = true,
|
divider: Boolean = true,
|
||||||
action: () -> Unit
|
action: ClickListener? = null
|
||||||
) {
|
) {
|
||||||
profileActionItem {
|
profileActionItem {
|
||||||
iconRes(icon)
|
iconRes(icon)
|
||||||
|
@ -47,7 +48,7 @@ fun EpoxyController.buildProfileAction(
|
||||||
destructive(destructive)
|
destructive(destructive)
|
||||||
title(title)
|
title(title)
|
||||||
listener { _ ->
|
listener { _ ->
|
||||||
action()
|
action?.invoke()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,15 +49,13 @@ class RoomSettingsController @Inject constructor(
|
||||||
stringProvider.getString(R.string.settings)
|
stringProvider.getString(R.string.settings)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Only enable encryption for the moment
|
|
||||||
if (roomSummary.isEncrypted) {
|
if (roomSummary.isEncrypted) {
|
||||||
buildProfileAction(
|
buildProfileAction(
|
||||||
id = "encryption",
|
id = "encryption",
|
||||||
title = stringProvider.getString(R.string.room_settings_addresses_e2e_enabled),
|
title = stringProvider.getString(R.string.room_settings_addresses_e2e_enabled),
|
||||||
dividerColor = dividerColor,
|
dividerColor = dividerColor,
|
||||||
divider = false,
|
divider = false,
|
||||||
editable = false,
|
editable = false
|
||||||
action = {}
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
buildProfileAction(
|
buildProfileAction(
|
||||||
|
|
|
@ -18,6 +18,7 @@ package im.vector.riotx.features.roomprofile.settings
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import com.airbnb.mvrx.Loading
|
import com.airbnb.mvrx.Loading
|
||||||
import com.airbnb.mvrx.args
|
import com.airbnb.mvrx.args
|
||||||
|
@ -70,7 +71,14 @@ class RoomSettingsFragment @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEnableEncryptionClicked() {
|
override fun onEnableEncryptionClicked() {
|
||||||
viewModel.handle(RoomSettingsAction.EnableEncryption)
|
AlertDialog.Builder(requireActivity())
|
||||||
|
.setTitle(R.string.room_settings_enable_encryption_dialog_title)
|
||||||
|
.setMessage(R.string.room_settings_enable_encryption_dialog_content)
|
||||||
|
.setNegativeButton(R.string.cancel, null)
|
||||||
|
.setPositiveButton(R.string.room_settings_enable_encryption_dialog_submit) { _, _ ->
|
||||||
|
viewModel.handle(RoomSettingsAction.EnableEncryption)
|
||||||
|
}
|
||||||
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderRoomSummary(state: RoomSettingsViewState) {
|
private fun renderRoomSummary(state: RoomSettingsViewState) {
|
||||||
|
|
|
@ -41,6 +41,10 @@
|
||||||
<string name="settings_category_composer">Message editor</string>
|
<string name="settings_category_composer">Message editor</string>
|
||||||
|
|
||||||
<string name="room_settings_enable_encryption">Enable end-to-end encryption</string>
|
<string name="room_settings_enable_encryption">Enable end-to-end encryption</string>
|
||||||
<string name="room_settings_enable_encryption_warning">Warning: once encryption is enabled in a room, it cannot be disabled</string>
|
<string name="room_settings_enable_encryption_warning">Once enabled, encryption cannot be disabled.</string>
|
||||||
|
|
||||||
|
<string name="room_settings_enable_encryption_dialog_title">Enable encryption?</string>
|
||||||
|
<string name="room_settings_enable_encryption_dialog_content">Once enabled, encryption for a room cannot be disabled. Messages sent in an encrypted room cannot be seen by the server, only by the participants of the room. Enabling encryption may prevent many bots and bridges from working correctly.</string>
|
||||||
|
<string name="room_settings_enable_encryption_dialog_submit">Enable encryption</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue