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 random | |
import time | |
# OOP perpus | |
# @author: kafri8889 | |
# Template nama orang | |
nameTemplate = [ | |
"Wang Yiren", | |
"Bai Lu", |
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 android.app.Activity | |
import android.content.ContextWrapper | |
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.DisposableEffect | |
import androidx.compose.runtime.getValue | |
import androidx.compose.runtime.mutableStateOf | |
import androidx.compose.runtime.remember | |
import androidx.compose.runtime.rememberUpdatedState | |
import androidx.compose.runtime.setValue | |
import androidx.compose.ui.platform.LocalContext |
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
""" | |
Pertama, buat function yang bernama "isPrimeNumber". | |
Apa itu ffunction? | |
Singkatnya function/method adalah suatu blok kode yang melakukan tugas tertentu (sesuai programmernya mau bikin apaan). | |
salahh satu kegunaan function adl bisa mengurangi boilerplate code (kode yang dipakai berulang kali tanpa perbedaan) | |
Flownya kayak gini: | |
INPUT => EKSEKUSI KODE => OUTPUT (opsional) |
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
def isPrimeNumberAndPrint(n): | |
for i in range(2, n): | |
if n % i == 0: | |
print(n, "bukan bilangan prima, karena bisa dibagi dengan", n//i) | |
return | |
print(n, "adalah bilangan prima") |
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 Unre<T> { | |
class UnreListNode<T>(var value: T) { | |
var next: UnreListNode<T>? = null | |
var prev: UnreListNode<T>? = null | |
override fun toString(): String { | |
return "ListNode(${value}, ${next?.toString()})" | |
} | |
} |
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 Unre<T> { | |
private var listener: UnreListener<T>? = null | |
val stacks: ArrayList<UnreData<T>> = arrayListOf() | |
var currentStack: Int = -1 | |
private fun modifyStack() { | |
val newStacks = arrayListOf<UnreData<T>>() | |
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
@Composable | |
fun BubbleNotificationHost( | |
hostState: BubbleNotificationHostState, | |
modifier: Modifier = Modifier, | |
animationSpec: FiniteAnimationSpec<IntOffset> = tween(300), | |
bubbleNotification: @Composable (BubbleNotificationData) -> Unit = { BubbleNotification(it) }, | |
content: @Composable () -> Unit | |
) { | |
val currentBubbleNotificationData = hostState.currentBubbleNotificationData |
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
// inside the composable function | |
val context = LocalContext.current | |
var exoPlayer by remember { mutableStateOf<ExoPlayer?>(null) } | |
val transformerListener = remember { | |
object : Transformer.Listener { | |
override fun onTransformationCompleted(inputMediaItem: MediaItem, transformationResult: TransformationResult) { | |
super.onTransformationCompleted(inputMediaItem, transformationResult) |
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
/** | |
@author kafri8889 | |
**/ | |
class PickerManager( | |
private val context: FragmentActivity, | |
private val listener: PickerListener | |
) { | |
fun datePicker( | |
data: Any? = null, |
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
@Composable | |
fun SettingPreference( | |
preference: Preference, | |
onClick: (Any) -> Unit | |
) { | |
when (preference) { | |
is BasicPreference -> { | |
BasicPreference( | |
preference = preference, | |
onClick = onClick |
NewerOlder