michael-rapp / androidmaterialpreferences Goto Github PK
View Code? Open in Web Editor NEWProvides various "Material Design"-styled preferences
License: Apache License 2.0
Provides various "Material Design"-styled preferences
License: Apache License 2.0
Hi, thanks for the great library. I use it in several of my apps. I am running into a peculiar issue a few users have reported on Samsung Galaxy Tabs running Android 4.4 with the EditTextPreference. The app crashes as soon as the EditTextPreference is opened. I can't reproduce it myself, but is it possible to at least catch the error? Let me know if any more information is needed, thanks.
android.view.InflateException: at android.view.LayoutInflater.createView (LayoutInflater.java:626) at android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:702) at android.view.LayoutInflater.inflate (LayoutInflater.java:470) at android.view.LayoutInflater.inflate (LayoutInflater.java:398) at android.view.LayoutInflater.inflate (LayoutInflater.java:354) at android.view.View.inflate (View.java:18457) at de.mrapp.android.preference.EditTextPreference.onPrepareDialog (EditTextPreference.java:346) at de.mrapp.android.preference.DialogPreference.showDialog (DialogPreference.java:1001) at de.mrapp.android.preference.DialogPreference.onClick (DialogPreference.java:2161) at android.preference.Preference.performClick (Preference.java:1052) at android.preference.PreferenceScreen.onItemClick (PreferenceScreen.java:229) at android.widget.AdapterView.performItemClick (AdapterView.java:308) at android.widget.AbsListView.performItemClick (AbsListView.java:1509) at android.widget.AbsListView$PerformClick.run (AbsListView.java:3471) at android.widget.AbsListView.onTouchUp (AbsListView.java:4849) at android.widget.AbsListView.onTouchEvent (AbsListView.java:4609) at android.view.View.dispatchTouchEvent (View.java:8135) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2425) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2149) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2164) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2164) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2164) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2164) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2164) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2164) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2164) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2164) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2164) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2164) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2164) at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent (PhoneWindow.java:2295) at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1622) at android.app.Activity.dispatchTouchEvent (Activity.java:2565) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent (WindowCallbackWrapper.java:68) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent (WindowCallbackWrapper.java:68) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent (PhoneWindow.java:2243) at android.view.View.dispatchPointerEvent (View.java:8343) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent (ViewRootImpl.java:4768) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:4634) at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4192) at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4246) at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4215) at android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:4326) at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4223) at android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:4383) at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4192) at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4246) at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4215) at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4223) at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4192) at android.view.ViewRootImpl.deliverInputEvent (ViewRootImpl.java:6557) at android.view.ViewRootImpl.doProcessInputEvents (ViewRootImpl.java:6474) at android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:6445) at android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:6410) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent (ViewRootImpl.java:6637) at android.view.InputEventReceiver.dispatchInputEvent (InputEventReceiver.java:185) at android.os.MessageQueue.nativePollOnce (Native Method) at android.os.MessageQueue.next (MessageQueue.java:138) at android.os.Looper.loop (Looper.java:131) at android.app.ActivityThread.main (ActivityThread.java:5602) 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:1283) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1099) at dalvik.system.NativeStart.main (Native Method) Caused by: java.lang.reflect.InvocationTargetException: at java.lang.reflect.Constructor.constructNative (Native Method) at java.lang.reflect.Constructor.newInstance (Constructor.java:423) at android.view.LayoutInflater.createView (LayoutInflater.java:600)
Hi, great library!
I ran into a NPE when updating the values array in a list preference. This happened during development, but could potentially happen in production as well if an update modified the values array. I think it would be better if the library silently falled back to a default value or no value at all in this case.
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference at de.mrapp.android.preference.AbstractListPreference.indexOf(AbstractListPreference.java:202)
When using a SeekBarPreference
within a Fragment, the app may crash when restoring the preference's state. The issue seems to occur after the device's display remained turned of for quite some time with the preference dialog opened. When turning the device on again, the Fragment's state, including the state of the SeekBarPreference
, gets restored, resulting in a crash. This bug seems not to happen after orientation changes. See attached stacktrace for further information.
There a separators between the list elements (rows). Is it possible to hide them?
Like here: http://www.google.com/design/spec/components/dialogs.html#dialogs-behavior ---> "Scrollable content exception"
Hi again,
Comments
I'm doing a quite extensive search for all variations in my app between versions and to smooth them out. That's why I find so many differences now :)
It feels like I've only found faults, but I really like your library and as I mentioned I went through many before I found this :) I think these are the last differences I've found from your libraries.
Issue Description
I found that the list style is different on different Android versions. The attached picture describes all of them, I also included an image from https://material.google.com/components/lists.html#lists-specs.
In the settings the user should be able to set a profile image. This image should be visible in the settings-view.
Maybe possible to open other pickers from other libs to get values?
This would be really awesome. :-)
Hi Michael, thanks for this awesome library. I noticed an issue after upgrading to v4.0.0, the ColorPalettePreference
is not full height anymore. I didn't change anything with the theme or layout, only the changes required to migrate the library from the older version.
Below is a screenshot of what it looks like currently, whereas previously, the dialog was full height (similar to the ColorPalettePreference
screenshot in your readme). There are about 50 colors in this dialog (notice the tiny scrollbar), so it's not an issue with it being only 3 colors.
Here is the relevant code. I tried setting a dialogHeight
and dialogMaxHeight
, but those didn't take any affect.
<de.mrapp.android.preference.ColorPalettePreference
android:defaultValue="@color/bottom_bar_background"
android:key="pref_bottom_nav_color"
android:title="@string/pref_bottom_nav_color"
custom:colorFormat="hex4bytes"
custom:colorPalette="@array/color_picker_options"
custom:dialogHeight="400dp"
custom:dialogMarginBottom="10dp"
custom:dialogMarginLeft="10dp"
custom:dialogMarginRight="10dp"
custom:dialogMarginTop="10dp"
custom:dialogMaxHeight="400dp"
custom:showPreview="true"
custom:showValueAsSummary="false" />
Is it an issue with the library or did I miss something? Thank you.
It seems that the plain ole "Preference" is going to be deprecated in Android P. Is this going to work with the Support Library version?
Thanks!
like in the guidelines: http://www.google.com/design/spec/patterns/settings.html#settings-grouping-settings
I am new Android preference activity
how to get color from colorPalettePreference
I am getting a lot of these errors when using this library, any ideas?:
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{[APP]MainActivity}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: de.mrapp.android.preference.AbstractDialogPreference$SavedState
Ability to have negative numbers in NumberPickerPreference. Maybe implement similar to this:
http://stackoverflow.com/questions/14357520/android-numberpicker-negative-numbers
<de.mrapp.android.preference.SwitchPreference
android:defaultValue="@bool/preference_default_home"
android:key="@string/preference_key_default_home"
android:summary="@string/set_as_default_summary"
android:title="@string/set_as_default"
/>
<PreferenceCategory android:title="@string/general_text">
<de.mrapp.android.preference.SwitchPreference
android:defaultValue="@bool/preference_default_leftscreen"
android:key="@string/preference_key_launcher_leftscreen"
android:summary="@string/preferences_title_leftscreen_summary"
android:title="@string/preferences_title_leftscreen"
android:icon="@drawable/setting_appearance_ic"/>
<de.mrapp.android.preference.ListPreference
android:defaultValue="@string/preference_default_effect"
android:entries="@array/transition_effect_entries"
android:entryValues="@array/transition_effect_entries_values"
android:key="@string/preference_key_launcher_effect"
android:summary="@string/preferences_title_effect_summary"
android:title="@string/appearance_text"
android:icon="@drawable/setting_appearance_ic"/>
<PreferenceScreen android:title="@string/gesture_text"
android:dependency="">
<de.mrapp.android.preference.ListPreference
android:defaultValue="@string/preference_default_effect"
android:entries="@array/transition_effect_entries"
android:entryValues="@array/transition_effect_entries_values"
android:key="@string/preference_key_launcher_effect"
android:summary="@string/preferences_title_effect_summary"
android:title="@string/appearance_text"
android:icon="@drawable/setting_appearance_ic"/>
</PreferenceScreen>
</PreferenceCategory>
Hi Michael,
(Thanks for an awesome preference library! Found many along the way but this one was the best)
I have an feature request, my problem is that in some settings I have the ability to logout, or reset something. I.e. I only want a confirmation dialog preference. An example would be "Logout?" "Are you sure you want to logout?" With Logout / Cancel buttons.
I've extended your AbstractDialogPreference which makes this a lot easier, but it would be nice if more people can use it :) Of course you can change the code so that it matches your coding style :)
import android.content.Context;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import de.mrapp.android.dialog.MaterialDialog;
import de.mrapp.android.preference.AbstractDialogPreference;
/**
* A confirm dialog preference screen
*/
public class ConfirmDialogPreference extends AbstractDialogPreference {
private Listener mListener = null;
public ConfirmDialogPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
public ConfirmDialogPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public ConfirmDialogPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ConfirmDialogPreference(Context context) {
super(context);
}
/**
* Set listener for when the dialog is closed
* @param listener listen to dialog events
*/
public void setListener(Listener listener) {
mListener = listener;
}
@Override
protected boolean needInputMethod() {
return false;
}
@Override
protected void onPrepareDialog(@NonNull MaterialDialog.Builder dialogBuilder) {
// Does nothing
}
@Override
protected void onDialogClosed(boolean positiveResult) {
if (mListener != null) {
mListener.onDialogClosed(positiveResult);
}
}
public interface Listener {
/**
* Called when the dialog is closed
* @param positiveResult true if the user clicked the positive button
*/
void onDialogClosed(boolean positiveResult);
}
}
ConfirmDialogPreference confirmDialogPreference = (ConfirmDialogPreference) findPreference(resources.getString(R.string.preference_logout_key));
confirmDialogPreference.setListener(new ConfirmDialogPreference.Listener() {
@Override
public void onDialogClosed(boolean positiveResult) {
if (positiveResult) {
user.logout();
}
}
});
When using the attributes android:switchTextOn
and anddroid:switchTextOff
or the corresponding setter methods of the class SwitchPreference
, the text is not displayed.
Hi there,
I'm not exactly sure when this started but fairly recent. When an EditTextDialog is opened, but there's no text entered, and OK is pressed, it leads to the following NPE.
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence de.mrapp.android.dialog.EditTextDialog.getText()' on a null object reference
at de.mrapp.android.preference.EditTextPreference.onDialogClosed(EditTextPreference.java:377)
at de.mrapp.android.preference.DialogPreference.onDismiss(DialogPreference.java:2762)
Looks like there needs to be a null check here because I believe null (or empty) should be an acceptable value when accepting text input.
When the default number of a NumberPickerPreference
is changed by using the setter method or a XML attribute, this may cause the app to crash. The reason is, that the minimum and maximum number are not initialized yet and therefore are 0. Therefore the precondition, that the preference's number must be between both values, may fail.
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.