Skip to content

Instantly share code, notes, and snippets.

View tbruyelle's full-sized avatar

Thomas Bruyelle tbruyelle

View GitHub Profile
@tbruyelle
tbruyelle / OkHttpStack.java
Created August 7, 2014 08:09
Volley & OkHttp
package com.comalia.gesicamobile.manager.net;
import com.android.volley.toolbox.HurlStack;
import com.comalia.gesicamobile.manager.util.NukeSSLCerts;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.OkUrlFactory;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
@tbruyelle
tbruyelle / ProgressBarWrapper.java
Created January 15, 2014 15:05
smooth progress bar in action bar
package util;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.view.Gravity;
import android.view.LayoutInflater;
@tbruyelle
tbruyelle / ActionButtonRotate.java
Created January 15, 2014 14:38
action button rotate
package com.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.animation.Animation;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.EViewGroup;
package com.comalia.gesicamobile.util;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Looper;
import android.util.DisplayMetrics;
import android.util.TypedValue;
@tbruyelle
tbruyelle / gist:8183003
Created December 30, 2013 14:55
update action bar title
int titleId = getResources().getIdentifier("action_bar_title", "id",
"android");
TextView yourTextView = (TextView) findViewById(titleId);
yourTextView.setTypeface(TypefaceUtil.getTypeFace(this, "fonts/Roboto-Light.ttf"));
yourTextView.setTextAppearance(this, R.style.TextAppearance_GesicaManager_Title);
@tbruyelle
tbruyelle / FontableTextView.java
Created December 30, 2013 14:43
android custom font
package com.comalia.gesicamobile.manager.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.TextView;
import com.comalia.gesicamobile.manager.R;
@tbruyelle
tbruyelle / MyAndroid.java
Created December 18, 2013 15:28
ActionBarSherlock fest android
package com.comalia.gesicamobile.test;
import com.actionbarsherlock.app.ActionBar;
import org.fest.assertions.api.ANDROID;
public class MyANDROID extends ANDROID {
public static SupportActionBarAssert assertThat(ActionBar actionBar) {
return new SupportActionBarAssert(actionBar);
@tbruyelle
tbruyelle / build.gradle
Created December 18, 2013 07:53
android app test module
buildscript {
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'com.novoda:gradle-android-test-plugin:0.9.7-SNAPSHOT'
}
@tbruyelle
tbruyelle / gist:7908852
Created December 11, 2013 11:31
java print stack trace
for (StackTraceElement el : Thread.currentThread().getStackTrace()) {
logger.e("stacktrace %s %s", el.getClassName(), el.getMethodName());
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.