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 getStatusBarHeight() { | |
int result = 0; | |
int resourceId = mContext.getResources().getIdentifier("status_bar_height", "dimen", "android"); | |
if (resourceId > 0) { | |
result = mContext.getResources().getDimensionPixelSize(resourceId); | |
} | |
return result; | |
} |
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 getThemeAttributeDimensionSize(Context context, int attr) | |
{ | |
TypedArray a = null; | |
try{ | |
a = context.getTheme().obtainStyledAttributes(new int[] { attr }); | |
return a.getDimensionPixelSize(0, 0); | |
}finally{ | |
if(a != null){ | |
a.recycle(); | |
} |
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
@Override | |
public void onTrimMemory(int level) { | |
super.onTrimMemory(level); | |
String levelString = "TRIM_MEMORY_RUNNING_MODERATE"; | |
switch (level) { | |
case TRIM_MEMORY_RUNNING_MODERATE: levelString = "TRIM_MEMORY_RUNNING_MODERATE"; break; | |
case TRIM_MEMORY_RUNNING_LOW: levelString = "TRIM_MEMORY_RUNNING_LOW"; break; | |
case TRIM_MEMORY_RUNNING_CRITICAL: levelString = "TRIM_MEMORY_RUNNING_CRITICAL"; break; |
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
private static final String DEBUG_TAG = "ScrollDirectionDebug"; | |
private float y = -1; | |
private String mScrollDirection = ""; | |
// OnTouchEvent is picked up by the child view that handles the event | |
// So we use dispatchTouchEvent which all events pass through | |
@Override | |
public boolean dispatchTouchEvent(MotionEvent event) { | |
Log.d(DEBUG_TAG, "Action was " + event.toString()); | |
int action = MotionEventCompat.getActionMasked(event); |