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 static void printActivityFlags(String activityName, Intent intent) { | |
Field[] declaredFields = Intent.class.getDeclaredFields(); | |
StringBuilder stringBuilder = new StringBuilder(activityName + " => "); | |
for (Field field : declaredFields) { | |
if (field.getName().startsWith("FLAG_")) { // Fetch all the flag names which start from "FLAG_" | |
try { | |
int flag = field.getInt(null); | |
if ((intent.getFlags() | flag) == intent.getFlags()) { // checking that flag is present or not. | |
stringBuilder.append(field.getName()); | |
stringBuilder.append("|"); |
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
/** | |
* This utility method moves contents from sourceDirectory to destinationDirectory | |
* | |
* @param sourceDirectory : from where to get contents | |
* @param destinationDirectory : where to move contents | |
* @return true if success, false otherwise. | |
*/ | |
public static boolean moveDirectoryContents(@NonNull File sourceDirectory, @NonNull File destinationDirectory) { | |
if (!sourceDirectory.exists()) { | |
return false; |
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
<manifest package="com.saurabh.dynamic_feature" | |
<!--split tag : declare your module as a new split apk of your application--> | |
split="custom_dynamic_feature" | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:dist="http://schemas.android.com/apk/distribution"> | |
<!--split dist:module : define module attributes/configs--> | |
<dist:module | |
dist:onDemand="true" | |
dist:title="@string/title_dynamic_feature"> |
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
// new plugin | |
apply plugin: 'com.android.dynamic-feature' | |
android { | |
... | |
} | |
dependencies { | |
implementation fileTree(dir: 'libs', include: ['*.jar']) | |
// add main/base module's dependency |
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
// In the base module’s build.gradle file. | |
android { | |
// Specifies dynamic feature modules that have a dependency on this base module. | |
dynamicFeatures = [':features:kotlin', | |
':features:java', | |
':features:native', | |
':features:assets', | |
":dynamic_feature"] | |
} |
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.buildTypes { | |
release { | |
// You must use the following property to specify additional ProGuard | |
// rules for dynamic feature modules. | |
consumerProguardFiles 'proguard-rules-dynamic-features.pro' | |
} | |
} |
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 fun createSliceWithHeaderAndRow(sliceUri: Uri): Slice? { | |
return list(context, sliceUri, ListBuilder.INFINITY) { | |
header { | |
title = "Get a ride." | |
subtitle = "Ride in 4 min." | |
summary = "Work in 45 min | Home in 15 min." | |
} | |
row { | |
title = "Home" | |
subtitle = "15 miles | 15 min | $15.23" |