mirror of
https://github.com/oxen-io/session-android.git
synced 2025-05-01 05:10:47 +00:00
Update MessageNotificationsActivity
This commit is contained in:
parent
88cfe41893
commit
28d92fd547
@ -120,7 +120,7 @@
|
|||||||
android:windowSoftInputMode="adjustResize"
|
android:windowSoftInputMode="adjustResize"
|
||||||
android:theme="@style/Theme.Session.DayNight.FlatActionBar" />
|
android:theme="@style/Theme.Session.DayNight.FlatActionBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name="org.thoughtcrime.securesms.onboarding.PNModeActivity"
|
android:name="org.thoughtcrime.securesms.onboarding.messagenotifications.MessageNotificationsActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/Theme.Session.DayNight.FlatActionBar" />
|
android:theme="@style/Theme.Session.DayNight.FlatActionBar" />
|
||||||
<activity
|
<activity
|
||||||
|
@ -24,6 +24,7 @@ import kotlinx.coroutines.launch
|
|||||||
import org.session.libsession.utilities.TextSecurePreferences
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
import org.thoughtcrime.securesms.BaseActionBarActivity
|
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||||
import org.thoughtcrime.securesms.dependencies.ConfigFactory
|
import org.thoughtcrime.securesms.dependencies.ConfigFactory
|
||||||
|
import org.thoughtcrime.securesms.onboarding.messagenotifications.startPNModeActivity
|
||||||
import org.thoughtcrime.securesms.onboarding.pickname.startPickDisplayNameActivity
|
import org.thoughtcrime.securesms.onboarding.pickname.startPickDisplayNameActivity
|
||||||
import org.thoughtcrime.securesms.ui.AppTheme
|
import org.thoughtcrime.securesms.ui.AppTheme
|
||||||
import org.thoughtcrime.securesms.ui.ProgressArc
|
import org.thoughtcrime.securesms.ui.ProgressArc
|
||||||
|
@ -1,187 +0,0 @@
|
|||||||
package org.thoughtcrime.securesms.onboarding
|
|
||||||
|
|
||||||
import android.animation.ArgbEvaluator
|
|
||||||
import android.animation.ValueAnimator
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.graphics.drawable.TransitionDrawable
|
|
||||||
import android.net.Uri
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.Menu
|
|
||||||
import android.view.MenuItem
|
|
||||||
import android.view.View
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.annotation.ColorInt
|
|
||||||
import androidx.annotation.DrawableRes
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
|
||||||
import network.loki.messenger.R
|
|
||||||
import network.loki.messenger.databinding.ActivityPnModeBinding
|
|
||||||
import org.session.libsession.utilities.TextSecurePreferences
|
|
||||||
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.notifications.PushManager
|
|
||||||
import org.thoughtcrime.securesms.notifications.PushRegistry
|
|
||||||
import org.thoughtcrime.securesms.showSessionDialog
|
|
||||||
import org.thoughtcrime.securesms.util.GlowViewUtilities
|
|
||||||
import org.thoughtcrime.securesms.util.PNModeView
|
|
||||||
import org.thoughtcrime.securesms.util.disableClipping
|
|
||||||
import org.thoughtcrime.securesms.util.getAccentColor
|
|
||||||
import org.thoughtcrime.securesms.util.getColorWithID
|
|
||||||
import org.thoughtcrime.securesms.util.push
|
|
||||||
import org.thoughtcrime.securesms.util.setUpActionBarSessionLogo
|
|
||||||
import org.thoughtcrime.securesms.util.show
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
@AndroidEntryPoint
|
|
||||||
class PNModeActivity : BaseActionBarActivity() {
|
|
||||||
|
|
||||||
@Inject lateinit var pushRegistry: PushRegistry
|
|
||||||
|
|
||||||
private lateinit var binding: ActivityPnModeBinding
|
|
||||||
private var selectedOptionView: PNModeView? = null
|
|
||||||
|
|
||||||
// region Lifecycle
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
setUpActionBarSessionLogo(true)
|
|
||||||
TextSecurePreferences.setHasSeenWelcomeScreen(this, true)
|
|
||||||
binding = ActivityPnModeBinding.inflate(layoutInflater)
|
|
||||||
setContentView(binding.root)
|
|
||||||
with(binding) {
|
|
||||||
contentView.disableClipping()
|
|
||||||
fcmOptionView.setOnClickListener { toggleFCM() }
|
|
||||||
fcmOptionView.mainColor = ThemeUtil.getThemedColor(root.context, R.attr.colorPrimary)
|
|
||||||
fcmOptionView.strokeColor = resources.getColorWithID(R.color.pn_option_border, theme)
|
|
||||||
backgroundPollingOptionView.setOnClickListener { toggleBackgroundPolling() }
|
|
||||||
backgroundPollingOptionView.mainColor = ThemeUtil.getThemedColor(root.context, R.attr.colorPrimary)
|
|
||||||
backgroundPollingOptionView.strokeColor = resources.getColorWithID(R.color.pn_option_border, theme)
|
|
||||||
registerButton.setOnClickListener { register() }
|
|
||||||
}
|
|
||||||
toggleFCM()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
|
||||||
menuInflater.inflate(R.menu.menu_pn_mode, menu)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
// endregion
|
|
||||||
|
|
||||||
// region Animation
|
|
||||||
private fun performTransition(@DrawableRes transitionID: Int, subject: View) {
|
|
||||||
val drawable = resources.getDrawable(transitionID, theme) as TransitionDrawable
|
|
||||||
subject.background = drawable
|
|
||||||
drawable.startTransition(250)
|
|
||||||
}
|
|
||||||
// endregion
|
|
||||||
|
|
||||||
// region Interaction
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
|
||||||
when(item.itemId) {
|
|
||||||
R.id.learnMoreButton -> learnMore()
|
|
||||||
else -> { /* Do nothing */ }
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun learnMore() {
|
|
||||||
try {
|
|
||||||
val url = "https://getsession.org/faq/#privacy"
|
|
||||||
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
|
|
||||||
startActivity(intent)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Toast.makeText(this, R.string.invalid_url, Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun toggleFCM() = with(binding) {
|
|
||||||
val accentColor = getAccentColor()
|
|
||||||
when (selectedOptionView) {
|
|
||||||
null -> {
|
|
||||||
performTransition(R.drawable.pn_option_background_select_transition, fcmOptionView)
|
|
||||||
GlowViewUtilities.animateShadowColorChange(fcmOptionView, resources.getColorWithID(R.color.transparent, theme), accentColor)
|
|
||||||
animateStrokeColorChange(fcmOptionView, resources.getColorWithID(R.color.pn_option_border, theme), accentColor)
|
|
||||||
selectedOptionView = fcmOptionView
|
|
||||||
}
|
|
||||||
fcmOptionView -> {
|
|
||||||
performTransition(R.drawable.pn_option_background_deselect_transition, fcmOptionView)
|
|
||||||
GlowViewUtilities.animateShadowColorChange(fcmOptionView, accentColor, resources.getColorWithID(R.color.transparent, theme))
|
|
||||||
animateStrokeColorChange(fcmOptionView, accentColor, resources.getColorWithID(R.color.pn_option_border, theme))
|
|
||||||
selectedOptionView = null
|
|
||||||
}
|
|
||||||
backgroundPollingOptionView -> {
|
|
||||||
performTransition(R.drawable.pn_option_background_select_transition, fcmOptionView)
|
|
||||||
GlowViewUtilities.animateShadowColorChange(fcmOptionView, resources.getColorWithID(R.color.transparent, theme), accentColor)
|
|
||||||
animateStrokeColorChange(fcmOptionView, resources.getColorWithID(R.color.pn_option_border, theme), accentColor)
|
|
||||||
performTransition(R.drawable.pn_option_background_deselect_transition, backgroundPollingOptionView)
|
|
||||||
GlowViewUtilities.animateShadowColorChange(backgroundPollingOptionView, accentColor, resources.getColorWithID(R.color.transparent, theme))
|
|
||||||
animateStrokeColorChange(backgroundPollingOptionView, accentColor, resources.getColorWithID(R.color.pn_option_border, theme))
|
|
||||||
selectedOptionView = fcmOptionView
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun toggleBackgroundPolling() = with(binding) {
|
|
||||||
val accentColor = getAccentColor()
|
|
||||||
when (selectedOptionView) {
|
|
||||||
null -> {
|
|
||||||
performTransition(R.drawable.pn_option_background_select_transition, backgroundPollingOptionView)
|
|
||||||
GlowViewUtilities.animateShadowColorChange(backgroundPollingOptionView, resources.getColorWithID(R.color.transparent, theme), accentColor)
|
|
||||||
animateStrokeColorChange(backgroundPollingOptionView, resources.getColorWithID(R.color.pn_option_border, theme), accentColor)
|
|
||||||
selectedOptionView = backgroundPollingOptionView
|
|
||||||
}
|
|
||||||
backgroundPollingOptionView -> {
|
|
||||||
performTransition(R.drawable.pn_option_background_deselect_transition, backgroundPollingOptionView)
|
|
||||||
GlowViewUtilities.animateShadowColorChange(backgroundPollingOptionView, accentColor, resources.getColorWithID(R.color.transparent, theme))
|
|
||||||
animateStrokeColorChange(backgroundPollingOptionView, accentColor, resources.getColorWithID(R.color.pn_option_border, theme))
|
|
||||||
selectedOptionView = null
|
|
||||||
}
|
|
||||||
fcmOptionView -> {
|
|
||||||
performTransition(R.drawable.pn_option_background_select_transition, backgroundPollingOptionView)
|
|
||||||
GlowViewUtilities.animateShadowColorChange(backgroundPollingOptionView, resources.getColorWithID(R.color.transparent, theme), accentColor)
|
|
||||||
animateStrokeColorChange(backgroundPollingOptionView, resources.getColorWithID(R.color.pn_option_border, theme), accentColor)
|
|
||||||
performTransition(R.drawable.pn_option_background_deselect_transition, fcmOptionView)
|
|
||||||
GlowViewUtilities.animateShadowColorChange(fcmOptionView, accentColor, resources.getColorWithID(R.color.transparent, theme))
|
|
||||||
animateStrokeColorChange(fcmOptionView, accentColor, resources.getColorWithID(R.color.pn_option_border, theme))
|
|
||||||
selectedOptionView = backgroundPollingOptionView
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun animateStrokeColorChange(bubble: PNModeView, @ColorInt startColor: Int, @ColorInt endColor: Int) {
|
|
||||||
val animation = ValueAnimator.ofObject(ArgbEvaluator(), startColor, endColor)
|
|
||||||
animation.duration = 250
|
|
||||||
animation.addUpdateListener { animator ->
|
|
||||||
val color = animator.animatedValue as Int
|
|
||||||
bubble.strokeColor = color
|
|
||||||
}
|
|
||||||
animation.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun register() {
|
|
||||||
if (selectedOptionView == null) {
|
|
||||||
showSessionDialog {
|
|
||||||
title(R.string.activity_pn_mode_no_option_picked_dialog_title)
|
|
||||||
button(R.string.ok)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
TextSecurePreferences.setPushEnabled(this, (selectedOptionView == binding.fcmOptionView))
|
|
||||||
val application = ApplicationContext.getInstance(this)
|
|
||||||
application.startPollingIfNeeded()
|
|
||||||
pushRegistry.refresh(true)
|
|
||||||
val intent = Intent(this, HomeActivity::class.java)
|
|
||||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
|
||||||
intent.putExtra(HomeActivity.FROM_ONBOARDING, true)
|
|
||||||
show(intent)
|
|
||||||
}
|
|
||||||
// endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Context.startPNModeActivity(flags: Int = 0) {
|
|
||||||
Intent(this, PNModeActivity::class.java)
|
|
||||||
.also { it.flags = flags }
|
|
||||||
.also(::startActivity)
|
|
||||||
}
|
|
@ -0,0 +1,156 @@
|
|||||||
|
package org.thoughtcrime.securesms.onboarding.messagenotifications
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.activity.viewModels
|
||||||
|
import androidx.annotation.StringRes
|
||||||
|
import androidx.compose.foundation.BorderStroke
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.material.ButtonDefaults
|
||||||
|
import androidx.compose.material.MaterialTheme
|
||||||
|
import androidx.compose.material.OutlinedButton
|
||||||
|
import androidx.compose.material.RadioButton
|
||||||
|
import androidx.compose.material.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.collectAsState
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.platform.ComposeView
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
import network.loki.messenger.R
|
||||||
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
|
import org.thoughtcrime.securesms.ApplicationContext
|
||||||
|
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||||
|
import org.thoughtcrime.securesms.home.HomeActivity
|
||||||
|
import org.thoughtcrime.securesms.notifications.PushRegistry
|
||||||
|
import org.thoughtcrime.securesms.ui.AppTheme
|
||||||
|
import org.thoughtcrime.securesms.ui.OutlineButton
|
||||||
|
import org.thoughtcrime.securesms.ui.h8
|
||||||
|
import org.thoughtcrime.securesms.ui.h9
|
||||||
|
import org.thoughtcrime.securesms.ui.session_accent
|
||||||
|
import org.thoughtcrime.securesms.ui.small
|
||||||
|
import org.thoughtcrime.securesms.util.setUpActionBarSessionLogo
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@AndroidEntryPoint
|
||||||
|
class MessageNotificationsActivity : BaseActionBarActivity() {
|
||||||
|
|
||||||
|
@Inject lateinit var pushRegistry: PushRegistry
|
||||||
|
|
||||||
|
private val viewModel: MessageNotificationsViewModel by viewModels()
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setUpActionBarSessionLogo(true)
|
||||||
|
TextSecurePreferences.setHasSeenWelcomeScreen(this, true)
|
||||||
|
|
||||||
|
ComposeView(this)
|
||||||
|
.apply { setContent { MessageNotifications() } }
|
||||||
|
.let(::setContentView)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun MessageNotifications() {
|
||||||
|
val state by viewModel.stateFlow.collectAsState()
|
||||||
|
|
||||||
|
MessageNotifications(state, viewModel::setEnabled, ::register)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun register() {
|
||||||
|
TextSecurePreferences.setPushEnabled(this, viewModel.stateFlow.value.pushEnabled)
|
||||||
|
ApplicationContext.getInstance(this).startPollingIfNeeded()
|
||||||
|
pushRegistry.refresh(true)
|
||||||
|
Intent(this, HomeActivity::class.java).apply {
|
||||||
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||||
|
putExtra(HomeActivity.FROM_ONBOARDING, true)
|
||||||
|
}.also(::startActivity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
fun MessageNotifications(
|
||||||
|
state: MessageNotificationsState = MessageNotificationsState(),
|
||||||
|
setEnabled: (Boolean) -> Unit = {},
|
||||||
|
onContinue: () -> Unit = {}
|
||||||
|
) {
|
||||||
|
AppTheme {
|
||||||
|
Column(Modifier.padding(horizontal = 32.dp)) {
|
||||||
|
Spacer(Modifier.weight(1f))
|
||||||
|
Text("Message notifications", style = MaterialTheme.typography.h4)
|
||||||
|
Spacer(Modifier.height(16.dp))
|
||||||
|
Text("There are two ways Session can notify you of new messages.")
|
||||||
|
Spacer(Modifier.height(16.dp))
|
||||||
|
NotificationRadioButton(
|
||||||
|
R.string.activity_pn_mode_fast_mode,
|
||||||
|
R.string.activity_pn_mode_fast_mode_explanation,
|
||||||
|
R.string.activity_pn_mode_recommended_option_tag,
|
||||||
|
selected = state.pushEnabled,
|
||||||
|
onClick = { setEnabled(true) }
|
||||||
|
)
|
||||||
|
Spacer(Modifier.height(16.dp))
|
||||||
|
NotificationRadioButton(
|
||||||
|
R.string.activity_pn_mode_slow_mode,
|
||||||
|
R.string.activity_pn_mode_slow_mode_explanation,
|
||||||
|
selected = state.pushDisabled,
|
||||||
|
onClick = { setEnabled(false) }
|
||||||
|
)
|
||||||
|
Spacer(Modifier.weight(1f))
|
||||||
|
OutlineButton(
|
||||||
|
stringResource(R.string.continue_2),
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.CenterHorizontally)
|
||||||
|
.width(262.dp),
|
||||||
|
onClick = onContinue
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(12.dp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun NotificationRadioButton(
|
||||||
|
@StringRes title: Int,
|
||||||
|
@StringRes explanation: Int,
|
||||||
|
@StringRes tag: Int? = null,
|
||||||
|
selected: Boolean = false,
|
||||||
|
onClick: () -> Unit = {}
|
||||||
|
) {
|
||||||
|
Row {
|
||||||
|
OutlinedButton(
|
||||||
|
onClick = onClick,
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
colors = ButtonDefaults.outlinedButtonColors(backgroundColor = MaterialTheme.colors.background, contentColor = Color.White),
|
||||||
|
border = if (selected) BorderStroke(ButtonDefaults.OutlinedBorderSize, session_accent) else ButtonDefaults.outlinedBorder,
|
||||||
|
shape = RoundedCornerShape(8.dp)
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
verticalArrangement = Arrangement.spacedBy(6.dp)
|
||||||
|
) {
|
||||||
|
Text(stringResource(title), style = MaterialTheme.typography.h8)
|
||||||
|
Text(stringResource(explanation), style = MaterialTheme.typography.small)
|
||||||
|
tag?.let { Text(stringResource(it), color = session_accent, style = MaterialTheme.typography.h9) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RadioButton(selected = selected, modifier = Modifier.align(Alignment.CenterVertically), onClick = onClick)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Context.startPNModeActivity(flags: Int = 0) {
|
||||||
|
Intent(this, MessageNotificationsActivity::class.java)
|
||||||
|
.also { it.flags = flags }
|
||||||
|
.also(::startActivity)
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package org.thoughtcrime.securesms.onboarding.messagenotifications
|
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
|
import kotlinx.coroutines.flow.update
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@HiltViewModel
|
||||||
|
class MessageNotificationsViewModel @Inject constructor(): ViewModel() {
|
||||||
|
private val state = MutableStateFlow(MessageNotificationsState())
|
||||||
|
val stateFlow = state.asStateFlow()
|
||||||
|
|
||||||
|
fun setEnabled(enabled: Boolean) {
|
||||||
|
state.update { MessageNotificationsState(pushEnabled = enabled) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class MessageNotificationsState(val pushEnabled: Boolean = true) {
|
||||||
|
val pushDisabled get() = !pushEnabled
|
||||||
|
}
|
@ -32,9 +32,7 @@ import dagger.hilt.android.AndroidEntryPoint
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.thoughtcrime.securesms.BaseActionBarActivity
|
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||||
import org.thoughtcrime.securesms.conversation.v2.ConversationActivityV2
|
import org.thoughtcrime.securesms.onboarding.messagenotifications.startPNModeActivity
|
||||||
import org.thoughtcrime.securesms.conversation.v2.ConversationViewModel
|
|
||||||
import org.thoughtcrime.securesms.onboarding.startPNModeActivity
|
|
||||||
import org.thoughtcrime.securesms.ui.AppTheme
|
import org.thoughtcrime.securesms.ui.AppTheme
|
||||||
import org.thoughtcrime.securesms.ui.OutlineButton
|
import org.thoughtcrime.securesms.ui.OutlineButton
|
||||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||||
|
@ -1,119 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<ScrollView
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/contentView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
|
||||||
android:layout_marginTop="@dimen/very_large_spacing"
|
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
|
||||||
android:textSize="@dimen/very_large_font_size"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:contentDescription="@string/AccessibilityId_message_notifications"
|
|
||||||
android:text="@string/activity_pn_mode_message_notifications" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
|
||||||
android:layout_marginTop="@dimen/large_spacing"
|
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
|
||||||
android:textSize="@dimen/medium_font_size"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:text="@string/activity_pn_mode_explanation" />
|
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.util.PNModeView
|
|
||||||
android:contentDescription="@string/AccessibilityId_fast_mode_notifications_option"
|
|
||||||
android:id="@+id/fcmOptionView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
|
||||||
android:layout_marginTop="@dimen/large_spacing"
|
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
|
||||||
android:padding="12dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:background="@drawable/pn_option_background">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="@dimen/medium_font_size"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="@string/activity_pn_mode_fast_mode" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:textSize="@dimen/very_small_font_size"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:text="@string/activity_pn_mode_fast_mode_explanation" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:textSize="@dimen/small_font_size"
|
|
||||||
android:textColor="?colorAccent"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="@string/activity_pn_mode_recommended_option_tag" />
|
|
||||||
|
|
||||||
</org.thoughtcrime.securesms.util.PNModeView>
|
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.util.PNModeView
|
|
||||||
android:contentDescription="@string/AccessibilityId_slow_mode_notifications_option"
|
|
||||||
android:id="@+id/backgroundPollingOptionView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
|
||||||
android:layout_marginTop="@dimen/small_spacing"
|
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
|
||||||
android:padding="12dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:background="@drawable/pn_option_background">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="@dimen/medium_font_size"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="@string/activity_pn_mode_slow_mode"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:textSize="@dimen/very_small_font_size"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:text="@string/activity_pn_mode_slow_mode_explanation" />
|
|
||||||
|
|
||||||
</org.thoughtcrime.securesms.util.PNModeView>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style="@style/Widget.Session.Button.Common.ProminentFilled"
|
|
||||||
android:id="@+id/registerButton"
|
|
||||||
android:contentDescription="@string/AccessibilityId_continue_message_notifications"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/medium_button_height"
|
|
||||||
android:layout_marginLeft="@dimen/massive_spacing"
|
|
||||||
android:layout_marginTop="@dimen/very_large_spacing"
|
|
||||||
android:layout_marginRight="@dimen/massive_spacing"
|
|
||||||
android:layout_marginBottom="@dimen/onboarding_button_bottom_offset"
|
|
||||||
android:text="@string/continue_2" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</ScrollView>
|
|
@ -1,118 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<ScrollView
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/contentView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
|
||||||
android:layout_marginTop="@dimen/very_large_spacing"
|
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
|
||||||
android:textSize="@dimen/large_font_size"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:contentDescription="@string/AccessibilityId_message_notifications"
|
|
||||||
android:text="@string/activity_pn_mode_message_notifications" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
|
||||||
android:layout_marginTop="@dimen/medium_spacing"
|
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
|
||||||
android:textSize="@dimen/medium_font_size"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:text="@string/activity_pn_mode_explanation" />
|
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.util.PNModeView
|
|
||||||
android:contentDescription="@string/AccessibilityId_fast_mode_notifications_option"
|
|
||||||
android:id="@+id/fcmOptionView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
|
||||||
android:layout_marginTop="@dimen/medium_spacing"
|
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
|
||||||
android:padding="12dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:background="@color/pn_option_border">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="@dimen/medium_font_size"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="@string/activity_pn_mode_fast_mode" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:textSize="@dimen/very_small_font_size"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:text="@string/activity_pn_mode_fast_mode_explanation" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:textSize="@dimen/small_font_size"
|
|
||||||
android:textColor="?colorAccent"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="@string/activity_pn_mode_recommended_option_tag" />
|
|
||||||
|
|
||||||
</org.thoughtcrime.securesms.util.PNModeView>
|
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.util.PNModeView
|
|
||||||
android:contentDescription="@string/AccessibilityId_slow_mode_notifications_option"
|
|
||||||
android:id="@+id/backgroundPollingOptionView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
|
||||||
android:layout_marginTop="@dimen/small_spacing"
|
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
|
||||||
android:padding="12dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:background="@drawable/pn_option_background">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="@dimen/medium_font_size"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="@string/activity_pn_mode_slow_mode" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:textSize="@dimen/very_small_font_size"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:text="@string/activity_pn_mode_slow_mode_explanation" />
|
|
||||||
|
|
||||||
</org.thoughtcrime.securesms.util.PNModeView>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style="@style/Widget.Session.Button.Common.ProminentFilled"
|
|
||||||
android:contentDescription="@string/AccessibilityId_continue_message_notifications"
|
|
||||||
android:id="@+id/registerButton"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/medium_button_height"
|
|
||||||
android:layout_marginLeft="@dimen/massive_spacing"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:layout_marginRight="@dimen/massive_spacing"
|
|
||||||
android:layout_marginBottom="@dimen/onboarding_button_bottom_offset"
|
|
||||||
android:text="@string/continue_2" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</ScrollView>
|
|
@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:title="@string/activity_path_learn_more_button_title"
|
|
||||||
android:id="@+id/learnMoreButton"
|
|
||||||
android:icon="@drawable/ic_info_outline_white_24dp"
|
|
||||||
app:showAsAction="always" />
|
|
||||||
|
|
||||||
</menu>
|
|
Loading…
x
Reference in New Issue
Block a user