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
//http://stackoverflow.com/questions/2646028/android-horizontalscrollview-within-scrollview-touch-handling | |
public class VerticalScrollView extends ScrollView { | |
private float xDistance, yDistance, lastX, lastY; | |
public VerticalScrollView(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} | |
@Override | |
public boolean onInterceptTouchEvent(MotionEvent ev) { |
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
// get meta-data from AndroidManifest.xml | |
ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA); | |
String meta = ai.metaData.getString("key"); | |
// get version name and version code | |
PackageInfo pinfo = getPackageManager().getPackageInfo(getPackageName(), 0); | |
String versionName = pinfo.versionName; | |
int versionCode = pinfo.versionCode; |
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
<resources xmlns:android="http://schemas.android.com/apk/res/android"> | |
<style name="AppTheme" parent="android:Theme.Light" /> | |
<style name="FP"> | |
<item name="android:layout_width">fill_parent</item> | |
<item name="android:layout_height">fill_parent</item> | |
</style> | |
<style name="WC"> | |
<item name="android:layout_width">wrap_content</item> |
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 TextHelper { | |
public static SpannableString strikeText(String text){ | |
if (text==null)text = ""; | |
SpannableString str = new SpannableString(text); | |
str.setSpan(new StrikethroughSpan(), 0, str.length(), Spanned.SPAN_PARAGRAPH); | |
return str; | |
} | |
public static SpannableString underlineText(String text){ | |
if (text==null)text = ""; | |
SpannableString str = new SpannableString(text); |
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
// home intent | |
adb shell am start -c android.intent.category.HOME -a android.intent.action.MAIN |
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
# recursive cat | |
find . -name '*.php' | xargs wc -l | |
# format json | |
echo '{"json":"obj"}' | python -mjson.tool | |
# git diff | |
git difftool --tool=tkdiff --no-prompt | |
# grep |
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
// iosched/android/src/com/google/android/apps/iosched/ui/HomeActivity.java | |
@Override | |
protected void onSaveInstanceState(Bundle outState) { | |
super.onSaveInstanceState(outState); | |
// Since the pager fragments don't have known tags or IDs, the only way to persist the | |
// reference is to use putFragment/getFragment. Remember, we're not persisting the exact | |
// Fragment instance. This mechanism simply gives us a way to persist access to the | |
// 'current' fragment instance for the given fragment (which changes across orientation |
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
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage | |
import datetime | |
def capture_and_save(fname): | |
device = MonkeyRunner.waitForConnection() | |
snapshot = device.takeSnapshot() | |
snapshot.writeToFile(fname) | |
def capture(prefix=""): | |
d = datetime.datetime.now() |
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
//http://stackoverflow.com/questions/1705239/how-should-i-give-images-rounded-corners-in-android | |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.Path; | |
import android.graphics.RectF; | |
import android.util.AttributeSet; | |
import android.util.Log; | |
import android.widget.ImageView; |
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
<?xml version="1.0" encoding="utf-8"?> | |
<bitmap xmlns:android="http://schemas.android.com/apk/res/android" | |
android:src="@drawable/leather_1" | |
android:tileMode="repeat" /> |
OlderNewer