Skip to content

Instantly share code, notes, and snippets.

View fnk0's full-sized avatar

Marcus Gabilheri fnk0

  • Snap
  • Los Angeles, CA
View GitHub Profile
@fnk0
fnk0 / ObliqueDataRenderer.java
Created September 27, 2016 17:16
An oblique chart data renderer for MpAndroidChart
package com.gabilheri.fithub.ui.views.charts;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Path;
import android.graphics.Shader;
import com.gabilheri.fithub.helpers.ColorUtils;
import com.github.mikephil.charting.animation.ChartAnimator;
import com.github.mikephil.charting.buffer.BarBuffer;
import com.github.mikephil.charting.interfaces.dataprovider.BarDataProvider;
package com.gabilheri.fithub.ui.linking;
import android.app.Activity;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.android.gms.common.ConnectionResult;
@fnk0
fnk0 / CircularProgressBar.java
Last active August 18, 2016 00:46
Circular progress bar for Android
public class CircularProgressBar extends View {
private static final int DEFAULT_ANIMATION = 1500;
// Properties
private float progress = 0;
private float strokeWidth = getResources().getDimension(R.dimen.default_stroke_width);
private float backgroundStrokeWidth = getResources().getDimension(R.dimen.default_background_stroke_width);
private boolean isRounded = false;
@fnk0
fnk0 / CacheManager.java
Last active March 21, 2016 18:06
A simple cache manager for Android
package okstate.edu.canopeo.helpers;
import android.content.Context;
import android.graphics.Bitmap;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@fnk0
fnk0 / GpsTracker.java
Created March 17, 2016 22:33
GpsTracker
import android.Manifest;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.IBinder;
@fnk0
fnk0 / button_primary.xml
Created March 14, 2016 18:22
Example of a shape in android with different states
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<shape>
<solid android:color="@color/primary_dark" />
</shape>
</item>
<item android:state_pressed="true">
@fnk0
fnk0 / BangAnimationListener.java
Last active March 8, 2016 21:11
Bang Animation View similar to Twitter
public interface BangAnimationListener {
/**
* <p>Notifies the start of the animation.</p>
*/
void onAnimationStart();
/**
* <p>Notifies the end of the animation. </p>
*/
@fnk0
fnk0 / DestinationActivity.java
Last active March 8, 2016 17:52
ActivityTransition
String pictureUrl = extras.getString(Const.EXTRA_IMAGE);
// We still need to Load the image
loadImage(pictureUrl);
@fnk0
fnk0 / MainActivity.java
Last active March 2, 2016 00:51
animals
public void initRandomAnimals(int size) {
mAnimalList = new ArrayList<>();
for(int i = 0; i < size; i++) {
Animal a = new Animal(
animalNames[i % animalNames.length],
animalImages[i % animalImages.length]);
mAnimalList.add(a);
}
}
@fnk0
fnk0 / Hex Color Values - Alpha
Created February 22, 2016 21:58
Hex values for transparency in hex values
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
70% — B3
65% — A6
60% — 99
55% — 8C