アプリで使う色でベースカラーは決まってるけど、少し明るい色とか、少し暗い色などベースカラーを基に色を決める時に便利だったサイトをメモ
色を指定するだけで候補を出してくれるので便利!
paletton
http://paletton.com/色を指定するだけで候補を出してくれるので便利!
Posted in デザイン
//重要なところだけで、その他は省略
@Override
public ChatAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
switch (i) {
case VIEW_TYPE_LEFT:
return new ViewHolder(mInflater.inflate(R.layout.left, viewGroup, false));
case VIEW_TYPE_RIGHT:
return new ViewHolder(mInflater.inflate(R.layout.right, viewGroup, false));
default:
return new ViewHolder(mInflater.inflate(R.layout.left, viewGroup, false));
}
}
@Override
public int getItemViewType(int position) {
if (mItems.get(position).isShowLeft) {
return VIEW_TYPE_LEFT;
} else {
return VIEW_TYPE_RIGHT;
}
}
getItemViewTypeで表示の位置を判定して、それに伴ってonCreateViewHolderで使うlayoutファイルを切替えています
Duplicate id 0x7f0e00d9, tag null, or parent id 0xffffffff with another fragment for com.google.android.gms.maps.SupportMapFragment
<fragment android:id="@+id/map" class="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="250dp" />
@Overridepublic void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
if (getActivity() != null) {
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
Fragment fragment = fragmentManager.findFragmentById(R.id.map);
if (fragment != null) {
getActivity().getSupportFragmentManager().beginTransaction().remove(fragment).commit();
}
}
}
Posted in Fragment, MapFragment
Posted in 位置情報
Posted in Badge Generator
| 0 | 1ブロック目のバイト数 | |
| 1 |
フラグ
| |
| 2 | ||
| 3 | 2ブロック目のバイト数 | |
| 4 | AD Type | |
| 5 |
会社ID
|
0x00CがAPPLE
|
| 6 | ||
| 7 | データタイプ | 0x02がiBeacon |
| 8 | iBeaconデータのバイト数 | |
| 9 |
UUID
|
16バイト
|
| ~ | ||
| 24 | ||
| 25 |
major
|
4バイト
|
| 26 | ||
| 27 |
minor
|
4バイト
|
| 28 | ||
| 29 | 電波強度 | 距離計算する際の基準値として利用 |
private BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() {
@Override
public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) {
if (scanRecord.length > 30) {
//このif文でiBeaconかどうかを判別
if ((scanRecord[5] == (byte) 0x4c) && (scanRecord[6] == (byte) 0x00)
&& (scanRecord[7] == (byte) 0x02) && (scanRecord[8] == (byte) 0x15)) {
String uuid = getScanData(9, 24, scanRecord);
String major = getScanData(25, 26, scanRecord);
String minor = getScanData(27, 28, scanRecord);
String strength = String.valueOf(scanRecord[29]);
Log.d("BeaconSample", "-----------------------------");
Log.d("BeaconSample", "uuid::" + uuid);
Log.d("BeaconSample", "major::" + major);
Log.d("BeaconSample", "minor::" + minor);
Log.d("BeaconSample", "strength::" + strength);
Log.d("BeaconSample", "rssi::" + rssi);
}
}
}
};
public String getScanData(int start, int end, byte[] scanRecord) {
StringBuilder result = new StringBuilder(end - start);
for (int i = start; i <= end; i++) {
result.append(convertHex(scanRecord[i] & 0xff));
}
return result.toString();
}
public String convertHex(int i) {
char hexArray[] = {
Character.forDigit((i >> 4) & 0x0f, 16), Character.forDigit(i & 0x0f, 16)
};
return new String(hexArray).toUpperCase();
}
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
private BluetoothAdapter mBluetoothAdapter;
public class MainActivity extends Activity {
private BluetoothAdapter mBluetoothAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
mBluetoothAdapter = bluetoothManager.getAdapter();
}
}
@Override
protected void onResume() {
super.onResume();
scanLeDevice(true);
}
private void scanLeDevice(final boolean enable) {
if (enable) {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
mScanning = false;
mBluetoothAdapter.stopLeScan(mLeScanCallback);
}
}, SCAN_PERIOD);
mScanning = true;
mBluetoothAdapter.startLeScan(mLeScanCallback);
} else {
mScanning = false;
mBluetoothAdapter.stopLeScan(mLeScanCallback);
}
}
private BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() {
@Override
public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) {
Log.d("BeaconSample", "name::" + device.getName());
Log.d("BeaconSample", "address::" + device.getAddress());
Log.d("BeaconSample", "------------------------------");
}
};
@Override
protected void onPause() {
super.onPause();
scanLeDevice(false);
}
Posted in 位置情報




Posted in Remote TestKit, Test
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
Rect dialogRect = new Rect();
getWindow().getDecorView().getHitRect(dialogRect);
if (dialogRect.contains((int) event.getX(), (int) event.getY()) == false) {
finish();
}
return super.dispatchTouchEvent(event);
}
Posted in Tips
Posted in レビュー
Posted in NavigationDrawer, SlidingMenu, Tips, UI
Remote TestKitはスマートフォンの「リモート・レンタル・サービス」です。コレだけ読むと、「端末を郵送で送ってくれて、それを使うのかな?」と思うのですが、続きがあります
増加する様々なスマートフォン端末に、インターネットを経由して「リモートアクセス」。
一般的な実機レンタルとは一線を画す、利便性の高い検証環境を実現します。
・windows XP SP2以降、Vista、7、8(32bit/64bit)
・MacOS Ⅹ(10.7、10.8)
・Port 443に直接つながることが可能なインターネット環境
Posted in Remote TestKi
Posted in In-App Billing
Posted in In-App Billing
No server options fields detected. To suppress this message either add a field with the @Parameter annotation, or override the load() method
-keepattributes *Annotation*これをつけることによってアノテーションが削除されなくなる
-keepattributes *Annotation*,Exception,Signature,InnerClass
Posted in proguard
Posted in アプリ
色の候補