Skip to content

Instantly share code, notes, and snippets.

####### start emulators script:
#!/bin/bash
export PATH=$ANDROID_HOME/tools/:$ANDROID_HOME/platform-tools/:$PATH
echo "Android HOME : $ANDROID_HOME"
echo "Android SDK HOME : $ANDROID_SDK_HOME"
echo "PATH : $PATH"
`dirname $0`/kill_android_emulators.sh
@andaag
andaag / text.py
Created August 24, 2014 11:07 — forked from psorianom/text.py
# -*- coding: utf-8 -*-
# Authors: Olivier Grisel <[email protected]>
# Mathieu Blondel <[email protected]>
# Lars Buitinck <[email protected]>
# Robert Layton <[email protected]>
# Jochen Wersdörfer <[email protected]>
# Roman Sinayev <[email protected]>
#
# License: BSD 3 clause
"""
@andaag
andaag / strip.conf
Last active August 29, 2015 14:07 — forked from dextorer/strip.conf
actions=true
ads=true
analytics=true
appindexing=true
appstate=true
auth=true
cast=true
common=true
drive=false
dynamic=true
final Toolbar toolbar = (Toolbar) findViewById(R.id.activity_main_toolbar);
//toolbar.setTitle("This is toolbar title");
toolbar.setTitleTextAppearance(getBaseContext(), R.style.AppTheme_TextStyle);
//toolbar.setSubtitle("This is toolbar Subtitle");
toolbar.setSubtitleTextAppearance(getBaseContext(), R.style.AppTheme_TextStyle);
toolbar.inflateMenu(R.menu.menu_main);
ShareActionProvider bob = (ShareActionProvider) MenuItemCompat.getActionProvider(toolbar.getMenu().findItem(R.id.share_test));
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
#!/bin/bash
DEVICES=$(adb devices | egrep -v 'List of devices' | cut -f 1 | xargs echo)
IFS=' '
echo "Installing emulator hacks"
for DEVICE in $DEVICES; do
adb -s $DEVICE uninstall no.finn.android.ci &>/dev/null
adb -s $DEVICE install -r "src/main/resources/android_emulator_hacks.apk" || exit 1
adb -s $DEVICE shell pm grant no.finn.android_emulator_hacks android.permission.SET_ANIMATION_SCALE
adb -s $DEVICE shell am start -n no.finn.android_emulator_hacks/no.finn.android_emulator_hacks.HackActivity
@andaag
andaag / gist:ec1339635b5188a6b137
Last active August 29, 2015 14:20
generic serialization with logansquared
public class GenericTypeConverter implements TypeConverter<GenericTypeConverter.GenericType> {
@Override
public GenericType parse(JsonParser jsonParser) throws IOException {
String field = null;
String value = null;
String fieldType = null;
String data = null;
@andaag
andaag / gist:b05ab66ed0f06167d6e0
Last active April 9, 2018 12:43
workaround for shareactionprovider leak
package no.finn.android.ui.objectpage;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import android.content.Context;
import android.content.Intent;
import android.support.v7.internal.widget.ActivityChooserModel;
import android.widget.ShareActionProvider;
public class RxActivityDelegate {
private static final String KEY_OBJECT = "rxActivityController.object";
private static final String KEY_OBJECTTYPE = "rxActivityController.object.type";
private static final String KEY_REQUESTCODE = "rxActivityController.requestCode";
public static void setResponse(Activity activity, int requestCode, RxResponseHandler rxResponseHandler) {
Intent intent = activity.getIntent();
intent.putExtra(KEY_OBJECT, JsonUtils.toBytes(rxResponseHandler));
intent.putExtra(KEY_OBJECTTYPE, rxResponseHandler.getClass().getName());
package no.finn.android.contentprovider;
import android.content.ContentResolver;
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@andaag
andaag / eureka-proxy.py
Last active February 15, 2016 17:12
A script to copy some eureka instances from a remote eureka to a local one. I use it to pull some dev eurekas into a docker-compose setup.
#!/usr/bin/python3
import json
import urllib
import urllib.request
import gzip
import os
### Need to setup some env's first
EUREKA_SOURCE = os.environ["EUREKA_SOURCE"]