Skip to content

Commit

Permalink
fixed share data
Browse files Browse the repository at this point in the history
  • Loading branch information
yamin8000 committed Sep 11, 2023
1 parent ee3802c commit e5a59d6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ android {
applicationId "io.github.yamin8000.owl"
minSdk 21
targetSdk 34
versionCode 20
versionName "1.4.0"
versionCode 21
versionName "1.4.1"
vectorDrawables {
useSupportLibrary true
}
Expand Down Expand Up @@ -89,7 +89,7 @@ android {

dependencies {
//core android
implementation("androidx.core:core-ktx:1.10.1")
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.palette:palette-ktx:1.0.0")
//compose
def material3_version = "1.1.1"
Expand All @@ -110,7 +110,7 @@ dependencies {
implementation("io.coil-kt:coil:$coil_version")
implementation("io.coil-kt:coil-compose:$coil_version")
//navigation
def nav_version = "2.7.1"
def nav_version = "2.7.2"
implementation("androidx.navigation:navigation-compose:$nav_version")
//datastore
implementation("androidx.datastore:datastore-preferences:1.0.0")
Expand Down
41 changes: 23 additions & 18 deletions app/src/main/java/io/github/yamin8000/owl/content/home/HomeState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import retrofit2.HttpException
import java.util.Locale
import java.util.Map.entry

class HomeState(
val listState: ScrollState,
Expand Down Expand Up @@ -316,26 +315,32 @@ class HomeState(
private fun createShareText() = buildString {
append("Word: ")
append(entry.value?.word ?: "-")
append("\n")
appendLine()
append("Pronunciation(IPA): ")
append(entry.value?.phonetics?.firstOrNull { it.text != null }?.text ?: "-")
append("\n\n")
/*entry { index, item ->
if (searchResult.value.item.size > 1)
append("${index + 1})\n")
append("Definition: ${item.definition}\n\n")
item.type?.let { append("Type: $it\n\n") }
item.example?.let { append("Example: $it\n\n") }
item.emoji?.let { append("Emoji: $it") }
}*/
appendLine()
appendLine()
entry.value?.meanings?.forEachIndexed { index, meaning ->
appendLine("${index + 1})")
appendLine("Type: ${meaning.partOfSpeech}")
meaning.definitions.take(5).forEach { definition ->
appendLine("Definition: ${definition.definition}")
if (definition.example != null)
appendLine("Example: ${definition.example}")
if (definition.synonyms.isNotEmpty())
appendLine("Synonyms: ${definition.synonyms.take(5).joinToString()}")
if (definition.antonyms.isNotEmpty())
appendLine("Antonyms: ${definition.antonyms.take(5).joinToString()}")
appendLine()
}
appendLine()
}
trim()
append("\n\n")
append(context.getString(R.string.this_text_generated_using_owl))
append("\n")
append(context.getString(R.string.github_source))
append("\n")
append(context.getString(R.string.this_text_extracted_from_free_dictionary))
append("\n")
appendLine()
appendLine()
appendLine(context.getString(R.string.this_text_generated_using_owl))
appendLine(context.getString(R.string.github_source))
appendLine(context.getString(R.string.this_text_extracted_from_free_dictionary))
append(context.getString(R.string.free_dictionary_link))
}

Expand Down

0 comments on commit e5a59d6

Please # to comment.