Skip to content

Instantly share code, notes, and snippets.

View fdoyle's full-sized avatar

Frank Doyle fdoyle

  • San Antonio, TX
View GitHub Profile
package com.lol.android.activity;
import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ScrollView;
import android.widget.Toast;
import com.lol.android.R;
@fdoyle
fdoyle / gist:7015476
Created October 16, 2013 21:47
fancy button animation scales when pressed, tilts based on finger movement
b.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
float touchPositionX = motionEvent.getX();
float touchPositionY = motionEvent.getY();
float touchNormalX = touchPositionX / b.getWidth()-.5f;
float touchNormalY = touchPositionY / b.getHeight()-.5f;
touchNormalX = Math.max(Math.min(touchNormalX, .5f), -.5f);
touchNormalY = Math.max(Math.min(touchNormalY, .5f), -.5f);
switch(motionEvent.getAction()) {
@fdoyle
fdoyle / CustomStringRequest.java
Last active January 19, 2018 02:32
Easy to use volley Request. Allows for get, post, and put, along with custom headers.
package com.example.android.api;
import com.android.volley.*;
import com.android.volley.toolbox.StringRequest;
import com.google.gson.Gson;
import java.io.UnsupportedEncodingException;
import java.util.Map;
/**
package com.wta.videodemo;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.hardware.Camera;
import android.media.CamcorderProfile;
import android.media.MediaRecorder;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
@fdoyle
fdoyle / CameraManager.java
Last active May 30, 2016 17:55
This is a stripped down version of the CameraManager class used in the Android stock camera
package com.wta.videodemo;
/*
* 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