This file contains hidden or 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 | |
WORK_PATH="$PWD" | |
function list() { | |
SAVEIFS=$IFS | |
IFS=$'\n' | |
for file in $1/* | |
do | |
echo $file |
This file contains hidden or 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 | |
WORK_PATH="$PWD" | |
function list() { | |
SAVEIFS=$IFS | |
IFS=$'\n' | |
for file in $1/* | |
do | |
echo $file |
This file contains hidden or 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
#pragma mark - Memory methods | |
double getMemoryUsage(void) { | |
struct task_basic_info info; | |
mach_msg_type_number_t size = sizeof(info); | |
kern_return_t kerr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &size); | |
double memoryUsageInMB = kerr == KERN_SUCCESS ? (info.resident_size / 1024.0 / 1024.0) : 0.0; | |
return memoryUsageInMB; |
This file contains hidden or 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 final OnTouchListener TouchLight = new OnTouchListener() { | |
public final float[] BT_SELECTED = new float[] { 1, 0, 0, 0, 50, 0, 1, 0, 0, 50, 0, 0, 1, 0, 50, 0, 0, 0, 1, 0 }; | |
public final float[] BT_NOT_SELECTED = new float[] { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0 }; | |
@Override | |
public boolean onTouch(View v, MotionEvent event) { | |
if (event.getAction() == MotionEvent.ACTION_DOWN) { | |
v.getBackground().setColorFilter(new ColorMatrixColorFilter(BT_SELECTED)); | |
v.setBackgroundDrawable(v.getBackground()); |
This file contains hidden or 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
/** | |
* An animation that rotates the view on the Y axis between two specified | |
* angles. This animation also adds a translation on the Z axis (depth) to | |
* improve the effect. | |
*/ | |
public class Rotate3dAnimation extends Animation | |
{ | |
private final float mFromDegrees; | |
private final float mToDegrees; | |
private final float mCenterX; |
This file contains hidden or 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 RotateAnimation extends Animation | |
{ | |
/** 值为true时可明确查看动画的旋转方向。 */ | |
public static final boolean DEBUG = false; | |
/** 沿Y轴正方向看,数值减1时动画逆时针旋转。 */ | |
public static final boolean ROTATE_DECREASE = true; | |
/** 沿Y轴正方向看,数值减1时动画顺时针旋转。 */ | |
public static final boolean ROTATE_INCREASE = false; | |
/** Z轴上最大深度。 */ | |
public static final float DEPTH_Z = 310.0f; |
This file contains hidden or 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.cyrilmottier.android.androidtips; | |
import android.content.BroadcastReceiver; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.content.IntentFilter; | |
import android.content.res.Configuration; | |
import android.os.Build; | |
import android.util.AttributeSet; | |
import android.view.View; |
This file contains hidden or 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 TimeUtility { | |
private static int MILL_MIN = 1000 * 60; | |
private static int MILL_HOUR = MILL_MIN * 60; | |
private static int MILL_DAY = MILL_HOUR * 24; | |
private static String JUST_NOW = GlobalContext.getInstance().getString(R.string.justnow); | |
private static String MIN = GlobalContext.getInstance().getString(R.string.min); | |
private static String HOUR = GlobalContext.getInstance().getString(R.string.hour); | |
private static String DAY = GlobalContext.getInstance().getString(R.string.day); |
This file contains hidden or 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
/** | |
* 通过反射来设置对话框是否要关闭,在表单校验时很管用, 因为在用户填写出错时点确定时默认Dialog会消失, 所以达不到校验的效果 | |
* 而mShowing字段就是用来控制是否要消失的,而它在Dialog中是私有变量, 所有只有通过反射去解决此问题 | |
* | |
* @param pDialog | |
* @param pIsClose | |
*/ | |
public void setAlertDialogIsClose(DialogInterface pDialog, Boolean pIsClose) { | |
try { | |
Field field = pDialog.getClass().getSuperclass() |