Skip to content

Instantly share code, notes, and snippets.

View LeonDevLifeLog's full-sized avatar
:octocat:
Focusing

Leon LeonDevLifeLog

:octocat:
Focusing
  • nanjing,jiangsu China
View GitHub Profile
@xc-racer99
xc-racer99 / clone_depth.xml
Last active June 5, 2019 02:15
Remove bloat in AOSP 7.0
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- Remove first, re-add with clone-depth of 1 -->
<remove-project path="cts" name="platform/cts" groups="cts,pdk-cw-fs,pdk-fs" />
<remove-project path="dalvik" name="platform/dalvik" groups="pdk-cw-fs,pdk-fs" />
<remove-project path="developers/build" name="platform/developers/build" />
<remove-project path="developers/demos" name="platform/developers/demos" />
<remove-project path="developers/samples/android" name="platform/developers/samples/android" />
<remove-project path="development" name="platform/development" groups="pdk-cw-fs,pdk-fs" />
@suweya
suweya / FileUtil.java
Last active February 17, 2023 03:39
OkHttp download file by Okio
import android.os.Environment;
import android.support.annotation.NonNull;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.TimeUnit;
package com.segmentfault.app.view;
import android.content.Context;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.NestedScrollingChild;
import android.support.v4.view.NestedScrollingChildHelper;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;
import android.view.MotionEvent;
@christopherperry
christopherperry / ExpiringLruCache.java
Last active February 16, 2024 15:12
LruCache for Android with expiring keys. Instead of modifying LruCache directly I used delegation to get around final keyword usage and a dirty hack to override everything else.
import android.os.SystemClock;
import android.support.v4.util.LruCache;
import java.util.HashMap;
import java.util.Map;
/**
* An Lru Cache that allows entries to expire after
* a period of time. Items are evicted based on a combination
* of time, and usage. Adding items past the {@code maxSize}
@srgtuszy
srgtuszy / gist:6371749
Last active May 18, 2022 03:16
Gradle task for uploading builds to TestFlight using HTTPBuilder
task uploadTf(dependsOn: assembleRelease) << {
def teamToken = '<TestFlight team token here>'
def apiToken = '<TestFlight api token here>'
def lists = '<TestFlight distribution lists here>'
def apk = file("build/apk/$project.name-release.apk")
def notes = new File(file('changelog.mdown')).getText("UTF-8")
def http = new HTTPBuilder('http://testflightapp.com')
println('Uploading build to TestFlight...')
http.request(POST, JSON) { req ->
uri.path = '/api/builds.json'