Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
KapilYadav-dev committed Jul 9, 2021
2 parents 0cd7629 + b6dccf8 commit 776ed60
Showing 1 changed file with 50 additions and 1 deletion.
51 changes: 50 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,51 @@
# Prefs.io
An easy Shared Prefs library with more options : )
A small and easy Shared Prefs library with more options : )

# Implementation
<p>Add jitpack to your maven sources</p>
<div class="highlight highlight-source-groovy"><pre>allprojects {
repositories {
<span class="pl-k">..</span>.
maven { url <span class="pl-s"><span class="pl-pds">"</span>https://jitpack.io<span class="pl-pds">"</span></span> }
}
}</pre></div>
<p>Add Censory as a dependency to your <code>build.gradle</code></p>
<div class="highlight highlight-source-groovy"><pre>dependencies {
implementation <span class="pl-s"><span class="pl-pds">'</span>com.github.KapilYadav-dev:Prefs.io:CURRENT_RELEASE<span class="pl-pds">'</span></span>
}</pre></div>


# Usage
1) Initialization ( in application class )
2) Use it 👨🏽‍💻

# Initialization

@Override
public void onCreate() {
super.onCreate();
// Initialize the Prefs class
SharedPrefs.init(this);
}



# Use it
After initialization, you can use simple one-line methods to save and get those values from the shared preferences anywhere in your app, such as:

<ul>
<li><code>SharedPrefs.setString(key, string)</code></li>
<li><code>SharedPrefs.getString(key, defaultString")</code></li>
<li><code>SharedPrefs.setInteger(key, int)</code></li>
<li><code>SharedPrefs.getInteger(key, defaultInt)</code></li>
<li><code>SharedPrefs.setboolean(key, boolean)</code></li>
<li><code>SharedPrefs.getboolean(key, defaultBoolean)</code></li>
</ul>

# Use it with encryption
## It's a better practice to encrypt down your sharedPrefs so that it can't be altered by Root Piratess 🏴‍☠️
<ul>
<li><code>SharedPrefs.setString(key, string, encryptionKey)</code> // This will encrypt your String 🤐</li>
<li><code>SharedPrefs.getString(key, defaultString, encryptionKey, encryptedText)</code> // This will decrypt down your encrypted String 😎</li>
</ul>

0 comments on commit 776ed60

Please sign in to comment.