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 TinyThumbDecoder( | |
private var context: Context, | |
private val bitmapPool: BitmapPool, | |
private val blurProvider: (source: Bitmap, options: BlurOptions?) -> Bitmap | |
) : ResourceDecoder<TinyThumb, BitmapDrawable> { | |
override fun handles(source: TinyThumb, options: Options) = source.base64.isNotEmpty() | |
override fun decode( | |
source: TinyThumb, |
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 TinyThumbDataFetcher(private val thumb: TinyThumb) : DataFetcher<TinyThumb> { | |
override fun loadData( | |
priority: Priority, | |
callback: DataFetcher.DataCallback<in TinyThumb> | |
) = callback.onDataReady(thumb) | |
override fun getDataClass(): Class<TinyThumb> = TinyThumb::class.java | |
override fun getDataSource(): DataSource = DataSource.LOCAL | |
override fun cleanup() { /* Do nothing */ } |
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 TinyThumbLoader : ModelLoader<TinyThumb, TinyThumb> { | |
override fun buildLoadData( | |
model: TinyThumb, | |
width: Int, | |
height: Int, | |
options: Options | |
) = ModelLoader.LoadData( | |
ObjectKey(model.toString()), | |
TinyThumbDataFetcher(model) | |
) |
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 thumbnail = TinyThumb(base64 = "...") | |
requestManager | |
.load(imageUrl) | |
.thumbnail(requestManager.load(thumbnail)) | |
.transition(DrawableTransitionOptions().crossFade(750)) | |
.into(imageView) |
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
@GlideModule | |
class GlideModule : AppGlideModule() { | |
override fun registerComponents(context: Context, glide: Glide, registry: Registry) { | |
// Register a ModelLoaderFactory for TinyThumb allowing the type to be loaded using Glide | |
registry.append(TinyThumb::class.java, TinyThumb::class.java, TinyThumbLoader.Factory()) | |
// Register a ResourceDecoder for TinyThumb. Specifying the input and output type. | |
// Note that the tailing lambda is the blur provider. If we wanted to use another blur | |
// implementation we could replace it here. | |
registry.append( |
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
/* | |
* Based on https://gist.github.com/jamiesanson/d1a3ed0910cd605e928572ce245bafc4 | |
* | |
* Refactored to use the preferred `DefaultLifecycleObserver` which does not rely on the annotation processor. | |
* See https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle#init | |
* | |
* Usage: | |
* `private var binding: TheViewBinding by viewLifecycle()` | |
*/ |
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.subgarden.eventlogging | |
import android.os.Bundle | |
import android.support.annotation.IntegerRes | |
import android.support.v7.app.AppCompatActivity | |
import android.util.Log | |
import java.util.* | |
class MainActivity : AppCompatActivity() { |
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
var fs = require("fs"); | |
var tus = require("tus-js-client"); | |
const ENDPOINT = "http://" | |
const FILE_NAME = "video.MOV" | |
const X_AUTH_KEY = "" | |
const file = fs.readFileSync( __dirname + "/"+ FILE_NAME) | |
if (file.err) { |