gericop / android-support-preference-v7-fix Goto Github PK
View Code? Open in Web Editor NEWAndroid androidx.preference support library has some issues, this lib tries to fix them.
Home Page: https://discord.gg/87NVsSK
License: Apache License 2.0
Android androidx.preference support library has some issues, this lib tries to fix them.
Home Page: https://discord.gg/87NVsSK
License: Apache License 2.0
Hey there,
i want to change the accent color to a different color as the default accent color in the rest of my activity.
Adding <color name="accent">#ff4081</color> <color name="preference_accent">@color/accent</color>
to my colors.xml doesn't fix it :(
Is there a other way to overwrite the accentcolor only for the preference fragment?
The issue initially related to this mess (https://code.google.com/p/android/issues/detail?id=183376) was closed and marked as released. Other users have complained this was not the case but Google dev won't bother look at it anymore.
Since you have a pretty clear understanding of the issue, would you mind opening a new case as asked in comment 64 so they can release a proper fix once for all ?
Hello. If you rotate device 2 times with the open dialog then occurs crash:
java.lang.IllegalStateException: Failure saving state: ListPreferenceDialogFragmentCompat{9d3f3e08 #1 android.support.v7.preference.PreferenceFragment.DIALOG} has target not in fragment manager: SettingsFragment{9d3f3c08}
at android.support.v4.app.FragmentManagerImpl.saveAllState(FragmentManager.java:1935)
at android.support.v4.app.FragmentController.saveAllState(FragmentController.java:134)
at android.support.v4.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:568)
at android.support.v7.app.AppCompatActivity.onSaveInstanceState(AppCompatActivity.java:511)
at android.app.Activity.performSaveInstanceState(Activity.java:1153)
at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1223)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3712)
at android.app.ActivityThread.access$900(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
<EditTextPreference
android:defaultValue="200"
android:inputType="number"
android:key="limit"
android:summary="title"
android:title="content" />
When I use
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
return preferences.getInt("limit", 200);
It throws java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
.
Hi @Gericop ,
I tried to add the following information on the already closed ticket - #25
However, I'm not sure whether you will get notified. Since I found no way to contact you, I try to create a new ticket. I hope that is fine for you.
I realize the reflection solution doesn't work fine for inner preference page.
Here's the XML for the preference screen - https://gist.github.com/yccheok/4172d782249757b1153cee9edd4c566b
Thanks.
p/s I like the work u had done on this project. In order to show my appreciate, I would like to donate to this project. May I know, does your project accept paypal donation? Thanks.
As they say, a picture is worth a thousand words...
On API 19 and 23 the background color looks good, the white I specified as <item name="android:windowBackground">@android:color/white</item>
on my application theme. But it looks odd on API 22 (probably 21 too). Any thoughts on how to fix this locally or would I have to wait for a possible fix on this library?
Although this does not look good to me, could this be the expected behavior?
Got some crashes from SwitchPreferencesCompat:
java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling
at android.support.v7.widget.RecyclerView.assertNotInLayoutOrScroll(RecyclerView.java)
at android.support.v7.widget.RecyclerView$RecyclerViewDataObserver.onItemRangeChanged(RecyclerView.java)
at android.support.v7.widget.RecyclerView$AdapterDataObservable.notifyItemRangeChanged(RecyclerView.java)
at android.support.v7.widget.RecyclerView$Adapter.notifyItemChanged(RecyclerView.java)
at android.support.v7.preference.PreferenceGroupAdapter.onPreferenceChange(PreferenceGroupAdapter.java)
at android.support.v7.preference.Preference.notifyChanged(Preference.java)
at android.support.v7.preference.TwoStatePreference.setChecked(TwoStatePreference.java)
at com.takisoft.fix.support.v7.preference.SwitchPreferenceCompat.setChecked(SwitchPreferenceCompat.java)
at android.support.v7.preference.SwitchPreferenceCompat$Listener.onCheckedChanged(SwitchPreferenceCompat.java)
at android.widget.CompoundButton.setChecked(CompoundButton.java:165)
at android.support.v7.widget.SwitchCompat.setChecked(SwitchCompat.java)
at com.takisoft.fix.support.v7.preference.SwitchPreferenceCompat.onBindViewHolder(SwitchPreferenceCompat.java)
This came from developer console and I can't reproduce it from my test devices. Could it be the animation when switching state?
Nothing preferences related, but it still needs the upgrade.
Btw is #13 going to be merged some day?
Hi Gergely Kőrössy,
Sorry for that! Since I don't find any better channel to contact you to ask about non-project thingy, I decide to open this issues in order able to ping you.
Recently, I wish to fork some Android library projects from GitHub, perform some modification, publish to maven (or jcenter) for my own usage purpose.
So that I can use them by having the following in my build.gradle
compile 'com.yccheok:my-forked-library-v7:24'
After reading https://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en
I expect I shall saw some similar info in your build.gradle
apply plugin: 'com.android.library'
ext {
bintrayRepo = 'maven'
bintrayName = 'fb-like'
publishedGroupId = 'com.inthecheesefactory.thecheeselibrary'
libraryName = 'FBLike'
However, I found none. They just seem like a normal build.gradle for non-library project.
May I know what is the secret behind, of publishing your Android-Support-Preference-V7-Fix
library?
Thank you very much!
Cheok
First of all, great library! I don't think this is a bug directly for your library, but maybe can add it as a fix? See the comparison below using the regular PreferenceFragment, PreferenceFragmentCompat (using v14 theme), and your PreferenceFragmentCompat respectively.
I've tried setting my own android:listSeparatorTextViewStyle
and Preference_TextAppearanceMaterialBody2
with 0 bottom margin/padding and it doesn't seem to fix it.
Any idea what's causing this issue? Thanks for all the work you put in.
I'm seeing a crash on a user. It's a Note 3 with Android 4.4.2. It seems it's because of the reflection not finding the fields? I can't reproduce this on my Nexus 5.
Here's the stacktrace:
Fatal Exception: java.lang.NullPointerException
at com.takisoft.fix.support.v7.preference.PreferenceGroupAdapter.getReflectedIds(Unknown Source)
at com.takisoft.fix.support.v7.preference.PreferenceGroupAdapter.getReflectedIds(Unknown Source)
at com.takisoft.fix.support.v7.preference.PreferenceGroupAdapter.onCreateViewHolder(Unknown Source)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(Unknown Source)
at android.support.v7.widget.RecyclerView$Recycler.clear(Unknown Source)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(Unknown Source)
at android.support.v7.widget.LinearLayoutManager$LayoutState.hasMore(Unknown Source)
at android.support.v7.widget.LinearLayoutManager.generateDefaultLayoutParams(Unknown Source)
at android.support.v7.widget.LinearLayoutManager.generateDefaultLayoutParams(Unknown Source)
at android.support.v7.widget.LinearLayoutManager.findViewByPosition(Unknown Source)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(Unknown Source)
at android.support.v7.widget.RecyclerView.dispatchLayout(Unknown Source)
at android.support.v7.widget.RecyclerView.onLayout(Unknown Source)
at android.view.View.layout(View.java:15648)
at android.view.ViewGroup.layout(ViewGroup.java:4856)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:15648)
at android.view.ViewGroup.layout(ViewGroup.java:4856)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
at android.view.View.layout(View.java:15648)
at android.view.ViewGroup.layout(ViewGroup.java:4856)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:15648)
at android.view.ViewGroup.layout(ViewGroup.java:4856)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
at android.view.View.layout(View.java:15648)
at android.view.ViewGroup.layout(ViewGroup.java:4856)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:15648)
at android.view.ViewGroup.layout(ViewGroup.java:4856)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
at android.view.View.layout(View.java:15648)
at android.view.ViewGroup.layout(ViewGroup.java:4856)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:15648)
at android.view.ViewGroup.layout(ViewGroup.java:4856)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
at android.view.View.layout(View.java:15648)
at android.view.ViewGroup.layout(ViewGroup.java:4856)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:15648)
at android.view.ViewGroup.layout(ViewGroup.java:4856)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:15648)
at android.view.ViewGroup.layout(ViewGroup.java:4856)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2245)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1967)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1199)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6383)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803)
at android.view.Choreographer.doCallbacks(Choreographer.java:603)
at android.view.Choreographer.doFrame(Choreographer.java:573)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5293)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
at dalvik.system.NativeStart.main(NativeStart.java)
Currently, I have an app which I need to support Android 4 and above.
Previously, I'm using solution from https://github.com/Gericop/Android-Support-Preference-V7-Fix/tree/c42097b2e733aeb2ca69a5c43e9437f6f21ac541
It looks like
In previously solution, I'm using multiple styles.xml which looks like
values/styles.xml
<!-- https://github.com/Gericop/Android-Support-Preference-V7-Fix --> <!-- http://stackoverflow.com/questions/32070670/preferencefragmentcompat-requires-preferencetheme-to-be-set --> <style name="Theme.JStock.Light" parent="@style/Theme.JStock.Base.Light"> <item name="preferenceTheme">@style/PreferenceThemeOverlay</item> <!-- Overriding the category views as they don't look good --> <item name="android:listSeparatorTextViewStyle">@style/MyListSeparatorTextView</item> </style> <style name="Theme.JStock.Dark" parent="@style/Theme.JStock.Base.Dark"> <item name="preferenceTheme">@style/PreferenceThemeOverlay</item> <!-- Overriding the category views as they don't look good --> <item name="android:listSeparatorTextViewStyle">@style/MyListSeparatorTextView</item> </style> <!-- Overriding preference theme to eliminate left-right padding --> <!-- Actually it would require one to provide the custom layout files with the padding INSIDE the preference layouts, not on the preference list itself, thus, I'll not do this now <style name="PreferenceThemeOverlayFix" parent="@style/PreferenceThemeOverlay"> <item name="preferenceFragmentListStyle">@style/PreferenceFragmentListFix</item> </style> <style name="PreferenceFragmentListFix"> <item name="android:paddingLeft">0dp</item> <item name="android:paddingRight">0dp</item> </style>--> <!-- The default category looks bad, so overriding its appearance now --> <style name="MyListSeparatorTextView"> <item name="android:textSize">14sp</item> <item name="android:textStyle">bold</item> <item name="android:paddingTop">16dp</item> <item name="android:layout_marginBottom">16dp</item> </style>
values-v14/styles.xml
# values-v17/styles.xml<!-- https://github.com/Gericop/Android-Support-Preference-V7-Fix --> <!-- http://stackoverflow.com/questions/32070670/preferencefragmentcompat-requires-preferencetheme-to-be-set --> <style name="Theme.JStock.Light" parent="@style/Theme.JStock.Base.Light"> <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> </style> <style name="Theme.JStock.Dark" parent="@style/Theme.JStock.Base.Dark"> <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> </style> <!-- This is needed because the default PreferenceCategory appearance doesn't use bold text style --> <style name="Preference_TextAppearanceMaterialBody2"> <item name="android:textSize">14sp</item> <item name="android:fontFamily">sans-serif-medium</item> <item name="android:textStyle">bold</item> <item name="android:textColor">?android:attr/textColorPrimary</item> </style> <!-- END OF HACKING -->
# values-v21/styles.xml<!-- https://github.com/Gericop/Android-Support-Preference-V7-Fix --> <!-- http://stackoverflow.com/questions/32070670/preferencefragmentcompat-requires-preferencetheme-to-be-set --> <style name="Theme.JStock.Light" parent="@style/Theme.JStock.Base.Light"> <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> <!-- Padding fix --> <item name="android:listPreferredItemPaddingStart">16dp</item> <item name="android:listPreferredItemPaddingEnd">16dp</item> </style> <style name="Theme.JStock.Dark" parent="@style/Theme.JStock.Base.Dark"> <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> <!-- Padding fix --> <item name="android:listPreferredItemPaddingStart">16dp</item> <item name="android:listPreferredItemPaddingEnd">16dp</item> </style> <!-- This is needed because the default PreferenceCategory appearance doesn't use bold text style --> <style name="Preference_TextAppearanceMaterialBody2"> <item name="android:textSize">14sp</item> <item name="android:fontFamily">sans-serif-medium</item> <item name="android:textStyle">bold</item> <item name="android:textColor">?android:attr/textColorPrimary</item> </style> <!-- END OF HACKING -->
<!-- https://github.com/Gericop/Android-Support-Preference-V7-Fix --> <!-- http://stackoverflow.com/questions/32070670/preferencefragmentcompat-requires-preferencetheme-to-be-set --> <style name="Theme.JStock.Light" parent="@style/Theme.JStock.Base.Light"> <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> </style> <style name="Theme.JStock.Dark" parent="@style/Theme.JStock.Base.Dark"> <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> </style>
After migrating to latest gradle based solution, I was wondering, whether those multiple styles.xml are still necessary? As, I remove all styles.xml except values/styles.xml
<style name="Theme.JStock.Light" parent="@style/Theme.JStock.Base.Light"> <item name="preferenceTheme">@style/PreferenceThemeOverlay</item> </style> <style name="Theme.JStock.Dark" parent="@style/Theme.JStock.Base.Dark"> <item name="preferenceTheme">@style/PreferenceThemeOverlay</item> </style>
But, it looks like this.
Does that means, I should leave all my multiple styles.xml unchanged?
Stack trace:
Duplicate annotation 'android.support.annotation.IntDef'; for signature: 'com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers divPrefFlags' in the file /home/yaroslav/AndroidStudioProjects/LibreTorrent/app/build/intermediates/exploded-aar/com.takisoft.fix/preference-v7/24.2.0.0/annotations.zip!/com/takisoft/fix/support/v7/preference/annotations.xml
java.lang.Throwable
at com.intellij.diagnostic.LogMessageEx.error(LogMessageEx.java:136)
at com.intellij.codeInsight.ExternalAnnotationsManagerImpl.duplicateError(ExternalAnnotationsManagerImpl.java:709)
at com.intellij.codeInsight.BaseExternalAnnotationsManager$DataParsingSaxHandler.endElement(BaseExternalAnnotationsManager.java:468)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at com.intellij.codeInsight.BaseExternalAnnotationsManager.getDataFromFile(BaseExternalAnnotationsManager.java:178)
at com.intellij.codeInsight.BaseExternalAnnotationsManager.doCollect(BaseExternalAnnotationsManager.java:219)
at com.intellij.codeInsight.BaseExternalAnnotationsManager.collectExternalAnnotations(BaseExternalAnnotationsManager.java:146)
at com.intellij.codeInsight.BaseExternalAnnotationsManager.findExternalAnnotations(BaseExternalAnnotationsManager.java:123)
at org.jetbrains.android.inspections.lint.LombokPsiParser.getAnnotations(LombokPsiParser.java:430)
at org.jetbrains.android.inspections.lint.LombokPsiParser.access$900(LombokPsiParser.java:57)
at org.jetbrains.android.inspections.lint.LombokPsiParser$ResolvedPsiMethod.getAnnotations(LombokPsiParser.java:559)
at com.android.tools.lint.checks.CallSuperDetector.getRequiredSuperMethod(CallSuperDetector.java:164)
at com.android.tools.lint.checks.CallSuperDetector.checkCallSuper(CallSuperDetector.java:117)
at com.android.tools.lint.checks.CallSuperDetector.access$000(CallSuperDetector.java:53)
at com.android.tools.lint.checks.CallSuperDetector$1.visitMethodDeclaration(CallSuperDetector.java:105)
at com.android.tools.lint.client.api.JavaVisitor$DispatchVisitor.visitMethodDeclaration(JavaVisitor.java:1066)
at lombok.ast.MethodDeclaration.accept(MethodDeclaration.java:226)
at lombok.ast.NormalTypeBody.accept(NormalTypeBody.java:57)
at lombok.ast.ClassDeclaration.accept(ClassDeclaration.java:239)
at lombok.ast.CompilationUnit.accept(CompilationUnit.java:83)
at com.android.tools.lint.client.api.JavaVisitor.visitFile(JavaVisitor.java:274)
at com.android.tools.lint.client.api.LintDriver.checkIndividualJavaFiles(LintDriver.java:1571)
at com.android.tools.lint.client.api.LintDriver.runFileDetectors(LintDriver.java:1049)
at com.android.tools.lint.client.api.LintDriver.checkProject(LintDriver.java:908)
at com.android.tools.lint.client.api.LintDriver.analyze(LintDriver.java:436)
at com.android.tools.lint.client.api.LintDriver.analyze(LintDriver.java:377)
at org.jetbrains.android.inspections.lint.AndroidLintExternalAnnotator.doAnnotate(AndroidLintExternalAnnotator.java:168)
at org.jetbrains.android.inspections.lint.AndroidLintExternalAnnotator.doAnnotate(AndroidLintExternalAnnotator.java:67)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doAnnotate(ExternalToolPass.java:218)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass.access$500(ExternalToolPass.java:44)
at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:160)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
at com.intellij.util.ui.update.MergingUpdateQueue$3.run(MergingUpdateQueue.java:271)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:286)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:244)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:234)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:352)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.intellij.util.concurrency.QueueProcessor$RunnableConsumer.consume(QueueProcessor.java:298)
at com.intellij.util.concurrency.QueueProcessor$RunnableConsumer.consume(QueueProcessor.java:295)
at com.intellij.util.concurrency.QueueProcessor$2$1.run(QueueProcessor.java:110)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.concurrency.QueueProcessor$2.consume(QueueProcessor.java:107)
at com.intellij.util.concurrency.QueueProcessor$2.consume(QueueProcessor.java:104)
at com.intellij.util.concurrency.QueueProcessor$3$1.run(QueueProcessor.java:215)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.concurrency.QueueProcessor$3.run(QueueProcessor.java:212)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:366)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:55)
It's generated by Studio:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<item name="com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers divPrefFlags">
<annotation name="android.support.annotation.IntDef">
<val name="flag" val="true" />
<val name="value" val="{com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_CATEGORY_BETWEEN, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_CATEGORY_BEFORE_FIRST, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_CATEGORY_AFTER_LAST, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_PREFERENCE_BETWEEN, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_PREFERENCE_BEFORE_FIRST, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_PREFERENCE_AFTER_LAST, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_PADDING_CHILD, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_PADDING_PARENT}" />
</annotation>
<annotation name="android.support.annotation.IntDef">
<val name="value" val="{com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_DEFAULT, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_NONE}" />
</annotation>
</item>
<item name="com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers void applyDividerPreference(android.support.v7.widget.RecyclerView, int) 1">
<annotation name="android.support.annotation.IntDef">
<val name="flag" val="true" />
<val name="value" val="{com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_CATEGORY_BETWEEN, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_CATEGORY_BEFORE_FIRST, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_CATEGORY_AFTER_LAST, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_PREFERENCE_BETWEEN, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_PREFERENCE_BEFORE_FIRST, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_PREFERENCE_AFTER_LAST, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_PADDING_CHILD, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_PADDING_PARENT}" />
</annotation>
<annotation name="android.support.annotation.IntDef">
<val name="value" val="{com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_DEFAULT, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_NONE}" />
</annotation>
</item>
<item name="com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers void setDividerPreferences(int) 0">
<annotation name="android.support.annotation.IntDef">
<val name="flag" val="true" />
<val name="value" val="{com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_CATEGORY_BETWEEN, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_CATEGORY_BEFORE_FIRST, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_CATEGORY_AFTER_LAST, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_PREFERENCE_BETWEEN, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_PREFERENCE_BEFORE_FIRST, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_PREFERENCE_AFTER_LAST, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_PADDING_CHILD, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_PADDING_PARENT}" />
</annotation>
<annotation name="android.support.annotation.IntDef">
<val name="value" val="{com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_DEFAULT, com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers.DIVIDER_NONE}" />
</annotation>
</item>
</root>
With suppor lib preferencefragment, we don't see any dividers in between preferences, I thought it should have been fixed in your workaround, its not.
is it normal?
I apologize if this is not directly related to Preference-V7-Fix - though perhaps it is something it could assist with in the future.
I have been trying to style the popup dialogs from ListPreference, but nothing is working. I have tried overriding dialogPreferenceStyle, alertDialogStyle, etc. but it is always ignored. (I changed my main preferences to use a dark background and white text, which then causes many of the text and controls in the dialogs to be white and white and thus invisible).
Is there an global dialog style in the Fix lib that might help be accomplish this?
As they say, a picture is worth a thousand words...
On API 22 (probably 21 too) and 23 the margin seems alright, but on 19 not so food. There's not much breathing space on the left side. Any thoughts on how to fix this locally or would I have to wait for a possible fix on this library?
Although this does not look good to me, could this be the expected behavior?
Hi,
I can't find any official documentation from support libraries which indicates that they are using Semantic Versioning. However judging from past versions, I think they are.
So, from that base, it looks weird that you append a dot and then your version number to their original version. Would you please have a look at Semantic Versioning and try another scheme? For example, I think this one is good: 24.1.1-fix.1
, 24.1.1-fix.2
, 24.1.1-fix.3
...
My own library uses the pre-release section as the whole mirror of major-minor-patch. For example:
24.1.1-1.0.0
: first release.24.1.1-1.0.1
: patches.24.1.1-1.1.0
: added some features.But that would become complicated. So it's up to you to choose. But it would be nice if you agree to adapting Semantic Versioning.
Thank you,
In non material design, you can see proper padding at divider.
I notice you do have code https://github.com/Gericop/Android-Support-Preference-V7-Fix/blob/master/app/src/main/java/android/support/v7/preference/PreferenceFragmentCompatFix.java#L86
However, parent.getPaddingLeft
and parent.getPaddingRight
just return 0.
Is there any way we can get a better padding value for divider?
I have a fragment extending PreferenceFragmentCompatDividers
in the onCreatePreferencesFix method
I am using this
setDivider(ResourcesCompat.getDrawable(getResources(), R.drawable.pref_divider, null));
but the divider does not change.
I have also tried setting the divider preferences and height with no luck.
I have even tried getting the drawable with the old getResources.getdrawable method. I know that wouldn't matter just wanted to put it out there.
How can i change the color of the divider?
When an item's height changed (for example when I removed the summary of a preference), the splitter bumps instantly to the final location while the rest of the content moves there. The inconsistency looks uncomfortable.
Is there any way to change the typeface and set a custom font type?
I use Version 24.1.1.0
and everything was tested on emulators.
Consider the following screenhots:
How it should be: API 24
Not colored correctly: API 16
The preference layout is as follows:
<ListPreference
android:defaultValue="60"
android:dependency="pref_news_notifications"
android:entryValues="@array/news_notifications_interval_values"
android:key="pref_news_notifications_interval"
android:summary="%s"
android:title="@string/preference_news_notifications_interval_title" />
I don't know if this is really a bug, but I thought you may want to take a look at it.
Thanks in advance!
The problem can be demonstrated using the sample app. Just uncomment the setDividerPreferences() call in MyPreferenceFragment.onCreateView() and set the dividers to DIVIDER_NONE.
When the app is started, dividers are correctly hidden. Then press "PreferenceSrceen test" and return from the subscreen. The dividers are not hidden anymore.
I test this on a Nexus 7/2013, Android 6.0.1
Apparently, when the fragment is restored, the check "divPrefFlags == flags && !divPrefInvalid" in setDividerPreferences() is true and thus, the divider preferences are not applied.
EditTextPreference is displayed incorrectly after adding support library com.android.support:design:23.3.0 into project.
There is only top title header part with no edit entry and bottom buttons.
this screenshot is taken from Android 6.0
Older versions have next error during start process
android.content.res.Resources$NotFoundException: File res/drawable/abc_list_selector_holo_light.xml from color state list resource ID #0x7f020032
After updating to 25.0.0.0, the animation of the switch is disabled :(. Reverting back to 24.2.1.0 fixes the problem
I think we need also a PreferenceFixTheme.DayNight.DarkActionBar theme. Without it, I have to create manual Toolbar and style it to match the desired design.
I built in this library so I can use a collapsing toolbar with a PreferenceFragment in the content area. So far I got everything working, unless one small thing: I can't remove the divider above the first preference. The result is, that the grey divider is directly beneath the yellow toolbar, which just doesn't look good...
Just in case it's important, there are only Preferences on my PreferenceScreen.
Nothing preferences related, but it still needs the upgrade.
Hi,
Currently, we allow user to switch between the app theme during run-time
public static void updateTheme(Context context) {
if (Utils.isDarkThemeEnabled()) {
context.setTheme(R.style.Theme_App_Dark);
} else {
context.setTheme(R.style.Theme_App_Light);
}
}
In your colors_indigo_pink.xml
,
<color name="accent">#FF4081</color>
<!-- this is needed as preference_category_material layout is using this color as the text color -->
<color name="preference_fallback_accent_color">@color/accent</color>
It only support 1 color. Is there any way we can change preference_fallback_accent_color
during run-time? I wish I can have something like
<color name="accent">?attr/my_accent</color>
But Android doesn't support such.
Hopefully the issues you discovered in 23.0.1 have been fixed.
In pre-lollipop device, listpreference's popped dialog comes with black radio button. Do we need a ListPreferenceDialogFragmentCompatFix class?
In recent commit, I saw custom divider drawing feature is being removed
However, I would like to have a feature, where I can have divider on category section, and no divider on non-category section. As a result, I adopt your old code from https://github.com/Gericop/Android-Support-Preference-V7-Fix/blob/9f3595d054f070b1b0b41255c019414f308d02d2/app/src/main/java/android/support/v7/preference/PreferenceFragmentCompatFix.java
I modify the custom divider drawing code, to make sure it only draw on category section - https://gist.github.com/yccheok/9da06876cbde1cb0849182647e030743
It looks something like http://i.imgur.com/pq3piNC.png
Although I able to achieve my own custom divider drawing on category section only, and turn off divider for non-category section. I believe other users might be interested too.
It might good to have such feature in official release of PreferenceFragmentCompatFix.java
Thank you for providing an amazing fix to this problem.
Hi,
I new android developer and I not sure if is correct to post this problem here. When I disable a preference under PreferenceFragmentCompat I see the preference in the same color schema that all preferences. I have the same result in XML with android:enabled="false".
Thanks,
Rafa
Nothing preferences related, but it still needs the upgrade.
First thing that occurred to me: API 7 support is dropped, API 9 is the new minSdk version for v24.2.0, even though the package name suggests 7 (hence the v7
). It has been reported but I wouldn't really hope in anything.
The library's minSdk version is still going to be set to 7 by overriding this behavior, but I cannot guarantee that it's really compatible with API 7 and 8 as it would require me to go through the API calls this lib ever could make, which is essentially impossible.
@Gericop @MGaetan89
Even after importing the library via gradle and setting <item name="android:activatedBackgroundIndicator">?android:attr/selectableItemBackground</item>
in my main styles xml file i'm still seeing a transparent background when my preference fragment launches.
More background:
I'm setting the following theme on my preference fragment:
<style name="MyMaterialTheme" parent="Theme.AppCompat">
...
<item name="preferenceTheme">@style/PreferenceFixTheme</item>
<item name="android:activatedBackgroundIndicator">?android:attr/selectableItemBackground</item>
</style>
and i'm using the following code for my PreferenceFragmentCompat fix class extension:
public class FragmentSettingsMenu extends com.takisoft.fix.support.v7.preference.PreferenceFragmentCompat {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Load the preferences from the XML resource
addPreferencesFromResource(R.xml.preferences);
}
@Override
public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String rootKey) {
getView().setBackgroundColor(ContextCompat.getColor(getContext(), R.color.preference_fallback_accent_color));
}
}
but despite all these fixes, my preference fragment still has a transparent background.
Is this a bug in the library or am I not applying this fix correctly?
I am using your lib fine in Java, then I switched to use Kotlin. I was then getting an exception in the OnCreate method because the savedInstanceState Bundle was not marked as @nullable, but it was coming in as null from the OS.
I added overrides via the IDE (Android Studio 2.2) but it would likely be better if your source included the annotations directly.
An interesting item is that I see the android PreferenceFragmentCompat does not include the @nullable, but its superclass - Fragment - does include it. So I think it is a bug in the Android SDK too.
Hello,
Many thanks for this project: it has helped me out when trying to upgrade my own project to app compat 23.0.1.
I found another issue related to the EditTextPreference: it creates an EditText. It should create an AppCompatEditText instead, or else the theming will not be correct on versions < Lollipop.
For info, my own collection of hacks to work around app compat v7 prefs issues is currently in one package in this project: https://github.com/caarmen/network-monitor/tree/app-compat-preferences/networkmonitor/src/main/java/ca/rmen/android/networkmonitor/app/prefs/hack
I haven't taken the time out to make an isolated reusable project like you have though.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.