Skip to content

Instantly share code, notes, and snippets.

View esmasui's full-sized avatar

Sosuke Masui esmasui

  • uPhyca Inc.
  • Yokohama-shi, Kanagawa, Japan
View GitHub Profile
@kasem-sm
kasem-sm / CoilWithPlaceholder.kt
Created February 6, 2022 15:49
Small workaround to show thumbnail before loading actual image with Coil.
var isOriginalImageLoaded = false
// Thumbnail Request
val thumbRequest = ImageRequest.Builder(ctx)
.data(thumbUrl)
.target(
onSuccess = { result ->
// If highRes image is not loaded yet,
// show the thumbnail
if (!isOriginalImageLoaded) {
@Intyre
Intyre / Wahoo_Elemnt.md
Last active October 24, 2025 17:27
Wahoo Elemnt - Tips, tricks and custom images
@cbeyls
cbeyls / WindowInsetsFrameLayout.java
Last active November 10, 2024 14:25
A fragment container enabling the use of android:fitsSystemWindows in fragment layouts.
package be.digitalia.common.widgets;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Rect;
import android.os.Build;
import android.support.v4.util.ObjectsCompat;
import android.util.AttributeSet;
import android.view.View;
@wbroek
wbroek / genymotionwithplay.txt
Last active December 16, 2025 11:18
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)

MergeAdapter便利

ふとFoursquareアプリのLicense表示を見たら便利そうなライブラリを発見して便利だったので紹介。

MergeAdapterとは

MergeAdapterは、google groupsとかstackoverflowでAndroidの問題を探しているとかなりの頻度で目にするMark Murphy(@commonsguy) さんが作成した便利なAdapterです。

MergeAdapter accepts a mix of Adapters and Views and presents them as one contiguous whole to whatever ListView it is poured into. This is good for cases where you have multiple data sources, or if you have a handful of ordinary Views to mix in with lists of data, or the like.

@wasabeef
wasabeef / AnimatedGifEncoder.java
Last active July 8, 2023 10:04
Android - AnimatedGifEncoder
import java.io.IOException;
import java.io.OutputStream;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Paint;
public class AnimatedGifEncoder {
protected int width; // image size
@nolanlawson
nolanlawson / completion-for-gradle.md
Last active September 25, 2024 12:51
Gradle tab completion for Bash. Works on both Mac and Linux.

Gradle tab completion script for Bash

A tab completion script that works for Bash. Relies on the BSD md5 command on Mac and md5sum on Linux, so as long as you have one of those two commands, this should work.

Usage

$ gradle [TAB]
@alterakey
alterakey / build.gradle
Created January 24, 2014 17:36
Experimental Launcher for Android Gradle Plugin
// Patch in
task launchDebug(dependsOn: 'installDebug') << {
final String cmdline = "bash ${projectDir}/../gradle/start-intent.sh android.intent.action.MAIN ${project.tasks.generateDebugBuildConfig.appPackageName} .activity.MainActivity"
final Process p = cmdline.execute()
p.in.eachLine { l -> println l }
final int code = p.waitFor()
if (code != 0) {
throw new RuntimeException("Task exited with code " + code + ": " + cmdline)
}
}
@imminent
imminent / AndroidCookieStore.java
Last active December 14, 2015 06:38
Collection of code to use the Client interface of Retrofit to use HttpUrlConnection with SharedPreferences persistent cookies.
import android.annotation.TargetApi;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.PatternMatcher;
import com.keepandshare.android.utils.CryptographyUtil;
import com.keepandshare.android.utils.Ln;
import javax.inject.Singleton;
import java.net.CookieStore;
import java.net.HttpCookie;
@xconnecting
xconnecting / build.gradle
Created November 8, 2012 06:30
Gradle: print buildscript dependencies
apply plugin: 'eclipse'
apply plugin: 'maven'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.apache.commons:commons-email:1.2'
}