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
/* https://stackoverflow.com/questions/65140871/split-list-when-predicate-is-true*/ | |
/* First Way */ | |
inline fun List<String>.splitWhenOne(predicate: (String)->Boolean):List<List<String>> { | |
val list = mutableListOf<MutableList<String>>() | |
var needNewList = false | |
forEach { | |
string-> | |
if(!predicate(string)){ | |
if(needNewList||list.isEmpty()){ | |
list.add(mutableListOf(string)) |
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"?> | |
<--https://stackoverflow.com/questions/65078252/custom-tab-layout-with-viewpager2/65079234#65079234 --> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |