Skip to content

Instantly share code, notes, and snippets.

Evelio Tarazona eveliotc

Block or report user

Report or block eveliotc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@eveliotc
eveliotc / android-select-device
Last active Feb 5, 2019
My (android) dev aliases and scripts
View android-select-device
#! /bin/bash
# from http://dtmilano.blogspot.com/2012/03/selecting-adb-device.html
# selects an android device
PROGNAME=$(basename $0)
UNAME=$(uname)
DEVICE_OPT=
for opt in "$@"
do
case "$opt" in
View README.md

A visited command for Backtick. Injects CSS to visually differentiate regular links from visited ones.

To install Copy 68fbf2e317c8b4b473c3 then Paste it into the custom commands field in the Backtick settings. You can easily access the settings by clicking the Backtick icon on the command execution console.

@eveliotc
eveliotc / MyActivityOrFragment.java
Created Jul 29, 2013
A variant of https://gist.github.com/eveliotc/6051367 to show a drop shadow, should not be used for performance in mind views
View MyActivityOrFragment.java
final ImageView imageView = (ImageView) view.findViewById(R.id.image);
final int shadowSize = getResources().getDimensionPixelSize(R.dimen.shadow_size);
final int shadowColor = getResources().getColor(R.color.shadow_color);
imageView.setImageDrawable(new RoundedAvatarDrawable(mBitmap, shadowSize, shadowColor));
if (SDK_INT >= HONEYCOMB) {
imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
@eveliotc
eveliotc / RoundedAvatarDrawable.java
Created Jul 22, 2013
RoundedAvatarDrawable: A Drawable that draws an oval with given {@link Bitmap} See http://evel.io/2013/07/21/rounded-avatars-in-android/
View RoundedAvatarDrawable.java
/*
* Copyright 2013 Evelio Tarazona Cáceres <evelio@evelio.info>
*
* 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
@eveliotc
eveliotc / getRoundedBitmap.java
Created Jul 22, 2013
A better yet dirty way of get rounded avatars
View getRoundedBitmap.java
public static Bitmap getRoundedBitmap(Bitmap bitmap) {
final Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(output);
final int color = Color.RED;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
final RectF rectF = new RectF(rect);
paint.setAntiAlias(true);
@eveliotc
eveliotc / bad_avatar_overlay.xml
Created Jul 22, 2013
A sample of a bad way of doing rounded avatars
View bad_avatar_overlay.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- From post http://evel.io/2013/07/21/rounded-avatars-in-android/ -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
View gist:4506761
<!-- res/values/styles.xml -->
<style name="MyCheckbox" parent="@android:style/Widget.CompoundButton.CheckBox">
<item name="android:button">@drawable/btn_check</item>
<item name="android:paddingLeft">@dimen/checkbox_padding_left_workaround</item>
<!-- yada yada yada -->
</style>
<!-- res/values/dimens.xml -->
<dimen name="checkbox_padding_left_workaround">50dip</dimen> <!-- or whatever your drawable is -->
<!-- res/values-v17/dimens.xml -->
<dimen name="checkbox_padding_left_workaround">0dip</dimen> <!-- yup, you got it -->
@eveliotc
eveliotc / resize.sh
Created Aug 15, 2012
Script to batch resize non 9patch images
View resize.sh
#!/bin/bash
SRC_DIR=$1; # e.g. res/drawable-xhdpi/
DEST_DIR=$2; # e.g. res/drawable-mdpi/
RESIZE_BY=$3; # e.g. 50%
echo "From $SRC_DIR to $DEST_DIR resize by $RESIZE_BY";
for item in $( ls $SRC_DIR | grep -v '\.9.png$' ); do
echo Resizing: $item
convert $SRC_DIR$item -resize $RESIZE_BY $DEST_DIR$item
done
You can’t perform that action at this time.