Skip to content

Instantly share code, notes, and snippets.

View robUx4's full-sized avatar

Steve Lhomme robUx4

View GitHub Profile
@robUx4
robUx4 / build.gradle
Last active August 29, 2015 14:10
Gradle plugin transition from 0.12/0.13 to 0.14/1.0.0
// enable proguard on all version of the android gradle plugin
release {
if (!properties.findAll{it.key == 'runProguard'}.isEmpty()) {
runProguard true
} else if (!properties.findAll{it.key == 'minifyEnabled'}.isEmpty()) {
minifyEnabled true
}
}
// detect proguard in a variant
@robUx4
robUx4 / crash.log
Created December 1, 2014 08:20
Rooted Nexus 4
java.lang.NullPointerException
at com.qihoo.sandbox.monitor.SystemMonitor$SendBroadcastThread.SendRegisterBroadcast(SystemMonitor.java:40)
at com.qihoo.sandbox.monitor.SystemMonitor$SendBroadcastThread.run(SystemMonitor.java:77)
@robUx4
robUx4 / proguard.txt
Created November 26, 2014 06:50
This fix doesn't fix
# try to avoid this issue on Samsung 4.2.2 https://code.google.com/p/android/issues/detail?id=78377
-keep class !android.support.v7.internal.view.menu.MenuBuilder
-keep class !android.support.v7.internal.view.menu.SubMenuBuilder
@robUx4
robUx4 / FontManager.java
Created November 20, 2014 11:01
Basic Font setter
package com.levelup.touiteur;
import android.graphics.Typeface;
import android.util.SparseArray;
import android.widget.TextView;
import com.levelup.touiteur.log.TouiteurLog;
public class FontManager {
@robUx4
robUx4 / PhoneWindow.java
Created November 12, 2014 09:14
windowDrawsSystemBarBackgrounds WTF
// Non-floating windows on high end devices must put up decor beneath the system bars and
// therefore must know about visibility changes of those.
if (!mIsFloating && ActivityManager.isHighEndGfx()) {
if (!targetPreL && a.getBoolean(
R.styleable.Window_windowDrawsSystemBarBackgrounds,
false)) {
setFlags(FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS & ~getForcedWindowFlags());
}
}
@robUx4
robUx4 / logcat
Created September 8, 2014 07:12
LG Optimus L9 running 4.4.4
java.lang.IllegalArgumentException: Optimized data directory /data/data/com.levelup.touiteur/cache is not owned by the current user. Shared storage cannot protect your application from code injection attacks.
at dalvik.system.DexFile.(DexFile.java:102)
at dalvik.system.DexFile.loadDex(DexFile.java:151)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:266)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:230)
at dalvik.system.DexPathList.(DexPathList.java:112)
at dalvik.system.BaseDexClassLoader.(BaseDexClassLoader.java:48)
at dalvik.system.DexClassLoader.(DexClassLoader.java:57)
at vi.a(SourceFile:91)
at vk.a(SourceFile:68)
@robUx4
robUx4 / project.gradle
Created September 1, 2014 07:39
Android-Switch workaround
dependencies {
def artifactAndroidSwitch = 'org.jraf:android-switch-backport:1.3.+'
def useLocalAndroidSwitch = false
def localAndroidSwitch = ':android-Switch'
allprojects {
rootProject.allprojects.project.each {
if (it.path == localAndroidSwitch) {
@robUx4
robUx4 / settings.gradle
Created July 8, 2014 18:59
FileLogger gradle
// version 1
include ':dependencies:Android-FileLogger:library'
// version 2
include 'FileLogger'
project(':FileLogger').projectDir = new File('dependencies/Android-FileLogger/library')
@robUx4
robUx4 / gist:4a8a6f15c4e7d96021e3
Created July 8, 2014 13:33
Android InetSocketAddress source
/**
* Returns the hostname if known, or the result of {@code InetAddress.getHostAddress}.
* Unlike {@link #getHostName}, this method will never cause a DNS lookup.
* @since 1.7
* @hide 1.7 - remember to add a link in the getHostName documentation!
*/
public final String getHostString() {
return (hostname != null) ? hostname : addr.getHostAddress();
}
@robUx4
robUx4 / tighter call
Last active August 29, 2015 13:59
Application.onCreate double call
0 | 00:00:00:040 | I/Plume_55902 Plume Oncreate
1 | 00:00:00:040 | I/Plume_55902 Startup: loggers logger:com.levelup.touiteur.c.c@41c209c8
2 | 00:00:00:125 | D/Plume_55902 clear PhotoCache memory
3 | 00:00:00:203 | D/Plume_55902 clear PhotoCache memory
4 | 00:00:00:988 | D/PlumeStream Start stream checker
5 | 00:00:01:017 | D/PlumeStream assertRunningStreams needs stream:true
6 | 00:00:01:017 | D/PlumeStream assertRunningStream mWantsStreamRunning:true
7 | 00:00:01:063 | D/PlumeStream run user streams needed:true instance:null
8 | 00:00:01:063 | I/PlumeStream attach b{41c5d400 connected:false} state was:OFFLINE
9 | 00:00:01:066 | D/PlumeStream m{41c42c38 kraatsie66} startListening isStreamStarted:false connected:false