Skip to content

Instantly share code, notes, and snippets.

@Veeyikpong
Veeyikpong / MiddleDividerItemDecoration.kt
Last active July 15, 2023 11:54
MiddleDividerItemDecoration, suitable for both LinearLayoutManager and GridLayoutManager.
/*
* Copyright 2018 The Android Open Source Project
*
* 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
@delacrixmorgan
delacrixmorgan / CubeTransformer.md
Last active November 21, 2021 09:45
Cube ViewPager Transformer

Cube ViewPager Transformer

class CubeTransformer : ViewPager.PageTransformer {
    override fun transformPage(view: View, position: Float) {
        val deltaY = 0.5F

        view.pivotX = if (position < 0F) view.width.toFloat() else 0F
        view.pivotY = view.height * deltaY
 view.rotationY = 45F * position
@Sloy
Sloy / FirebaseCoroutinesExtensions.kt
Last active January 20, 2021 11:48
Reading Firebase Database as Kotlin coroutines
/*
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WARNING!!!
NO, SERIOUSLY. REAL WARNING!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@lisawray
lisawray / ColumnItemDecoration.java
Last active May 29, 2023 21:11
Equal column spacing in a RecyclerView with GridLayoutManager
package com.example.columnspacing
import android.graphics.Paint;
import android.graphics.Rect;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
@abeluck
abeluck / gist:6243306
Last active April 14, 2020 04:43
Local HTTP server to stream an InputStream to MediaPlayer on Android
/**
* This is simple HTTP local server for streaming InputStream to apps which are capable to read data from url.
* Random access input stream is optionally supported, depending if file can be opened in this mode.
*
* from: http://stackoverflow.com/a/9096241
*/
public class StreamOverHttp{
private static final boolean debug = false;
private final Browser.FileEntry file;