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
/** | |
* Created by Naing Aung Luu on 27/05/2022 | |
*/ | |
fun <T : Any> T.translateToAppLanguage(appLanguage: Language): T { | |
if (this::class.isData) { | |
this::class.declaredMemberProperties | |
.filter(KProperty1<out Any, *>::isATranslationProperty) | |
.map { it as KProperty1<Any, Translation<*>> } | |
.forEach { | |
it.get(this).translateToAppLanguage(appLanguage) |
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
package com.rwsentosa.mobileapp.widgets | |
import android.content.Context | |
import android.util.AttributeSet | |
import android.view.View | |
import android.widget.FrameLayout | |
import android.widget.ImageView | |
import android.widget.TextView | |
import androidx.databinding.BindingAdapter | |
import com.rwsentosa.mobileapp.R |
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
package com.rwsentosa.mobileapp.components | |
import androidx.annotation.DrawableRes | |
import androidx.compose.animation.AnimatedContent | |
import androidx.compose.animation.ExperimentalAnimationApi | |
import androidx.compose.animation.SizeTransform | |
import androidx.compose.animation.fadeIn | |
import androidx.compose.animation.fadeOut | |
import androidx.compose.animation.slideInVertically | |
import androidx.compose.animation.slideOutVertically |
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 GridItem( | |
modifier: Modifier = Modifier | |
) { | |
val interactionSource = remember { MutableInteractionSource() } | |
val indication = rememberRipple(bounded = false) | |
Box( | |
modifier = modifier.size(160.dp) | |
) { | |
Image( |
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
enum class AppLanguage(val value: String) { | |
ENGLISH("English"), | |
BURMESE("Burmese"), | |
CHINESE("Chinese"); | |
} |
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
sealed class StatefulData<out T : Any> { | |
data class Success<T : Any>(val result : T) : StatefulData<T>() | |
data class Error(val msg : String) : StatefulData<Nothing>() | |
object Loading : StatefulData<Nothing>() | |
inline fun <R : Any> map(transform: (T) -> R): StatefulData<R> { | |
return when(this) { | |
is Loading -> Loading | |
is Error -> Error(this.msg) | |
is Success -> Success(transform(this.result)) |
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.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.util.List; | |
class bubblesort { | |
public static void main(String[] args) { | |
List<String> names ; | |
try{ |