Skip to content

Commit 7a6bcd8

Browse files
committed
removed useless resources
1 parent 9d1965d commit 7a6bcd8

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,26 @@
22

33
[![Android Arsenal]( https://img.shields.io/badge/Android%20Arsenal-JadeSharedPreference-green.svg?style=flat )]( https://android-arsenal.com/details/1/7504 ) [![CircleCI](https://circleci.com/gh/devmike01/JadeSharedPreference/tree/master.svg?style=svg)](https://circleci.com/gh/devmike01/JadeSharedPreference/tree/master)
44

5-
A lite weight SharedPreference library which uses annotation processing to generate codes that let.
5+
A light weight library which uses annotation processing to generate codes that let you read and write to both `SharedPreferences` and `Preference` files.
66

7-
* Eliminate the whole `SharedPreference` code
7+
* Eliminate the whole `SharedPreference` boilerplace codes
88
* Write less code to configure JadeSharedPreference
9-
* Save multiple values to JadeSharedPrefence at onces
10-
* Read from JadeSharedPreference using just annotations `@Read...`)
9+
* Save multiple values to both `Preference` and `SharedPreferences` at onces
10+
* Read from `Preference` and `SharedPreferences` using just annotations `@Read...`)
1111
* Listen to value changes in real-time
1212

13+
No one like writing lot of codes just to achieve a simple task. I mean, who does this:
14+
15+
```kotlin
16+
val sp: SharedPreference = getSharedPreferences("coconut_head", Context.MODE_PRIVATE)
17+
val value: String? =sp.getString("key", null)
18+
```
19+
When you can achieve same thing with less line of codes. Such as this:
20+
```kotlin
21+
@ReadString("key")
22+
val value: String?= null
23+
```
24+
1325
### What's new in version `1.3.0`
1426

1527
* Bug fixes
@@ -23,7 +35,6 @@ class InecBox @SharedPref("key") @Preference constructor(context: Context) {
2335

2436
val TAG: String = "InecBox"
2537

26-
//Read item from JadeSharedPreference
2738
@ReadString("ballot")
2839
var ballotPaper: String? = null
2940

@@ -37,19 +48,15 @@ class InecBox @SharedPref("key") @Preference constructor(context: Context) {
3748
//Setup for Preference file
3849
private var jp :JadeSharedPreference =JadeSharedPreference.preference(this, context)
3950

40-
//Read and write to JadeSharedPreference
4151
fun inecBox() {
42-
//Insert item to JadeSharedPreference
4352
jsp.insert("ballot", "Ballot Paper")
4453
}
4554

4655
fun readBallot(){
4756
Log.d(TAG, ballotPaper)
4857
}
4958

50-
//Read and write to Preference
5159
fun fakeInecBox() {
52-
//Insert item to JadeSharedPreference
5360
jp.insert("pref_ballot", "Fake Ballot Paper")
5461
}
5562

app/src/main/java/devmike/jade/com/jadesharedpreference/MainActivity.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package devmike.jade.com.jadesharedpreference
22

3+
import android.content.Context
4+
import android.content.SharedPreferences
35
import android.support.v7.app.AppCompatActivity
46
import android.os.Bundle
57
import android.support.annotation.VisibleForTesting
@@ -44,7 +46,6 @@ class MainActivity @SharedPref("setting") constructor(): AppCompatActivity() {
4446
setContentView(R.layout.activity_main)
4547
jsp =JadeSharedPreference.apply(this, this)
4648

47-
4849
read_1.text = mString
4950
read_2.text = mInteger.toString()
5051
read_3.text = mFloat.toString()

0 commit comments

Comments
 (0)