This file contains 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
class SnackbarState { | |
var show by mutableStateOf(false) | |
} | |
@Composable | |
fun TransientSnackbar( | |
modifier: Modifier = Modifier, | |
snackbarState: SnackbarState, | |
text: String, | |
actionLabel: String, |
This file contains 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
SQLiteDatabase database = dbHelper.getWritableDatabase(); | |
Cursor c = database.rawQuery( | |
"SELECT name FROM sqlite_master WHERE type='table'", null); | |
Assert.assertNotNull(c); | |
String actual = ""; | |
if (c.moveToFirst()) { | |
while (!c.isAfterLast()) { | |
actual += c.getString(0) + ","; | |
c.moveToNext(); |
This file contains 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
/* | |
* Progress Updater | |
* */ | |
adapter.addLoadStateListener { loadState -> | |
if (loadState.refresh is LoadState.Loading || | |
loadState.append is LoadState.Loading) | |
// Show ProgressBar | |
else { | |
// Hide ProgressBar |
This file contains 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
inline fun <reified T : Fragment> launchFragmentInHiltContainer( | |
fragmentArgs: Bundle? = null, | |
@StyleRes themeResId: Int = R.style.SomeTheme, | |
fragmentFactory: FragmentFactory? = null, | |
crossinline action: Fragment.() -> Unit = {} | |
) { | |
val startActivityIntent = Intent.makeMainActivity( | |
ComponentName( | |
ApplicationProvider.getApplicationContext(), | |
HiltTestActivity::class.java |
This file contains 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
import android.content.Context | |
import android.content.Context.CONNECTIVITY_SERVICE | |
import android.net.ConnectivityManager | |
import android.net.Network | |
import android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET | |
import android.net.NetworkRequest | |
import android.util.Log | |
import androidx.lifecycle.LiveData | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.Dispatchers |
This file contains 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
/** | |
* Authenticator that attempts to refresh the client's access token. | |
* In the event that a refresh fails and a new token can't be issued an error | |
* is delivered to the caller. This authenticator blocks all requests while a token | |
* refresh is being performed. In-flight requests that fail with a 401 are | |
* automatically retried. | |
*/ | |
class AccessTokenAuthenticator( | |
private val tokenProvider: AccessTokenProvider | |
) : Authenticator { |
This file contains 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
import androidx.animation.IntToVectorConverter | |
import androidx.animation.tween | |
import androidx.compose.Composable | |
import androidx.compose.mutableStateOf | |
import androidx.compose.remember | |
import androidx.ui.animation.animatedFloat | |
import androidx.ui.animation.animatedValue | |
import androidx.ui.core.* | |
import androidx.ui.core.gesture.scrollorientationlocking.Orientation | |
import androidx.ui.foundation.animation.FlingConfig |
This file contains 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 <T> Flow<T>.throttle(waitMillis: Int) = flow { | |
coroutineScope { | |
val context = coroutineContext | |
var nextMillis = 0L | |
var delayPost: Deferred<Unit>? = null | |
collect { | |
val current = SystemClock.uptimeMillis() | |
if (nextMillis < current) { | |
nextMillis = current + waitMillis |
This file contains 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
# Add project specific ProGuard rules here. | |
# You can control the set of applied configuration files using the | |
# proguardFiles setting in build.gradle. | |
# | |
# For more details, see | |
# http://developer.android.com/guide/developing/tools/proguard.html | |
# If your project uses WebView with JS, uncomment the following | |
# and specify the fully qualified class name to the JavaScript interface | |
# class: |
This file contains 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
package com.edinstudio.app.samples.multiplerowradiobuttons; | |
import android.os.Bundle; | |
import android.support.v7.app.ActionBarActivity; | |
import android.view.View; | |
import android.widget.RadioGroup; | |
import android.widget.Toast; | |
public class MainActivity extends ActionBarActivity { |
OlderNewer