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
import java.io.File | |
val input = File("src/main/kotlin/day13/Day13.txt").readLines().mapNotNull { | |
when (it) { | |
"" -> null | |
else -> it | |
} | |
} | |
sealed class Data { |
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
// usage: | |
// spannedStringFormatter.format(context.getText(R.string.mystring), "url1", "url2")) | |
// where R.string.mystring is <string name="mystring"><![CDATA[ Link one <a href="%s"><b> Link one</b></a> and link two <a href="%s"><b>Link two</b></a>.]]></string> | |
class SpannedStringFormatter { | |
/** | |
* replace all the %s in the spanned string with corresponding URLs | |
*/ | |
fun format(format: CharSequence, vararg urls: String?): SpannedString { | |
// make a spannable copy so that we can change the spans (Spanned is immutable) |
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 HomeFragment : Fragment() { | |
override fun onCreateView( | |
inflater: LayoutInflater, | |
container: ViewGroup?, | |
savedInstanceState: Bundle? | |
): View? { | |
return inflater.inflate(R.layout.fragment_home, container, false) | |
} | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
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"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:id="@+id/container" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:paddingTop="?attr/actionBarSize"> | |
<com.google.android.material.bottomnavigation.BottomNavigationView | |
android:id="@+id/nav_view" |
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 MainActivity : AppCompatActivity(), ToFlowNavigatable { | |
private val navigator: Navigator = Navigator() | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
val navView: BottomNavigationView = findViewById(R.id.nav_view) | |
val navController = findNavController(R.id.nav_host_fragment) |
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 StartFragment : Fragment() { | |
override fun onCreateView( | |
inflater: LayoutInflater, | |
container: ViewGroup?, | |
savedInstanceState: Bundle? | |
): View? { | |
return inflater.inflate(R.layout.fragment_start, container, false) | |
} | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
NewerOlder