Skip to content

Instantly share code, notes, and snippets.

View castorflex's full-sized avatar

Antoine Merle castorflex

View GitHub Profile
@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;
@frankiesardo
frankiesardo / QuickReturn.java
Last active December 14, 2015 22:49
A refactored version of LarsWerkman's QuickReturnListView. It should provide an easier to use API and an easier to understand library.
public class QuickReturn {
private final static int ANIMATION_DURATION_MILLIS = 250;
private final ListView listView;
private final View quickReturnView;
private final View headerPlaceholder;
private int itemCount;
private int itemOffsetY[];
@romainpiel
romainpiel / run.sh
Last active December 26, 2015 05:09
Create a new bash run configuration on Android Studio based on that script to speed up the running process
#!/bin/sh
./gradlew installDebug --parallel --daemon
adb shell am start -n com.packagename.app/.MainActivity
@mpost
mpost / Entry.java
Created December 12, 2013 10:27
Android application demonstrating the usage of Android 4.4 transitions to achieve animations effects.
package com.eclipsesource.overlay;
public class Entry {
private final int imageResId;
private final String title;
private final int id;
public Entry( int imageResId, String title, int id ) {
@jgilfelt
jgilfelt / gist:8105b5ca07776a4359c2
Created November 28, 2014 10:33
Notification whose content is partially redacted on API 21 secure lockscreens
private Notification buildNotification() {
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
.setCategory(NotificationCompat.CATEGORY_EVENT)
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE) // default
.setContentTitle(title)
.setContentText(shortText)
.setStyle(new NotificationCompat.BigTextStyle().bigText(fullText))
.setSmallIcon(R.drawable.ic_stat_notification)
.setColor(context.getResources().getColor(R.color.my_color))
.setContentIntent(intent);
@jgilfelt
jgilfelt / ExpandingListView.java
Created November 6, 2013 19:03
Fixes for Daniel Olshansky's DevByte example "ListView Expanding Cells Animation" (lines 130-132), also adds compatibility back to API 11. http://www.youtube.com/watch?v=mwE61B56pVQ http://developer.android.com/shareables/devbytes/ListViewExpandingCells.zip
/*
* Copyright (C) 2013 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
*
* Unless required by applicable law or agreed to in writing, software

Sexy transition between Activities (based on Twitter transition)

Looking at the officiel Twitter Android client I've noticed the slight cool & sexy transition between activities. I was curious to know how that worked so I had fun with android xml animations and ended up with that:

push_left_in.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
@jgilfelt
jgilfelt / ScalpelDrawer.java
Last active January 28, 2017 13:09
ScalpelDrawer - A simple wrapper for Scalpel (https://github.com/JakeWharton/scalpel) that includes toggle controls accessible from a right-side navigation drawer. Call ScalpelDrawer.wrapInside() in a base Activity onPostCreate() to easily wrap all content in your app.
package com.example.scalpeldrawer;
import android.app.Activity;
import android.content.Context;
import android.support.v4.widget.DrawerLayout;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
@ignasi
ignasi / db_getter.sh
Created January 30, 2014 11:43
Get database from an Android app (Android 4.3+)
#!/bin/bash
# Android 4.3+ changes app's internal directory permissions and you can not just pull your
# databases to your computer, so I did this as a workaround to extract my databases.
# I only use it for debug, use it under your responsability.
package=$1
db_name=$2
path="/data/data/$package/"
@chrisjenx
chrisjenx / gist:3405429
Created August 20, 2012 16:14
BasePagerFragment - Simple way to place a FragmentViewPager in a Fragment!
/**
* @project
* @author chris.jenkins
* @created Dec 28, 2011
*/
package com.application.android.ui.fragments;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.FragmentStatePagerAdapter;