Skip to content

Instantly share code, notes, and snippets.

View zaki50's full-sized avatar

Makoto Yamazaki zaki50

View GitHub Profile
@zaki50
zaki50 / volley_with_spdy.diff
Created May 23, 2013 18:43
adamrocker さんの volley サンプル https://github.com/adamrocker/volley を元に OkHttp を組み込んで SPDY でアクセスするための差分。 変更後のものは https://github.com/zaki50/volley/tree/with-OkHttp にあります。
diff --git a/VolleySample/libs/okhttp-1.0.2.jar b/VolleySample/libs/okhttp-1.0.2.jar
new file mode 100644
index 0000000..7592cdf
Binary files /dev/null and b/VolleySample/libs/okhttp-1.0.2.jar differ
diff --git a/VolleySample/libs/volley.jar b/VolleySample/libs/volley.jar
index 31c143c..762e993 100644
Binary files a/VolleySample/libs/volley.jar and b/VolleySample/libs/volley.jar differ
diff --git a/VolleySample/src/com/adamrocker/volleysample/MainActivity.java b/VolleySample/src/com/adamrocker/volleysample/MainActivity.java
index b2c1dd5..c2118c5 100644
--- a/VolleySample/src/com/adamrocker/volleysample/MainActivity.java
@zaki50
zaki50 / toAppCompat.diff
Created July 25, 2013 02:03
雛形のプロジェクトを ActionBarCompat 対応してみた。AndroidAnnotations で問題出るかもしれないので様子見。
diff --git a/MyTemplate/build.gradle b/MyTemplate/build.gradle
index 98a1b61..ef8ce25 100644
--- a/MyTemplate/build.gradle
+++ b/MyTemplate/build.gradle
@@ -18,8 +18,8 @@ dependencies {
compile "com.squareup.dagger:dagger:${daggerVersion}"
compile "com.android.support:support-v4:${supportV4Version}"
+ compile "com.android.support:appcompat-v7:${appCompatVersion}"
compile "com.google.android.gms:play-services:${playServicesVersion}"
@zaki50
zaki50 / use_footnotetext.diff
Created September 12, 2013 10:23
ReVIEW で表の中だと \footnote がうまく動かないのでその対処のための下調べ。 footnotetext を true にすれば脚注が \footnote ではなく \footnotemark と \footnotetext で生成されるようになる。これは表の中でも使えるがハイパーリンクにならないという欠点があったのでハイパーリンクになるようにしてみた。 最終的には footnotetext が false の時に、表の中にで使われている脚注だけ特別にハイパーリンク付きの \footnotetext と \footnotemark にするように実装したい
diff --git a/bin/review-compile b/bin/review-compile
index afea0d0..f0d3b6e 100755
--- a/bin/review-compile
+++ b/bin/review-compile
@@ -58,7 +58,7 @@ def _main
"mathml" => nil, # for HTML
"language" => "ja", # for HTML
"deprecated-blocklines" => nil,
- "footnotetext" => false,
+ "footnotetext" => true,
@zaki50
zaki50 / AndroidManifest.xml
Last active January 21, 2018 21:32
ためしに PrintService を作ってみた
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.zakky.myprintservice"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="19" />
Kitkat での実行結果がこんなでつらい
D/hoge ( 8203): "あ".getBytes(Shift_JIS).length = 1
D/hoge ( 8203): "あい".getBytes(Shift_JIS).length = 3
D/hoge ( 8203): "あいう".getBytes(Shift_JIS).length = 6
D/hoge ( 8203): "あいうえ".getBytes(Shift_JIS).length = 8
D/hoge ( 8203): "あいうえお".getBytes(Shift_JIS).length = 10
@zaki50
zaki50 / panel_bg.xml
Created February 22, 2014 09:06
パネルの背景画像用の drawable リソースとして、上端にハイライト、下端にシャドウをいれたものを作る例。色を変えやすいように基本部分は shape を使う。ハイライトとシャドウはshapeでは作れないので、半透明な9patch画像を用意する。xxhdpi用だとこんな感じ https://dl.dropboxusercontent.com/u/713512/highlight_and_shadow.9.png
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:shape="rectangle">
<solid android:color="#ffcccccc"/>
</shape>
</item>
<item android:drawable="@drawable/highlight_and_shadow"/>
</layer-list>
@zaki50
zaki50 / gist:9663178
Created March 20, 2014 12:55
私がよくつかうライブラリのライセンスページ用 HTML
<html>
<head>
<style> body { font-family: sans-serif; }
div { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; font-family: monospace }
</style>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
</head>
<body>
<h3><a href="http://jakewharton.github.io/butterknife/">Butter Knife</a></h3>
@zaki50
zaki50 / FloatingActionButton.java
Last active August 29, 2015 14:03
Material Design の FloatingActionButton のためのクラスを作ってみた
/*
* Copyright (C) 2014 uPhyca Inc.
*
* 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
@zaki50
zaki50 / gist:f798b8507db03d9ecea3
Last active August 29, 2015 14:03
android wear のバックライトの明るさ調整方法と、端末ごとの設定値
// AndroidManifest.xml に <uses-permission android:name="android.permission.WRITE_SETTINGS"/> を書くこと
final int brightness = 128; // 0-255 の範囲で明るさを指定する
// バックライトの明るさの設定方法は、普通のAndroid端末と同じ
Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, brightness);
// Samsung Gear Live の設定画面では5段階(括弧の中は設定画面で選択した場合の値)
// 5(255): 255-230
// Google Plus
compile "com.google.android.gms:play-services-plus:6.5.+"
// Google Account Login
compile "com.google.android.gms:play-services-identity:6.5.+"
// Google Activity Recognition
compile "com.google.android.gms:play-services-location:6.5.+"
// Google App Indexing
compile "com.google.android.gms:play-services-appindexing:6.5.+"
// Google Cast
compile "com.google.android.gms:play-services-cast:6.5.+"