Skip to content

Instantly share code, notes, and snippets.

View mbobiosio's full-sized avatar
🎯
Focusing

Mbuodile Obiosio mbobiosio

🎯
Focusing
View GitHub Profile
/**
Usage for extensions.
Initialize Moshi in your Converter class
*/
private val moshi: Moshi = Moshi.Builder()
.add(KotlinJsonAdapterFactory())
.build()
/**
* [Moshi] extension to transform a [List] to Json
@mbobiosio
mbobiosio / Extensions.kt
Last active November 15, 2023 16:58 — forked from albertogiunta/Extensions.kt
Extension functions (Kotlin) & build.gradle files for Android projects
/**
* ANY
*/
fun Any.toJson(): String = GsonInitializer.toJson(this)
/**
* String to Inches
**/
internal fun convertStringToInches(centimeters: String) : String =
(BigDecimal(centimeters.toDouble() * 0.393701).setScale(3, RpundingMode.HALF_EVEN)).toString()
{
"app_name": "My App",
"example_text_view_key": "Hello, World!",
"settings_title": "Settings",
"language_title": "Language",
"select_language": "Select Language",
"display_name": "English",
"ok_button": "OK",
"cancel_button": "Cancel",
"home_feature": "Changed Home"
{
"app_name": "My App",
"example_text_view_key": "Hello, World!",
"settings_title": "Settings",
"language_title": "Language",
"select_language": "Select Language",
"display_name": "English",
"ok_button": "OK",
"cancel_button": "Cancel",
"home_feature": "Changed Home"