Skip to content

Instantly share code, notes, and snippets.

@ameriod
ameriod / SimpleStore.sq
Last active August 4, 2021 00:14
Simple database powered network caching system for Kotlin Multiplatform Mobile using SQLDelight and Ktor
CREATE TABLE SimpleStore(
key TEXT NOT NULL PRIMARY KEY,
valueString TEXT,
valueBinary BLOB,
timeStamp TEXT NOT NULL
);
insertItem:
INSERT OR REPLACE INTO SimpleStore(key, valueString, valueBinary, timeStamp)VALUES(?,?,?,?);
package com.duethealth.lib.medialibrary;
import android.util.Log;
import java.io.File;
import java.util.Arrays;
import java.util.Comparator;
/**
* A very dumb file catch that deletes the files in order by the {@link File#lastModified()} until the
@ameriod
ameriod / FixCompoundDrawableUtils.java
Created August 13, 2015 03:43
Simple Android Utils class to fix the non-centering of text in TextViews and Buttons when having compound drawables.
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.widget.TextView;
/**
* Simple Utils class to help in fixing the issue where Button's and TextView's compound drawables will un-center
* text when either one of a left and right or top and bottom compound drawable is not there. The centering of the
* text is achieved by adding a transparent drawable of the same bounds to the opposite side.
* <p/>
* Methods: