Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when inspecting a ListPreference/MultiSelectListPreference #618

Closed
afollestad opened this issue Sep 18, 2018 · 1 comment
Closed

Comments

@afollestad
Copy link

afollestad commented Sep 18, 2018

While using Stetho in the sample project of one of my open source libraries, I noticed a crash.

The crash:

Process: com.afollestad.aestheticsample, PID: 8673
java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed
        at android.graphics.Canvas.checkValidClipOp(Canvas.java:779)
        at android.graphics.Canvas.clipRect(Canvas.java:826)
        at com.facebook.stetho.inspector.elements.android.ViewHighlightOverlays$ViewHighlightOverlaysJellybeanMR2$MainHighlightDrawable.draw(ViewHighlightOverlays.java:141)
        at android.view.ViewOverlay$OverlayViewGroup.dispatchDraw(ViewOverlay.java:256)

This is the visual layout:

I get a crash when inspecting a MultiSelectListPreference, I'm using an AndroidX PreferenceFragmentCompat, not sure if it would happen in the legacy Support Library's as well.


I've made the contents below expandable so it's not overwhelming to look at, at first glance.

The preferences XML:

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:title="My Preferences">

  <Preference
      android:key="basic_preference"
      android:summary="Hello world, testing 1 2 1 2"
      android:title="Basic Preference"
      />

  <PreferenceCategory
      android:title="Category One">

    <CheckBoxPreference
        android:key="checkbox_preference"
        android:summary="Hello world, testing 1 2 1 2"
        android:title="CheckBox Preference"
        />

    <SwitchPreference
        android:key="switch_preference"
        android:summary="Hello world, testing 1 2 1 2"
        android:title="Switch Preference"
        />

  </PreferenceCategory>

  <PreferenceCategory
      android:title="Category Two">

    <DropDownPreference
        android:entries="@array/entries"
        android:entryValues="@array/entry_values"
        android:key="dropdown_preference"
        android:summary="Hello world, testing 1 2 1 2"
        android:title="Dropdown Preference"
        />

    <SeekBarPreference
        android:defaultValue="5"
        android:key="seekbar_preference"
        android:max="10"
        android:summary="Hello world, testing 1 2 1 2"
        android:title="SeekBar Preference"
        />

  </PreferenceCategory>

  <PreferenceCategory
      android:title="Category Three">

    <EditTextPreference
        android:dialogTitle="EditText Dialog"
        android:key="edittext_preference"
        android:summary="Hello world, testing 1 2 1 2"
        android:title="EditText Preference"/>

    <ListPreference
        android:dialogTitle="List Dialog"
        android:entries="@array/entries"
        android:entryValues="@array/entry_values"
        android:key="list_preference"
        android:summary="Hello world, testing 1 2 1 2"
        android:title="List Preference"/>

    <MultiSelectListPreference
        android:dialogTitle="Multi-select List Dialog"
        android:entries="@array/entries"
        android:entryValues="@array/entry_values"
        android:key="multi_select_list_preference"
        android:summary="Hello world, testing 1 2 1 2"
        android:title="Mutli-Select Preference"/>

  </PreferenceCategory>

</PreferenceScreen>

The code that uses the preferences XML:

import android.os.Bundle
import androidx.preference.PreferenceFragmentCompat
import com.afollestad.aesthetic.AestheticActivity

class SettingsFragment : PreferenceFragmentCompat() {

  override fun onCreatePreferences(
    savedInstanceState: Bundle?,
    rootKey: String?
  ) = setPreferencesFromResource(R.xml.preferences, rootKey)
}

class SettingsActivity : AestheticActivity() {

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_settings)

    if (savedInstanceState == null) {
      supportFragmentManager
          .beginTransaction()
          .add(R.id.container, SettingsFragment())
          .commit()
    }
  }
}
@afollestad afollestad changed the title Crash when inspecting a ListPreference Crash when inspecting a ListPreference/MultiSelectListPreference Sep 18, 2018
@jasta
Copy link
Contributor

jasta commented Mar 18, 2019

Duplicate of #607. Fixed in v1.5.1 which just released.

@jasta jasta closed this as completed Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants