Skip to content

Instantly share code, notes, and snippets.

View fredgrott's full-sized avatar
👾
focusing on flutter cross platform mobile dev

Fred Grott fredgrott

👾
focusing on flutter cross platform mobile dev
View GitHub Profile
@tleach
tleach / ReflectingLayout.java
Created January 19, 2012 16:04
An Android Layout which can be used to apply a "reflection" effect to all child Views it contains.
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Shader.TileMode;
import android.util.AttributeSet;
@bepcyc
bepcyc / HeapInfo.java
Created January 30, 2012 12:59
Logging Heap info in Android
/**
* Logging Heap Info for Android
* @source <a href="http://stackoverflow.com/a/8018476/918211">StackOverflow Thread</a>
*/
public static void logHeap(Class clazz) {
final String APP = "MyApp";
Double allocated = new Double(Debug.getNativeHeapAllocatedSize())/1048576d;
Double available = new Double(Debug.getNativeHeapSize())/1048576.0d;
Double free = new Double(Debug.getNativeHeapFreeSize())/1048576.0d;
DecimalFormat df = new DecimalFormat();
@printminion
printminion / photo_monkey.py
Created February 10, 2012 20:18
Android Monkeyrunner - photo_monkey.py
# This is a monkeyrunner jython script that opens a connection to an Android
# device and starts camera app and makes photos by touching the camerabutton.
#
# See http://developer.android.com/guide/developing/tools/monkeyrunner_concepts.html
#
# usage: monkeyrunner photo_monkey.py
#
# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
@KonajuGames
KonajuGames / gist:1954646
Created March 2, 2012 01:33
Android OpenGL background context
using System;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.ES20;
using OpenTK.Platform;
using OpenTK.Platform.Android;
using Android.Views;
using Android.Content;
@fjolnir
fjolnir / tlc.lua
Last active February 15, 2024 15:01
LuaJIT ObjC bridge
The bridge is now located at https://github.com/fjolnir/TLC
@romannurik
romannurik / button_bar_layout.xml
Created April 10, 2012 04:24
How to make a proper button bar on ICS
<!--
A button bar is a set of buttons at the bottom of an activity.
An example is an AlertDialog with OK/Cancel buttons.
Note that something similar can be accomplished using a
split action bar and text-only action buttons, but this is an
alternate presentation that's often preferred.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
@daichan4649
daichan4649 / MainActivity.java
Created April 17, 2012 12:35
DialogFragment sample
package test.fragment;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
public class MainActivity extends Activity {
@graetzer
graetzer / ActionbarTabsPager.java
Created April 19, 2012 21:39
Android FragmentTabsPager with Actionbarsherlock
import java.util.ArrayList;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager;
@kimukou
kimukou / GridViewActivity.java
Created May 4, 2012 00:47
GridView MultiTouch Test
/*
* ref
* http://www.mkyong.com/android/android-gridview-example/
* http://blog.fujiu.jp/2011/11/android.html
* http://d.hatena.ne.jp/xuwei/20120316/1331868246
* http://stackoverflow.com/questions/5730240/android-get-bounding-rectangle-of-a-view
*/
@kaz-tk
kaz-tk / gist:2626506
Created May 7, 2012 07:35
MonkeyRunnerからDeviceの取得
# これからWaitForConnectionすればいい感じ
from java.io import File
from java.net import URL
from java.net import URLClassLoader
import jarray
urlClassLoader=URLClassLoader(jarray.array([File("ddmlib.jar").toURL()], URL))
AndroidDebugBridge=urlClassLoader.loadClass("com.android.ddmlib.AndroidDebugBridge")
bridge = AndroidDebugBridge.getBridge()