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
# Dockerfile for Android app build. Can be used for native Android builds. | |
# | |
# Before building, you need to replace the values of variables | |
# ANDROID_SDK_LICENSE and ANDROID_SDK_PREVIEW_LICENSE (lines 70 and 71). | |
# Replace these values with contents of files android-sdk-license | |
# and android-sdk-preview-license that can be found at ANDROID_SDK/licenses. | |
# The line breakes are mandatory, use \n to add them. | |
FROM ubuntu:18.04 |
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
# Dockerfile for Android app build. Can be used for native Android builds. | |
# | |
# Before building, you need to replace the values of variables | |
# ANDROID_SDK_LICENSE and ANDROID_SDK_PREVIEW_LICENSE (lines 70 and 71). | |
# Replace these values with contents of files android-sdk-license | |
# and android-sdk-preview-license that can be found at ANDROID_SDK/licenses. | |
# The line breakes are mandatory, use \n to add them. | |
FROM ubuntu:16.04 |
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
//gradle.properties | |
dexMemory=3g | |
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=4096m | |
org.gradle.configureondemand=true | |
org.gradle.caching=true | |
android.enableBuildCache=true | |
org.gradle.parallel=true | |
android.enableAapt2=true | |
android.enableD8=true | |
android.enableD8.desugaring = true |
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 android.content.Context; | |
import android.support.design.widget.AppBarLayout; | |
import android.support.design.widget.CoordinatorLayout; | |
import android.util.AttributeSet; | |
import android.view.View; | |
public class NestedScrollAppBarBehavior extends AppBarLayout.Behavior { | |
private boolean nestedScrollEnabled; | |
public DisableableAppBarLayoutBehavior() { |
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
Gson gson = new GsonBuilder() | |
.registerTypeAdapterFactory(AutoValueGsonAdapterFactory.create()) | |
.create(); |
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
@GsonTypeAdapterFactory | |
abstract class AutoValueGsonAdapterFactory implements TypeAdapterFactory { | |
static TypeAdapterFactory create() { | |
return new AutoValueGson_AutoValueGsonAdapterFactory(); | |
} | |
} |
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
PersonData personData = PersonData.builder() | |
.id(1) | |
.name("David Tiago Conceição") | |
.eMail("david@david.com") | |
.status(0) | |
.profileUrl("twitter.com/davidtiagocon") | |
.pictureImageUrl("https://pbs.twimg.com/profile_images/601894402198544384/FJupV0uC.jpg") | |
.build(); |
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.ryanharter.auto.value.gson.AutoValueGsonTypeAdapterFactory; | |
//... | |
Gson gson = new GsonBuilder() | |
.registerTypeAdapterFactory(new AutoValueGsonTypeAdapterFactory()) | |
.create(); |
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 AutoValueTypeAdapterFactory implements TypeAdapterFactory { | |
@Override | |
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { | |
Class<? super T> rawType = type.getRawType(); | |
if (PersonData.class.isAssignableFrom(rawType)) { | |
return (TypeAdapter<T>) PersonData.typeAdapter(gson); | |
} | |
return null; | |
} | |
} |
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 static TypeAdapter<PersonData> typeAdapter(Gson gson) { | |
return new AutoValue_PersonData.GsonTypeAdapter(gson); | |
} |
NewerOlder