Skip to content

Instantly share code, notes, and snippets.

View ivanvasheka's full-sized avatar

Ivan Vasheka ivanvasheka

  • Intellias
  • Kharkiv
View GitHub Profile
@ivanvasheka
ivanvasheka / palette.xml
Last active June 14, 2019 10:04
Color palette (according to material design guidelines)
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="material_red_50">#ffebee</color>
<color name="material_red_100">#ffcdd2</color>
<color name="material_red_200">#ef9a9a</color>
<color name="material_red_300">#e57373</color>
<color name="material_red_400">#ef5350</color>
<color name="material_red_500">#f44336</color>
<color name="material_red_600">#e53935</color>
@ivanvasheka
ivanvasheka / db_helper.java
Last active December 19, 2015 13:48
DB upgrade example
public class DatabaseHelper extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "utilities.db";
private static final int DATABASE_VERSION = 3;
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
@ivanvasheka
ivanvasheka / SharedPreferencesDelegates.kt
Created April 26, 2019 15:42
SharedPreferences Delegates
import android.content.SharedPreferences
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
fun SharedPreferences.boolean(defaultValue: Boolean, key: String = ""): SharedPreferencesBooleanDelegate {
return SharedPreferencesBooleanDelegate(this, key, defaultValue)
}
fun SharedPreferences.float(defaultValue: Float, key: String = ""): SharedPreferencesFloatDelegate {
return SharedPreferencesFloatDelegate(this, key, defaultValue)