Skip to content

Instantly share code, notes, and snippets.

View saadfarooq's full-sized avatar

Saad Farooq saadfarooq

  • Life360
  • Boston
View GitHub Profile
@saadfarooq
saadfarooq / android_replace_in_manifest.gradle
Last active March 1, 2024 15:47
Gradle function to replace a placeholder string in AndroidManifest.xml with productFlavor package name
replaceInManifest = {variant, fromString, toString ->
def flavor = variant.productFlavors.get(0)
def buildtype = variant.buildType
def manifestFile = "$buildDir/manifests/${flavor.name}/${buildtype.name}/AndroidManifest.xml"
def updatedContent = new File(manifestFile).getText('UTF-8').replaceAll(fromString, toString)
new File(manifestFile).write(updatedContent, 'UTF-8')
}
<RecyclerView
android:id="@+id/recycler"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:visibleIfNotNull="@{viewModel.items}"
android:itemView="@{viewModel.itemView}"
android:items="@{viewModel.items}"
android:layoutManager="@{LayoutManagers.linear()}" />
@saadfarooq
saadfarooq / terminal.xml
Created April 10, 2020 19:12
Android Studio terminal settings for JAVA_HOME
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="TerminalProjectOptionsProvider">
<envs>
<env key="JAVA_HOME" value="$APPLICATION_HOME_DIR$/jre/jdk/Contents/Home/" />
</envs>
</component>
</project>