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
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:paddingLeft="@dimen/activity_horizontal_margin" | |
android:paddingRight="@dimen/activity_horizontal_margin" | |
android:paddingTop="@dimen/activity_vertical_margin" | |
android:paddingBottom="@dimen/activity_vertical_margin" | |
tools:context=".MainActivity"> | |
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 MainActivity extends Activity { | |
Button play,stop,record; | |
private MediaRecorder audioRecorder; | |
private String outputFile = null; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_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
import android.content.Context; | |
import android.view.MotionEvent; | |
import android.view.GestureDetector.SimpleOnGestureListener; | |
import android.view.animation.AnimationUtils; | |
import android.widget.ViewFlipper; | |
public class SwipeGestureDetector extends SimpleOnGestureListener{ | |
private static final int SWIPE_MIN_DISTANCE = 120; | |
private static final int SWIPE_THRESHOLD_VELOCITY = 200; |
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.util.AttributeSet; | |
import android.view.KeyEvent; | |
import android.view.MotionEvent; | |
import android.widget.ScrollView; | |
public class LockableScrollView extends ScrollView { | |
// true if we can scroll (not locked) |
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
protected void onActivityResult(int requestCode, int resultCode, Intent intent) | |
{ | |
if (requestCode == PICK_REQUEST_CODE) | |
{ | |
if (resultCode == RESULT_OK) | |
{ | |
Uri uri = intent.getData(); | |
String type = intent.getType(); | |
LogHelper.i(TAG,"Pick completed: "+ uri + " "+type); | |
if (uri != null) |
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.graphics.Bitmap; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.Matrix; | |
import android.graphics.Paint; | |
import android.view.MotionEvent; | |
import android.view.View; | |
import android.widget.FrameLayout; |
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.Parameters parameters = mCamera.getParameters(); | |
List<Size> mSupportedPreviewSizes = parameters.getSupportedPreviewSizes(); | |
Size mPreviewSize = getOptimalPreviewSize(mSupportedPreviewSizes, width, height); | |
private Size getOptimalPreviewSize(List<Size> sizes, int w, int h) { | |
final double ASPECT_TOLERANCE = 0.2; | |
double targetRatio = (double) w / h; | |
if (sizes == null) return null; | |
Size optimalSize = null; | |
double minDiff = Double.MAX_VALUE; |
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 Bitmap bitmap = null; | |
private void gellerySelectedPhoto(Uri imageUri){ | |
Uri uri = imageUri; | |
try{ | |
String path =getRealPathFromURI(uri); | |
ExifInterface exif = new ExifInterface(path); | |
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); | |
int angle = 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 void makeMaskImage(ImageView mImageView, int mContent){ | |
Bitmap original = BitmapFactory.decodeResource(getResources(), mContent); | |
Bitmap mask = BitmapFactory.decodeResource(getResources(),R.drawable.mask); | |
Bitmap result = Bitmap.createBitmap(mask.getWidth(), mask.getHeight(), Config.ARGB_8888); | |
Canvas mCanvas = new Canvas(result); | |
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); | |
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN)); | |
mCanvas.drawBitmap(original, 0, 0, null); | |
mCanvas.drawBitmap(mask, 0, 0, paint); |