Skip to content

Instantly share code, notes, and snippets.

Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21.
To use the support version of these attributes, remove the android namespace.
For instance, "android:colorControlNormal" becomes "colorControlNormal".
These attributes will be propagated to their corresponding attributes within the android namespace
for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------
@shaobin0604
shaobin0604 / place_autocomplete_item_prediction.xml
Last active March 15, 2016 03:04
Google Play Service Place Search UI
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="@dimen/place_autocomplete_prediction_height"
xmlns:android="http://schemas.android.com/apk/res/android">
<include android:layout_gravity="center" android:visibility="invisible" android:layout_width="@dimen/place_autocomplete_progress_size" android:layout_height="@dimen/place_autocomplete_progress_size" android:layout_marginLeft="@dimen/place_autocomplete_progress_horizontal_margin" android:layout_marginRight="@dimen/place_autocomplete_progress_horizontal_margin" android:layout_alignParentLeft="true" android:layout_centerVertical="true" layout="@layout/place_autocomplete_progress" />
<View android:id="@id/place_autocomplete_separator" android:layout_width="0.0dip" android:layout_height="0.0dip" android:layout_centerVertical="true" />
<TextView android:textSize="@dimen/place_autocomplete_prediction_primary_text" android:textColor="@color/place_autocomple
@shaobin0604
shaobin0604 / gist:f35faae7b9a32587e8bf
Created March 9, 2016 01:28 — forked from aisk/gist:3735854
百度地图坐标与像素互相转换的方法
pixelToPoint = function(point, zoom, center, bounds) {
// 像素到坐标
if (!point) {
return
}
var zoomUnits = getZoomUnits(zoom);
var mercatorLng = center.lng + zoomUnits * (point.x - bounds.width / 2);
var mercatorLat = center.lat - zoomUnits * (point.y - bounds.height / 2);
var mercatorLngLat = {lng: mercatorLng, lat: mercatorLat};
return mercatorToLngLat(mercatorLngLat)
@shaobin0604
shaobin0604 / Android Studio .gitignore
Created October 15, 2015 03:18 — forked from iainconnor/Android Studio .gitignore
A .gitignore for use in Android Studio
# Built application files
/*/build/
# Crashlytics configuations
com_crashlytics_export_strings.xml
# Local configuration file (sdk path, etc)
local.properties
# Gradle generated files
@shaobin0604
shaobin0604 / android-tcpdump.sh
Created September 24, 2015 06:50 — forked from dweinstein/android-tcpdump.sh
Easier tcpdump setup for Android (make sure tcpdump binary is in /data/local/tmp/xbin/tcpdump). Assumes socat and wireshark are installed on your system and that you're on OS X. Easily tweaked for other platforms...
#!/usr/bin/env bash
TCPDUMP_PID=""
SOCAT_PID=""
OUTPUT_FILE=""
PORT=12345
TMPDIR="."
TCPDUMP_PATH="/data/local/tmp/xbin/tcpdump"
NETCAT_PATH="/data/local/tmp/nc"
HOST_INTERFACE="en0"
@shaobin0604
shaobin0604 / 数据采集.md
Last active September 11, 2015 01:57
[功能] 附近兴趣点采集
版本 作者 日期
1.0 邵彬 2015-09-10

[TOC]

数据采集(管理版)

@shaobin0604
shaobin0604 / form_template.json
Last active September 7, 2015 09:58
附近信息提交模板
{
"id": 1,
"version": 1,
"title": "二手车信息采集",
"entries": [
{
"key": "email",
"name": "电子邮件",
"optional": false,
"widget": "edittext",
@shaobin0604
shaobin0604 / INotificationManager.aidl
Last active August 29, 2015 14:14
INotificationManager.aidl
/* //device/java/android/android/app/INotificationManager.aidl
**
** Copyright 2007, 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
**
@shaobin0604
shaobin0604 / BrowserProvider2.java
Created December 7, 2014 18:08
ContentProviders in Browser
/*
* Copyright (C) 2010 he 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
@shaobin0604
shaobin0604 / GetUnicode.java
Created September 17, 2014 06:59
GetUnicode.java
static String getUnicode(String s) {
try {
StringBuffer out = new StringBuffer("");
byte[] bytes = s.getBytes("unicode");
for (int i = 0; i < bytes.length - 1; i += 2) {
out.append("\\u");
String str = Integer.toHexString(bytes[i + 1] & 0xff);
for (int j = str.length(); j < 2; j++) {
out.append("0");