Skip to content

Instantly share code, notes, and snippets.

View eduardb's full-sized avatar

Eduard-Cristian Boloș eduardb

View GitHub Profile
@gatlingxyz
gatlingxyz / gist:52fb21eb92181716b0ce
Created July 11, 2014 23:49
Unofficial Base WatchFace Activity
import android.app.Activity;
import android.content.Context;
import android.hardware.display.DisplayManager;
import android.os.Bundle;
import android.view.Display;
/**
* A base activity for watch faces that have callbacks for the various screen states (dim, awake, and off)
* as well as a callback for when the watch face is removed.
* <p/>
@blundell
blundell / WatchFaceLifecycle-ExampleActivity.java
Last active August 29, 2015 14:03
Unofficial Base WatchFace Listener
public class ExampleActivity extends Activity implements WatchFaceLifecycle.Listener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_layout);
WatchFaceLifecycle.attach(this, savedInstanceState, this);
}
@Override
@alexjlockwood
alexjlockwood / ActivityTransitionCoordinator.java
Last active August 29, 2015 14:08
ActivityTransitionCoordinator.java
package android.app;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcelable;
import android.os.ResultReceiver;
@PomepuyN
PomepuyN / loop_screencap.sh
Created December 15, 2014 10:42
Take a screenshot by second on android
#!/bin/sh
LEVEL=3
ISCHARGING=false
while [ 1=1 ]
do
adb shell screencap -p | sed 's/\r$//' > screen${LEVEL}.png
@easycheese
easycheese / FABAnimator
Last active August 29, 2015 14:21
FloatingActionButton Animator
package com.companionfree.tracker.bjj.util;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import com.getbase.floatingactionbutton.FloatingActionButton;
@marianeum
marianeum / FloatingActionButton.java
Last active November 25, 2015 11:24
FloatingActionButton with custom ripple colours
package com.marianeum.fab;
import android.animation.AnimatorInflater;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Outline;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.RippleDrawable;
import android.util.AttributeSet;
@ultraon
ultraon / ChildrenViewStateHelper.java
Last active August 3, 2016 07:33
Example of ChildrenViewStateHelper for saving view states with the same id in ViewGroup
package mypackage.presentation.utils.view;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.SparseArray;
import android.view.ViewGroup;
public class ChildrenViewStateHelper {
@kaushikgopal
kaushikgopal / Junit4EnclosedTestRunnerExample.java
Created July 24, 2016 03:53
Sample use of the Enclosed.class test runner
@RunWith(Enclosed.class)
public class WorkflowStateMachineTest {
@RunWith(Parameterized.class)
public static class ParameterizedTests {
@Parameter public ISBatchType mTestBatchType; // first data value (0) is default
public class MyFragment {
boolean loaded;
private void maybeLoad() {
if (!loaded && getUserVisibleHint()) {
loaded = true;
loadMyData();
}
}
@Override
@degliwe
degliwe / 0_Add some depth to your WatchFace.gif
Last active February 17, 2017 15:01
Add some depth to your WatchFace
0_Add some depth to your WatchFace.gif