Skip to content

Instantly share code, notes, and snippets.

View Aracem's full-sized avatar
👨‍🚀
Jobandtalent and Storybeat

Marcos Trujillo Aracem

👨‍🚀
Jobandtalent and Storybeat
View GitHub Profile
@Aracem
Aracem / LogTag
Created July 21, 2014 09:11
Add a tag to DDMS Android Log to see all the entries with whatever-string-whatever
^.*rushmore.*$
@Aracem
Aracem / openActivity.java
Created July 21, 2014 09:28
Open an Activity growing from a View
if (SupportVersion.JellyBean()) {
ActivityOptions options = ActivityOptions.makeScaleUpAnimation(view, 0,
0, view.getWidth(), view.getHeight());
startActivity(coverFlowIntent, options.toBundle());
} else {
startActivity(coverFlowIntent);
}
@Aracem
Aracem / OverrideTypefaceApplication.java
Last active May 31, 2018 23:19 — forked from artem-zinnatullin/MyApp.java
Example to override the default font of an Application.
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
}
}
@Aracem
Aracem / GsonTemplate.java
Last active August 29, 2015 14:04
Android Studio TemplateTemplate to implement Gson serialization and deserialization in a bean
/**
* 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
*/
@Aracem
Aracem / BeanListOptionsTemplate.java
Last active August 29, 2015 14:04
An Android Studio template to generate utils methods for Beans that contains a List of objects
/*
* 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
*/
@Aracem
Aracem / SystemUiHelper.java
Last active August 29, 2015 14:05 — forked from chrisbanes/SystemUiHelper.java
Helper to easily change the Screen/window aspect, like FullScreen, Inmersive ...
/*
* 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
@Aracem
Aracem / Alias AndroidManifest.xml
Last active August 29, 2015 14:06 — forked from cdsap/AndroidManifest.xml
Use alias in the Android Manifest. Currently only available in the flavours, not in the buildTypes
<?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);
@Aracem
Aracem / DepthPageTransformer.java
Created September 22, 2014 11:31
ViewPager Page Transformer. Created by Google
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();