Skip to content

Instantly share code, notes, and snippets.

View ruijun's full-sized avatar

Jimson Liang ruijun

View GitHub Profile
@ruijun
ruijun / copy-mapping
Created January 12, 2016 05:29
copy proguard mapping.txt to save it
android {
applicationVariants.all { variant ->
variant.outputs.each { output ->
if (variant.getBuildType().isMinifyEnabled()) {
variant.assemble.doLast{
copy {
from variant.mappingFile
into "${projectDir}/mappings"
rename { String fileName ->
"mapping-${variant.name}.txt"
@rocboronat
rocboronat / BaseActivity.java
Last active April 13, 2016 08:16
Calling setTaskDescription() in a reflected way
private void setTaskDescription(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
String title = getString(R.string.app_name);
Bitmap icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
int color = getResources().getColor(R.color.task_background);
// The legacy method call
// setTaskDescription(new ActivityManager.TaskDescription(title, icon, color));
// The reflected method call
@kevinmcmahon
kevinmcmahon / coloredlogcat.py
Created January 19, 2012 20:31
Colored Logcat
#!/usr/bin/python
'''
Copyright 2009, The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
获取问题跟文章
http://v3.wufazhuce.com:8000/api/reading/index/
然后根据essay跟question id进去到不同的详细
http://v3.wufazhuce.com:8000/api/question/1282
http://v3.wufazhuce.com:8000/api/essay/1339
获取首页
http://v3.wufazhuce.com:8000/api/hp/idlist/0
然后通过http://v3.wufazhuce.com:8000/api/hp/detail/1275 进入
@PierceZ
PierceZ / EventLiveData.java
Created September 20, 2017 13:00
Another approach where EventLiveData contains a reference to its lifecycle.
public class EventLiveData extends LiveData<Object> {
private final int mSubject;
private final LifecycleRegistryOwner mLifecycle;
public EventLiveData(@LiveDataBus.Subject int subject, @NonNull LifecycleRegistryOwner lifecycle) {
mSubject = subject;
mLifecycle = lifecycle;
}
@IlyaEremin
IlyaEremin / build.gradle
Created February 18, 2017 20:34
Example of managing dependencies in separate file
apply from: 'deps.gradle'
// ...
dependencies {
compile supportLibs
compile rxJavaLibs
compile retrofitLibs
compile okHttpLibs
@qrtt1
qrtt1 / aar-deps.gradle
Last active May 19, 2020 16:09
gradle: package *.jar into aar
project.afterEvaluate {
def isAndroidLibraryProject = project.plugins.hasPlugin('com.android.library')
if(isAndroidLibraryProject) {
task copyDeps(type:Copy) {
from configurations.compile {
include '**/*.jar'
}
into "./build/intermediates/bundles/release/libs/"
}
bundleRelease.dependsOn copyDeps
@lucifr
lucifr / gist:1208100
Created September 10, 2011 08:16
Sublime Text 2 - 实用快捷键 (Mac OS X)
@gabrielemariotti
gabrielemariotti / README.md
Last active February 24, 2021 10:52
How to manage the support libraries in a multi-module projects. Thanks to Fernando Cejas (http://fernandocejas.com/)

Centralize the support libraries dependencies in gradle

Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.

A very good way is to separate gradle build files, defining something like:

root
  --gradleScript
 ----dependencies.gradle
@wyon
wyon / BlockDetect.java
Last active February 25, 2021 05:56
检测应用在UI线程的卡顿,打印出卡顿时调用堆栈。
public class BlockDetect {
// BlockDetectByPrinter
public static void start() {
Looper.getMainLooper().setMessageLogging(new Printer() {
private static final String START = ">>>>> Dispatching";
private static final String END = "<<<<< Finished";
@Override