mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
Utilise dialog dsl in RationaleDialog
This commit is contained in:
parent
72c07f4b99
commit
4641512644
@ -44,7 +44,7 @@ fun Context.showExpirationDialog(
|
||||
|
||||
updateText(selectedIndex)
|
||||
|
||||
return sessionDialog {
|
||||
return showSessionDialog {
|
||||
title(getString(R.string.ExpirationDialog_disappearing_messages))
|
||||
view(view)
|
||||
okButton { onExpirationTime(numberPickerView.let { expirationTimes[it.value] }) }
|
||||
|
@ -1,19 +1,15 @@
|
||||
package org.thoughtcrime.securesms
|
||||
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import network.loki.messenger.R
|
||||
import java.math.BigInteger
|
||||
import java.time.Instant
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
fun showMuteDialog(
|
||||
context: Context,
|
||||
onMuteDuration: (Long) -> Unit
|
||||
): AlertDialog = context.sessionDialog {
|
||||
): AlertDialog = context.showSessionDialog {
|
||||
title(R.string.MuteDialog_mute_notifications)
|
||||
items(Option.values().map { it.stringRes }.map(context::getString).toTypedArray()) {
|
||||
onMuteDuration(Option.values()[it].getTime())
|
||||
|
@ -137,7 +137,7 @@ class SessionDialogBuilder(val context: Context) {
|
||||
fun show(): AlertDialog = dialogBuilder.show().also { dialog = it }
|
||||
}
|
||||
|
||||
fun Context.sessionDialog(build: SessionDialogBuilder.() -> Unit): AlertDialog =
|
||||
fun Context.showSessionDialog(build: SessionDialogBuilder.() -> Unit): AlertDialog =
|
||||
SessionDialogBuilder(this).apply { build() }.show()
|
||||
|
||||
fun Fragment.showSessionDialog(build: SessionDialogBuilder.() -> Unit): AlertDialog =
|
||||
|
@ -20,7 +20,6 @@ import android.widget.RelativeLayout
|
||||
import android.widget.Toast
|
||||
import androidx.activity.viewModels
|
||||
import androidx.annotation.DimenRes
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.lifecycle.Observer
|
||||
@ -960,7 +959,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
}
|
||||
|
||||
override fun block(deleteThread: Boolean) {
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
title(R.string.RecipientPreferenceActivity_block_this_contact_question)
|
||||
text(R.string.RecipientPreferenceActivity_you_will_no_longer_receive_messages_and_calls_from_this_contact)
|
||||
destructiveButton(R.string.RecipientPreferenceActivity_block, R.string.AccessibilityId_block_confirm) {
|
||||
@ -1011,7 +1010,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
}
|
||||
|
||||
override fun unblock() {
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
title(R.string.ConversationActivity_unblock_this_contact_question)
|
||||
text(R.string.ConversationActivity_you_will_once_again_be_able_to_receive_messages_and_calls_from_this_contact)
|
||||
destructiveButton(
|
||||
@ -1455,7 +1454,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
private fun showGIFPicker() {
|
||||
val hasSeenGIFMetaDataWarning: Boolean = textSecurePreferences.hasSeenGIFMetaDataWarning()
|
||||
if (!hasSeenGIFMetaDataWarning) {
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
title(R.string.giphy_permission_title)
|
||||
text(R.string.giphy_permission_message)
|
||||
button(R.string.continue_2) {
|
||||
@ -1618,7 +1617,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
if (recipient.isOpenGroupRecipient) {
|
||||
val messageCount = 1
|
||||
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
title(resources.getQuantityString(R.plurals.ConversationFragment_delete_selected_messages, messageCount, messageCount))
|
||||
text(resources.getQuantityString(R.plurals.ConversationFragment_this_will_permanently_delete_all_n_selected_messages, messageCount, messageCount))
|
||||
button(R.string.delete) { messages.forEach(viewModel::deleteForEveryone); endActionMode() }
|
||||
@ -1645,7 +1644,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
} else {
|
||||
val messageCount = 1
|
||||
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
title(resources.getQuantityString(R.plurals.ConversationFragment_delete_selected_messages, messageCount, messageCount))
|
||||
text(resources.getQuantityString(R.plurals.ConversationFragment_this_will_permanently_delete_all_n_selected_messages, messageCount, messageCount))
|
||||
button(R.string.delete) { messages.forEach(viewModel::deleteLocally); endActionMode() }
|
||||
@ -1655,7 +1654,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
}
|
||||
|
||||
override fun banUser(messages: Set<MessageRecord>) {
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
title(R.string.ConversationFragment_ban_selected_user)
|
||||
text("This will ban the selected user from this room. It won't ban them from other rooms.")
|
||||
button(R.string.ban) { viewModel.banUser(messages.first().individualRecipient); endActionMode() }
|
||||
@ -1664,7 +1663,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
}
|
||||
|
||||
override fun banAndDeleteAll(messages: Set<MessageRecord>) {
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
title(R.string.ConversationFragment_ban_selected_user)
|
||||
text("This will ban the selected user from this room and delete all messages sent by them. It won't ban them from other rooms or delete the messages they sent there.")
|
||||
button(R.string.ban) { viewModel.banAndDeleteAll(messages.first().individualRecipient); endActionMode() }
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.thoughtcrime.securesms.conversation.v2
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.database.Cursor
|
||||
@ -31,7 +30,7 @@ import org.thoughtcrime.securesms.database.model.MessageRecord
|
||||
import org.thoughtcrime.securesms.dependencies.DatabaseComponent
|
||||
import org.thoughtcrime.securesms.mms.GlideRequests
|
||||
import org.thoughtcrime.securesms.preferences.PrivacySettingsActivity
|
||||
import org.thoughtcrime.securesms.sessionDialog
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
|
||||
class ConversationAdapter(
|
||||
context: Context,
|
||||
@ -147,7 +146,7 @@ class ConversationAdapter(
|
||||
viewHolder.view.bind(message, messageBefore)
|
||||
if (message.isCallLog && message.isFirstMissedCall) {
|
||||
viewHolder.view.setOnClickListener {
|
||||
context.sessionDialog {
|
||||
context.showSessionDialog {
|
||||
title(R.string.CallNotificationBuilder_first_call_title)
|
||||
text(R.string.CallNotificationBuilder_first_call_message)
|
||||
button(R.string.activity_settings_title) {
|
||||
|
@ -2,7 +2,6 @@ package org.thoughtcrime.securesms.conversation.v2.menus
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.PorterDuff
|
||||
@ -15,7 +14,6 @@ import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.view.ContextThemeWrapper
|
||||
import androidx.appcompat.widget.SearchView
|
||||
@ -44,7 +42,7 @@ import org.thoughtcrime.securesms.groups.EditClosedGroupActivity
|
||||
import org.thoughtcrime.securesms.groups.EditClosedGroupActivity.Companion.groupIDKey
|
||||
import org.thoughtcrime.securesms.preferences.PrivacySettingsActivity
|
||||
import org.thoughtcrime.securesms.service.WebRtcCallService
|
||||
import org.thoughtcrime.securesms.sessionDialog
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
import org.thoughtcrime.securesms.showMuteDialog
|
||||
import org.thoughtcrime.securesms.util.BitmapUtil
|
||||
import java.io.IOException
|
||||
@ -187,7 +185,7 @@ object ConversationMenuHelper {
|
||||
private fun call(context: Context, thread: Recipient) {
|
||||
|
||||
if (!TextSecurePreferences.isCallNotificationsEnabled(context)) {
|
||||
context.sessionDialog {
|
||||
context.showSessionDialog {
|
||||
title(R.string.ConversationActivity_call_title)
|
||||
text(R.string.ConversationActivity_call_prompt)
|
||||
button(R.string.activity_settings_title, R.string.AccessibilityId_settings) {
|
||||
@ -303,7 +301,7 @@ object ConversationMenuHelper {
|
||||
|
||||
fun onLeaveFailed() = Toast.makeText(context, R.string.ConversationActivity_error_leaving_group, Toast.LENGTH_LONG).show()
|
||||
|
||||
context.sessionDialog {
|
||||
context.showSessionDialog {
|
||||
title(R.string.ConversationActivity_leave_group)
|
||||
text(message)
|
||||
button(R.string.yes) {
|
||||
|
@ -3,11 +3,11 @@ package org.thoughtcrime.securesms.conversation.v2.utilities
|
||||
import android.content.Context
|
||||
import network.loki.messenger.R
|
||||
import org.session.libsession.utilities.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.sessionDialog
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
|
||||
object NotificationUtils {
|
||||
fun showNotifyDialog(context: Context, thread: Recipient, notifyTypeHandler: (Int)->Unit) {
|
||||
context.sessionDialog {
|
||||
context.showSessionDialog {
|
||||
title(R.string.RecipientPreferenceActivity_notification_settings)
|
||||
singleChoiceItems(
|
||||
context.resources.getStringArray(R.array.notify_types),
|
||||
|
@ -10,7 +10,6 @@ import android.os.Bundle
|
||||
import android.text.SpannableString
|
||||
import android.widget.Toast
|
||||
import androidx.activity.viewModels
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@ -62,7 +61,7 @@ import org.thoughtcrime.securesms.mms.GlideRequests
|
||||
import org.thoughtcrime.securesms.onboarding.SeedActivity
|
||||
import org.thoughtcrime.securesms.onboarding.SeedReminderViewDelegate
|
||||
import org.thoughtcrime.securesms.preferences.SettingsActivity
|
||||
import org.thoughtcrime.securesms.sessionDialog
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
import org.thoughtcrime.securesms.showMuteDialog
|
||||
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
|
||||
import org.thoughtcrime.securesms.util.DateUtils
|
||||
@ -489,7 +488,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
||||
}
|
||||
|
||||
private fun blockConversation(thread: ThreadRecord) {
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
title(R.string.RecipientPreferenceActivity_block_this_contact_question)
|
||||
text(R.string.RecipientPreferenceActivity_you_will_no_longer_receive_messages_and_calls_from_this_contact)
|
||||
button(R.string.RecipientPreferenceActivity_block) {
|
||||
@ -505,7 +504,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
||||
}
|
||||
|
||||
private fun unblockConversation(thread: ThreadRecord) {
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
title(R.string.RecipientPreferenceActivity_unblock_this_contact_question)
|
||||
text(R.string.RecipientPreferenceActivity_you_will_once_again_be_able_to_receive_messages_and_calls_from_this_contact)
|
||||
button(R.string.RecipientPreferenceActivity_unblock) {
|
||||
@ -576,7 +575,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
||||
resources.getString(R.string.activity_home_delete_conversation_dialog_message)
|
||||
}
|
||||
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
text(message)
|
||||
button(R.string.yes) {
|
||||
lifecycleScope.launch(Dispatchers.Main) {
|
||||
@ -643,7 +642,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
||||
}
|
||||
|
||||
private fun hideMessageRequests() {
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
text("Hide message requests?")
|
||||
button(R.string.yes) {
|
||||
textSecurePreferences.setHasHiddenMessageRequests()
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.thoughtcrime.securesms.messagerequests
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.content.Intent
|
||||
import android.database.Cursor
|
||||
import android.os.Bundle
|
||||
@ -20,7 +19,7 @@ import org.thoughtcrime.securesms.database.ThreadDatabase
|
||||
import org.thoughtcrime.securesms.database.model.ThreadRecord
|
||||
import org.thoughtcrime.securesms.mms.GlideApp
|
||||
import org.thoughtcrime.securesms.mms.GlideRequests
|
||||
import org.thoughtcrime.securesms.sessionDialog
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
|
||||
import org.thoughtcrime.securesms.util.push
|
||||
import javax.inject.Inject
|
||||
@ -83,7 +82,7 @@ class MessageRequestsActivity : PassphraseRequiredActionBarActivity(), Conversat
|
||||
LoaderManager.getInstance(this).restartLoader(0, null, this)
|
||||
}
|
||||
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
title(R.string.RecipientPreferenceActivity_block_this_contact_question)
|
||||
text(R.string.message_requests_block_message)
|
||||
button(R.string.recipient_preferences__block) { doBlock() }
|
||||
@ -100,7 +99,7 @@ class MessageRequestsActivity : PassphraseRequiredActionBarActivity(), Conversat
|
||||
}
|
||||
}
|
||||
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
title(R.string.decline)
|
||||
text(resources.getString(R.string.message_requests_decline_message))
|
||||
button(R.string.decline) { doDecline() }
|
||||
@ -123,7 +122,7 @@ class MessageRequestsActivity : PassphraseRequiredActionBarActivity(), Conversat
|
||||
}
|
||||
}
|
||||
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
text(resources.getString(R.string.message_requests_clear_all_message))
|
||||
button(R.string.yes) { doDeleteAllAndBlock() }
|
||||
button(R.string.no)
|
||||
|
@ -2,7 +2,6 @@ package org.thoughtcrime.securesms.onboarding
|
||||
|
||||
import android.animation.ArgbEvaluator
|
||||
import android.animation.ValueAnimator
|
||||
import android.app.AlertDialog
|
||||
import android.content.Intent
|
||||
import android.graphics.drawable.TransitionDrawable
|
||||
import android.net.Uri
|
||||
@ -20,7 +19,7 @@ import org.session.libsession.utilities.ThemeUtil
|
||||
import org.thoughtcrime.securesms.ApplicationContext
|
||||
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||
import org.thoughtcrime.securesms.home.HomeActivity
|
||||
import org.thoughtcrime.securesms.sessionDialog
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
import org.thoughtcrime.securesms.util.GlowViewUtilities
|
||||
import org.thoughtcrime.securesms.util.PNModeView
|
||||
import org.thoughtcrime.securesms.util.disableClipping
|
||||
@ -152,7 +151,7 @@ class PNModeActivity : BaseActionBarActivity() {
|
||||
|
||||
private fun register() {
|
||||
if (selectedOptionView == null) {
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
title(R.string.activity_pn_mode_no_option_picked_dialog_title)
|
||||
button(R.string.ok)
|
||||
}
|
||||
|
@ -162,15 +162,13 @@ public class Permissions {
|
||||
request.onResult(requestedPermissions, grantResults, new boolean[requestedPermissions.length]);
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
private void executePermissionsRequestWithRationale(PermissionsRequest request) {
|
||||
AlertDialog dialog = RationaleDialog.createFor(permissionObject.getContext(), rationaleDialogMessage, rationalDialogHeader)
|
||||
.setPositiveButton(R.string.Permissions_continue, (d, which) -> executePermissionsRequest(request))
|
||||
.setNegativeButton(R.string.Permissions_not_now, (d, which) -> executeNoPermissionsRequest(request))
|
||||
.show();
|
||||
dialog.getWindow().setLayout((int)(permissionObject.getWindowWidth() * .75), ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
Button positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
|
||||
positiveButton.setContentDescription("Continue");
|
||||
RationaleDialog.show(
|
||||
permissionObject.getContext(),
|
||||
rationaleDialogMessage,
|
||||
() -> executePermissionsRequest(request),
|
||||
() -> executeNoPermissionsRequest(request),
|
||||
rationalDialogHeader);
|
||||
}
|
||||
|
||||
private void executePermissionsRequest(PermissionsRequest request) {
|
||||
|
@ -1,56 +0,0 @@
|
||||
package org.thoughtcrime.securesms.permissions;
|
||||
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.session.libsession.utilities.ViewUtil;
|
||||
|
||||
import network.loki.messenger.R;
|
||||
|
||||
public class RationaleDialog {
|
||||
|
||||
public static AlertDialog.Builder createFor(@NonNull Context context, @NonNull String message, @DrawableRes int... drawables) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.permissions_rationale_dialog, null);
|
||||
view.setClipToOutline(true);
|
||||
ViewGroup header = view.findViewById(R.id.header_container);
|
||||
TextView text = view.findViewById(R.id.message);
|
||||
|
||||
for (int i=0;i<drawables.length;i++) {
|
||||
ImageView imageView = new ImageView(context);
|
||||
imageView.setImageDrawable(context.getResources().getDrawable(drawables[i]));
|
||||
imageView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
|
||||
|
||||
header.addView(imageView);
|
||||
|
||||
if (i != drawables.length - 1) {
|
||||
TextView plus = new TextView(context);
|
||||
plus.setText("+");
|
||||
plus.setTextSize(TypedValue.COMPLEX_UNIT_SP, 40);
|
||||
plus.setTextColor(Color.WHITE);
|
||||
|
||||
LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
||||
layoutParams.setMargins(ViewUtil.dpToPx(context, 20), 0, ViewUtil.dpToPx(context, 20), 0);
|
||||
|
||||
plus.setLayoutParams(layoutParams);
|
||||
header.addView(plus);
|
||||
}
|
||||
}
|
||||
|
||||
text.setText(message);
|
||||
|
||||
return new AlertDialog.Builder(context, R.style.ThemeOverlay_Session_AlertDialog).setView(view);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package org.thoughtcrime.securesms.permissions
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import network.loki.messenger.R
|
||||
import org.session.libsession.utilities.ViewUtil
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
|
||||
object RationaleDialog {
|
||||
@JvmStatic
|
||||
fun show(
|
||||
context: Context,
|
||||
message: String,
|
||||
onPositive: Runnable,
|
||||
onNegative: Runnable,
|
||||
@DrawableRes vararg drawables: Int
|
||||
): androidx.appcompat.app.AlertDialog {
|
||||
val view = LayoutInflater.from(context).inflate(R.layout.permissions_rationale_dialog, null)
|
||||
.apply { clipToOutline = true }
|
||||
val header = view.findViewById<ViewGroup>(R.id.header_container)
|
||||
view.findViewById<TextView>(R.id.message).text = message
|
||||
drawables.forEach {
|
||||
ImageView(context).apply {
|
||||
setImageDrawable(ResourcesCompat.getDrawable(context.resources, it, context.theme))
|
||||
layoutParams = LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT)
|
||||
}.also(header::addView)
|
||||
}
|
||||
if (drawables.isNotEmpty()) {
|
||||
TextView(context).apply {
|
||||
text = "+"
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_SP, 40f)
|
||||
setTextColor(Color.WHITE)
|
||||
layoutParams = LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply {
|
||||
ViewUtil.dpToPx(context, 20).let { setMargins(it, 0, it, 0) }
|
||||
}
|
||||
}.also(header::addView)
|
||||
}
|
||||
|
||||
return context.showSessionDialog {
|
||||
view(view)
|
||||
button(R.string.Permissions_continue) { onPositive.run() }
|
||||
button(R.string.Permissions_not_now) { onNegative.run() }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package org.thoughtcrime.securesms.preferences
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.activity.viewModels
|
||||
@ -9,7 +8,7 @@ import dagger.hilt.android.AndroidEntryPoint
|
||||
import network.loki.messenger.R
|
||||
import network.loki.messenger.databinding.ActivityBlockedContactsBinding
|
||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
||||
import org.thoughtcrime.securesms.sessionDialog
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
|
||||
@AndroidEntryPoint
|
||||
class BlockedContactsActivity: PassphraseRequiredActionBarActivity(), View.OnClickListener {
|
||||
@ -52,7 +51,7 @@ class BlockedContactsActivity: PassphraseRequiredActionBarActivity(), View.OnCli
|
||||
getString(R.string.Unblock_dialog__message, stringBuilder.toString())
|
||||
}
|
||||
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
title(title)
|
||||
text(message)
|
||||
button(R.string.continue_2) { viewModel.unblock(contactsToUnblock) }
|
||||
|
@ -6,9 +6,7 @@ import androidx.preference.Preference
|
||||
import network.loki.messenger.R
|
||||
import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.session.libsession.utilities.TextSecurePreferences.Companion.setBooleanPreference
|
||||
import org.thoughtcrime.securesms.createSessionDialog
|
||||
import org.thoughtcrime.securesms.permissions.Permissions
|
||||
import org.thoughtcrime.securesms.sessionDialog
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
|
||||
internal class CallToggleListener(
|
||||
|
@ -3,14 +3,14 @@ package org.thoughtcrime.securesms.preferences
|
||||
import android.content.Context
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.preference.ListPreference
|
||||
import org.thoughtcrime.securesms.sessionDialog
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
|
||||
fun listPreferenceDialog(
|
||||
context: Context,
|
||||
listPreference: ListPreference,
|
||||
onChange: () -> Unit
|
||||
) : AlertDialog = listPreference.run {
|
||||
context.sessionDialog {
|
||||
context.showSessionDialog {
|
||||
val index = entryValues.indexOf(value)
|
||||
val options = entries.map(CharSequence::toString).toTypedArray()
|
||||
|
||||
|
@ -13,7 +13,6 @@ import org.session.libsignal.utilities.hexEncodedPrivateKey
|
||||
import org.thoughtcrime.securesms.createSessionDialog
|
||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil
|
||||
import org.thoughtcrime.securesms.crypto.MnemonicUtilities
|
||||
import org.thoughtcrime.securesms.sessionDialog
|
||||
|
||||
class SeedDialog: DialogFragment() {
|
||||
private val seed by lazy {
|
||||
|
@ -16,7 +16,6 @@ import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.view.isVisible
|
||||
import network.loki.messenger.BuildConfig
|
||||
import network.loki.messenger.R
|
||||
@ -38,7 +37,7 @@ import org.thoughtcrime.securesms.mms.GlideRequests
|
||||
import org.thoughtcrime.securesms.permissions.Permissions
|
||||
import org.thoughtcrime.securesms.preferences.appearance.AppearanceSettingsActivity
|
||||
import org.thoughtcrime.securesms.profiles.ProfileMediaConstraints
|
||||
import org.thoughtcrime.securesms.sessionDialog
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
import org.thoughtcrime.securesms.util.BitmapDecodingException
|
||||
import org.thoughtcrime.securesms.util.BitmapUtil
|
||||
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
|
||||
@ -261,7 +260,7 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
||||
}
|
||||
|
||||
private fun showEditProfilePictureUI() {
|
||||
sessionDialog {
|
||||
showSessionDialog {
|
||||
title(R.string.activity_settings_set_display_picture)
|
||||
view(R.layout.dialog_change_avatar)
|
||||
button(R.string.activity_settings_upload) { startAvatarSelection() }
|
||||
|
@ -16,7 +16,7 @@ import org.session.libsession.utilities.task.ProgressDialogAsyncTask
|
||||
import org.session.libsignal.utilities.ExternalStorageUtil
|
||||
import org.session.libsignal.utilities.Log
|
||||
import org.thoughtcrime.securesms.mms.PartAuthority
|
||||
import org.thoughtcrime.securesms.sessionDialog
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.io.IOException
|
||||
@ -46,7 +46,7 @@ class SaveAttachmentTask @JvmOverloads constructor(context: Context, count: Int
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun showWarningDialog(context: Context, count: Int = 1, onAcceptListener: () -> Unit = {}) {
|
||||
context.sessionDialog {
|
||||
context.showSessionDialog {
|
||||
title(R.string.ConversationFragment_save_to_sd_card)
|
||||
iconAttribute(R.attr.dialog_alert_icon)
|
||||
text(context.resources.getQuantityString(
|
||||
|
Loading…
x
Reference in New Issue
Block a user