Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions app/src/main/java/be/scri/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import be.scri.ui.screens.download.DataDownloadViewModel
import be.scri.ui.screens.download.DownloadActions
import be.scri.ui.screens.download.DownloadDataScreen
import be.scri.ui.screens.settings.SettingsScreen
import be.scri.ui.screens.conjugate.ConjugateScreen
import be.scri.ui.theme.ScribeTheme
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -167,13 +168,12 @@ fun ScribeApp(
}
is BottomBarScreen.Conjugate -> {
Box(
modifier =
Modifier.fillMaxSize(),
contentAlignment = Alignment.Center,
modifier = Modifier.fillMaxSize()
) {
Text(
text = "Conjugate App",
style = MaterialTheme.typography.headlineMedium,
ConjugateScreen(
isDarkTheme = isDarkTheme,
downloadStates = downloadStates,
onDownloadAction = onDownloadAction
)
}
HandleBackPress(pagerState, coroutineScope)
Expand Down
17 changes: 17 additions & 0 deletions app/src/main/java/be/scri/helpers/arabic/ARInterfaceVariables.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: GPL-3.0-or-later

package be.scri.helpers.arabic

/**
* Interface variables for Arabic language keyboards.
*/
object ARInterfaceVariables {
const val LANGUAGE = "العربية"
const val INVALID_COMMAND_MSG_WIKIDATA = "في Wikidata"
const val INVALID_COMMAND_TEXT_WIKIDATA_1 =
"Wikidata هي قاعدة بيانات معرفية يتم تحريرها بشكل تعاوني ويتم إدارتها من قبل مؤسسة ويكيميديا. تعمل كمصدر للبيانات المفتوحة لمشاريع مثل ويكيبيديا والعديد من المشاريع الأخرى."
const val INVALID_COMMAND_TEXT_WIKIDATA_2 =
"يستخدم Scribe بيانات اللغة من Wikidata للعديد من ميزاته الأساسية. نحصل على معلومات مثل أجناس الأسماء، وتصريف الأفعال والمزيد!"
const val INVALID_COMMAND_TEXT_WIKIDATA_3 =
"يمكنك إنشاء حساب في wikidata.org للانضمام إلى المجتمع الذي يدعم Scribe والعديد من المشاريع الأخرى. ساعدنا في تقديم المعلومات المجانية للعالم!"
}
17 changes: 17 additions & 0 deletions app/src/main/java/be/scri/helpers/bengali/BNInterfaceVariables.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: GPL-3.0-or-later

package be.scri.helpers.bengali

/**
* Interface variables for Bengali language keyboards.
*/
object BNInterfaceVariables {
const val LANGUAGE = "বাংলা"
const val INVALID_COMMAND_MSG_WIKIDATA = "উইকিডাটায় নেই"
const val INVALID_COMMAND_TEXT_WIKIDATA_1 =
"উইকিডাটা হল একটি সহযোগিতামূলকভাবে সম্পাদিত জ্ঞান গ্রাফ যা উইকিমিডিয়া ফাউন্ডেশন দ্বারা রক্ষণাবেক্ষণ করা হয়। এটি উইকিপিডিয়ার মতো প্রকল্প এবং আরও অনেক প্রকল্পের জন্য একটি উন্মুক্ত ডেটা উৎস হিসাবে কাজ করে।"
const val INVALID_COMMAND_TEXT_WIKIDATA_2 =
"Scribe তার অনেক মূল বৈশিষ্ট্যের জন্য উইকিডাটার ভাষার ডেটা ব্যবহার করে। আমরা যেমন তথ্য পাই: বিশেষ্য লিঙ্গ, ক্রিয়াপদ সংযোজন এবং আরও অনেক কিছু!"
const val INVALID_COMMAND_TEXT_WIKIDATA_3 =
"আপনি wikidata.org-এ একটি অ্যাকাউন্ট তৈরি করতে পারেন এবং Scribe এবং অন্যান্য অনেক প্রকল্পকে সমর্থনকারী কমিউনিটিতে যোগ দিতে পারেন। আমাদের সাহায্য করুন বিনামূল্যে তথ্য বিশ্বে পৌঁছে দিতে!"
}
17 changes: 17 additions & 0 deletions app/src/main/java/be/scri/helpers/hindi/HIInterfaceVariables.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: GPL-3.0-or-later

package be.scri.helpers.hindi

/**
* Interface variables for Hindi language keyboards.
*/
object HIInterfaceVariables {
const val LANGUAGE = "हिन्दी"
const val INVALID_COMMAND_MSG_WIKIDATA = "Wikidata में नहीं"
const val INVALID_COMMAND_TEXT_WIKIDATA_1 =
"Wikidata is a collaboratively edited knowledge graph that's maintained by the Wikimedia Foundation. It serves as a source of open data for projects like Wikipedia and countless others."
const val INVALID_COMMAND_TEXT_WIKIDATA_2 =
"Scribe uses Wikidata's language data for many of its core features. We get information like noun genders, verb conjugations and much more!"
const val INVALID_COMMAND_TEXT_WIKIDATA_3 =
"You can make an account at wikidata.org to join the community that's supporting Scribe and so many other projects. Help us bring free information to the world!"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: GPL-3.0-or-later

package be.scri.helpers.indonesian

/**
* Interface variables for Indonesian language keyboards.
*/
object IDInterfaceVariables {
const val LANGUAGE = "Indonesia"
const val INVALID_COMMAND_MSG_WIKIDATA = "Tidak dalam Wikidata"
const val INVALID_COMMAND_TEXT_WIKIDATA_1 =
"Wikidata adalah grafik pengetahuan yang disunting secara kolaboratif yang dikelola oleh Wikimedia Foundation. Ia berfungsi sebagai sumber data terbuka bagi proyek seperti Wikipedia dan berbagai proyek lainnya."
const val INVALID_COMMAND_TEXT_WIKIDATA_2 =
"Scribe menggunakan data bahasa milik Wikidata untuk banyak fitur utama. Kami mendapatkan informasi seperti kata benda bergender, konjugasi kata kerja, dan banyak lagi!"
const val INVALID_COMMAND_TEXT_WIKIDATA_3 =
"Kamu bisa membuat akun di wikidata.org untuk bergabung dengan komunitas yang mendukung Scribe dan banyak proyek lainnya. Bantu kami membawakan informasi secara gratis untuk dunia!"
}
17 changes: 17 additions & 0 deletions app/src/main/java/be/scri/helpers/kannada/KNInterfaceVariables.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: GPL-3.0-or-later

package be.scri.helpers.kannada

/**
* Interface variables for Kannada language keyboards.
*/
object KNInterfaceVariables {
const val LANGUAGE = "ಕನ್ನಡ"
const val INVALID_COMMAND_MSG_WIKIDATA = "ವಿಕಿಡೇಟಾ ನಲ್ಲಿ ಇಲ್ಲ"
const val INVALID_COMMAND_TEXT_WIKIDATA_1 =
"Wikidata is a collaboratively edited knowledge graph that's maintained by the Wikimedia Foundation. It serves as a source of open data for projects like Wikipedia and countless others."
const val INVALID_COMMAND_TEXT_WIKIDATA_2 =
"Scribe uses Wikidata's language data for many of its core features. We get information like noun genders, verb conjugations and much more!"
const val INVALID_COMMAND_TEXT_WIKIDATA_3 =
"You can make an account at wikidata.org to join the community that's supporting Scribe and so many other projects. Help us bring free information to the world!"
}
17 changes: 17 additions & 0 deletions app/src/main/java/be/scri/helpers/korean/KOInterfaceVariables.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: GPL-3.0-or-later

package be.scri.helpers.korean

/**
* Interface variables for Korean language keyboards.
*/
object KOInterfaceVariables {
const val LANGUAGE = "한국어"
const val INVALID_COMMAND_MSG_WIKIDATA = "위키데이터에 없음"
const val INVALID_COMMAND_TEXT_WIKIDATA_1 =
"위키데이터는 위키미디어 재단에 의해 유지되는 협업 편집 지식 그래프입니다. 이는 위키백과와 수많은 다른 프로젝트를 위한 개방형 데이터의 출처로 사용됩니다."
const val INVALID_COMMAND_TEXT_WIKIDATA_2 =
"Scribe는 많은 핵심 기능에서 위키데이터의 언어 데이터를 사용합니다. 우리는 명사의 성별, 동사의 활용 등 다양한 정보를 얻습니다!"
const val INVALID_COMMAND_TEXT_WIKIDATA_3 =
"wikidata.org에서 계정을 만들면 Scribe와 많은 다른 프로젝트를 지원하는 커뮤니티에 참여할 수 있습니다. 함께 세상에 유용한 정보를 나누는 데 도움을 주세요!"
}
17 changes: 17 additions & 0 deletions app/src/main/java/be/scri/helpers/marathi/MRInterfaceVariables.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: GPL-3.0-or-later

package be.scri.helpers.marathi

/**
* Interface variables for Marathi language keyboards.
*/
object MRInterfaceVariables {
const val LANGUAGE = "मराठी"
const val INVALID_COMMAND_MSG_WIKIDATA = "विकिडाटामध्ये नाही"
const val INVALID_COMMAND_TEXT_WIKIDATA_1 =
"विकिडाटा हे सहयोगाने संपादित ज्ञान ग्राफ आहे, जे विकिमीडिया फाउंडेशनद्वारा देखभाल केले जाते. हे विकिपीडिया आणि इतर अनेक प्रकल्पांसाठी खुला डेटा स्रोत आहे."
const val INVALID_COMMAND_TEXT_WIKIDATA_2 =
"स्क्राइब विकिडाटाच्या भाषा डेटाचा वापर त्याच्या अनेक मुख्य वैशिष्ट्यांसाठी करतो. आम्हाला या डेटामधून संज्ञा लिंग, क्रियापद रूपांतरण आणि इतर माहिती मिळते!"
const val INVALID_COMMAND_TEXT_WIKIDATA_3 =
"तुम्ही wikidata.org वर खाती बनवून त्या समुदायात सामील होऊ शकता, जो स्क्राइब आणि इतर अनेक प्रकल्पांना समर्थन देत आहे. आमच्यासोबत मोफत माहिती जगभर पोहचविण्यात मदत करा!"
}
17 changes: 17 additions & 0 deletions app/src/main/java/be/scri/helpers/tamil/TAInterfaceVariables.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: GPL-3.0-or-later

package be.scri.helpers.tamil

/**
* Interface variables for Tamil language keyboards.
*/
object TAInterfaceVariables {
const val LANGUAGE = "தமிழ்"
const val INVALID_COMMAND_MSG_WIKIDATA = "விக்கிடேட்டாவில் இல்லை"
const val INVALID_COMMAND_TEXT_WIKIDATA_1 =
"Wikidata is a collaboratively edited knowledge graph that's maintained by the Wikimedia Foundation. It serves as a source of open data for projects like Wikipedia and countless others."
const val INVALID_COMMAND_TEXT_WIKIDATA_2 =
"Scribe uses Wikidata's language data for many of its core features. We get information like noun genders, verb conjugations and much more!"
const val INVALID_COMMAND_TEXT_WIKIDATA_3 =
"You can make an account at wikidata.org to join the community that's supporting Scribe and so many other projects. Help us bring free information to the world!"
}
17 changes: 17 additions & 0 deletions app/src/main/java/be/scri/helpers/telugu/TEInterfaceVariables.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: GPL-3.0-or-later

package be.scri.helpers.telugu

/**
* Interface variables for Telugu language keyboards.
*/
object TEInterfaceVariables {
const val LANGUAGE = "తెలుగు"
const val INVALID_COMMAND_MSG_WIKIDATA = "వికీడేటాలో లేదు"
const val INVALID_COMMAND_TEXT_WIKIDATA_1 =
"Wikidata is a collaboratively edited knowledge graph that's maintained by the Wikimedia Foundation. It serves as a source of open data for projects like Wikipedia and countless others."
const val INVALID_COMMAND_TEXT_WIKIDATA_2 =
"Scribe uses Wikidata's language data for many of its core features. We get information like noun genders, verb conjugations and much more!"
const val INVALID_COMMAND_TEXT_WIKIDATA_3 =
"You can make an account at wikidata.org to join the community that's supporting Scribe and so many other projects. Help us bring free information to the world!"
}
17 changes: 17 additions & 0 deletions app/src/main/java/be/scri/helpers/turkish/TRInterfaceVariables.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: GPL-3.0-or-later

package be.scri.helpers.turkish

/**
* Interface variables for Turkish language keyboards.
*/
object TRInterfaceVariables {
const val LANGUAGE = "Türkçe"
const val INVALID_COMMAND_MSG_WIKIDATA = "Wikidata'da değil"
const val INVALID_COMMAND_TEXT_WIKIDATA_1 =
"Wikimedia Vakfı tarafından barındırılan Wikidata, kolaboratif çok dilli bir bilgi grafiğidir. Wikipedia ve diğer birçok projeler için açık veri kaynağı olarak hizmet eder."
const val INVALID_COMMAND_TEXT_WIKIDATA_2 =
"Scribe, birçok temel özelliği için Wikidata'nın dil verilerini kullanır. İsim cinsiyetleri, fiil çekimleri ve çok daha fazlasını Wikidata'dan alırız!"
const val INVALID_COMMAND_TEXT_WIKIDATA_3 =
"wikidata.org adresinde bir hesap oluşturabilir, Scribe'ı ve diğer birçok projeyi destekleyen bu topluluğa katılabilirsiniz. Dünya'ya ücretsiz bilgi getirmemize yardımcı olun!"
}
154 changes: 154 additions & 0 deletions app/src/main/java/be/scri/ui/screens/conjugate/ConjugateScreen.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
// SPDX-License-Identifier: GPL-3.0-or-later

package be.scri.ui.screens.conjugate

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import be.scri.R
import be.scri.ui.common.appcomponents.PageTitle
import be.scri.ui.common.components.DownloadDataOptionComp
import be.scri.ui.screens.download.DownloadState

/**
* Main Conjugate Screen displaying empty state and download action.
*/
@Composable
fun ConjugateScreen(
isDarkTheme: Boolean,
downloadStates: Map<String, DownloadState>,
onDownloadAction: (String, Boolean) -> Unit,
modifier: Modifier = Modifier,
viewModel: ConjugateViewModel = viewModel(),
) {
val isDataAvailable by viewModel.isDataAvailable.collectAsState()
val conjugateDownloadState = downloadStates["conjugate_data"] ?: DownloadState.Ready

Scaffold(
topBar = {
// Using PageTitle as a stand-in for the shared TabBar from issue #560
// if an explicit TabBar component is not present in the current branch.
PageTitle(
pageTitle = "Conjugate", // Can be replaced by i18n string
modifier = Modifier.fillMaxWidth()
)
},
modifier = modifier.fillMaxSize(),
) { paddingValues ->
Box(
modifier = Modifier
.fillMaxSize()
.padding(paddingValues),
contentAlignment = Alignment.Center
) {
if (!isDataAvailable) {
ConjugateEmptyState(
isDarkTheme = isDarkTheme,
downloadState = conjugateDownloadState,
onDownloadClick = {
onDownloadAction("conjugate_data", false)
}
)
} else {
// Next page content (out of scope for #563)
Text("Conjugation UI will be here")
}
}
}
}

/**
* The "No Data" Empty state representation for Conjugation.
*/
@Composable
fun ConjugateEmptyState(
isDarkTheme: Boolean,
downloadState: DownloadState,
onDownloadClick: () -> Unit,
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier.padding(16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
// SVG Placeholder logo
Icon(
painter = painterResource(id = R.drawable.scribe_logo),
contentDescription = null,
modifier = Modifier.size(120.dp),
tint = MaterialTheme.colorScheme.onSurfaceVariant
)

Spacer(modifier = Modifier.height(24.dp))

Text(
text = stringResource(id = R.string.i18n_app_download_menu_option_conjugate_description),
style = MaterialTheme.typography.bodyLarge,
textAlign = TextAlign.Center,
color = MaterialTheme.colorScheme.onSurface
)

Spacer(modifier = Modifier.height(32.dp))

DownloadDataOptionComp(
onClick = onDownloadClick,
isDarkTheme = isDarkTheme,
downloadState = downloadState,
modifier = Modifier.padding(horizontal = 16.dp)
)

Spacer(modifier = Modifier.height(16.dp))

Text(
text = stringResource(id = R.string.i18n_app_download_menu_option_conjugate_download_data_start),
style = MaterialTheme.typography.bodyMedium,
textAlign = TextAlign.Center,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
}
}

@androidx.compose.ui.tooling.preview.Preview(showBackground = true)
@Composable
fun ConjugateEmptyStatePreview() {
MaterialTheme {
ConjugateEmptyState(
isDarkTheme = false,
downloadState = DownloadState.Ready,
onDownloadClick = {}
)
}
}

@androidx.compose.ui.tooling.preview.Preview(showBackground = true, uiMode = android.content.res.Configuration.UI_MODE_NIGHT_YES)
@Composable
fun ConjugateEmptyStateDarkPreview() {
MaterialTheme {
ConjugateEmptyState(
isDarkTheme = true,
downloadState = DownloadState.Ready,
onDownloadClick = {}
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: GPL-3.0-or-later

package be.scri.ui.screens.conjugate

import androidx.lifecycle.ViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow

class ConjugateViewModel : ViewModel() {
private val _isDataAvailable = MutableStateFlow(false)
val isDataAvailable: StateFlow<Boolean> = _isDataAvailable.asStateFlow()

// Assuming we would check actual data availability via a repository or ConjugateDataManager.
fun checkDataAvailability(hasData: Boolean) {
_isDataAvailable.value = hasData
}
}
Loading