TypedPreferences


Source link: https://github.com/johnjohndoe/TypedPreferences

Typed Preferences

This library for Android provides classes which allow to store and retrieve settings from the preferences. There is an individual class for each native type:

Each class comes with two constructors - one of them allows to ommit the default value.

All classes declare the same methods: get(), isSet(), set() and delete(). Here are the method signatures as definied in the StringPreference class.

public class StringPreference {

  public String get() {
 ... 
}

  public boolean isSet() {
 ... 
}

  public void set(String value) {
 ... 
}

  public void delete() {
 ... 
}
 
}

Wrappers for frequently used classes can be found and added in the wiki. Take a look!

How to get the thing running?

Add the library as a dependency to your build.gradle in case you use Gradle:

dependencies {

  compile "info.metadude.android:typed-preferences:{
$version
}
" 
}

Or if you use Maven you should be looking for this:

<dependency>
  <groupId>info.metadude.android</groupId>
  <artifactId>typed-preferences</artifactId>
  <version>{
$version
}
</version> </dependency>

For anything else, go to Maven Central - or just build the library yourself.

Minimum SDK version / API level

The library is available in two different versions. If you need to support API level 8 in your project you must include the latest 1.x.x version. This library version persists the settings synchronously using the commit method of the SharedPreferences.Editor. If the minimum SDK version you need to support is API level 9 you can choose the latest 2.x.x version which relies on the apply method of the SharedPreferences.Editor. Thereby settings are persisted asynchronously.

For further information please stick to documentation of the SharedPreferences.Editor interface.

Demo project

Check out the demo project TypedPreferencesDemo which shows how to use the library.

Tests

Run ./gradlew clean test to execute the tests.

Feedback

If you use this library and you are happy with it please send a tweet to @tbsprs and feel free to announce your app. I will be happy to list it here.

In case you do not like the library please do not hesitate to open an issue and let me know what can be improved.

Which applications are using this library?

Reference

This library is mainly inspired by the classes which have been published by Jake Wharton in the u2020 project.

Authors

Contributors

License

Copyright 2014-2017 Tobias Preuss  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

Extra "injection" library for Android which uses annotation processing to generate code that does direct field assignment of your extras.

Dart is inspired by ButterKnife.

Using Java Annotations and Reflection, this library will allow you to replace some of annoying boilerplate setup from your Activities, Fragments, and Views with an annotation based approach.

This widget is a customized version of the Android ProgressBar. It provides developers the ability to add a dynamically populated progress circle with gradient.

Features:

  • Increase or decrease progress changes
  • Modifiable
    • Ring width
    • Ring background color
    • Ring fill color
    • Ring gradient

SharedPreferenceInspector provides a simple way to see shared preferences and edit them for test. No need to pull shared preferences. Just some simple clicks to see the values stored. Also with test mode to change the values and check the behavior of the app.

android-autobgbutton is a subclass of the Button widget that automatically darkens the button's background drawable when pressed, and sets it to transparent when disabled. This is inspired by iOS' automatic handling of custom background images for buttons.

AndroidPullMenu is an Open Source Android library that allows developers to easily create applications with pull menu. The aim of this library is to allow users that with a simple pull gesture to choose actions that they want to be executed.

This actions stand for refreshing options like refreshing the latest news, most viewed news, most commented views etc. or adding more actions inside view when you don’t want to implement these actions inside sliding menu. It can be implemented inside ScrollView, GridView, ListView.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes