Skip to content

Instantly share code, notes, and snippets.

View kibotu's full-sized avatar
🎯
Focusing

Jan Rabe kibotu

🎯
Focusing
View GitHub Profile
@murdly
murdly / Crossfader.kt
Last active January 19, 2021 08:19
Cross fading images across requests with Glide library.
import android.content.Context
import android.graphics.drawable.Drawable
import android.util.AttributeSet
import android.view.View
import android.view.ViewGroup
import android.view.animation.AnimationUtils
import android.widget.ImageView
import android.widget.ViewSwitcher
import com.bumptech.glide.load.DataSource
import com.bumptech.glide.load.engine.GlideException
@bolot
bolot / PeekingLinearLayoutManager.kt
Last active August 30, 2023 07:19
LinearLayoutManager subclass that "peeks", shows a portion of the adjacent child views.
class PeekingLinearLayoutManager : LinearLayoutManager {
@Suppress("Unused")
@JvmOverloads
constructor(context: Context?, @RecyclerView.Orientation orientation: Int = RecyclerView.VERTICAL, reverseLayout: Boolean = false) : super(context, orientation, reverseLayout)
@Suppress("Unused")
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes)
override fun generateDefaultLayoutParams() =
scaledLayoutParams(super.generateDefaultLayoutParams())
import android.graphics.Canvas
import android.graphics.Rect
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
/**
* Created with Android Studio
* User: Sergey Petrov s.a.petrov.spb@gmail.com
@keima
keima / HowToUseActivity.kt
Last active March 31, 2024 21:58
LifecycleOwner implemented RecyclerView ViewHolder & Adapter (concept design)
import android.os.Bundle
import android.util.Log
import android.view.ViewGroup
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
import app.keima.android.recyclerviewsandbox.databinding.ActivityMainBinding
@fians
fians / optimize.php
Created January 3, 2018 10:24
Optimize Image in PHP using Imagick according Google Pagespeed Recommendation
/**
* Optimize image image
*
* https://developers.google.com/speed/docs/insights/OptimizeImages
* -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace sRGB
*
* @access public
* @param string $filePath Path of the file
* @return string Raw image result from the process
*/
@scruffyfox
scruffyfox / VideoPlayer.kt
Last active February 1, 2023 12:57
Playing a video from Assets using ExoPlayer 2
/**
* It took me AGES to figure this out, seriously, exoplayer documentation IS SO BAD.
*/
package xxx
import android.net.Uri
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.cube.arc.R
@erkattak
erkattak / AndroidManifest.xml
Created June 19, 2017 18:47
Android Application Setup for use with Charles Proxy
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:networkSecurityConfig="@xml/network_security_config">
@zly394
zly394 / AppBarLayoutOverScrollViewBehavior.java
Last active April 4, 2024 12:13
Overscroll AppBarLayout Behavior—— AppBarLayout越界弹性效果
package com.zly.widget.behavior;
import android.animation.ValueAnimator;
import android.content.Context;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.View;
@tayvano
tayvano / gist:6e2d456a9897f55025e25035478a3a50
Created February 19, 2017 05:29
complete list of ffmpeg flags / commands
Originall From: Posted 2015-05-29 http://ubwg.net/b/full-list-of-ffmpeg-flags-and-options
This is the complete list that’s outputted by ffmpeg when running ffmpeg -h full.
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…
Getting help:
-h — print basic options
-h long — print more options
-h full — print all options (including all format and codec specific options, very long)
@jk2K
jk2K / extract_realm_database_android.sh
Last active February 22, 2023 15:04 — forked from medyo/extract_realm_database_android.sh
how to export realm database, work on Android 5.0+
#!/bin/bash
ADB_PATH="/Users/lee/Library/Android/sdk/platform-tools"
PACKAGE_NAME="com.yourcompany.app"
DB_NAME="default.realm"
DESTINATION_PATH="/Users/lee/Downloads/${DB_NAME}"
NOT_PRESENT="List of devices attached"
ADB_FOUND=`${ADB_PATH}/adb devices | tail -2 | head -1 | cut -f 1 | sed 's/ *$//g'`
if [[ ${ADB_FOUND} == ${NOT_PRESENT} ]]; then
echo "Make sure a device is connected"
else