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 / Android网络最佳实践
Last active October 20, 2016 06:33
NetWorkingPractice
**Android生态圈发展步伐之快,网络框架更是层出不穷,本次主讲人将带你回顾网络框架的变迁史,并对比时下流行网络框架,阐述他的经验,以及这些演变背后的原因。**
Android开发生态圈的节奏非常之快。每周都会有新的工具诞生,类库的更新,博客的发表以及技术探讨。
如果你外出度假,当你回来的时候可能已经发布了新版本的
网络框架不同于其他,因为它在一定程度上与业务耦合度极高,甚至从代码的角度来说会遍布于工程的各个角落,很难集中管理,一旦替换甚至还要经过漫长的调试过程。
不同与图像加载,日志打印等框架那样,在短时间内就能够进行重构,而且一直沿用多个迭代版本也是正常的。
这一次我会跟大家一起回顾Android开发中那些常见的网络加载类,还有库。
阐述我的观点,分享我的经验,希望大家能够喜欢。
@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
@SmartDengg
SmartDengg / Reduce.java
Created June 22, 2016 05:24
轮询+退避+重试
package com.smartdengg.rxgallery.example.activity;
import android.os.Bundle;
import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.smartdengg.rxgallery.example.R;
import java.util.Random;
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>;