Skip to content

Instantly share code, notes, and snippets.

View julianfalcionelli's full-sized avatar
🐉
Turning coffee into code

Julian Falcionelli julianfalcionelli

🐉
Turning coffee into code
View GitHub Profile
@julianfalcionelli
julianfalcionelli / build.gradle
Last active October 24, 2016 18:15
buildConfigField
buildTypes {
debug {
buildConfigField “String”, “BASE_URL”, “\”http://api-staging.com/\""
}
release {
buildConfigField “String”, “BASE_URL”, “\”https://api.com/\""
debuggable false
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’
signingConfig signingConfigs.config
}
@julianfalcionelli
julianfalcionelli / Constants.java
Created October 24, 2016 18:18
Using BuildConfig
public static final String BASE_URL = BuildConfig.BASE_URL;
@julianfalcionelli
julianfalcionelli / build.gradle
Created October 24, 2016 18:19
shrikResources
android {
buildTypes {
release {
debuggable false
shrinkResources true
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’
signingConfig signingConfigs.config
}
}
}
@julianfalcionelli
julianfalcionelli / build.gradle
Created October 24, 2016 18:20
Dependencies by buildType
dependencies {
releaseCompile ‘com.google.firebase:firebase-crash:9.6.1’
}
@julianfalcionelli
julianfalcionelli / ExampleActivity.java
Last active October 24, 2016 20:00
IcePick Example
class ExampleActivity extends Activity {
@State int mSelectedPosition; // This will be automatically saved and restored
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Icepick.restoreInstanceState(this, savedInstanceState);
}
@Override public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
class ExampleActivity extends Activity {
@BindView(R.id.title) TextView mTitleTextView;
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.example_activity);
ButterKnife.bind(this);
mTitleTextView.setText("Hello World");
}
class ExampleActivity extends Activity {
private ActivityExampleBinding mBinding;
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mBinding = DataBindingUtil.setContentView(this, R.layout.example_activity);
mBinding.title.setText("Hello World");
}
}
@julianfalcionelli
julianfalcionelli / styles.xml
Created October 28, 2016 00:08
Global layout attributes
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
@julianfalcionelli
julianfalcionelli / AndroidManifest.xml
Created October 28, 2016 00:10
Setting Application Theme
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
...
</application>
@julianfalcionelli
julianfalcionelli / MainActivity.java
Created January 5, 2017 14:01
Magic Form Example
package com.dummyapp;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import java.util.List;