Skip to content

Instantly share code, notes, and snippets.

Avatar

Moritz Post mpost

View GitHub Profile
@mpost
mpost / YogaLayout.java
Last active Feb 17, 2018
Integrate the Facebook Yoga layout (https://facebook.github.io/yoga/) into the Android layout system as a YogaLayout ViewGroup. The YogaLayout exposes the underlying yoga specific child layout properties on its LayoutParams object as a YogaNode object.
View YogaLayout.java
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import com.facebook.yoga.YogaMeasureFunction;
import com.facebook.yoga.YogaMeasureMode;
import com.facebook.yoga.YogaMeasureOutput;
@mpost
mpost / android-cli.bat
Created Jul 29, 2016
Register windows context menu entry to adb install apk from explorer
View android-cli.bat
@ECHO OFF
ECHO Running "adb install -r %1"
adb install -r %1
PAUSE
@mpost
mpost / cordova_config.xml
Created Jul 2, 2015
The gist demonstrates how to create a custom Tabris.js Android theme.
View cordova_config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget
xmlns="http://www.w3.org/ns/widgets"
id="com.eclipsesource.sandbox.theme"
version="1.0.0">
<name>Tabris.js Android Theming Sandbox</name>
<hook type="after_platform_add" src="scripts/android/afterPlatformAdd.js" />
@mpost
mpost / colors.xml
Last active Jan 8, 2020
This gist demonstrates how to create an animated pause/resume media playback button for Android. It uses animated vector drawables and state transitions to orchestrate the effect. Some background: https://plus.google.com/u/0/+MoritzPost/posts/3EFF8uC7jXv
View colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="action_pause">#FF8F00</color>
<color name="action_resume">#43A047</color>
</resources>
@mpost
mpost / Entry.java
Created Dec 12, 2013
Android application demonstrating the usage of Android 4.4 transitions to achieve animations effects.
View Entry.java
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 ) {
@mpost
mpost / Entry.java
Created Sep 18, 2013
Android application demonstrating the usage of ViewOverlay and OnPreDrawListener to achieve animations effects.
View Entry.java
package com.example.overlay;
public class Entry {
private final int imageResId;
private final String title;
public Entry( int imageResId, String title ) {
this.imageResId = imageResId;
@mpost
mpost / GridDataUtil.java
Created Jul 25, 2013
An efficient way to deal with SWT GridLayout and GridData configurations. Allows you to apply SWT GridLayout and GridData to Composites and Controls in a very compact form, while being more powerful at the same time. To apply a GridLayout and configure it to your use case the following expression can be used: GridLayoutUtil.applyGridLayout( comp…
View GridDataUtil.java
package com.eclipsesource.swt.util;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Control;
public class GridDataUtil {
private final GridData gridData;