Skip to content
This repository was archived by the owner on May 1, 2021. It is now read-only.

Commit 3fa404e

Browse files
Update README.md
1 parent 2f04b54 commit 3fa404e

File tree

1 file changed

+43
-23
lines changed

1 file changed

+43
-23
lines changed

README.md

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,64 @@
1-
ActionBarPreferenceActivityLibrary
1+
MaterialPreferenceLibrary
22
==================================
33

4-
Allows to have an ActionBar even on PreferenceActivity, even for pre-Honeycomb versions of Android.
4+
Allows to have a nice Material-Design look&feel for API 7 and above for the PreferenceActivity, including most commonly used preferences and also showing the actionBar.
5+
All the dialogs are using the support library's dialogs, including accent-color.
6+
You can even choose which theme to use.
57

6-
All this library does is to simply put a Toolbar at the top of the PreferenceActivity, and you need to use the Toolbar instead of the ActionBar.
8+
Supported preferences are:
9+
- **DialogPreference**
10+
- **EditTextPreference**
11+
- **ListPreference**
12+
- **NumberEditTextPreference** - a customized preference I've made, that's like EditTextPreference, but allows to enters digits only.
13+
- **Preference**
14+
- **SwitchPreference**
15+
- **TwoStatePreference**
716

8-
Screenshots
9-
==
10-
Gingerbread :
17+
Sample and screenshots
18+
==================================
19+
Just check the code, or see how it works on my app, here:
20+
https://play.google.com/store/apps/details?id=com.lb.app_manager
21+
22+
**Screensots:**
23+
24+
**Gingerbread :**
1125

12-
![enter image description here](https://raw.githubusercontent.com/AndroidDeveloperLB/MaterialStuffLibrary/master/1.png)
1326

14-
Lollipop :
27+
**Lollipop :**
1528

16-
![enter image description here](https://raw.githubusercontent.com/AndroidDeveloperLB/MaterialStuffLibrary/master/2.png)
29+
Notes
30+
==================================
31+
32+
1. About the **actionBar**, all this library does is to simply put a Toolbar at the top of the PreferenceActivity, and you need to use the Toolbar instead of the ActionBar.
33+
2. Not all preferences were imported.
34+
3. Sadly, **reflection** was used for 2 functions of "PreferenceManager" which aren't public (yet the framework's classes have full access to it) : "unregisterOnActivityDestroyListener", "registerOnActivityDestroyListener". Those functions seem to be used only for dismissing the dialogs when the activity is being destroyed. Just in case something goes wrong, I've made the code ignore (and write in the logs) in case they are unreachable.
35+
4. **Preference icon** is missing, but I think it should be easy to add it. The reason it was missing is because I need to use the internal class that extends ImageView for it, which has "minWidth" and "minHeight", yet those are missing from old APIs, so I would need to import the entire code of ImageView... However, I'm sure there is a better way.
36+
5. Not tested on **PreferenceFragment** (yet), but you can try it using these libraries and see if you can support even older APIs :
37+
https://github.com/Machinarius/PreferenceFragment-Compat
38+
https://github.com/kolavar/android-support-v4-preferencefragment
39+
6. In order to add **action items**, you need to do it completely via code, without using XML. Otherwise, on some Android versions (or all?), the action items will all gather inside the overflow menu item.
40+
7. Some **attributes** should be used using Android's framework, and some using mine. Sorry for the confusion.
41+
42+
Contribution is appreciated. Please try to be "loyal" to the original code of Android, as I've tried.
1743

1844
Requirements
1945
==
2046
This library needs:
21-
- API 8 and above.
47+
- API 7 and above.
2248
- AppCompat v7.
2349

2450
That's it.
2551

2652
What this library doesn't do
2753
==
28-
Sadly, it doesn't style the preferences, but you can use the one of the support library if you wish.
29-
30-
It has handled dialogs in the past, but no longer. If you wish to have material-style dialogs, you can use this great library:
31-
https://github.com/fengdai/AlertDialogPro
54+
Sadly, it doesn't support all kinds of preferences. Currently, those are missing:
55+
- RingtonePreference
56+
- MultiSelectListPreference
57+
- CheckBoxPreference
58+
and others...
3259

33-
Also, note that in order to add action items, you need to do it completely via code, without using XML. Otherwise, on some Android versions (or all?), the action items will all gather inside the overflow menu item.
60+
Also, note that
3461

3562
Thanks
3663
==
37-
Didn't get a lot of code from others:
38-
39-
- Some code I got from my own app:
40-
https://play.google.com/store/apps/details?id=com.lb.app_manager
41-
- The support library of Google, of course:
42-
http://android-developers.blogspot.co.il/2014/10/appcompat-v21-material-design-for-pre.html
43-
- This website:
44-
https://chris.banes.me/2014/10/17/appcompat-v21/
64+
Android's code ?

0 commit comments

Comments
 (0)