Skip to content

Instantly share code, notes, and snippets.

View alorma's full-sized avatar
🤡

Bernat Borrás Paronella alorma

🤡
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/blue_facebook_dark">
<item>
<shape android:shape="rectangle" >
<corners android:radius="10dp"/>
<solid android:color="@color/blue_facebook"/>
</shape>
</item>
</ripple>
@twiceyuan
twiceyuan / gist:0c1b7faa6fad2d3cad42
Last active April 23, 2019 14:31 — forked from z8888q/gist:7280681
[如何动态改变 App 图标] #Android How to change an application icon programmatically in Android
//1 . Modify your MainActivity section in AndroidManifest.xml, delete from it, line with MAIN category in intent-//filter section
<activity android:name="ru.quickmessage.pa.MainActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:label="@string/app_name"
android:theme="@style/CustomTheme"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
package com.example.marcin.splitlayout;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Region;
@ffgiraldez
ffgiraldez / ToolbarActivity.java
Last active May 4, 2016 16:11
Disable toolbar scroll flag when content it's not enough to fill the screen
public class ToolbarActivity extends AppCompatActivity {
// Set the flags that fit your needs
private static final int ENABLED_SCROLL_BEHAVIOR = AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS | AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL;
private static final int DISABLED_SCROLL_BEHAVIOR = 0;
private static final int SCROLL_DOWN = 1;
//Injected via ButterKnife (http://jakewharton.github.io/butterknife)
@InjectView(R.id.toolbar)
Toolbar toolbar;
@InjectView(R.id.recyclerview)
@gabrielemariotti
gabrielemariotti / README.md
Last active February 24, 2021 10:52
How to manage the support libraries in a multi-module projects. Thanks to Fernando Cejas (http://fernandocejas.com/)

Centralize the support libraries dependencies in gradle

Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.

A very good way is to separate gradle build files, defining something like:

root
  --gradleScript
 ----dependencies.gradle
@rocboronat
rocboronat / DarkOrLightColour.java
Last active June 30, 2018 19:04
Know if a text on a dynamic background colour must be black or white to be easy to read
int color = palette.getVibrantColor(defaultColor);
int r = (color >> 16) & 0xFF;
int g = (color >> 8) & 0xFF;
int b = (color >> 0) & 0xFF;
row.setBackgroundColor(color);
//@see http://stackoverflow.com/questions/12043187/how-to-check-if-hex-color-is-too-black
double luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;
@MarioPerezEsteso
MarioPerezEsteso / InfoPantalla.java
Created April 12, 2015 14:35
Obtener información de la pantalla en Android
Display display = getWindowManager().getDefaultDisplay();
String displayName = display.getName();  // minSdkVersion=17+
Log.i(TAG, "Pantalla          = " + displayName);
 
// Tamaño en píxeles
@homj
homj / GridSpanSizeLookupHelper.java
Last active June 30, 2022 02:39
A ItemDecoration to center the contents of a RecyclerView. This comes in handy when you want to build a responsive UI.
/*
* Copyright 2015 Johannes Homeier
*
* 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
@chris95x8
chris95x8 / UIActivity.java
Created December 13, 2014 22:35
FAB expand
package com.materialdesign.chris.materialdesignexperimenting;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.ViewAnimationUtils;
@chrisbanes
chrisbanes / CollapsingTitleLayout.java
Last active March 26, 2023 11:58
CollapsingTitleLayout
/*
* Copyright 2014 Chris Banes
*
* 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