Skip to content

Instantly share code, notes, and snippets.

View zerobranch's full-sized avatar

Arman Sargsyan zerobranch

View GitHub Profile
@zerobranch
zerobranch / BaseMainFragment.java
Created October 4, 2018 08:23
When animating, the next fragment will be ABOVE the previous one. Copy xml resources to res/animator
public abstract class BaseMainFragment extends Fragment {
@Override
public Animation onCreateAnimation(int transit, final boolean enter, int nextAnim) {
if (nextAnim == R.animator.next_fragment_anim) {
Animation nextAnimation = AnimationUtils.loadAnimation(getContext(), nextAnim);
nextAnimation.setAnimationListener(new Animation.AnimationListener() {
private float startZ = 0f;
@Override
@zerobranch
zerobranch / TimerUtils.java
Created October 4, 2018 08:13
TimerUtils allows to start a timer
import java.util.Timer;
import java.util.TimerTask;
public class TimerUtils {
private TimerTask timerTask;
private Timer timer;
private Action action;
public void start(Action action, int delay) {
this.action = action;
@zerobranch
zerobranch / CheckableLinearLayout.java
Last active October 3, 2018 07:43
Checkable Linear Layout
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Checkable;
import android.widget.LinearLayout;
import java.util.HashSet;
import java.util.Set;
public class CheckableLinearLayout extends LinearLayout implements Checkable {
@zerobranch
zerobranch / SwipeLayout.java
Last active February 16, 2021 21:17
This custom view provides an opportunity to perform swipe for any layout. SwipeLayout is just a 'Custom ViewGroup', extended from FrameLayout, which provides easy and fast to use the 'swipe to dismiss' function, without using the ItemTouchHelper, for any layout.
/*
* The MIT License (MIT)
*
* Copyright (c) 2018 Arman Sargsyan
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is