Commit 86706753 authored by Emily Kager's avatar Emily Kager Committed by Emily Kager
Browse files

For #3568 - Use correct styling for QR and Share Alert Dialogs

parent ef8d9604
......@@ -11,7 +11,6 @@ import android.graphics.Typeface.BOLD
import android.graphics.Typeface.ITALIC
import android.os.Bundle
import android.text.style.StyleSpan
import android.view.ContextThemeWrapper
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
......@@ -134,12 +133,7 @@ class SearchFragment : Fragment(), BackHandler {
onScanResult = { result ->
search_scan_button.isChecked = false
activity?.let {
AlertDialog.Builder(
ContextThemeWrapper(
it,
R.style.DialogStyle
)
).apply {
AlertDialog.Builder(it).apply {
val spannable = resources.getSpannable(
R.string.qr_scanner_confirmation_dialog_message,
listOf(
......
......@@ -10,7 +10,6 @@ import android.content.Intent.EXTRA_TEXT
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
import android.os.Bundle
import android.os.Parcelable
import android.view.ContextThemeWrapper
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
......@@ -41,7 +40,11 @@ class ShareFragment : AppCompatDialogFragment() {
setStyle(STYLE_NO_TITLE, R.style.ShareDialogStyle)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val view = inflater.inflate(R.layout.fragment_share, container, false)
val args = ShareFragmentArgs.fromBundle(arguments!!)
if (args.url == null && args.tabs.isNullOrEmpty()) {
......@@ -77,31 +80,31 @@ class ShareFragment : AppCompatDialogFragment() {
dismiss()
}
ShareAction.SignInClicked -> {
val directions = ShareFragmentDirections.actionShareFragmentToTurnOnSyncFragment()
val directions =
ShareFragmentDirections.actionShareFragmentToTurnOnSyncFragment()
nav(R.id.shareFragment, directions)
dismiss()
}
ShareAction.AddNewDeviceClicked -> {
AlertDialog.Builder(
ContextThemeWrapper(
context,
R.style.DialogStyle
)
).apply {
setMessage(R.string.sync_connect_device_dialog)
setPositiveButton(R.string.sync_confirmation_button) { dialog, _ -> dialog.cancel() }
create()
}.show()
context?.let {
AlertDialog.Builder(it).apply {
setMessage(R.string.sync_connect_device_dialog)
setPositiveButton(R.string.sync_confirmation_button) { dialog, _ -> dialog.cancel() }
create()
}.show()
}
}
is ShareAction.ShareDeviceClicked -> {
val authAccount = requireComponents.backgroundServices.accountManager.authenticatedAccount()
val authAccount =
requireComponents.backgroundServices.accountManager.authenticatedAccount()
authAccount?.run {
sendSendTab(this, it.device.id, tabs)
}
dismiss()
}
is ShareAction.SendAllClicked -> {
val authAccount = requireComponents.backgroundServices.accountManager.authenticatedAccount()
val authAccount =
requireComponents.backgroundServices.accountManager.authenticatedAccount()
authAccount?.run {
it.devices.forEach { device ->
sendSendTab(this, device.id, tabs)
......
......@@ -53,19 +53,19 @@
<style name="NormalTheme" parent="NormalThemeBase" />
<style name="DialogStyle" parent="Theme.MaterialComponents.Dialog.Alert">
<style name="BaseDialogStyle" parent="Theme.MaterialComponents.Dialog.Alert">
<item name="dialogCornerRadius">@dimen/tab_corner_radius</item>
<item name="android:colorBackground">?above</item>
<item name="colorAccent">?accent</item>
<item name="android:textColorPrimary">?primaryText</item>
</style>
<style name="DialogStyleLight" parent="DialogStyle">
<style name="DialogStyleLight" parent="BaseDialogStyle">
<item name="buttonBarNegativeButtonStyle">@style/DialogButtonStyleLight</item>
<item name="buttonBarPositiveButtonStyle">@style/DialogButtonStyleLight</item>
</style>
<style name="DialogStyleDark" parent="DialogStyle">
<style name="DialogStyleDark" parent="BaseDialogStyle">
<item name="buttonBarNegativeButtonStyle">@style/DialogButtonStyleDark</item>
<item name="buttonBarPositiveButtonStyle">@style/DialogButtonStyleDark</item>
</style>
......
Supports Markdown
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