mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-07-08 15:04:21 +01:00
Update SwitchMaterial to the new MaterialSwitch.
This commit is contained in:
committed by
Greyson Parrelli
parent
ee48e6c347
commit
eb150d9a15
+2
-2
@@ -13,7 +13,7 @@ import androidx.annotation.CallSuper
|
||||
import androidx.annotation.Discouraged
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.switchmaterial.SwitchMaterial
|
||||
import com.google.android.material.materialswitch.MaterialSwitch
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.components.settings.models.AsyncSwitch
|
||||
@@ -205,7 +205,7 @@ class MultiSelectListPreferenceViewHolder(itemView: View) : PreferenceViewHolder
|
||||
|
||||
class SwitchPreferenceViewHolder(itemView: View) : PreferenceViewHolder<SwitchPreference>(itemView) {
|
||||
|
||||
private val switchWidget: SwitchMaterial = itemView.findViewById(R.id.switch_widget)
|
||||
private val switchWidget: MaterialSwitch = itemView.findViewById(R.id.switch_widget)
|
||||
|
||||
override fun bind(model: SwitchPreference) {
|
||||
super.bind(model)
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ import androidx.core.content.ContextCompat
|
||||
import androidx.core.graphics.drawable.DrawableCompat
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.google.android.material.switchmaterial.SwitchMaterial
|
||||
import com.google.android.material.materialswitch.MaterialSwitch
|
||||
import com.google.android.material.timepicker.MaterialTimePicker
|
||||
import com.google.android.material.timepicker.TimeFormat
|
||||
import io.reactivex.rxjava3.kotlin.subscribeBy
|
||||
@@ -69,7 +69,7 @@ class EditNotificationProfileScheduleFragment : LoggingFragment(R.layout.fragmen
|
||||
|
||||
lifecycleDisposable.bindTo(viewLifecycleOwner.lifecycle)
|
||||
|
||||
val enableToggle: SwitchMaterial = view.findViewById(R.id.edit_notification_profile_schedule_switch)
|
||||
val enableToggle: MaterialSwitch = view.findViewById(R.id.edit_notification_profile_schedule_switch)
|
||||
enableToggle.setOnClickListener { viewModel.setEnabled(enableToggle.isChecked) }
|
||||
|
||||
val startTime: TextView = view.findViewById(R.id.edit_notification_profile_schedule_start_time)
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package org.thoughtcrime.securesms.components.settings.app.notifications.profile
|
||||
|
||||
import android.view.View
|
||||
import com.airbnb.lottie.SimpleColorFilter
|
||||
import com.google.android.material.switchmaterial.SwitchMaterial
|
||||
import com.google.android.material.materialswitch.MaterialSwitch
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.components.settings.DSLSettingsIcon
|
||||
import org.thoughtcrime.securesms.components.settings.DSLSettingsText
|
||||
@@ -34,7 +34,7 @@ object NotificationProfilePreference {
|
||||
|
||||
private class ViewHolder(itemView: View) : PreferenceViewHolder<Model>(itemView) {
|
||||
|
||||
private val switchWidget: SwitchMaterial = itemView.findViewById(R.id.switch_widget)
|
||||
private val switchWidget: MaterialSwitch = itemView.findViewById(R.id.switch_widget)
|
||||
|
||||
override fun bind(model: Model) {
|
||||
super.bind(model)
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ import androidx.navigation.fragment.findNavController
|
||||
import com.airbnb.lottie.LottieAnimationView
|
||||
import com.airbnb.lottie.LottieDrawable
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.google.android.material.switchmaterial.SwitchMaterial
|
||||
import com.google.android.material.materialswitch.MaterialSwitch
|
||||
import io.reactivex.rxjava3.kotlin.subscribeBy
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.thoughtcrime.securesms.R
|
||||
@@ -31,7 +31,7 @@ class ThanksForYourSupportBottomSheetDialogFragment : FixedRoundedCornerBottomSh
|
||||
|
||||
override val peekHeightPercentage: Float = 1f
|
||||
|
||||
private lateinit var switch: SwitchMaterial
|
||||
private lateinit var switch: MaterialSwitch
|
||||
private lateinit var heading: TextView
|
||||
|
||||
private lateinit var badgeRepository: BadgeRepository
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package org.thoughtcrime.securesms.components.settings.models
|
||||
|
||||
import android.view.View
|
||||
import android.widget.ViewSwitcher
|
||||
import com.google.android.material.switchmaterial.SwitchMaterial
|
||||
import com.google.android.material.materialswitch.MaterialSwitch
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.components.settings.DSLSettingsText
|
||||
import org.thoughtcrime.securesms.components.settings.PreferenceModel
|
||||
@@ -33,7 +33,7 @@ object AsyncSwitch {
|
||||
}
|
||||
|
||||
class ViewHolder(itemView: View) : PreferenceViewHolder<Model>(itemView) {
|
||||
private val switchWidget: SwitchMaterial = itemView.findViewById(R.id.switch_widget)
|
||||
private val switchWidget: MaterialSwitch = itemView.findViewById(R.id.switch_widget)
|
||||
private val switcher: ViewSwitcher = itemView.findViewById(R.id.switcher)
|
||||
|
||||
override fun bind(model: Model) {
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package org.thoughtcrime.securesms.components.settings.models
|
||||
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import com.google.android.material.switchmaterial.SwitchMaterial
|
||||
import com.google.android.material.materialswitch.MaterialSwitch
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.components.settings.DSLSettingsText
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.LayoutFactory
|
||||
@@ -35,7 +35,7 @@ object OutlinedSwitch {
|
||||
class ViewHolder(itemView: View) : MappingViewHolder<Model>(itemView) {
|
||||
|
||||
private val text: TextView = findViewById(R.id.outlined_switch_control_text)
|
||||
private val switch: SwitchMaterial = findViewById(R.id.outlined_switch_switch)
|
||||
private val switch: MaterialSwitch = findViewById(R.id.outlined_switch_switch)
|
||||
|
||||
override fun bind(model: Model) {
|
||||
text.text = model.text.resolve(context)
|
||||
|
||||
@@ -18,7 +18,7 @@ import androidx.constraintlayout.widget.Guideline
|
||||
import androidx.core.animation.doOnEnd
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.airbnb.lottie.SimpleColorFilter
|
||||
import com.google.android.material.switchmaterial.SwitchMaterial
|
||||
import com.google.android.material.materialswitch.MaterialSwitch
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.components.TooltipPopup
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
@@ -59,7 +59,7 @@ class ImageEditorHudV2 @JvmOverloads constructor(
|
||||
private val cropFlipButton: View = findViewById(R.id.image_editor_hud_flip_button)
|
||||
private val cropAspectLockButton: ImageView = findViewById(R.id.image_editor_hud_aspect_lock_button)
|
||||
private val blurToggleContainer: View = findViewById(R.id.image_editor_hud_blur_toggle_container)
|
||||
private val blurToggle: SwitchMaterial = findViewById(R.id.image_editor_hud_blur_toggle)
|
||||
private val blurToggle: MaterialSwitch = findViewById(R.id.image_editor_hud_blur_toggle)
|
||||
private val blurToast: View = findViewById(R.id.image_editor_hud_blur_toast)
|
||||
private val blurHelpText: View = findViewById(R.id.image_editor_hud_blur_help_text)
|
||||
private val colorIndicator: ImageView = findViewById(R.id.image_editor_hud_color_indicator)
|
||||
|
||||
@@ -64,7 +64,8 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
style="@style/Widget.Signal.CompoundButton.MaterialSwitch"
|
||||
android:id="@+id/switch_widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:viewBindingIgnore="true"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/dsl_preference_item_background"
|
||||
android:minHeight="56dp">
|
||||
android:minHeight="56dp"
|
||||
tools:viewBindingIgnore="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
@@ -55,15 +55,15 @@
|
||||
tools:text="Some random text to get stuff onto more than one line but not absurdly long like lorem/random"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/switch_widget"
|
||||
style="@style/Widget.Signal.CompoundButton.MaterialSwitch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dsl_settings_gutter"
|
||||
android:clickable="false"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:useMaterialThemeColors="true" />
|
||||
tools:checked="true" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -66,7 +66,8 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/edit_notification_profile_schedule_description"
|
||||
app:layout_goneMarginTop="0dp" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
style="@style/Widget.Signal.CompoundButton.MaterialSwitch"
|
||||
android:id="@+id/edit_notification_profile_schedule_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -85,7 +85,8 @@
|
||||
app:layout_constraintStart_toStartOf="@id/group_link_enable_and_share_approve_outline"
|
||||
app:layout_constraintTop_toTopOf="@id/group_link_enable_and_share_approve_outline" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
style="@style/Widget.Signal.CompoundButton.MaterialSwitch"
|
||||
android:id="@+id/group_link_enable_and_share_approve_new_members_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -57,7 +57,8 @@
|
||||
tools:text="Some random text to get stuff onto more than one line but not absurdly long like lorem/random"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
style="@style/Widget.Signal.CompoundButton.MaterialSwitch"
|
||||
android:id="@+id/switch_widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -32,7 +32,8 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
style="@style/Widget.Signal.CompoundButton.MaterialSwitch"
|
||||
android:id="@+id/outlined_switch_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48sp"
|
||||
|
||||
@@ -104,7 +104,8 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/thanks_bottom_sheet_subhead" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
style="@style/Widget.Signal.CompoundButton.MaterialSwitch"
|
||||
android:id="@+id/thanks_bottom_sheet_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48sp"
|
||||
|
||||
@@ -393,7 +393,8 @@
|
||||
android:text="@string/ImageEditorHud_blur_faces"
|
||||
android:textColor="@color/core_white" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
style="@style/Widget.Signal.CompoundButton.MaterialSwitch"
|
||||
android:id="@+id/image_editor_hud_blur_toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -323,6 +323,10 @@
|
||||
<item name="indicatorColor">@color/signal_colorPrimaryContainer</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Signal.CompoundButton.MaterialSwitch" parent="Widget.Material3.CompoundButton.MaterialSwitch">
|
||||
<item name="materialThemeOverlay">@style/ThemeOverlay.Signal.MaterialSwitch</item>
|
||||
</style>
|
||||
|
||||
<style name="Signal.ThemeOverlay.TextInputLayout" parent="ThemeOverlay.Material3">
|
||||
<item name="colorSurfaceVariant">@color/signal_colorSurfaceVariant</item>
|
||||
<item name="colorOnSurfaceVariant">@color/signal_colorOnSurfaceVariant</item>
|
||||
@@ -331,4 +335,22 @@
|
||||
<item name="colorOnSurface">@color/signal_colorOnSurface</item>
|
||||
<item name="colorError">@color/signal_colorError</item>
|
||||
</style>
|
||||
|
||||
<style name="ThemeOverlay.Signal.MaterialSwitch" parent="ThemeOverlay.Material3">
|
||||
<item name="colorPrimary">@color/signal_colorPrimary</item>
|
||||
<item name="colorPrimaryContainer">@color/signal_colorPrimaryContainer</item>
|
||||
<item name="colorSecondary">@color/signal_colorSecondary</item>
|
||||
<item name="colorSecondaryContainer">@color/signal_colorSecondaryContainer</item>
|
||||
<item name="colorSurface">@color/signal_colorSurface</item>
|
||||
<item name="colorSurfaceVariant">@color/signal_colorSurfaceVariant</item>
|
||||
<item name="colorOnPrimary">@color/signal_colorOnPrimary</item>
|
||||
<item name="colorOnPrimaryContainer">@color/signal_colorOnPrimaryContainer</item>
|
||||
<item name="colorOnSecondary">@color/signal_colorOnSecondary</item>
|
||||
<item name="colorOnSecondaryContainer">@color/signal_colorOnSecondaryContainer</item>
|
||||
<item name="colorOnSurface">@color/signal_colorOnSurface</item>
|
||||
<item name="colorOnSurfaceVariant">@color/signal_colorOnSurfaceVariant</item>
|
||||
<item name="colorOnBackground">@color/signal_colorOnBackground</item>
|
||||
<item name="colorOutline">@color/signal_colorOutline</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -646,5 +646,4 @@
|
||||
<item name="colorControlHighlight">@color/signal_accent_primary</item>
|
||||
<item name="colorControlActivated">@color/signal_accent_primary</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user