It's not as if you didn't know...
A Pen by Gerard Ferrandez on CodePen.
It's not as if you didn't know...
A Pen by Gerard Ferrandez on CodePen.
import android.content.Context; | |
import android.content.Loader; | |
import android.os.Bundle; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
import com.google.android.gms.common.ConnectionResult; | |
import com.google.android.gms.common.api.GoogleApiClient; | |
import timber.log.Timber; |
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.graphics.Canvas; | |
import android.graphics.drawable.Drawable; | |
import android.os.Build; | |
import android.util.AttributeSet; | |
import android.widget.RelativeLayout; |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
import com.example.app.BuildConfig; | |
import timber.log.Timber; | |
/** | |
* Utils for debugging. | |
*/ |
import android.os.Bundle; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
import com.google.android.gms.common.ConnectionResult; | |
import com.google.android.gms.common.api.GoogleApiClient; | |
import timber.log.Timber; | |
import xyz.louiscad.common.Constants; |
/** | |
* Ensures the view is square by making it the size of the smallest side. | |
*/ | |
@Override | |
protected final void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
super.onMeasure(widthMeasureSpec, heightMeasureSpec); | |
int size = Math.min(getMeasuredWidth(), getMeasuredHeight()); | |
setMeasuredDimension(size, size); | |
} |
import android.os.Bundle | |
import android.support.v4.app.LoaderManager | |
import android.support.v4.content.Loader | |
class LoadListener<D, out L : Loader<D>>(private val createLoader: () -> L, | |
private val onLoadDone: (loader: L, data: D) -> Unit) | |
: LoaderManager.LoaderCallbacks<D> { | |
override fun onCreateLoader(id: Int, args: Bundle?) = createLoader() | |
@Suppress("UNCHECKED_CAST") |
import android.content.Context | |
import android.os.Bundle | |
import android.support.v4.content.Loader | |
import com.google.android.gms.common.ConnectionResult | |
import com.google.android.gms.common.api.GoogleApiClient | |
import timber.log.Timber | |
/** |
import android.content.BroadcastReceiver | |
import android.content.Context | |
import android.content.Intent | |
import android.content.IntentFilter | |
import android.net.ConnectivityManager.CONNECTIVITY_ACTION | |
import com.google.android.agera.BaseObservable | |
import org.jetbrains.anko.connectivityManager | |
class ConnectivityListener(private val context: Context) : BaseObservable() { |
import android.content.Context | |
import android.preference.PreferenceManager | |
inline fun Context.runOnce(uniqueKey: String, f: () -> Unit) { | |
val prefs = PreferenceManager.getDefaultSharedPreferences(this) | |
val isFirstRun = prefs.getBoolean(uniqueKey, true) | |
if (isFirstRun) { | |
prefs.edit().putBoolean(uniqueKey, false).commit() | |
f() | |
} |