This file contains hidden or 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
android { | |
productFlavors { | |
// Define separate dev and prod product flavors. | |
dev { | |
// dev utilizes minSDKVersion = 21 to allow the Android gradle plugin | |
// to pre-dex each module and produce an APK that can be tested on | |
// Android Lollipop without time consuming dex merging processes. | |
minSdkVersion 21 | |
} | |
prod { |
This file contains hidden or 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
flavorDimensions ("version", "brand") | |
productFlavors{ | |
Devoper{ | |
dimension "version" | |
minSdkVersion 21 | |
} | |
UAT{ | |
dimension "version" | |
minSdkVersion 19 |
This file contains hidden or 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
android { | |
compileSdkVersion 23 | |
buildToolsVersion '23.0.2' | |
defaultConfig { | |
applicationId "testing" | |
minSdkVersion getMinSdk() | |
targetSdkVersion 23 | |
versionCode 1 | |
versionName "1.0" |
This file contains hidden or 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
RetrofitClient client = new Retrofit.Builder() | |
/*configure Retrofit */ | |
.build().create(RetrofitClient.class); | |
private void retrieveSomeValue(String param) { | |
client.doRequest(param) | |
.subscribe(response ->{ | |
getContext().getSharedPreferences("sharedpreferences", Context.MODE_PRIVATE) | |
.edit() | |
/*write response to disk */ |
This file contains hidden or 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 Retrofit retrofit = ApplicationFactory.getRetrofitClient(); | |
private ManagerDelegate managerDelegate = ApplicationFactory.getManagerDelegateImpl(); | |
private Observable<Response> retrieveSomeValue(String param) { | |
RetrofitClient client = retrofit.create(RetrofitClient.class); | |
Observable<Response> request = client.doRequest(param); | |
request.subscribe(response ->{ | |
CachingManager.getInstance().cacheSimpleResponse(response); | |
// Which one's better? | |
managerDelegate.getCachingManager.cacheSimpleResponse(response); |
This file contains hidden or 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 ExampleUnitTest { | |
private boolean mResponseCached = false | |
public void testCachingStrategy(){ | |
MockManagerDelegate mockDelegate = new MockManagerDelegate(); | |
ApplicationFactory.setInstance(mockDelegate); | |
mockDelegate.setCachingManager(new CachingManager(){ | |
@Override | |
void cacheSimpleResponse(Response response) { | |
mResponseCached = true; |
This file contains hidden or 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 DemoService { | |
@GET("/somesuffix") | |
void getData(Callback<List<Data>> callback); | |
} | |
public class MockDemoService implements DemoService { | |
public void getData(Callback<List<Data>> callback){ | |
//do your own implementation for mocking | |
throw new IllegalStateException("Stub"); |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
AAPT notify(QueuedJob{ | |
title=Cruncher abc_scrubber_control_to_pressed_mtrl_005.png, | |
task={from=abc_scrubber_control_to_pressed_mtrl_005.png, to=/Users/patrykpoborca/Documents/consulting/plagrounds/app/build/intermediates/res/merged/debug/drawable-xxhdpi-v4/abc_scrubber_control_to_pressed_mtrl_005.png}, | |
latch=BooleanLatch{signaled=false}, | |
result=false}): Done | |
22:08:15.911 [DEBUG] [org.gradle.api.Project] AAPT out(Facade for 808747103): Crunching single PNG file: /Users/patrykpoborca/Documents/consulting/plagrounds/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/24.0.0/res/drawable-xhdpi-v4/abc_list_divider_mtrl_alpha.9.png | |
22:08:15.913 [DEBUG] [org.gradle.api.Project] AAPT out(Facade for 808747103): -> QueuedJob{ | |
title=Cruncher abc_list_divider_mtrl_alpha.9.png, | |
task={from=abc_list_divider_mtrl_alpha.9.png, to=/Users/patrykpoborca/Documents/consulting/plagrounds/app/build/intermediates/res/merged/debug/drawable-xhdpi-v4/abc_list_divider_mtrl_alpha.9.png}, | |
latch=BooleanLatch{signaled= |
This file contains hidden or 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
Executing tasks: [clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugUnitTestSources, :app:compileDebugAndroidTestSources, :othermodule:generateDebugSources, :othermodule:generateDebugAndroidTestSources, :othermodule:mockableAndroidJar, :othermodule:prepareDebugUnitTestDependencies, :othermodule:compileDebugSources, :othermodule:compileDebugAndroidTestSources, :othermodule:compileDebugUnitTestSources] | |
Configuration on demand is an incubating feature. | |
Incremental java compilation is an incubating feature. | |
:clean | |
:app:clean | |
:othermodule:clean | |
:app:preBuild UP-TO-DATE | |
:app:preDebugBuild UP-TO-DATE | |
:app:checkDebugManifest |
This file contains hidden or 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
Executing tasks: [clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugUnitTestSources, :app:compileDebugAndroidTestSources, :othermodule:generateDebugSources, :othermodule:generateDebugAndroidTestSources, :othermodule:mockableAndroidJar, :othermodule:prepareDebugUnitTestDependencies, :othermodule:compileDebugSources, :othermodule:compileDebugAndroidTestSources, :othermodule:compileDebugUnitTestSources] | |
The client will now receive all logging from the daemon (pid: 40016). The daemon log file: /Users/patrykpoborca/.gradle/daemon/2.10/daemon-40016.out.log | |
Starting 23rd build in daemon [uptime: 5 hrs 32 mins 27.174 secs, performance: 95%, memory: 42% of 1.4 GB] | |
Executing build with daemon context: DefaultDaemonContext[uid=7a09de72-fd6f-477b-99bb-3934bbf664ba,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home,daemonRegistryDir=/Users/patrykpoborca/.gradle/daemon,pid= |