Skip to content

Instantly share code, notes, and snippets.

View teppeihomma's full-sized avatar

Teppei Homma teppeihomma

  • PLAYSMART Inc.
  • Tokyo Japan
View GitHub Profile
@teppeihomma
teppeihomma / karabiner.json
Created September 19, 2018 06:41
Microsoft Natural Ergonomic Keyboard 4000
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@teppeihomma
teppeihomma / karabiner.json
Last active August 4, 2017 06:00
karabinerでWindows用キーボードの半角/全角キーを使う
{
"description": "半角/全角キーの有効化",
"manipulators": [
{
"from": {
"key_code": "grave_accent_and_tilde",
"modifiers": {
"optional": [
"any"
]
@teppeihomma
teppeihomma / SettingListItem.java
Created March 9, 2014 13:16
iOS風の設定項目
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
public class SettingListItem extends LinearLayout {
@teppeihomma
teppeihomma / WidthAdjustImageView.java
Created June 20, 2013 20:46
横幅を最大に広げた状態で縦を調整するImageView。Androidのlayout_weight="1"のエリアの下に配置するフッター画像などで使用します。
import android.content.Context;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;
public class WidthAdjustImageView extends ImageView {
public WidthAdjustImageView(Context context) {
this(context, null);
@teppeihomma
teppeihomma / LinkImageView.java
Created September 29, 2012 14:53
指定したURLを開くImageView Widget
package com.example.app.widget;
import com.example.app.R;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.net.Uri;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
@teppeihomma
teppeihomma / VersionView.java
Created September 29, 2012 12:41
バージョンを表示するView Widget
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.util.AttributeSet;
import android.widget.TextView;
public class VersionView extends TextView {
public VersionView(Context context) {
@teppeihomma
teppeihomma / gist:3522079
Created August 30, 2012 03:42
glReadPixelsからBitmapへの画像取得
// ByteBufferに読み込み
ByteBuffer buffer = ByteBuffer.allocateDirect(width * height * 4);
gl10.glReadPixels(0, 0, width, height, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, buffer);
// 上下逆なので、上下反転
byte[] tmp1 = new byte[width * 4];
byte[] tmp2 = new byte[width * 4];
int h = (int) height / 2;
for (int y = 0; y < h; y++) {
buffer.position(y * width * 4);
@teppeihomma
teppeihomma / gist:3217315
Created July 31, 2012 14:14
スクリーンの大きさを取得する
Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
@teppeihomma
teppeihomma / SplashActivity.java
Created July 17, 2012 16:29
スプラッシュ画面表示Activity
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;
public class SplashActivity extends Activity implements OnClickListener,
Runnable {