mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +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
|
||||
var destructive: Boolean = false
|
||||
@EpoxyAttribute
|
||||
lateinit var listener: View.OnClickListener
|
||||
var listener: View.OnClickListener? = null
|
||||
|
||||
override fun bind(holder: Holder) {
|
||||
super.bind(holder)
|
||||
holder.view.setOnClickListener(listener)
|
||||
if (listener == null) {
|
||||
holder.view.isClickable = false
|
||||
}
|
||||
holder.editable.isVisible = editable
|
||||
holder.title.text = title
|
||||
val tintColor = if (destructive) {
|
||||
|
|
|
@ -19,6 +19,7 @@ package im.vector.riotx.core.epoxy.profiles
|
|||
|
||||
import androidx.annotation.DrawableRes
|
||||
import com.airbnb.epoxy.EpoxyController
|
||||
import im.vector.riotx.core.epoxy.ClickListener
|
||||
import im.vector.riotx.core.epoxy.dividerItem
|
||||
|
||||
fun EpoxyController.buildProfileSection(title: String) {
|
||||
|
@ -37,7 +38,7 @@ fun EpoxyController.buildProfileAction(
|
|||
@DrawableRes icon: Int = 0,
|
||||
destructive: Boolean = false,
|
||||
divider: Boolean = true,
|
||||
action: () -> Unit
|
||||
action: ClickListener? = null
|
||||
) {
|
||||
profileActionItem {
|
||||
iconRes(icon)
|
||||
|
@ -47,7 +48,7 @@ fun EpoxyController.buildProfileAction(
|
|||
destructive(destructive)
|
||||
title(title)
|
||||
listener { _ ->
|
||||
action()
|
||||
action?.invoke()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,15 +49,13 @@ class RoomSettingsController @Inject constructor(
|
|||
stringProvider.getString(R.string.settings)
|
||||
)
|
||||
|
||||
// Only enable encryption for the moment
|
||||
if (roomSummary.isEncrypted) {
|
||||
buildProfileAction(
|
||||
id = "encryption",
|
||||
title = stringProvider.getString(R.string.room_settings_addresses_e2e_enabled),
|
||||
dividerColor = dividerColor,
|
||||
divider = false,
|
||||
editable = false,
|
||||
action = {}
|
||||
editable = false
|
||||
)
|
||||
} else {
|
||||
buildProfileAction(
|
||||
|
|
|
@ -18,6 +18,7 @@ package im.vector.riotx.features.roomprofile.settings
|
|||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.view.isVisible
|
||||
import com.airbnb.mvrx.Loading
|
||||
import com.airbnb.mvrx.args
|
||||
|
@ -70,8 +71,15 @@ class RoomSettingsFragment @Inject constructor(
|
|||
}
|
||||
|
||||
override fun onEnableEncryptionClicked() {
|
||||
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) {
|
||||
waiting_view.isVisible = state.currentRequest is Loading
|
||||
|
|
|
@ -41,6 +41,10 @@
|
|||
<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_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>
|
||||
|
|
Loading…
Reference in a new issue