Skip to content

Instantly share code, notes, and snippets.

Henrique Boregio quiqueqs

Block or report user

Report or block quiqueqs

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
View results.MD
Build type APK size
Without optimization 31.5MB
With optimization 23.2MB
@quiqueqs
quiqueqs / tasks.gradle
Created Nov 22, 2016
Gradle task to call an external bash script
View tasks.gradle
task optimizePngs(type: Exec) {
group = 'Optimizations'
description = 'Reduce the PNG size using PNGQuant'
def absolutePath = file('..') // Get project absolute path
commandLine "$absolutePath/scripts/optimize_png.sh", "$absolutePath/app/src"
}
@quiqueqs
quiqueqs / optimize_png.sh
Created Nov 22, 2016
Bash script to optimize png files
View optimize_png.sh
#!/bin/bash
if [ $# -lt 1 ]
then
echo "Missing argument"
echo "Usage : $0 <APPLICATION_PROJECT_DIRECTORY>"
exit 1;
fi
APPLICATION_PROJECT_DIRECTORY=$1
echo "Optimizing PNGs with pngquant"
View Example.java
// BasePresenter.java (Base class for all our Presenters)
public abstract class BasePresenter<V> {
private WeakReference<V> mView;
public void bindView(@NonNull V view) {
mView = new WeakReference<>(view);
}
public void unbindView() {
View gist:0b443aa28836d7201b30
private void fetchFeed() {
RestClient.getInstance().getUser(new ResultsListener<User>() {
@Override
public void onSuccess(String feed) {
Log.i("Feed: " + feed);
}
@Override
View gist:276715ccafbc5cf94f33
import com.loopj.android.http.AsyncHttpResponseHandler;
/**
* Singleton RestClient
*/
public class RestClient {
private static RestClient sInstance = null;
public static RestClient getInstance() {
View gist:bf5246a5350cd296d2c5
public interface ResultsListener<T> {
public void onSuccess(T result);
public void onFailure(Throwable e);
}
View gist:3163f5fa8bcf4cf30ac0
public class Api {
private static final String BASE_URL = "https://my.api.com/";
private static AsyncHttpClient aSyncClient;
private static String USER_AGENT = "Our Custom User Agent";
static {
// setup asynchronous client
aSyncClient = new AsyncHttpClient();
View word.json
{
list: [
{
defid: 7191449,
word: "dental rush",
author: "amatwiedle",
permalink: "http://dental-rush.urbanup.com/7191449",
other_definitions: 0,
definition: "The act of brushing your teeth multiple times right before a dentist appointment.",
example: "Guy 1: You going to the dentist? guy 2: Yah, I had a dental rush this morning.",
View miactivity.java
public class MiActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MiAsyncTask task = new MiAsyncTask(new Callback() {
public void finished() {
Toast.makeText(MiActivity.this, “Tarea terminada.”, Toast.LENGTH_SHORT).show();
You can’t perform that action at this time.