Build type | APK size |
---|---|
Without optimization | 31.5MB |
With optimization | 23.2MB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void fetchFeed() { | |
RestClient.getInstance().getUser(new ResultsListener<User>() { | |
@Override | |
public void onSuccess(String feed) { | |
Log.i("Feed: " + feed); | |
} | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.loopj.android.http.AsyncHttpResponseHandler; | |
/** | |
* Singleton RestClient | |
*/ | |
public class RestClient { | |
private static RestClient sInstance = null; | |
public static RestClient getInstance() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ResultsListener<T> { | |
public void onSuccess(T result); | |
public void onFailure(Throwable e); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
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.", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
NewerOlder