Improve dialog theming for M3

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-08-29 18:46:19 +02:00 committed by Tim Krüger
parent 1d0ff0bade
commit 62fa8c9645
No known key found for this signature in database
GPG key ID: FECE3A7222C52A4E
3 changed files with 15 additions and 16 deletions

View file

@ -5,7 +5,6 @@ import android.content.Intent
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.widget.EditText
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.SwitchCompat
@ -14,6 +13,7 @@ import com.nextcloud.talk.R
import com.nextcloud.talk.controllers.ConversationInfoController
import com.nextcloud.talk.data.user.model.User
import com.nextcloud.talk.databinding.ControllerConversationInfoBinding
import com.nextcloud.talk.databinding.DialogPasswordBinding
import com.nextcloud.talk.models.json.conversations.Conversation
import com.nextcloud.talk.repositories.conversations.ConversationsRepository
import com.nextcloud.talk.utils.Mimetype
@ -92,21 +92,18 @@ class GuestAccessHelper(
private fun showPasswordDialog(guestAccessPasswordSwitch: SwitchCompat) {
val builder = MaterialAlertDialogBuilder(activity)
builder.apply {
val dialogPassword = LayoutInflater.from(context).inflate(R.layout.dialog_password, null)
setView(dialogPassword)
setTitle("Guest access password")
setPositiveButton(
"OK"
) { _, _ ->
val password = dialogPassword.findViewById<EditText>(R.id.password).text.toString()
val dialogPassword = DialogPasswordBinding.inflate(LayoutInflater.from(context))
viewThemeUtils.colorEditText(dialogPassword.password)
setView(dialogPassword.root)
setTitle(R.string.nc_guest_access_password_dialog_title)
setPositiveButton(R.string.nc_ok) { _, _ ->
val password = dialogPassword.password.text.toString()
conversationsRepository.password(password, conversation.token!!)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(PasswordResultObserver(true))
}
setNegativeButton(
"Cancel"
) { _, _ ->
setNegativeButton(R.string.nc_cancel) { _, _ ->
guestAccessPasswordSwitch.isChecked = false
}
}

View file

@ -2,7 +2,9 @@
<!--
Nextcloud Talk application
@author Andy Scherzinger
@author Tim Krüger
Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
Copyright (C) 2022 Tim Krüger
Copyright (C) 2022 Nextcloud GmbH
@ -30,12 +32,11 @@
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/standard_margin"
android:layout_marginStart="@dimen/dialog_padding"
android:layout_marginTop="@dimen/standard_margin"
android:layout_marginEnd="@dimen/standard_margin"
android:layout_marginEnd="@dimen/dialog_padding"
android:layout_marginBottom="@dimen/standard_margin"
android:hint="@string/nc_guest_access_password_hint"
android:hint="@string/nc_guest_access_password_dialog_hint"
android:inputType="textPassword"
android:importantForAutofill="no" />
</LinearLayout>

View file

@ -338,7 +338,8 @@
<string name="nc_guest_access_allow_failed">Can\'t en-/disable guest access.</string>
<string name="nc_guest_access_password_title">Password protection</string>
<string name="nc_guest_access_password_summary">Set a password to restrict who can use the public link.</string>
<string name="nc_guest_access_password_hint">Enter a password</string>
<string name="nc_guest_access_password_dialog_title">Guest access password</string>
<string name="nc_guest_access_password_dialog_hint">Enter a password</string>
<string name="nc_guest_access_password_failed">Error during setting/disabling the password.</string>
<string name="nc_guest_access_password_weak_alert_title">Weak password</string>
<string name="nc_guest_access_share_link">Share conversation link</string>