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
//use this in your Recyclerview or whereever for asynchornous image loading | |
Glide.with(holder.itemView.context) | |
.load(avatarUrl) | |
.centerCrop() | |
.placeholder( | |
CircularProgressDrawable(holder.itemView.context).apply { | |
setColorSchemeColors( | |
ContextCompat.getColor(holder.itemView.context, R.color.colorPrimary) | |
) |
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 FlingAnimation() { | |
val offset = remember { Animatable(Offset(0f, 0f), Offset.VectorConverter) } | |
Box( | |
modifier = Modifier | |
.fillMaxSize() | |
.pointerInput(Unit) { | |
coroutineScope { | |
while (true) { | |
val position = awaitPointerEventScope { |
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
/** | |
* Swaps the order of the elements of the given [Pair] in a type-safe manner. | |
* | |
* Example: | |
* ``` | |
* Pair("David", 32).swap() // Pair(32, "David") | |
* ``` | |
*/ | |
fun <A, B> Pair<A, B>.swap(): Pair<B, A> = this.second to this.first |
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
#include <stdio.h> | |
#define _USE_MATH_DEFINES | |
#include <math.h> | |
#include <windows.h> | |
// width and height of screen | |
#define ww 100 | |
#define wh 50 | |
void clr(CHAR_INFO* d) |
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.codinginflow.sharedviewmodelexample; | |
import android.arch.lifecycle.Observer; | |
import android.arch.lifecycle.ViewModelProviders; | |
import android.os.Bundle; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
import android.support.v4.app.Fragment; | |
import android.view.LayoutInflater; | |
import android.view.View; |
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 Converters { | |
@TypeConverter | |
fun fromBitmap(bitmap: Bitmap): ByteArray { | |
val outputStream = ByteArrayOutputStream() | |
bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream) | |
return outputStream.toByteArray() | |
} | |
@TypeConverter |
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.appcompat.app.AppCompatActivity | |
import android.os.Bundle | |
import androidx.fragment.app.Fragment | |
import dagger.hilt.android.AndroidEntryPoint | |
import javax.inject.Inject | |
@AndroidEntryPoint | |
class MainActivity : AppCompatActivity() { | |
@Inject |
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
/* | |
Problem: | |
['Tokyo', 'London', 'Rome', 'Donlon', 'Kyoto', 'Paris'] | |
// YOUR ALGORITHM |
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
adb help // List all comands | |
== Adb Server | |
adb kill-server | |
adb start-server | |
== Adb Reboot | |
adb reboot | |
adb reboot recovery | |
adb reboot-bootloader |
NewerOlder