Skip to content

Instantly share code, notes, and snippets.

View enriquebautista's full-sized avatar

Enrique Bautista enriquebautista

View GitHub Profile
/*
Extension of FragmentStatePagerAdapter which intelligently caches
all active fragments and manages the fragment lifecycles.
Usage involves extending from SmartFragmentStatePagerAdapter as you would any other PagerAdapter.
*/
public abstract class SmartFragmentStatePagerAdapter extends FragmentStatePagerAdapter {
// Sparse array to keep track of registered fragments in memory
private SparseArray<Fragment> registeredFragments = new SparseArray<Fragment>();
public SmartFragmentStatePagerAdapter(FragmentManager fragmentManager) {
/*
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
package io.coworkerbox.data.sync
import android.content.Context
import androidx.core.content.edit
import androidx.work.*
import io.coworkerbox.BuildConfig
import io.coworkerbox.data.ObjectBox
import io.coworkerbox.data.Prefs
import io.coworkerbox.data.Prefs.PREF_STATE_CITY_VERSION
import io.coworkerbox.data.model.City
@enriquebautista
enriquebautista / Prefs.kt
Last active November 14, 2018 18:46
Prefs with Kotlin
import android.content.Context
import android.content.SharedPreferences
import android.text.TextUtils
class Prefs private constructor(context: Context) {
private var sharedPrefs: SharedPreferences
private var accessToken: String? = null
private var userEmail: String? = null
private var userPoints: Int = 0
package app.pasaporte.ui.widget;
import android.content.Context;
import android.graphics.Path;
import android.graphics.RectF;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import app.pasaporte.ui.widget.shapeofview.ClipPathManager;