Skip to content

Instantly share code, notes, and snippets.

@vkay94
vkay94 / BaseLocalListFragment.java
Last active January 21, 2021 15:31
NewPipe Local lists with Groupie
/**
* This fragment is design to be used with persistent data such as
* {@link org.schabi.newpipe.database.LocalItem}, and does not cache the data contained
* in the list adapter to avoid extra writes when the it exits or re-enters its lifecycle.
* <p>
* This fragment destroys its adapter and views when {@link Fragment#onDestroyView()} is
* called and is memory efficient when in backstack.
* </p>
*
* @param <I> List of {@link org.schabi.newpipe.database.LocalItem}s
@vkay94
vkay94 / 0_TimberTree.kt
Last active November 28, 2020 11:31
Custom Timber trees which print logs with lines and method names for faster navigation
package de.vkay.android
import android.util.Log
import timber.log.Timber
class TimberTree {
class Debug : Timber.DebugTree() {
override fun createStackElementTag(element: StackTraceElement): String? {
val parts = super.createStackElementTag(element)?.split("$")
public class PlayerGestureListener
extends BasePlayerGestureListener
implements View.OnTouchListener {
private static final String TAG = ".PlayerGestureListener";
private static final boolean DEBUG = BasePlayer.DEBUG;
private final VideoPlayerImpl playerImpl;
private final MainPlayer service;
private boolean isResizing;
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@vkay94
vkay94 / FadingTextView.java
Created August 13, 2019 18:05
Custom TextView class which shows a fading end on the last line if maxLines is set
package de.vkay.customviews.widget;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;