Created
January 4, 2016 14:02
-
-
Save shem8/9f055499562e67b7f67a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
fun AppCompatActivity.navigate(frag: Fragment) { | |
val fragmentTransaction = supportFragmentManager.beginTransaction() | |
fragmentTransaction.replace(content.id, frag); | |
fragmentTransaction.commit(); | |
} | |
fun Fragment.userError(msg: String?) { | |
Snackbar.make(view, msg, Snackbar.LENGTH_LONG).show() | |
} | |
fun SharedPreferences.edit(func:SharedPreferences.Editor.(): Unit) { | |
val editor = edit() | |
editor.func() | |
editor.apply() | |
} | |
fun SharedPreferences.Editor.set(pair: Pair<String, String>) = putString(pair.first, pair.second) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment