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.example.videotest; | |
import android.app.Activity; | |
import android.net.Uri; | |
import android.os.Bundle; | |
import android.widget.MediaController; | |
import android.widget.VideoView; | |
public class VideoPlaybackActivity extends Activity { | |
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 java.io.BufferedInputStream; | |
import java.io.DataInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.nio.Buffer; | |
import java.nio.ByteBuffer; | |
import java.nio.ByteOrder; | |
import java.nio.FloatBuffer; | |
import java.nio.ShortBuffer; | |
import java.util.ArrayList; |
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.graphics.Bitmap; | |
import android.graphics.BitmapShader; | |
import android.graphics.Canvas; | |
import android.graphics.Matrix; | |
import android.graphics.Paint; | |
import android.graphics.Shader; | |
import com.squareup.picasso.Transformation; | |
public class CircleTransformation implements Transformation { |
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
@file:Suppress("RedundantVisibilityModifier", "NOTHING_TO_INLINE") | |
import kotlin.reflect.KProperty | |
public interface LazyMutable<T> { | |
public var value: T | |
public fun isInitialized(): Boolean | |
} | |
public inline operator fun <T> LazyMutable<T>.getValue(thisRef: Any?, property: KProperty<*>): T { |
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 View.afterLayout(block: View.() -> Unit) { | |
val originalVto = viewTreeObserver | |
originalVto.addOnPreDrawListener(object : ViewTreeObserver.OnPreDrawListener { | |
override fun onPreDraw(): Boolean { | |
if (originalVto.isAlive) originalVto.removeOnPreDrawListener(this) | |
viewTreeObserver.removeOnPreDrawListener(this) | |
block(this@afterLayout) | |
return true | |
} | |
}) |
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
private abstract class CenterVerticalDrawableSpan : ReplacementSpan() { | |
abstract fun getDrawable(): Drawable? | |
private var drawableRef: WeakReference<Drawable>? = null | |
private val cachedDrawable: Drawable? | |
get() = drawableRef?.get() ?: getDrawable()?.also { drawableRef = WeakReference(it) } | |
override fun getSize(paint: Paint, text: CharSequence, |
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.os.Handler | |
fun <T> debounced(initialValue: T, debounceMs: Long = 500L): Debounced<T> { | |
return AndroidDebounced(initialValue, debounceMs) | |
} | |
private class AndroidDebounced<T>(initialValue: T, private val debounceMs: Long) : Debounced<T> { | |
private val handler = Handler() | |
private var _value: T = initialValue |
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.example.multitouch; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.Map; | |
import android.annotation.SuppressLint; | |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.Color; |
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.Bitmap; | |
import android.graphics.BitmapShader; | |
import android.graphics.Canvas; | |
import android.graphics.Paint; | |
import android.graphics.Shader; | |
import android.graphics.drawable.BitmapDrawable; | |
import android.util.AttributeSet; | |
import android.widget.ImageView; |
OlderNewer