Commit 36e385c5 authored by Niklas Fix's avatar Niklas Fix 🎓

adapt Alert Dialogs to dark mode

parent 1359c8fa
......@@ -11,6 +11,7 @@ import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import android.widget.*
import androidx.appcompat.widget.SearchView
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
......@@ -152,6 +153,7 @@ class FriendsListFragment : Fragment(),
builder.setTitle(getString(R.string.confirm_unfriend))
val infoTextView = TextView(requireActivity())
infoTextView.text = getString(R.string.confirm_unfriend_info, friend.username)
infoTextView.setTextColor(ContextCompat.getColor(requireActivity(), R.color.textLight))
val container = FrameLayout(requireActivity())
val params = FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
......@@ -182,6 +184,7 @@ class FriendsListFragment : Fragment(),
builder.setTitle(getString(R.string.no_questionpool_selected))
val infoTextView = TextView(requireActivity())
infoTextView.text = getString(R.string.no_questionpool_selected_info)
infoTextView.setTextColor(ContextCompat.getColor(requireActivity(), R.color.textLight))
val container = FrameLayout(requireActivity())
val params = FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
......
package de.akamu.tudarmstadt.features.profile
import android.app.Activity
import android.app.AlertDialog
import android.content.DialogInterface
import android.content.Intent
import android.os.Bundle
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.widget.Toolbar
import androidx.core.content.ContextCompat
import com.afollestad.materialdialogs.MaterialDialog
import com.google.android.material.snackbar.Snackbar
import de.akamu.tudarmstadt.BaseActivity
import de.akamu.tudarmstadt.R
import de.akamu.tudarmstadt.data.user.UserDataSourceImpl
import de.akamu.tudarmstadt.features.dashboard.MainActivity
import de.akamu.tudarmstadt.features.settings.SettingsActivity
import de.akamu.tudarmstadt.features.login.LoginActivity
import de.akamu.tudarmstadt.features.password.ChangePasswordActivity
......@@ -128,16 +135,30 @@ class ProfileActivity : BaseActivity(), ProfileContract.View,
}
fun onLogoutClick(@Suppress("UNUSED_PARAMETER") v: View) {
MaterialDialog(this).show {
title(text = getString(R.string.sign_out))
message(text = getString(R.string.confirm_sign_out))
positiveButton(text = getString(R.string.sign_out)) {
presenter.logout()
}
negativeButton(R.string.cancel) {
it.dismiss()
}
lateinit var infoDialog: AlertDialog
val builder = AlertDialog.Builder(this, R.style.DialogStyle)
builder.setTitle(getString(R.string.sign_out))
val infoTextView = TextView(this)
infoTextView.text = getString(R.string.confirm_sign_out)
infoTextView.setTextColor(ContextCompat.getColor(this, R.color.textLight))
val container = FrameLayout(this)
val params = FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
params.leftMargin = resources.getDimensionPixelSize(R.dimen.dialog_margin)
params.rightMargin = resources.getDimensionPixelSize(R.dimen.dialog_margin)
infoTextView.layoutParams = params
container.addView(infoTextView)
builder.setView(container)
builder.setPositiveButton(getString(R.string.sign_out)) { _: DialogInterface, _: Int ->
presenter.logout()
}
builder.setNegativeButton(getString(R.string.cancel)) { dialog, _ ->
dialog.cancel()
}
infoDialog = builder.create()
infoDialog.show()
}
override fun destroyLoginToken() {
......
......@@ -13,6 +13,7 @@ import android.widget.EditText
import android.widget.FrameLayout
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import de.akamu.tudarmstadt.R
import de.akamu.tudarmstadt.data.duel.DuelDataSourceImpl
import de.akamu.tudarmstadt.features.dashboard.MainActivity
......@@ -268,6 +269,7 @@ class QuestionActivity :
params.leftMargin = resources.getDimensionPixelSize(R.dimen.dialog_margin)
params.rightMargin = resources.getDimensionPixelSize(R.dimen.dialog_margin)
input.layoutParams = params
input.setTextColor(ContextCompat.getColor(this, R.color.textLight))
container.addView(input)
builder.setView(container)
builder.setPositiveButton(getString(R.string.send_feedback)) { _: DialogInterface, _: Int ->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment