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
class ListActivity : AppCompatActivity() { | |
private val splitListener = Consumer<List<SplitInfo>> { splitInfoList -> | |
// React to a split change | |
} | |
override fun onStart() { | |
super.onStart() | |
SplitController | |
.getInstance() |
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
val splitController = SplitController.getInstance() | |
if (!splitController.isSplitSupported()) { | |
// Split is not supported on this device | |
} |
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
<resources xmlns:window="http://schemas.android.com/apk/res-auto"> | |
<SplitPairRule | |
window:finishPrimaryWithSecondary="true" | |
window:finishSecondaryWithPrimary="true" | |
window:splitRatio="0.4"> | |
<SplitPairFilter | |
window:primaryActivityName=".list.ListActivity" | |
window:secondaryActivityName=".details.DetailsActivity" /> | |
</SplitPairRule> | |
</resources> |
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
<resources xmlns:window="http://schemas.android.com/apk/res-auto"> | |
<SplitPairRule | |
<!-- split rule config option --> | |
> | |
<SplitPairFilter | |
window:primaryActivityName=".list.ListActivity" | |
window:secondaryActivityName=".details.DetailsActivity" /> | |
<SplitPairFilter | |
window:primaryActivityName=".details.DetailsActivity" | |
window:secondaryActivityName=".share.ShareActivity" /> |
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"?> | |
<resources xmlns:window="http://schemas.android.com/apk/res-auto"> | |
<!-- Other rules --> | |
<SplitPlaceholderRule | |
window:placeholderActivityName=".details.DetailsPlaceholderActivity" | |
window:splitRatio="0.4"> | |
<ActivityFilter window:activityName=".list.ListActivity" /> | |
</SplitPlaceholderRule> | |
</resources> |
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
dependencies { | |
// Other app dependencies | |
implementation "androidx.window:window:1.0.0" | |
} |
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
class ActivityEmbeddingSampleApplication : Application() { | |
override fun onCreate() { | |
super.onCreate() | |
SplitController.initialize(this, R.xml.split_configuration) | |
} | |
} |
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"?> | |
<resources xmlns:window="http://schemas.android.com/apk/res-auto"> | |
<SplitPairRule | |
window:splitRatio="0.4"> | |
<SplitPairFilter | |
window:primaryActivityName=".list.ListActivity" | |
window:secondaryActivityName=".details.DetailsActivity" /> | |
</SplitPairRule> | |
</resources> |
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
class RemoteViewInteropWidget : GlanceAppWidget() { | |
@Composable | |
override fun Content() { | |
Column { | |
Text(text = "Above remote views") | |
val context = LocalContext.current | |
AndroidRemoteViews(remoteViews = RemoteViewWidget(context)) |
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
class SizeSingleWidget : GlanceAppWidget() { | |
override val sizeMode: SizeMode = SizeMode.Single | |
// Remainder of the widget's implementation | |
} |
NewerOlder