Skip to content

Instantly share code, notes, and snippets.

View 9re's full-sized avatar

Taro Kobayashi 9re

View GitHub Profile
@9re
9re / FlashPlayer11Test.as
Created October 20, 2011 07:43
targeting FlashPlayer11 by compiler options
package {
import flash.display.Sprite;
import flash.text.TextField;
public class FlashPlayer11Test extends Sprite {
public function FlashPlayer11Test() {
var tf:TextField = new TextField;
tf.x = tf.y = 10;
tf.width = tf.height = 465;
tf.text = JSON.stringify(tf, ["name", "x", "y", "width", "height"]);
addChild(tf);
@9re
9re / android.jsx
Created November 16, 2011 11:53 — forked from Layzie/to9patch.jsx
make 9patch file using PhotoShop
// rulerはpx指定にしておく
// 指定したフォルダ内にあるxhdpiのサイズのpng,jpgを
// mdpi, hdpi, xhdpiそれぞれにサイズを適宜縮小して入れる。
// .9.pngという名前の付いたpngファイルは一度9patchの線の枠を取ってから
// 再び9patchの枠を付け直す。
// vim:set ft=javascript:
#target photoshop
var MIDDLE = "mdpi", HIGH = "hdpi", XTRA_HIGH = "xhdpi";
@9re
9re / AndroidManifest.xml
Created December 3, 2011 09:02
Restrictions of MapActivity
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 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
Unless required by applicable law or agreed to in writing, software
@9re
9re / index.md
Created December 6, 2011 16:53
On MapView and the Support Package

On MapView and the Support Package

Introduction

As you may know, google released the support package, which exposed the new APIs only available for higher API level such as Fragment to make it also available for older platforms back to API level 4.

Using the support package, android.support.v4.app.FragmentManager, which is an android.app.FragmentManager compat, is available via FragmentActivity. This means, you must override FragmentActivity to use Fragment APIs.

@9re
9re / StateListDrawableTest.java
Created December 7, 2011 11:14
usage of StateListDrawable
import android.app.Activity;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
public class StateListDrawableTest extends Activity {
@9re
9re / GradientDrawableTest.java
Created December 8, 2011 01:55
Create <shape> Equivalent at Runtime
import android.app.Activity;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
public class GradientDrawableTest extends Activity {
@Override
@9re
9re / gist:1470165
Created December 13, 2011 02:21
diff between support-package rev.4 and rev.5
diff -u -r rev4-map/src/java/android/support/v4/android/accessibilityservice/AccessibilityServiceInfoCompat.java rev5/src/java/android/support/v4/android/accessibilityservice/AccessibilityServiceInfoCompat.java
--- rev4-map/src/java/android/support/v4/android/accessibilityservice/AccessibilityServiceInfoCompat.java Tue Dec 13 11:16:56 2011
+++ rev5/src/java/android/support/v4/android/accessibilityservice/AccessibilityServiceInfoCompat.java Tue Dec 13 11:05:21 2011
@@ -185,22 +185,34 @@
* @return The string representation.
*/
public static String feedbackTypeToString(int feedbackType) {
- switch (feedbackType) {
- case AccessibilityServiceInfo.FEEDBACK_AUDIBLE:
- return "FEEDBACK_AUDIBLE";
@9re
9re / JsonTest.java
Created December 20, 2011 23:45
example of using generics
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONTokener;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.TextView;
@9re
9re / gist:1516551
Created December 24, 2011 06:25
ugly type declaration without typedef
#include <stdio.h>
char * const func(int a, int b) {
static char * const str = "Yeah!";
printf("%s a: %d, b: %d\n", __func__, a, b);
return str;
}
char * const (*func_getter(int a))(int, int) {
printf("%s a: %d\n", __func__, a);
@9re
9re / gist:1522873
Created December 27, 2011 06:35
unicode list
U+0000 : NULL CHARACTER
U+0001 : START OF HEADING
U+0002 : START OF TEXT
U+0003 : END-OF-TEXT CHARACTER
U+0004 : END-OF-TRANSMISSION CHARACTER
U+0005 : ENQUIRY CHARACTER
U+0006 : ACKNOWLEDGE CHARACTER
U+0007 : BELL CHARACTER
U+0008 : BACKSPACE