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 ConnectDotsView extends View { | |
private Bitmap mBitmap; | |
private Canvas mCanvas; | |
private Path mPath; | |
private Paint mPaint; | |
private static final int TOUCH_TOLERANCE_DP = 24; | |
private static final int BACKGROUND = 0xFFDDDDDD; | |
private List<Point> mPoints = new ArrayList<Point>(); | |
private int mLastPointIndex = 0; |
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 abstract class HexUtils{ | |
pulbic static String convertToHex(byte[] data) { | |
StringBuffer buf = new StringBuffer(); | |
for (int i = 0; i < data.length; i++) { | |
int halfbyte = (data[i] >>> 4) & 0x0F; | |
int two_halfs = 0; | |
do { | |
if ((0 <= halfbyte) && (halfbyte <= 9)) | |
buf.append((char) ('0' + halfbyte)); | |
else |
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 ImageZoomView extends ImageView { | |
Matrix matrix = new Matrix(); | |
// Three possible states. | |
static final int NONE = 0; | |
static final int PAN = 1; | |
static final int ZOOM = 2; | |
static final int CLICK = 3; | |
int mode = NONE; |
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 CustomScrollView extends ScrollView { | |
private GestureDetector mGestureDetector; | |
public CustomScrollView(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
mGestureDetector = new GestureDetector(context, new YScrollDetector()); | |
setFadingEdgeLength(0); | |
} |
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
adb -d shell 'run-as com.yourpackage cat /data/data/com.yourpackage/databases/dbname > /sdcard/dbname' |
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
import android.content.Context; | |
import android.database.Cursor; | |
import android.support.v4.content.AsyncTaskLoader; | |
public abstract class SimpleCursorLoader extends AsyncTaskLoader<Cursor> { | |
private Cursor mCursor; | |
public SimpleCursorLoader(Context context) { | |
super(context); | |
} |
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 onPageSelected(int position) { | |
actionBar.setSelectedNavigationItem(position); | |
selectInSpinnerIfPresent(position, true); | |
} | |
/** |
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
TextView textView = new TextView(this); | |
textView.setEllipsize(TruncateAt.MARQUEE); | |
textView.setFocusableInTouchMode(true); | |
textView.setFreezesText(true); | |
textView.setSingleLine(true); | |
textView.setMarqueeRepeatLimit(-1); | |
textView.setFocusable(true); | |
textView.setSelected(true); | |
textView.setText("Sooooooooooooooome Loooooooooooooooooooooooong Teeeeeeeeeeeeeeeeeeeeeeeeeeext"); |
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"?> | |
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > | |
<!-- Drop Shadow Stack --> | |
<item> | |
<shape> | |
<padding | |
android:bottom="1dp" | |
android:left="1dp" | |
android:right="1dp" |
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
/* | |
* Copyright (C) 2012 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 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
OlderNewer