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

Exception, not working #116

Open
ronenfe opened this issue Nov 16, 2024 · 5 comments
Open

Exception, not working #116

ronenfe opened this issue Nov 16, 2024 · 5 comments

Comments

@ronenfe
Copy link

ronenfe commented Nov 16, 2024

<com.jaredrummler.android.colorpicker.ColorPreferenceCompat
app:defaultValue="#FF9999"
app:key="day_speed_color_picker1"
app:summary="Choose your color"
app:title="Dial color for day theme"/>

autovolumefree E FATAL EXCEPTION: main (Ask Gemini)
Process: net.festinger.autovolumefree, PID: 14580
android.view.InflateException: Binary XML file line #19: Error inflating class com.jaredrummler.android.colorpicker.ColorPreferenceCompat
at androidx.preference.PreferenceInflater.createItem(PreferenceInflater.java:253)
at androidx.preference.PreferenceInflater.createItemFromTag(PreferenceInflater.java:281)
at androidx.preference.PreferenceInflater.rInflate(PreferenceInflater.java:349)
at androidx.preference.PreferenceInflater.rInflate(PreferenceInflater.java:351)
at androidx.preference.PreferenceInflater.inflate(PreferenceInflater.java:161)
at androidx.preference.PreferenceInflater.inflate(PreferenceInflater.java:112)
at androidx.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:217)
at androidx.preference.PreferenceFragmentCompat.setPreferencesFromResource(PreferenceFragmentCompat.java:380)
at net.festinger.autovolumefree.SettingsFragment.onCreatePreferences(SettingsFragment.kt:58)
at androidx.preference.PreferenceFragmentCompat.onCreate(PreferenceFragmentCompat.java:161)
at androidx.fragment.app.Fragment.performCreate(Fragment.java:2949)
at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:475)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:278)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524)
at android.os.Handler.handleCallback(Handler.java:959)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8705)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at androidx.preference.PreferenceInflater.createItem(PreferenceInflater.java:246)
at androidx.preference.PreferenceInflater.createItemFromTag(PreferenceInflater.java:281) 
at androidx.preference.PreferenceInflater.rInflate(PreferenceInflater.java:349) 
at androidx.preference.PreferenceInflater.rInflate(PreferenceInflater.java:351) 
at androidx.preference.PreferenceInflater.inflate(PreferenceInflater.java:161) 
at androidx.preference.PreferenceInflater.inflate(PreferenceInflater.java:112) 
at androidx.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:217) 
at androidx.preference.PreferenceFragmentCompat.setPreferencesFromResource(PreferenceFragmentCompat.java:380) 
at net.festinger.autovolumefree.SettingsFragment.onCreatePreferences(SettingsFragment.kt:58) 
at androidx.preference.PreferenceFragmentCompat.onCreate(PreferenceFragmentCompat.java:161) 
at androidx.fragment.app.Fragment.performCreate(Fragment.java:2949) 
at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:475) 
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:278) 
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189) 
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100) 
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002) 
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524) 
at android.os.Handler.handleCallback(Handler.java:959) 
at android.os.Handler.dispatchMessage(Handler.java:100) 
at android.os.Looper.loopOnce(Looper.java:232) 
at android.os.Looper.loop(Looper.java:317) 
at android.app.ActivityThread.main(ActivityThread.java:8705) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886) 
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 18 to integer: type=0x3, theme={InheritanceMap=[id=0x7f120163net.festinger.autovolumefree:style/PreferenceThemeOverlay, id=0x7f12011fnet.festinger.autovolumefree:style/BasePreferenceThemeOverlay], Themes=[net.festinger.autovolumefree:style/PreferenceThemeOverlay, not forced, net.festinger.autovolumefree:style/Theme.AutoVolume, forced, net.festinger.autovolumefree:style/Theme.AppCompat.Empty, forced, android:style/Theme.DeviceDefault.Light.DarkActionBar, forced]}
at android.content.res.TypedArray.getInteger(TypedArray.java:652)
at com.jaredrummler.android.colorpicker.ColorPreferenceCompat.onGetDefaultValue(ColorPreferenceCompat.java:142)
at androidx.preference.Preference.(Preference.java:255)
at androidx.preference.Preference.(Preference.java:299)
at androidx.preference.Preference.(Preference.java:314)
at com.jaredrummler.android.colorpicker.ColorPreferenceCompat.(ColorPreferenceCompat.java:36)
at java.lang.reflect.Constructor.newInstance0(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:343) 
at androidx.preference.PreferenceInflater.createItem(PreferenceInflater.java:246) 
at androidx.preference.PreferenceInflater.createItemFromTag(PreferenceInflater.java:281) 
at androidx.preference.PreferenceInflater.rInflate(PreferenceInflater.java:349) 
at androidx.preference.PreferenceInflater.rInflate(PreferenceInflater.java:351) 
at androidx.preference.PreferenceInflater.inflate(PreferenceInflater.java:161) 
at androidx.preference.PreferenceInflater.inflate(PreferenceInflater.java:112) 
at androidx.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:217) 
at androidx.preference.PreferenceFragmentCompat.setPreferencesFromResource(PreferenceFragmentCompat.java:380) 
at net.festinger.autovolumefree.SettingsFragment.onCreatePreferences(SettingsFragment.kt:58) 
at androidx.preference.PreferenceFragmentCompat.onCreate(PreferenceFragmentCompat.java:161) 
at androidx.fragment.app.Fragment.performCreate(Fragment.java:2949) 
at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:475) 
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:278) 
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189) 
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100) 
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002) 
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524) 
at android.os.Handler.handleCallback(Handler.java:959) 
at android.os.Handler.dispatchMessage(Handler.java:100) 
at android.os.Looper.loopOnce(Looper.java:232) 
at android.os.Looper.loop(Looper.java:317) 
at android.app.ActivityThread.main(ActivityThread.java:8705) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886) 

@ronenfe
Copy link
Author

ronenfe commented Nov 16, 2024

It's because it can't accept a string color I think, only int.

@ronenfe
Copy link
Author

ronenfe commented Nov 16, 2024

The problem is you must provide it in this format 0xFF9999 otherwise it will throw exception, although the preview will work. Impossible to debug it. I found it out by trial and error. Also no autocompletion in the xml for the custom attributes.

@ronenfe
Copy link
Author

ronenfe commented Nov 16, 2024

Seems it only works on Android 15, on lower versions i get this:
Screenshot_20241116_213029

@ronenfe
Copy link
Author

ronenfe commented Nov 16, 2024

I had to add app:cpv_showAlphaSlider="true"
and move the slider to 0 because it has a default of 100%. But i don't want the users to have to do that.

@ronenfe
Copy link
Author

ronenfe commented Nov 16, 2024

ok it works now, i'm not sure what was the problem.

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

1 participant