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 / derived.kt
Created April 14, 2023 18:49
A cool way to do derivedState with LiveData
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import org.junit.Assert.assertEquals
import org.junit.Rule
import org.junit.Test
//pattern inspired by https://github.com/ensody/ReactiveState-Kotlin, no code was copied.
@fdoyle
fdoyle / FixedTransformerViewPager.java
Last active August 22, 2022 11:02
PageTransform + padding on viewpager doesn't work. this fixes it
package com.foo.ui.view;
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;
/**
* Created by fdoyle on 11/2/15.
*/
//from your application class, call
// new NavigationLogger().start(this);
//logs activity and fragment lifecycle events.
class NavigationLogger {
val logger = PVLog("Navigation")
fun start(app: Application) {
app.registerActivityLifecycleCallbacks(object: Application.ActivityLifecycleCallbacks {
@fdoyle
fdoyle / noise.dart
Created April 2, 2019 19:54
some stuff for working with simplex noise in dart
class VisualizerPainter extends CustomPainter {
final double position;
var noise = new SimplexNoise();
NoiseLoop rLoop;
NoiseLoop gLoop;
NoiseLoop bLoop;
VisualizerPainter(this.position, this.rLoop, this.gLoop, this.bLoop);
@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 / DelayedBaseAdapter
Last active June 14, 2018 08:42
BaseAdapter that allows for delayed content
package com.lacronicus.delayedloadingadapterdriver.app;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import java.util.HashSet;
@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 / mario2.html
Last active April 5, 2017 22:43
fun little mario demo
<!DOCTYPE html>
<html>
<body>
<h1>Arrow keys do stuff</h1>
<canvas id="myCanvas" width="800" height="400"
style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
var c = document.getElementById("myCanvas");
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="10000" height="1000"
style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
var c = document.getElementById("myCanvas");
@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