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
// add this to the general build.gradle, not in the subproject's build.gradle | |
// improved version of Xavier's tip http://tools.android.com/tech-docs/new-build-system/tips#TOC-Improving-Build-Server-performance. | |
// usage example default, preDex will be enabled: gradle clean build | |
// usage example disabling preDex: gradle clean build -PpreDexEnable=false | |
// preDexEnable parameter's value can be set as property of Continuous Integration build config | |
// this is the main difference from Xavier's workaround where he doing only hasProperty check | |
project.ext { | |
if (project.hasProperty('preDexEnable')) { |
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 MyApp extends Application { | |
@Override | |
public void onCreate() { | |
TypefaceUtil.overrideFont(getApplicationContext(), "SERIF", "fonts/Roboto-Regular.ttf"); // font from assets: "assets/fonts/Roboto-Regular.ttf | |
} | |
} |
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
// You can place it in the root build.gradle | |
allprojects { | |
tasks.withType(JavaForkOptions) { | |
// Forked processes like GradleWorkerMain for tests won't steal focus! | |
jvmArgs '-Djava.awt.headless=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
// Variant 1: For app or library project's build.gradle | |
android { | |
variantFilter { | |
if (it.buildType.name.equals('debug')) { | |
it.ignore = true | |
} | |
} | |
} | |
// Variant 2: For root build.gradle with applying only to library projects |
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
@Override | |
public void onActivityResult(int requestCode, int resultCode, Intent data) { | |
super.onActivityResult(requestCode, resultCode, data); | |
// notifying nested fragments (support library bug fix) | |
final FragmentManager childFragmentManager = getChildFragmentManager(); | |
if (childFragmentManager != null) { | |
final List<Fragment> nestedFragments = childFragmentManager.getFragments(); |
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
def apply_error_prone(**kwargs): | |
# Error Prone should be on by default in Bazel. | |
if IS_BAZEL: | |
return kwargs | |
has_java_files = False | |
for src in kwargs.get("srcs", []): | |
if src.endswith(".java"): | |
has_java_files = True | |
break |
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
android { | |
// ... | |
testOptions.unitTests.all { | |
testLogging { | |
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' | |
} | |
} | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<ripple xmlns:android="http://schemas.android.com/apk/res/android" | |
android:color="@color/bg_item_ripple"> | |
<item> | |
<selector> | |
<item android:state_pressed="true" android:drawable="@color/bg_item_pressed"/> | |
<item android:state_focused="true" android:drawable="@color/bg_item_focused"/> | |
<item android:drawable="@color/bg_item_normal"/> | |
</selector> | |
</item> |
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
apply plugin: 'kotlin-android' | |
android { | |
sourceSets { | |
main.java.srcDirs += 'src/main/kotlin' | |
} | |
} | |
// NOTICE: dependencies are fixed for build stability | |
dependencies { |
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
autoCorrect: true | |
failFast: false | |
test-pattern: # Configure exclusions for test sources | |
active: true | |
patterns: # Test file regexes | |
- '.*/test/.*' | |
- '.*Test.kt' | |
- '.*Spec.kt' | |
exclude-rule-sets: |
NewerOlder