This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Camera与Matrix的比较: | |
* Camera的rotate()相关方法是指定某一维度上旋转指定的角度。 | |
* Matrix的rotate()相关方法实现的效果是顺时针旋转指定的角度;与Camera指定Z轴旋转效果相同,但方向相反。 | |
* | |
* Camera的translate()方法根据某一维度上视点的位移实现图像的缩放,与Matrix的scale()相关方法作用效果相似, | |
* 只是Matrix的scale()相关方法是直接指定缩放比例。 | |
* | |
* Camera不支持倾斜操作,Matrix可以直接实现倾斜操作。 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int calculateInSampleSize( | |
BitmapFactory.Options options, int reqWidth, int reqHeight) { | |
// Raw height and width of image | |
final int height = options.outHeight; | |
final int width = options.outWidth; | |
int inSampleSize = 1; | |
if (height > reqHeight || width > reqWidth) { | |
final int halfHeight = height / 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 来源: | |
#1. https://stackoverflow.com/questions/2789462/find-package-name-for-android-apps-to-use-intent-to-launch-market-app-from-web/7502519#7502519 | |
#2. http://jp1017.github.io/2016/01/29/获取安卓应用的包名和入口-Activity/ | |
# how to use: ./getLauncherActivity.sh **.apk | |
#package_name=$1 | |
#launch app by package name | |
#adb shell monkey -p ${package_name} -c android.intent.category.LAUNCHER 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="#ffffff" | |
android:orientation="vertical" > | |
<FrameLayout | |
android:orientation="vertical" | |
android:layout_width="fill_parent" | |
android:layout_height="wrap_content" | |
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by Tiou on 2014/7/15. | |
* 一个实现 Recycle 机制的对象 | |
*/ | |
public class Data { | |
/** | |
* 对象池,就是上文所提到的对象仓库,用于暂时存放不用的对象。 | |
* 用链表来实现对象池结构,直观,高效,易用。 | |
* sPool 便是指向链表头部的引用 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DBHelper | |
{ | |
private static Context mContext; | |
private static DBHelper instance; | |
private CityInfoDBDao cityInfoDao; | |
private DBHelper() | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package cc.aa; | |
import android.os.Environment; | |
import android.view.MotionEvent; | |
import android.view.View; | |
public class UnderstandDispatchTouchEvent { | |
/** | |
* dispatchTouchEvent()源码学习及其注释 | |
* 常说事件传递中的流程是:dispatchTouchEvent->onInterceptTouchEvent->onTouchEvent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 冒泡排序 | |
* | |
* @param a | |
*/ | |
public static void bubbleSort(int[] a) { | |
int temp; | |
for (int i = 0; i < a.length; i++) | |
for (int j = 0; j < a.length - i - 1; j++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script adb+ | |
# Run any command adb provides on all your currently connected devices, | |
# Or prompt to select one device | |
showHelp() { | |
echo "Usage: adb+ [-a] <command>" | |
echo " -h: show help" | |
echo " -a: run command on all device" | |
echo " command: normal adb commands" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.inst.navigation.utils; | |
import android.os.Handler; | |
import android.os.Message; | |
import android.os.SystemClock; | |
/* The calls to {@link #onTick(long)} are synchronized to this object so that | |
* one call to {@link #onTick(long)} won't ever occur before the previous | |
* callback is complete. This is only relevant when the implementation of | |
* {@link #onTick(long)} takes an amount of time to execute that is significant |
NewerOlder