-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- temporary remove EncryptedSharedPreferences
- add sample
- Loading branch information
Showing
9 changed files
with
125 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
sample/src/main/java/id/codepresso/safedepositbox/SampleActivity.kt
This file was deleted.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
sample/src/main/java/id/codepresso/safedepositbox/sample/SampleActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package id.codepresso.safedepositbox.sample | ||
|
||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import id.codepresso.safedepositbox.SafeDepositBox | ||
import kotlinx.android.synthetic.main.activity_main.* | ||
|
||
class SampleActivity : AppCompatActivity() { | ||
|
||
private val safeDepositBox by lazy { | ||
SafeDepositBox(this, "SafeDepositBoxSample") | ||
} | ||
|
||
private val stringLogger by lazy { | ||
StringBuilder().append("") | ||
} | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
|
||
val tatang = | ||
User("Tatang", "Sutarna") | ||
val bejo = User("Bejo", "Surojo") | ||
|
||
safeDepositBox.apply { | ||
storeObject("tatang", tatang) | ||
storeObject("bejo", bejo) | ||
} | ||
|
||
stringLogger.append("Storing Object Value\n\n") | ||
|
||
val tatangFromPref = safeDepositBox.getObject("tatang", User::class.java) | ||
val bejoFromPref = safeDepositBox.getObject("bejo", User::class.java) | ||
|
||
stringLogger.append("Getting Object Value\n\n") | ||
stringLogger.append(tatangFromPref.toString()) | ||
stringLogger.append("\n") | ||
stringLogger.append(bejoFromPref.toString()) | ||
|
||
updateLogView() | ||
} | ||
|
||
private fun updateLogView() { | ||
tvLogger.text = stringLogger | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
sample/src/main/java/id/codepresso/safedepositbox/sample/User.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package id.codepresso.safedepositbox.sample | ||
|
||
/** | ||
* Crafted by Razib Kani Maulidan on 25/04/20. | ||
**/ | ||
|
||
data class User(private val firstName: String, private val lastName: String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
<androidx.constraintlayout.widget.ConstraintLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:padding="16dp" | ||
tools:context=".SampleActivity" /> | ||
tools:context=".SampleActivity"> | ||
|
||
<androidx.appcompat.widget.AppCompatTextView | ||
android:id="@+id/tvLogger" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:gravity="top|center" | ||
tools:text="Lorem ipsum" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |