-
Clone your fork:
git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
-
Add remote from original repository in your forked repository:
cd into/cloned/fork-repo git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git git fetch upstream
🤵♂️
This file contains hidden or 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
for (int i = 0; i < TICK_COUNT; i++) { | |
float startAngle = (float) Math.toRadians(0f); | |
float angle = (float) ((startAngle + i) * (Math.toRadians(360)/TICK_COUNT));// * (Math.PI / TICK_COUNT)); | |
int x = (int) ((radius* Math.cos(angle))+ cx); | |
int y = (int) ((radius* Math.sin(angle)) + cy); | |
int x1 = (int) (((radius+20)* Math.cos(angle))+ cx); | |
int y1= (int) (((radius+20)* Math.sin(angle)) + cy); | |
canvas.drawLine( |
This file contains hidden or 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 a new remote upstream repository | |
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git | |
# Sync your fork | |
git fetch upstream | |
git checkout master | |
git merge upstream/master |
This file contains hidden or 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
flow<String> { | |
// suspending call here | |
emit("Foo") | |
} | |
.onStart { // show loading } | |
.onCompletion { // hide loading } | |
.catch { // exception handling } | |
.onEach { // equivalent to rx onNext } | |
.launchIn(yourScope) |
This file contains hidden or 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.annotation.SuppressLint | |
import android.content.Context | |
import android.graphics.* | |
import android.util.AttributeSet | |
import android.view.View | |
import androidx.core.content.ContextCompat | |
import bg.dihanov.customviewexamples.R | |
import bg.dihanov.customviewexamples.px | |
import kotlin.math.max | |
import kotlin.math.min |
This file contains hidden or 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 <refied T: Any> Context.openActivity(noinline init: Intent.()-> Unit = {}){ | |
val intent == newIntent<T>(this) | |
intent.init() | |
startActivity(intent) | |
} | |
inline <refied T: Any> fun newIntent(context: Context): Int{ | |
Intent(context.T::class.kava) |
This file contains hidden or 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 InputStreamRequestBody extends RequestBody { | |
private final MediaType contentType; | |
private final ContentResolver contentResolver; | |
private final Uri uri; | |
public InputStreamRequestBody(MediaType contentType, ContentResolver contentResolver, Uri uri) { | |
if (uri == null) throw new NullPointerException("uri == null"); | |
this.contentType = contentType; | |
this.contentResolver = contentResolver; | |
this.uri = uri; |
This file contains hidden or 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
suspend fun <T> retryIO( | |
times: Int = Int.MAX_VALUE, | |
initialDelay: Long = 100, // 0.1 second | |
maxDelay: Long = 1000, // 1 second | |
factor: Double = 2.0, | |
block: suspend () -> T): T | |
{ | |
var currentDelay = initialDelay | |
repeat(times - 1) { | |
try { |
This file contains hidden or 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
// edit /home/.bashrc and add the following lines | |
JAVA_HOME='/home/raghu/jdk1.8.0_241' | |
export JAVA_HOME | |
export PATH=$PATH:$JAVA_HOME/bin | |
FLUTTER_HOME='/home/raghu/flutter' | |
export FLUTTER_HOME | |
export PATH=$PATH:$FLUTTER_HOME/bin | |
ANDROID_SDK_ROOT='/home/raghu/Android/Sdk' |