diff --git a/vector/src/main/java/im/vector/riotx/core/dialogs/Extensions.kt b/vector/src/main/java/im/vector/riotx/core/dialogs/Extensions.kt new file mode 100644 index 0000000000..1b90e88864 --- /dev/null +++ b/vector/src/main/java/im/vector/riotx/core/dialogs/Extensions.kt @@ -0,0 +1,27 @@ +/* + * Copyright 2019 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.riotx.core.dialogs + +import androidx.annotation.ColorRes +import androidx.appcompat.app.AlertDialog +import androidx.core.content.ContextCompat +import im.vector.riotx.R + +fun AlertDialog.withColoredButton(whichButton: Int, @ColorRes color: Int = R.color.vector_error_color): AlertDialog { + getButton(whichButton)?.setTextColor(ContextCompat.getColor(context, color)) + return this +} diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt index 264c0e98bc..4149436166 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt @@ -19,6 +19,7 @@ package im.vector.riotx.features.home.room.detail import android.annotation.SuppressLint import android.app.Activity.RESULT_OK import android.content.Context +import android.content.DialogInterface import android.content.Intent import android.graphics.drawable.ColorDrawable import android.net.Uri @@ -69,6 +70,7 @@ import im.vector.matrix.android.api.session.room.timeline.getLastMessageContent import im.vector.matrix.android.api.session.user.model.User import im.vector.riotx.R import im.vector.riotx.core.di.ScreenComponent +import im.vector.riotx.core.dialogs.withColoredButton import im.vector.riotx.core.epoxy.LayoutManagerStateRestorer import im.vector.riotx.core.error.ErrorFormatter import im.vector.riotx.core.extensions.hideKeyboard @@ -819,6 +821,7 @@ class RoomDetailFragment : .setPositiveButton(R.string.ok, null) .setNegativeButton(R.string.block_user) { _, _ -> vectorBaseActivity.notImplemented("block user") } .show() + .withColoredButton(DialogInterface.BUTTON_NEGATIVE) } data.inappropriate -> { AlertDialog.Builder(requireActivity()) @@ -827,6 +830,7 @@ class RoomDetailFragment : .setPositiveButton(R.string.ok, null) .setNegativeButton(R.string.block_user) { _, _ -> vectorBaseActivity.notImplemented("block user") } .show() + .withColoredButton(DialogInterface.BUTTON_NEGATIVE) } else -> { AlertDialog.Builder(requireActivity()) @@ -835,6 +839,7 @@ class RoomDetailFragment : .setPositiveButton(R.string.ok, null) .setNegativeButton(R.string.block_user) { _, _ -> vectorBaseActivity.notImplemented("block user") } .show() + .withColoredButton(DialogInterface.BUTTON_NEGATIVE) } } }