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 / SupportVersion.java
Last active August 4, 2021 11:19
SupportVersion Utils class to check if the current API version is as least certain API Level
package com.aracem.utils.version;
import android.os.Build;
/**
* Util class to check if the current device is running some of the awesome Android versions.
* <p/>
* Created by Marcos Trujillo (─‿‿─) on 3/02/14.
*/
public class SupportVersion {
@JMPergar
JMPergar / FlipPageViewTransformer.java
Last active November 7, 2019 05:33
Flip animation for ViewPager
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);
@Sloy
Sloy / video2gif.py
Last active December 30, 2015 09:59
Este script genera una animación gif a partir de un archivo de vídeo, colocando opcionalmente un fondo en cada frame. Está pensado para convertir los vídeos obtenidos en Android mediante 'adb shell screenrecord' o con la herramienta de Android Studio.
#coding=utf-8
"""
Por: Rafa Vázquez
http://sloydev.com/
Este script genera una animación gif a partir de un archivo de vídeo, colocando opcionalmente un fondo en cada frame.
Está pensado para convertir los vídeos obtenidos en Android mediante 'adb shell screenrecord' o con la herramienta de Android Studio.
Un ejemplo del resultado puede verse en http://i.imgur.com/Opu5aG3.gif
@artem-zinnatullin
artem-zinnatullin / MyApp.java
Last active January 15, 2023 13:04
If you need to set one font for all TextViews in android application you can use this solution. It will override ALL TextView's typefaces, includes action bar and other standard components, but EditText's password font won't be overriden.
public class MyApp extends Application {
@Override
public void onCreate() {
TypefaceUtil.overrideFont(getApplicationContext(), "SERIF", "fonts/Roboto-Regular.ttf"); // font from assets: "assets/fonts/Roboto-Regular.ttf
}
}
@tshrkmd
tshrkmd / styles_noactionbar.xml
Last active November 3, 2022 09:58
Theme.AppCompat.Light.NoActionBar
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.AppCompat.Light.NoActionBar" parent="@style/Theme.AppCompat.Light">
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item> <!-- For 2.x version -->
</style>
</resources>
@julianshen
julianshen / CircleTransform.java
Last active November 6, 2023 12:47
CircleTransform for Picasso
/*
* Copyright 2014 Julian Shen
*
* 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
@jihonrado
jihonrado / java_random_string_generation
Created May 31, 2013 15:42
Java random string generation
public static String generateRandomString() {
return new BigInteger(130, new SecureRandom()).toString(32);
}
@Aracem
Aracem / FetchInfoTask
Created May 23, 2013 11:19
Extension of an AsyncTask that download the info from a valid URL and return the result. This result may be parsed if is a Json, or may be parsed with your own parse implementation. This class uses the Jackson Library
package com.acdroid;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
@Aracem
Aracem / BaseWebView.java
Created May 9, 2013 09:32
Base WebView perfect to extend in your project and initialize it like you want -- this implementation hasn't any inicialization -- It has a workaround to avoid problems on Android 4.2.x version with the webview implemented by Jose I Honrado Has a method to load a Error page. Has a method to enable with reflection (when possible) the "plugins" at…
package com.acdroid.widget.webview;
import android.content.Context;
import android.util.AttributeSet;
import android.webkit.WebView;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Method;
@JakeWharton
JakeWharton / BindingAdapter.java
Last active July 25, 2023 05:49
An adapter base class that uses a new/bind pattern for its views.
// Apache 2.0 licensed.
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
/** An implementation of {@link BaseAdapter} which uses the new/bind pattern for its views. */
public abstract class BindableAdapter<T> extends BaseAdapter {