Skip to content

Instantly share code, notes, and snippets.

View fdoyle's full-sized avatar

Frank Doyle fdoyle

  • San Antonio, TX
View GitHub Profile
@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
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 / 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;
/**
@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()) {
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:7238594
Created October 30, 2013 19:24
Swipe to dismiss view. gotta put this in a library
package com.blah.lol.swipetodismiss;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.widget.FrameLayout;
import com.blah.lol.R;
@fdoyle
fdoyle / supernova.java
Last active January 1, 2019 19:50
SupernovaView, as demonstrated by the LG G2 lock screen where you click and drag to "punch a hole" through the lock screen to the home screen. This view extends ImageView to the same effect.Probably not as optimized as it could be, but it seems about as smooth as LGs implementation.
package com.lacronicus.supernova;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
@fdoyle
fdoyle / gist:9397785
Created March 6, 2014 19:42
"asyncObservable" example
package com.example.retrofitdemo3;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;
import com.example.retrofitdemo3.api.NobelApi;
import com.example.retrofitdemo3.api.NobelService;
package crub.the.flub
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ListView;
/**
* Created by fdoyle on 3/19/14.
#!/bin/bash
VIDEO_LENGTH="10"
VIDEO_NAME="gifme.mp4"
GIF_NAME="gifme.gif"
GIF_OPTIMIZED_NAME="gifme-optimized.gif"
VIDEO_PATH="/sdcard/"$VIDEO_NAME
LOCAL_VIDEO_PATH="./"$VIDEO_NAME