View ParallaxScreen.kt
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
@Composable | |
fun ParallaxScreen(modifier: Modifier = Modifier) { | |
val context = LocalContext.current | |
val scope = rememberCoroutineScope() | |
var data by remember { mutableStateOf<SensorData?>(null) } | |
DisposableEffect(Unit) { | |
val dataManager = SensorDataManager(context) | |
dataManager.init() |
View .bashrc
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
####################################### | |
# Displays a yes/no prompt to continue that repeats until input matches. | |
# Arguments: | |
# $1 - (optional) a string representing the yes/no question to ask | |
# $2 - (optional) a string representing the prompt style. | |
# Returns: | |
# 0 to proceed further (indicates "yes"), 1 to stop (indicates "no"). | |
####################################### | |
continue_prompt() { | |
local prompt default reply |
View ConnectivityAndInternetAccess.kt
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
/* | |
* Copyright (c) 2014 str4d | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining | |
* a copy of this software and associated documentation files (the | |
* "Software"), to deal in the Software without restriction, including | |
* without limitation the rights to use, copy, modify, merge, publish, | |
* distribute, sublicense, and/or sell copies of the Software, and to | |
* permit persons to whom the Software is furnished to do so, subject to | |
* the following conditions: |
View CrossFadeDrawable.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
package nl.kevinvanmierlo.testtransitiondrawable; | |
import android.graphics.Canvas; | |
import android.graphics.ColorFilter; | |
import android.graphics.PixelFormat; | |
import android.graphics.Rect; | |
import android.graphics.drawable.Drawable; | |
import android.os.SystemClock; | |
import androidx.annotation.NonNull; |
View BaseUpdateCheckActivity.kt
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.app.Activity | |
import android.content.Intent | |
import android.content.IntentSender | |
import android.os.Bundle | |
import android.widget.Toast | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.core.content.ContextCompat | |
import com.google.android.material.snackbar.Snackbar | |
import com.google.android.play.core.appupdate.AppUpdateManager | |
import com.google.android.play.core.appupdate.AppUpdateManagerFactory |
View uiModule.kt
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
val uiModule = module(definition = { | |
factory { get<NavHostFragment>().navController } | |
factory { ContextHelper.getAppCompatActivity()!!.supportFragmentManager.findFragmentById(R.id.navHost) as NavHostFragment } | |
}) | |
inline fun <reified T : Any> Any.inject( | |
name: String = "", | |
scope: Scope? = null, | |
noinline parameters: ParameterDefinition = emptyParameterDefinition() | |
) = lazy { getKoin().koinContext.get<T>(name, scope, parameters) } |
View MyActivity.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
public class MyActivity extends AppCompatActivity{ | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
setcontentView(R.layout.myview); | |
//To set the encrypted string to keystore | |
SharedPrefUtils.put(MyActivity.this , "My Key" ,"My keys value"); | |
//To get the decrypted string from keystore |
View CustomizedAndroidRunner.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
package whatever; | |
import android.app.Instrumentation; | |
import android.os.Bundle; | |
import android.support.test.internal.runner.junit4.AndroidJUnit4ClassRunner; | |
import android.support.test.internal.util.AndroidRunnerParams; | |
import org.junit.rules.TestRule; | |
import org.junit.runners.model.InitializationError; |
View realm.kt
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 io.realm.* | |
import io.realm.kotlin.where | |
import kotlinx.coroutines.GlobalScope | |
import kotlinx.coroutines.launch | |
import kotlinx.coroutines.suspendCancellableCoroutine | |
import kotlin.coroutines.resume | |
import kotlin.coroutines.resumeWithException | |
private suspend fun <T: RealmObject, S: RealmQuery<T>> findAllAwait(query: S): RealmResults<T> = suspendCancellableCoroutine { continuation -> | |
val listener = RealmChangeListener<RealmResults<T>> { t -> continuation.resume(t) } |
View Crossfader.kt
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.graphics.drawable.Drawable | |
import android.util.AttributeSet | |
import android.view.View | |
import android.view.ViewGroup | |
import android.view.animation.AnimationUtils | |
import android.widget.ImageView | |
import android.widget.ViewSwitcher | |
import com.bumptech.glide.load.DataSource | |
import com.bumptech.glide.load.engine.GlideException |
NewerOlder