Skip to content

Instantly share code, notes, and snippets.

/**
* Template to complete Jobs classes
*
* Declaration: Java - Declaration
* Variables:
* $CLASS$ expresion: className() defaultValue: Object
*
* Follow this instruction to add it to Android Studio
* http://dmytrodanylyk.com/pages/blog/templates.html
*/
if (SupportVersion.JellyBean()) {
ActivityOptions options = ActivityOptions.makeScaleUpAnimation(view, 0,
0, view.getWidth(), view.getHeight());
startActivity(coverFlowIntent, options.toBundle());
} else {
startActivity(coverFlowIntent);
}
public class OverrideTypefaceApplication extends Application {
@Override
public void onCreate() {
TypefaceUtil.overrideFont(getApplicationContext(), "SERIF", "fonts/Roboto-Regular.ttf"); // font from assets: "assets/fonts/Roboto-Regular.ttf
}
}
/**
* Template to implement Gson serialization and deserialization in a bean
*
* Declaration: Java - Declaration
* Variables:
* $TYPE$ expresion: className() defaultValue: Object
*
* Follow this instruction to add it to Android Studio
* http://dmytrodanylyk.com/pages/blog/templates.html
*/
/*
* Declaration: Java - Declaration
* Variables:
* $TYPE$ expresion: arrayValue() defaultValue: listField
* $OBJECT$ expresion:className() defaultValue: Object
*
* Follow this instruction to add it to Android Studio
* http://dmytrodanylyk.com/pages/blog/templates.html
*/
/*
* Copyright (C) 2014 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
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapplication" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
/*
* You can find all the Play Service Packages here
* http://developer.android.com/reference/gms-packages.html
*/
def toCamelCase(String string) {
String result = ""
string.findAll("[^\\W]+") { String word ->
result += word.capitalize()
}
import android.support.v4.view.ViewPager;
import android.view.View;
public class FlipPageViewTransformer implements ViewPager.PageTransformer {
@Override
public void transformPage(View page, float position) {
float percentage = 1 - Math.abs(position);
page.setCameraDistance(12000);
setVisibility(page, position);
setTranslation(page);
import android.support.v4.view.ViewPager;
import android.view.View;
public class DepthPageTransformer implements ViewPager.PageTransformer {
private static final float MIN_SCALE = 0.75f;
public void transformPage(View view, float position) {
int pageWidth = view.getWidth();