tylerbwong/stack

Issue with Switches for Crashlytics and Event Logging in Stack App Update

D4rK7355608 opened this issue · 2 comments

Describe the bug
The switches for Crashlytics and Event logging in the new update of the Stack app appear unusual.

To Reproduce
Steps to reproduce the behavior:

  1. Update the Stack app to the latest version.
  2. Navigate to the settings where the switches for Crashlytics and Event logging are located.
  3. Observe the appearance of the switches.

Expected behavior
The switches for Crashlytics and Event logging should appear normal.

Screenshots
Too lazy to add screenshots.

Device Info (please complete the following information):

  • Device: Does it matter?
  • OS:Does it matter?
  • Browser:Yes.
  • Version: 13

Additional context
Greetings! I noticed that the Stack app has received a new update, which includes the introduction of switches for Crashlytics and Event logging. However, the switches appear to be a bit unusual. Allow me to explain how to fix them, as I have encountered a similar issue in my own Android apps.

First, create a file called preference_switch_widget_layout.xml in the layout folder. This file should contain the following code:

<com.google.android.material.materialswitch.MaterialSwitch
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/switchWidget"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@null"
    android:clickable="false"
    android:focusable="false"/>

Next, add the following line to the theme used by the settings activity:

  <item name="switchPreferenceCompatStyle">@style/switchPreferenceCompatStyle</item>

Then, add this style to themes.xml:

 <style name="switchPreferenceCompatStyle" parent="@style/Preference.SwitchPreferenceCompat.Material">
        <item name="widgetLayout">@layout/preference_switch_widget_layout</item>
    </style>

After completing these steps, the switch should display normally (assuming I haven't forgotten anything). 😊

Hey @D4rK7355608, thanks for the heads up! I believe the appearance is the default for what the Material library from Google provides. However I have noticed that they don't look quite like the system switches. I'll look into this. Thanks for the code snippets!

Fixed in f5ba4bf