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
adb connect $(route -n get default | grep gateway | awk '{ print $2 }') |
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.text.Layout | |
import android.text.Spannable | |
import android.text.SpannableStringBuilder | |
import android.text.Spanned | |
import android.text.StaticLayout | |
import android.text.TextPaint | |
import android.text.method.LinkMovementMethod | |
import android.text.style.ClickableSpan |
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
internal fun disallowToolbarExpand() { | |
// Taken from: https://stackoverflow.com/a/49218710/1395437 | |
binding.appBar.setExpanded(false, false) | |
ViewCompat.setNestedScrollingEnabled(binding.content, false) | |
val params = binding.appBar.layoutParams as CoordinatorLayout.LayoutParams | |
if (params.behavior == null) { | |
params.behavior = AppBarLayout.Behavior() | |
} | |
val behaviour = params.behavior as AppBarLayout.Behavior | |
behaviour.setDragCallback(object : AppBarLayout.Behavior.DragCallback() { |
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
// find all build.gradle files in the expected locations in the build tree | |
fileTree('.') | |
.matching { | |
exclude '**/src/**', '**/build/**', '**/.*' | |
include '**/build.gradle' | |
} | |
.each { | |
// then convert the file path to a project path | |
final relative = rootProject.projectDir.relativePath(it.parentFile) | |
final project = ":${relative.replace('/', ':')}" |
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
open class ScopedViewModel : ViewModel() { | |
private val job = Job() | |
protected val scope: CoroutineScope = job + Dispatchers.Main | |
override fun onCleared() { | |
super.onCleared() | |
job.cancel() | |
} | |
} |
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
package com.julienarzul.android.recyclerview | |
import android.content.Context | |
import android.support.v7.widget.RecyclerView | |
import android.util.AttributeSet | |
class FadingEdgeRecyclerView : RecyclerView { | |
constructor(context: Context) : super(context) | |
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) |
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
/* | |
* Copyright 2017 Google, Inc. | |
* | |
* 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 | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
/* | |
* Copyright 2017 Google Inc. | |
* | |
* 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 | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software distributed under the | |
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
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
/** Set the View visibility to VISIBLE and eventually animate the View alpha till 100% */ | |
fun View.visible(animate: Boolean = true) { | |
if (animate) { | |
animate().alpha(1f).setDuration(300).setListener(object : AnimatorListenerAdapter() { | |
override fun onAnimationStart(animation: Animator) { | |
super.onAnimationStart(animation) | |
visibility = View.VISIBLE | |
} | |
}) | |
} else { |
NewerOlder