mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-21 15:05:19 +00:00
Update MuteDialog, LinkPreviewDialog, and PathActivity
This commit is contained in:
parent
e7dd1c582d
commit
6dd93b33f2
@ -3,10 +3,10 @@ package org.thoughtcrime.securesms
|
||||
import android.content.Context
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.squareup.phrase.Phrase
|
||||
import network.loki.messenger.R
|
||||
import org.session.libsession.LocalisedTimeUtil
|
||||
import org.session.libsession.utilities.StringSubstitutionConstants.TIME_LARGE_KEY
|
||||
import org.thoughtcrime.securesms.ui.getSubbedString
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
@ -22,10 +22,8 @@ fun showMuteDialog(
|
||||
if (entry.stringRes == R.string.notificationsMute) {
|
||||
context.getString(R.string.notificationsMute)
|
||||
} else {
|
||||
val largeTimeUnitText = LocalisedTimeUtil.getDurationWithSingleLargestTimeUnit(context, Option.entries[index].getTime().milliseconds)
|
||||
Phrase.from(context, entry.stringRes)
|
||||
.put(TIME_LARGE_KEY, largeTimeUnitText)
|
||||
.format().toString()
|
||||
val largeTimeUnitString = LocalisedTimeUtil.getDurationWithSingleLargestTimeUnit(context, Option.entries[index].getTime().milliseconds)
|
||||
context.getSubbedString(entry.stringRes, TIME_LARGE_KEY to largeTimeUnitString)
|
||||
}
|
||||
}.toTypedArray()) {
|
||||
// Note: We add the current timestamp to the mute duration to get the un-mute timestamp
|
||||
|
@ -3,11 +3,12 @@ package org.thoughtcrime.securesms.conversation.v2.dialogs
|
||||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import com.squareup.phrase.Phrase
|
||||
import network.loki.messenger.R
|
||||
import org.session.libsession.utilities.NonTranslatableStringConstants.APP_NAME
|
||||
import org.session.libsession.utilities.StringSubstitutionConstants.APP_NAME_KEY
|
||||
import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.thoughtcrime.securesms.createSessionDialog
|
||||
import org.thoughtcrime.securesms.ui.getSubbedCharSequence
|
||||
|
||||
/** Shown the first time the user inputs a URL that could generate a link preview, to
|
||||
* let them know that Session offers the ability to send and receive link previews. */
|
||||
@ -15,12 +16,10 @@ class LinkPreviewDialog(private val onEnabled: () -> Unit) : DialogFragment() {
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog = createSessionDialog {
|
||||
title(R.string.linkPreviewsEnable)
|
||||
val txt = Phrase.from(context, R.string.linkPreviewsFirstDescription)
|
||||
.put(APP_NAME_KEY, context.getString(R.string.app_name))
|
||||
.format()
|
||||
val txt = context.getSubbedCharSequence(R.string.linkPreviewsFirstDescription, APP_NAME_KEY to APP_NAME)
|
||||
text(txt)
|
||||
button(R.string.enable) { enable() }
|
||||
cancelButton { dismiss() }
|
||||
button(R.string.enable) { enable() }
|
||||
cancelButton { dismiss() }
|
||||
}
|
||||
|
||||
private fun enable() {
|
||||
|
@ -17,7 +17,6 @@ import android.widget.Toast
|
||||
import androidx.annotation.ColorRes
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import com.squareup.phrase.Phrase
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.Job
|
||||
@ -28,10 +27,12 @@ import kotlinx.coroutines.withContext
|
||||
import network.loki.messenger.R
|
||||
import network.loki.messenger.databinding.ActivityPathBinding
|
||||
import org.session.libsession.snode.OnionRequestAPI
|
||||
import org.session.libsession.utilities.NonTranslatableStringConstants.APP_NAME
|
||||
import org.session.libsession.utilities.StringSubstitutionConstants.APP_NAME_KEY
|
||||
import org.session.libsession.utilities.getColorFromAttr
|
||||
import org.session.libsignal.utilities.Snode
|
||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
||||
import org.thoughtcrime.securesms.ui.getSubbedString
|
||||
import org.thoughtcrime.securesms.util.GlowViewUtilities
|
||||
import org.thoughtcrime.securesms.util.IP2Country
|
||||
import org.thoughtcrime.securesms.util.PathDotView
|
||||
@ -54,8 +55,7 @@ class PathActivity : PassphraseRequiredActionBarActivity() {
|
||||
supportActionBar!!.title = resources.getString(R.string.onionRoutingPath)
|
||||
|
||||
// Substitute "Session" into the path description. Note: This is a non-translatable string.
|
||||
val appName = applicationContext.getString(R.string.app_name)
|
||||
val txt = Phrase.from(applicationContext, R.string.onionRoutingPathDescription).put(APP_NAME_KEY, appName).format().toString()
|
||||
val txt = applicationContext.getSubbedString(R.string.onionRoutingPathDescription,APP_NAME_KEY to APP_NAME)
|
||||
binding.pathDescription.text = txt
|
||||
|
||||
binding.pathRowsContainer.disableClipping()
|
||||
@ -259,13 +259,11 @@ class PathActivity : PassphraseRequiredActionBarActivity() {
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
|
||||
startAnimation()
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
|
||||
stopAnimation()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user