Skip to content

Instantly share code, notes, and snippets.

@cesco89
cesco89 / CircleAnimatedCheckBox.java
Last active February 9, 2023 05:09
A custom animated circle checkbox based on markushi's CircleButton (https://github.com/markushi/android-circlebutton)
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.widget.CheckBox;
import android.widget.ImageView;
@cesco89
cesco89 / FragmentPageAdapter
Last active January 11, 2022 02:56
Add Fragments dynamically to ViewPager
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
public class MyFragmentPageAdapter extends FragmentPagerAdapter {
@cesco89
cesco89 / MaterialDialog.java
Last active July 31, 2020 01:58
A custom AlertDialog that follows Material Design guidelines
import android.app.AlertDialog;
import android.content.Context;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ScrollView;
@cesco89
cesco89 / ObservableFragment.java
Last active May 6, 2018 04:34
Listen to FragmentTransaction animation events
import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.app.Fragment;
/**
* Created by francesco on 14/10/14.
*/
public class ObservableFragment extends Fragment {
private TransitionListener mListener;
@cesco89
cesco89 / GamePanel.java
Last active February 11, 2018 10:11
Java Game of life
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
public class GamePanel extends JPanel implements ActionListener{
Timer timer = new Timer(1, this);
private static int width = Toolkit.getDefaultToolkit().getScreenSize().width;
private static int height = Toolkit.getDefaultToolkit().getScreenSize().height - 100;
@cesco89
cesco89 / Cell.java
Last active February 9, 2018 21:47
Java Maze Generator based on Maze Generation Algorithm --> https://en.wikipedia.org/wiki/Maze_generation_algorithm
import java.awt.*;
import java.util.ArrayList;
public class Cell {
public int i;
public int j;
public int x;
public int y;
public boolean[] walls = {true, true, true, true}; //top, right, bottom, left
@cesco89
cesco89 / Line.java
Created February 8, 2018 12:12
A random java Maze generator
public class Line {
public int posx;
public int posy;
public int dim1;
public int dim2;
public Line (int _posx, int _posy, int _dim1, int _dim2) {
this.posx = _posx;
this.posy = _posy;
@echo off
title Activate Microsoft Office 2016 ALL versions for FREE!&cls&echo ============================================================================&echo #Project: Activating Microsoft software products for FREE without software&echo ============================================================================&echo.&echo #Supported products:&echo - Microsoft Office Standard 2016&echo - Microsoft Office Professional Plus 2016&echo.&echo.&(if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16")&(if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16")&(for /f %%x in ('dir /b ..\root\Licenses16\proplusvl_kms*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&(for /f %%x in ('dir /b ..\root\Licenses16\proplusvl_mak*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&echo.&echo ============================================================================&ech
@cesco89
cesco89 / ViewPager Crossfade
Created September 22, 2016 22:19
Crossfade effect in Android ViewPager
// Credit goes to http://fiskur.eu/?p=752
public class CrossfadePageTransformer implements ViewPager.PageTransformer {
@Override
public void transformPage(View page, float position) {
int pageWidth = page.getWidth();
View backgroundView = page.findViewById(R.id.background);
View text = page.findViewById(R.id.content);
@cesco89
cesco89 / CircularFlipImageView.java
Last active April 5, 2016 15:22
A Circular Flippable ImageView (See README.md for details and credits)
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Camera;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Shader;