SharedPreferenceInspector


Source link: https://github.com/PrashamTrivedi/SharedPreferenceInspector

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.

  • Note: 2.3 is last version distributed through Maven Central, new versions will be moved in JCenter. Additionally JitPack is also supported. You can grab latest versions from JitPack from here.

Usage

Gradle

Add this library as dependency to your project's build.gradle

debugCompile 'com.github.prashamtrivedi:sharedpreferenceinspector:{
latestVersion
}
'

Where latest version can be found from above (Maven Central Badge)

Code

If you are using version 1.x.

Declare this activity in your debug menifest.

<activity android:name="com.ceelites.sharedpreferenceinspector.SharedPrefsBrowser"/>

Don't forget to Provide appropriate theme (Any Child of Theme.AppCompat is recommended) to that activity. It's needed to inflate menus.

If you are using version 2.0 and above

Just import the library. Library will take care of adding activity.

To launch the SharedPrefsBrowser activity you have two ways.

  1. From the menu.
  2. Launch the activity directly

To Launch the activity from menu

Initiate SharedPreferenceUtils with SharedPreferenceUtils.initWith() call.

In onCreateOptionsMenu() call

if (BuildConfig.DEBUG) {
  prefsUtils.inflateDebugMenu(getMenuInflater(), menu);
 
}

In onOptionsItemSelected() method check value of isDebugHandled method

prefsUtils.isDebugHandled(this, item)) 

If this method returns true activity will open itself. Otherwise you have to handle menu generation code yourselves.

To Launch the activity directly

Just Call.

if (BuildConfig.DEBUG) {
  SharedPreferenceUtils.startActivity(this);
 
}

Test Mode

SharedPreferenceInspector has a unique feature called test mode, where you can change your already stored shared preference value to any supported value and check how your app behaves with this change. While you are in the test mode your original value is kept safe and when you exit it, the original value will be restored. There are two ways to enter the test mode.

  1. From menu. Where you can enter the tests mode
  2. If you are not in test mode and try to click on the row, it will ask you to enter test mode to change the value.

The test mode values are stored in shared preference keys until you exit test mode.

Support

This library gives support from api level 10. And It has been tested in a GingerBread device.

Proguard Configuration

If you are using proguard, you should add this line in your proguard file. In case of version 2.0 this line should be added automatically. -keep class android.support.v7.widget.SearchView { *; }

ChangeLog

See Change Log

Credits

Credits to Android DbInspector Library for all the inspiration behind this library.

Known Issues And TODOs

  • Not implemented handling String Set.
  • Does not have UI to clear the key.
  • Upload in maven.
  • Change example to reflect read me instructions

License


Copyright 2015 Prasham Trivedi
 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

Binds RxList to the RecyclerView.Adapter.

Markdown view for Android. Display Markdown in your apps, useful for FAQs, Help, Size Guides, About screens etc. To make things really easy there's an Activity included, just use the included IntentBuilder.

A simple library for delivery bitmaps using reactive approach.

A slider that allows a user to select a value at one of the specified tickmarks.

Composable adapters for Android RecyclerViews and ListViews.

Pulse animation for Android.

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