Skip to content

Instantly share code, notes, and snippets.

View myamamic's full-sized avatar

myamamic myamamic

View GitHub Profile
@myamamic
myamamic / adb-choice-device.sh
Last active October 28, 2022 09:07
Do adb command with choosing connected device
#!/bin/bash
# このスクリプトは他のスクリプトから使われます
#
# 接続するデバイスのシリアル番号を取得するスクリプト
# このスクリプトの標準出力の最後に、選択したデバイスのシリアル番号が出力されます
# 使う側は、最後の出力を使ってください
BUFIFS=$IFS
IFS=
@myamamic
myamamic / Settings.java
Created November 25, 2015 11:16
[android] Preference設定ヘルパークラス
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
public class Settings {
// TODO: ここに各設定のGetter/Setterを追加
/**
* ヘルパーメソッド
**/
@myamamic
myamamic / GsonRequest.java
Created November 25, 2015 09:44
[android] Gson用クラス
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.toolbox.HttpHeaderParser;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import java.io.UnsupportedEncodingException;
@myamamic
myamamic / RequestManager.java
Created November 25, 2015 09:39
[android] Volley用クラス
import android.content.Context;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
public class RequestManager {
// Singleton
private static RequestManager mInstance = new RequestManager();
@myamamic
myamamic / color.xml
Created October 8, 2015 09:15
[android] google material design guideline のcolor定義
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- From https://www.google.com/design/spec/style/color.html# -->
<color name="Red_50">#ffebee</color>
<color name="Red_100">#ffcdd2</color>
<color name="Red_200">#ef9a9a</color>
<color name="Red_300">#e57373</color>
<color name="Red_400">#ef5350</color>
<color name="Red_500">#f44336</color>
@myamamic
myamamic / gist:72064e54269c5084c8c0
Last active November 26, 2015 16:08
[android] パルスアニメーション
// アニメーション
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator">
<alpha
android:duration="500"
android:repeatCount="-1"
android:repeatMode="restart"
android:fromAlpha="0.8"
android:toAlpha="0.0" />
@myamamic
myamamic / gist:6f5ec8d9295ac8c58c07
Created June 26, 2015 02:50
[android][Android Studio] コマンドラインからlint
$ gradlew app:lint
→app の部分に、モジュール名を入れる
@myamamic
myamamic / gist:f4de7b7fb6134a6ebdad
Last active August 29, 2015 14:23
[ios] CBCentralManagerStateを文字列に変換
@import CoreBluetooth;
+ (NSString *)centralManagerStateToString:(CBCentralManagerState)state {
NSString *stateStr;
switch (state) {
case CBCentralManagerStateResetting:
stateStr = @"CBCentralManagerStateResetting";
break;
case CBCentralManagerStateUnsupported:
stateStr = @"CBCentralManagerStateUnsupported";
@myamamic
myamamic / gist:10696890
Last active August 29, 2015 13:59
[android][Android Studio] Android Studio (gradle)で、signed apkを作成
1) build.gradleに以下の用に記載
android {
...
signingConfigs {
debug {
storeFile file("debug.keystore")
}
@myamamic
myamamic / TabManager.java
Created February 7, 2014 09:22
[Android] タブ管理クラス
import android.app.ActionBar;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
public class TabManager {
public static <T extends Fragment> ActionBar.Tab createTab(
Activity activity, ActionBar actionBar, int fragmentContainerId,
int text_resid, String tag, Class<T> clazz, boolean select) {