Skip to content

Commit

Permalink
Mock word suggestion list
Browse files Browse the repository at this point in the history
  • Loading branch information
Sreang Rathanak committed Dec 22, 2023
1 parent eaf726e commit 5048195
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
package com.rathanak.khmerroman.keyboard.smartbar

import android.util.Log
import android.view.View
import android.view.inputmethod.ExtractedTextRequest
import android.widget.Button
import android.widget.LinearLayout
import androidx.core.graphics.drawable.DrawableCompat
import androidx.core.view.children
import com.rathanak.khmerroman.R
import com.rathanak.khmerroman.keyboard.R2KhmerService
import com.rathanak.khmerroman.keyboard.common.Styles
import kotlinx.android.synthetic.main.smartbar.view.btnOpenApp
import kotlinx.android.synthetic.main.smartbar.view.numbersList
import kotlinx.android.synthetic.main.smartbar.view.smartbar
import kotlinx.android.synthetic.main.spell_suggestion.view.spellSuggestionList
import kotlinx.android.synthetic.main.spell_suggestion.view.noDataText
import kotlinx.android.synthetic.main.spell_suggestion.view.noInternetConnection

class SpellSuggestionManager(private val r_2_khmer: R2KhmerService) {
var spellSuggestionView: LinearLayout? = null
private var isDarkMood: Boolean = false
var spellSuggestionAdapter: SpellSuggestionAdapter? = null
var spellSuggestionItems: ArrayList<SpellSuggestionItem> = ArrayList()
fun createSpellSuggestionView(): LinearLayout {
var spellSuggestionView = View.inflate(r_2_khmer.context, R.layout.spell_suggestion, null) as LinearLayout
this.spellSuggestionView = spellSuggestionView
Expand All @@ -32,16 +31,22 @@ class SpellSuggestionManager(private val r_2_khmer: R2KhmerService) {
wordsList.add(WordSuggestion("ការពិនិត្យ", 14, 22))
wordsList.add(WordSuggestion("ការពិនិត្យ", 14, 22))
wordsList.add(WordSuggestion("ការពិនិត្យ", 14, 22))
spellSuggestionItems.add(SpellSuggestionItem("កាពិនិត្យ", wordsList))
spellSuggestionItems.add(SpellSuggestionItem("កាពិនិត្យ", wordsList))
spellSuggestionItems.add(SpellSuggestionItem( "កាពិនិត្យ", wordsList))
spellSuggestionItems.add(SpellSuggestionItem( "កាពិនិត្យ", wordsList))
spellSuggestionItems.add(SpellSuggestionItem( "កាពិនិត្យ", wordsList))
spellSuggestionItems.add(SpellSuggestionItem( "កាពិនិត្យ", wordsList))

var arrayList: ArrayList<SpellSuggestionItem> = ArrayList()
arrayList.add(SpellSuggestionItem("កាពិនិត្យ", wordsList))
arrayList.add(SpellSuggestionItem("កាពិនិត្យ", wordsList))
arrayList.add(SpellSuggestionItem( "កាពិនិត្យ", wordsList))
arrayList.add(SpellSuggestionItem( "កាពិនិត្យ", wordsList))
arrayList.add(SpellSuggestionItem( "កាពិនិត្យ", wordsList))
arrayList.add(SpellSuggestionItem( "កាពិនិត្យ", wordsList))
var adapter = SpellSuggestionAdapter(r_2_khmer, r_2_khmer.context, arrayList)
listView.adapter = adapter
spellSuggestionAdapter = SpellSuggestionAdapter(r_2_khmer, r_2_khmer.context, spellSuggestionItems)
listView.adapter = spellSuggestionAdapter
val emptyView = spellSuggestionView.noDataText
var noInternet = spellSuggestionView.noInternetConnection
if(true) {
listView.emptyView = emptyView
} else {
listView.emptyView = noInternet
}

return spellSuggestionView
}
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/res/layout/spell_suggestion.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,22 @@
android:layout_width="match_parent"
android:layout_height="@dimen/spell_suggestion_height">
</ListView>
<TextView
android:text="@string/spell_suggestion_no_result"
android:layout_width="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:id="@+id/noDataText"
android:textColor="@color/colorPrimary"
android:layout_height="@dimen/spell_suggestion_height">
</TextView>
<TextView
android:text="@string/spell_suggestion_no_internet"
android:layout_width="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:id="@+id/noInternetConnection"
android:textColor="@color/danger"
android:layout_height="@dimen/spell_suggestion_height">
</TextView>
</LinearLayout>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,7 @@
<string name="app_name_on_key"></string>
<!-- //R2ខ្មែរ-->
<string name="app_name_on_key_kh"></string>
<string name="spell_suggestion_no_result">រកមិនឃើញកំហុសទេ !!</string>
<string name="spell_suggestion_no_internet">មិនអាចភ្ជាប់ទៅម៉ាស៊ីនមេ!</string>
<!-- ខ្មែរ-->
</resources>

0 comments on commit 5048195

Please sign in to comment.