Skip to content

Instantly share code, notes, and snippets.

View JMPergar's full-sized avatar
👾
Goonies never say die

José Manuel Pereira García JMPergar

👾
Goonies never say die
View GitHub Profile
@Aracem
Aracem / styles.xml
Last active July 11, 2017 15:48
Material Text Styles supported for all version with Appcompat + Calligraphy Library ( https://github.com/chrisjenx/Calligraphy ) Material Design recomendations http://www.google.com/design/spec/style/typography.html#typography-roboto-noto Remember to add the fonts to your source/fonts folder
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- TextView Empty Base-->
<style name="TextViewBase" parent="android:TextAppearance.Holo.Widget.TextView"/>
<!-- ActionBar Title -->
<style name="CustomActionBarTitleBase" parent="TextAppearance.AppCompat.Widget.ActionBar.Title"/>
<!-- Text Views Default Base -->
@Aracem
Aracem / ParallaxPageTransformer.java
Last active March 8, 2023 17:28
Parallax transformer for ViewPagers that let you set different parallax effects for each view in your Fragments.
package com.aracem.utils.animations.pagetransformation;
import org.jetbrains.annotations.NotNull;
import android.support.v4.view.ViewPager;
import android.view.View;
import java.util.ArrayList;
import java.util.List;
@Sefford
Sefford / Switching
Created July 25, 2014 14:06
This method will switch minSDKVersion of RecyclerLibrary on compile time for version 13
applicationVariants.all{ variant ->
// This is a terrible hacky way of compile-time changing all the libraries
// minSDKs to SDK 13. This script has to be mantained everytime you update
// any of these libraries or the plugin updates.
variant.processManifest.doFirst {
File manifestFile = file("${buildDir}/intermediates/exploded-aar/com.android.support/recyclerview-v7/21.0.0-rc1/AndroidManifest.xml")
if (manifestFile.exists()) {
println("Replacing minSdkVersion of RecyclerView-V7 library")
String content = manifestFile.getText('UTF-8')
content = content.replaceAll(/minSdkVersion="L"/, 'minSdkVersion=\"13\"')
@Jogan
Jogan / FloatingActionButton.java
Last active December 4, 2023 12:48
Implementation of Android L's floating action button pattern. API 14+
package your_package;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
@derekbrameyer
derekbrameyer / attrs.xml
Created May 7, 2014 18:58
CircularProgressView attrs.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="CircularProgressView">
<attr name="cpv__backgroundColor" format="color" />
<attr name="cpv__backgroundColorPressed" format="color" />
<attr name="cpv__animationTime" format="float" />
<attr name="cpv__insideRadius" format="dimension" />
<attr name="cpv__progressWidth" format="dimension" />
</declare-styleable>
</resources>
@derekbrameyer
derekbrameyer / CircularProgressView.java
Created May 7, 2014 18:57
CircularProgressView.java
package com.doomonafireball.samples.android.widget;
import com.doomonafireball.samples.android.R;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
@antoniolg
antoniolg / SwipeRefreshActivity.java
Last active July 29, 2019 11:59
An activity that uses a SwipeRefreshLayout as a container for the layout of the classes that extend it.
/*
* Copyright (C) 2014 Antonio Leiva Gordillo.
*
* 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
@alexfu
alexfu / MyContextWrapper.java
Last active November 10, 2017 10:49
A ContextWrapper that provides a custom Drawable for overscroll egde and glow. http://alexfu.github.io/blog/2013/12/11/customizing-edgeeffect/
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.AssetManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import android.util.Log;
/**
@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
}
}
# Linux terminal prompt colors (.bashrc)
PS1="\n\[$(tput bold)\]\[$(tput setaf 2)\]\u@\h \[$(tput setaf 3)\]\w\n\[$(tput setaf 7)\]\\$\[$(tput sgr0)\]"
# Mac, windows prompt colors
PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '