Skip to content

Instantly share code, notes, and snippets.

View SmartDengg's full-sized avatar
🇨🇳
Focusing

小鄧子 SmartDengg

🇨🇳
Focusing
View GitHub Profile
@SmartDengg
SmartDengg / GradleTaskTimer.gradle
Created May 13, 2017 05:18 — forked from nikos/GradleTaskTimer.gradle
Measure time for the execution of each gradle task executed
class TaskTimerListener implements TaskExecutionListener {
private Clock clock
@Override
void beforeExecute(Task task) {
clock = new org.gradle.util.Clock()
}
@Override
@SmartDengg
SmartDengg / deployApks.groovy
Created April 24, 2017 10:30 — forked from aquaflamingo/deployApks.groovy
Gradle task to archive APKs once built through android studio by running ./gradlew deployApks
task deployApks(type:Copy) {
description = "Copies APKs and Proguard mappings to the deploy directory"
def appName = "posture";
def versionDir = android.defaultConfig.versionName+"_"+android.defaultConfig.versionCode;
println("Copies APK and Proguard to " + versionDir)
from 'build/outputs/mapping/release/'
include '**/mapping.txt'
into '../.admin/deploy/' + versionDir
UseAge:
1:create providedJar dir at subProject
2:use:providAAR 'xxxx' in subproject
Code in root build.gradle:
buildscript {
repositories {
mavenLocal()
@SmartDengg
SmartDengg / IMMLeaks.java
Created November 3, 2016 08:04 — forked from pyricau/IMMLeaks.java
"Fix" for InputMethodManager leaking the last focused view: https://code.google.com/p/android/issues/detail?id=171190
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.ContextWrapper;
import android.os.Bundle;
import android.os.Looper;
import android.os.MessageQueue;
import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver;
@SmartDengg
SmartDengg / android_studio_shortcuts.md
Created November 1, 2016 08:15 — forked from stkent/android_studio_shortcuts.md
Android Studio Shortcuts (Mac)

Android Studio Shortcuts (Mac)

Notes:

  • Two of the most useful shortcuts utilize the Fn (function) keys. It is therefore recommended that you enable the "Use all F1, F2, etc. keys as standard function keys" option [System Preferences > Keyboard].
  • Be sure to enable the Mac OS X 10.5+ keymap in Android Studio [Preferences > Keymap].
  • A fairly complete shortcut list can be found here.

Useful symbols:

@SmartDengg
SmartDengg / app_build.gradle
Created September 6, 2016 06:32 — forked from almozavr/app_build.gradle
Workaround to bypass library's BuildConfig.DEBUG (always true, always release build type) via custom variable
// Application
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
import okhttp3.ResponseBody;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import okhttp3.mockwebserver.RecordedRequest;
import org.junit.Rule;
import org.junit.Test;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.http.GET;
@SmartDengg
SmartDengg / proguard-rules.pro
Created May 19, 2016 09:38 — forked from kosiara/proguard-rules.pro
RxJava RxAndroid Proguard rules
#build.gradle
#
# compile 'io.reactivex:rxandroid:1.0.1'
# compile 'io.reactivex:rxjava:1.0.14'
# compile 'io.reactivex:rxjava-math:1.0.0'
# compile 'com.jakewharton.rxbinding:rxbinding:0.2.0'
# rxjava
-keep class rx.schedulers.Schedulers {
public static <methods>;
@SmartDengg
SmartDengg / DevButton.java
Created May 17, 2016 05:07 — forked from Tagakov/DevButton.java
Hidden button for debugging purposes. Should be used with: debugCompile 'com.squareup:seismic:1.0.2'
import android.app.Application;
import android.content.Context;
import android.hardware.SensorManager;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationHandler;
import android.media.MediaRecorder;
import android.support.annotation.NonNull;
import com.f2prateek.rx.android.schedulers.AndroidSchedulers;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import rx.Observable;
import rx.subscriptions.Subscriptions;
public class RxMediaRecorder {