beautiful
This commit is contained in:
parent
c06aff7133
commit
8aac0ac2f5
@ -13,6 +13,7 @@ import android.widget.Button
|
|||||||
import android.widget.HorizontalScrollView
|
import android.widget.HorizontalScrollView
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import kotlin.properties.Delegates
|
import kotlin.properties.Delegates
|
||||||
|
|
||||||
|
|
||||||
@ -25,6 +26,7 @@ class MyKeyboardService : InputMethodService() {
|
|||||||
private lateinit var keyboardContainer: LinearLayout
|
private lateinit var keyboardContainer: LinearLayout
|
||||||
private lateinit var suggestionsContainer: LinearLayout
|
private lateinit var suggestionsContainer: LinearLayout
|
||||||
private lateinit var currentInputDisplay: TextView
|
private lateinit var currentInputDisplay: TextView
|
||||||
|
private lateinit var currentTitle: TextView
|
||||||
|
|
||||||
private var isShiftActive = false
|
private var isShiftActive = false
|
||||||
private fun updateCurrentInputDisplay(text: String) {
|
private fun updateCurrentInputDisplay(text: String) {
|
||||||
@ -40,10 +42,13 @@ class MyKeyboardService : InputMethodService() {
|
|||||||
"ASDFGHJKL".toList(),
|
"ASDFGHJKL".toList(),
|
||||||
"ZXCVBNM".toList()
|
"ZXCVBNM".toList()
|
||||||
)
|
)
|
||||||
|
data class FontInfo(val resourceId: Int, val name: String)
|
||||||
private val fonts = listOf(
|
private val fonts = listOf(
|
||||||
Typeface.NORMAL,
|
FontInfo(R.font.charm_regular,"charm"),
|
||||||
// Typeface.createFromAsset(assets, "fonts/round.ttf")
|
FontInfo(R.font.ibmplexsansthai_regular,"ibm"),
|
||||||
|
FontInfo(R.font.chonburi_regular,"chonburi"),
|
||||||
|
FontInfo(R.font.judson_regular,"judson"),
|
||||||
|
FontInfo(R.font.kanit_regular, "kanit")
|
||||||
)
|
)
|
||||||
|
|
||||||
private var currentFontIndex = 0
|
private var currentFontIndex = 0
|
||||||
@ -53,6 +58,7 @@ class MyKeyboardService : InputMethodService() {
|
|||||||
val inputView = layoutInflater.inflate(R.layout.keyboard_layout, null)
|
val inputView = layoutInflater.inflate(R.layout.keyboard_layout, null)
|
||||||
|
|
||||||
// Initialize views using findViewById
|
// Initialize views using findViewById
|
||||||
|
currentTitle = inputView.findViewById(R.id.keyboard_title)
|
||||||
currentInputDisplay = inputView.findViewById(R.id.current_input_display)
|
currentInputDisplay = inputView.findViewById(R.id.current_input_display)
|
||||||
suggestionsContainer = inputView.findViewById(R.id.suggestions_container)
|
suggestionsContainer = inputView.findViewById(R.id.suggestions_container)
|
||||||
keyboardContainer = inputView.findViewById(R.id.keyboard_container)
|
keyboardContainer = inputView.findViewById(R.id.keyboard_container)
|
||||||
@ -211,7 +217,6 @@ class MyKeyboardService : InputMethodService() {
|
|||||||
val button = Button(this).apply{
|
val button = Button(this).apply{
|
||||||
text = option
|
text = option
|
||||||
textSize = 20f
|
textSize = 20f
|
||||||
// typeface = fonts[currentFontIndex] // Set the current font
|
|
||||||
setOnClickListener { onSuggestionClicked(option) }
|
setOnClickListener { onSuggestionClicked(option) }
|
||||||
layoutParams = LinearLayout.LayoutParams(
|
layoutParams = LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||||
@ -243,22 +248,17 @@ class MyKeyboardService : InputMethodService() {
|
|||||||
}
|
}
|
||||||
private fun changeFont(_thing: String){
|
private fun changeFont(_thing: String){
|
||||||
currentFontIndex = (currentFontIndex + 1) % fonts.size
|
currentFontIndex = (currentFontIndex + 1) % fonts.size
|
||||||
Log.d("THAI_IME", "🔤 Changed font to index: $currentFontIndex")
|
val currentFont = fonts[currentFontIndex]
|
||||||
// Refresh suggestions with new font
|
currentTitle.text = currentFont.name
|
||||||
redrawCurrentSuggestions()
|
val typeface = ResourcesCompat.getFont(this, currentFont.resourceId)
|
||||||
}
|
|
||||||
private fun redrawCurrentSuggestions() {
|
|
||||||
val currentButtons = mutableListOf<String>()
|
|
||||||
for (i in 0 until suggestionsContainer.childCount) {
|
for (i in 0 until suggestionsContainer.childCount) {
|
||||||
val button = suggestionsContainer.getChildAt(i) as? Button
|
val button = suggestionsContainer.getChildAt(i) as? Button
|
||||||
button?.text?.toString()?.let { currentButtons.add(it) }
|
button?.let{
|
||||||
|
it.typeface = typeface
|
||||||
|
}
|
||||||
}
|
}
|
||||||
displaySuggestions(currentButtons)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: Add methods for handling shift and number toggle
|
|
||||||
}
|
}
|
||||||
object ViewDebugUtils {
|
object ViewDebugUtils {
|
||||||
fun getViewHierarchy(view: View?, level: Int = 0): String {
|
fun getViewHierarchy(view: View?, level: Int = 0): String {
|
||||||
|
11
app/src/main/res/font/charm.xml
Normal file
11
app/src/main/res/font/charm.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="400"
|
||||||
|
android:font="@font/charm_regular" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="700"
|
||||||
|
android:font="@font/charm_bold" />
|
||||||
|
</font-family>
|
BIN
app/src/main/res/font/charm_bold.ttf
Executable file
BIN
app/src/main/res/font/charm_bold.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/charm_regular.ttf
Executable file
BIN
app/src/main/res/font/charm_regular.ttf
Executable file
Binary file not shown.
7
app/src/main/res/font/chonburi.xml
Normal file
7
app/src/main/res/font/chonburi.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="400"
|
||||||
|
android:font="@font/chonburi_regular" />
|
||||||
|
</font-family>
|
BIN
app/src/main/res/font/chonburi_regular.ttf
Executable file
BIN
app/src/main/res/font/chonburi_regular.ttf
Executable file
Binary file not shown.
31
app/src/main/res/font/ibm.xml
Normal file
31
app/src/main/res/font/ibm.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="400"
|
||||||
|
android:font="@font/ibmplexsansthai_regular" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="700"
|
||||||
|
android:font="@font/ibmplexsansthai_bold" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="250"
|
||||||
|
android:font="@font/ibmplexsansthai_light" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="100"
|
||||||
|
android:font="@font/ibmplexsansthai_extralight" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="550"
|
||||||
|
android:font="@font/ibmplexsansthai_semibold" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="300"
|
||||||
|
android:font="@font/ibmplexsansthai_medium" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="200"
|
||||||
|
android:font="@font/ibmplexsansthai_thin" />
|
||||||
|
</font-family>
|
BIN
app/src/main/res/font/ibmplexsansthai_bold.ttf
Executable file
BIN
app/src/main/res/font/ibmplexsansthai_bold.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/ibmplexsansthai_extralight.ttf
Executable file
BIN
app/src/main/res/font/ibmplexsansthai_extralight.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/ibmplexsansthai_light.ttf
Executable file
BIN
app/src/main/res/font/ibmplexsansthai_light.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/ibmplexsansthai_medium.ttf
Executable file
BIN
app/src/main/res/font/ibmplexsansthai_medium.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/ibmplexsansthai_regular.ttf
Executable file
BIN
app/src/main/res/font/ibmplexsansthai_regular.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/ibmplexsansthai_semibold.ttf
Executable file
BIN
app/src/main/res/font/ibmplexsansthai_semibold.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/ibmplexsansthai_thin.ttf
Executable file
BIN
app/src/main/res/font/ibmplexsansthai_thin.ttf
Executable file
Binary file not shown.
15
app/src/main/res/font/judson.xml
Normal file
15
app/src/main/res/font/judson.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="400"
|
||||||
|
android:font="@font/judson_regular" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="700"
|
||||||
|
android:font="@font/judson_bold" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="italic"
|
||||||
|
android:fontWeight="700"
|
||||||
|
android:font="@font/judson_italic" />
|
||||||
|
</font-family>
|
BIN
app/src/main/res/font/judson_bold.ttf
Executable file
BIN
app/src/main/res/font/judson_bold.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/judson_italic.ttf
Executable file
BIN
app/src/main/res/font/judson_italic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/judson_regular.ttf
Executable file
BIN
app/src/main/res/font/judson_regular.ttf
Executable file
Binary file not shown.
43
app/src/main/res/font/kanit.xml
Normal file
43
app/src/main/res/font/kanit.xml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="400"
|
||||||
|
android:font="@font/kanit_regular" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="700"
|
||||||
|
android:font="@font/kanit_bold" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="900"
|
||||||
|
android:font="@font/kanit_extrabold" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="250"
|
||||||
|
android:font="@font/kanit_light" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="100"
|
||||||
|
android:font="@font/kanit_extralight" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="550"
|
||||||
|
android:font="@font/kanit_semibold" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="300"
|
||||||
|
android:font="@font/kanit_medium" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="normal"
|
||||||
|
android:fontWeight="200"
|
||||||
|
android:font="@font/kanit_thin" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="italic"
|
||||||
|
android:fontWeight="250"
|
||||||
|
android:font="@font/kanit_thinitalic" />
|
||||||
|
<font
|
||||||
|
android:fontStyle="italic"
|
||||||
|
android:fontWeight="700"
|
||||||
|
android:font="@font/kanit_bolditalic" />
|
||||||
|
</font-family>
|
BIN
app/src/main/res/font/kanit_black.ttf
Executable file
BIN
app/src/main/res/font/kanit_black.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_blackitalic.ttf
Executable file
BIN
app/src/main/res/font/kanit_blackitalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_bold.ttf
Executable file
BIN
app/src/main/res/font/kanit_bold.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_bolditalic.ttf
Executable file
BIN
app/src/main/res/font/kanit_bolditalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_extrabold.ttf
Executable file
BIN
app/src/main/res/font/kanit_extrabold.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_extrabolditalic.ttf
Executable file
BIN
app/src/main/res/font/kanit_extrabolditalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_extralight.ttf
Executable file
BIN
app/src/main/res/font/kanit_extralight.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_extralightitalic.ttf
Executable file
BIN
app/src/main/res/font/kanit_extralightitalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_italic.ttf
Executable file
BIN
app/src/main/res/font/kanit_italic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_light.ttf
Executable file
BIN
app/src/main/res/font/kanit_light.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_lightitalic.ttf
Executable file
BIN
app/src/main/res/font/kanit_lightitalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_medium.ttf
Executable file
BIN
app/src/main/res/font/kanit_medium.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_mediumitalic.ttf
Executable file
BIN
app/src/main/res/font/kanit_mediumitalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_regular.ttf
Executable file
BIN
app/src/main/res/font/kanit_regular.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_semibold.ttf
Executable file
BIN
app/src/main/res/font/kanit_semibold.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_semibolditalic.ttf
Executable file
BIN
app/src/main/res/font/kanit_semibolditalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_thin.ttf
Executable file
BIN
app/src/main/res/font/kanit_thin.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kanit_thinitalic.ttf
Executable file
BIN
app/src/main/res/font/kanit_thinitalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kodchasan_bold.ttf
Executable file
BIN
app/src/main/res/font/kodchasan_bold.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kodchasan_bolditalic.ttf
Executable file
BIN
app/src/main/res/font/kodchasan_bolditalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kodchasan_extralight.ttf
Executable file
BIN
app/src/main/res/font/kodchasan_extralight.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kodchasan_extralightitalic.ttf
Executable file
BIN
app/src/main/res/font/kodchasan_extralightitalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kodchasan_italic.ttf
Executable file
BIN
app/src/main/res/font/kodchasan_italic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kodchasan_light.ttf
Executable file
BIN
app/src/main/res/font/kodchasan_light.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kodchasan_lightitalic.ttf
Executable file
BIN
app/src/main/res/font/kodchasan_lightitalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kodchasan_medium.ttf
Executable file
BIN
app/src/main/res/font/kodchasan_medium.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kodchasan_mediumitalic.ttf
Executable file
BIN
app/src/main/res/font/kodchasan_mediumitalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kodchasan_regular.ttf
Executable file
BIN
app/src/main/res/font/kodchasan_regular.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kodchasan_semibold.ttf
Executable file
BIN
app/src/main/res/font/kodchasan_semibold.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/kodchasan_semibolditalic.ttf
Executable file
BIN
app/src/main/res/font/kodchasan_semibolditalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/mali_bold.ttf
Executable file
BIN
app/src/main/res/font/mali_bold.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/mali_bolditalic.ttf
Executable file
BIN
app/src/main/res/font/mali_bolditalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/mali_extralight.ttf
Executable file
BIN
app/src/main/res/font/mali_extralight.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/mali_extralightitalic.ttf
Executable file
BIN
app/src/main/res/font/mali_extralightitalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/mali_italic.ttf
Executable file
BIN
app/src/main/res/font/mali_italic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/mali_light.ttf
Executable file
BIN
app/src/main/res/font/mali_light.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/mali_lightitalic.ttf
Executable file
BIN
app/src/main/res/font/mali_lightitalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/mali_medium.ttf
Executable file
BIN
app/src/main/res/font/mali_medium.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/mali_mediumitalic.ttf
Executable file
BIN
app/src/main/res/font/mali_mediumitalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/mali_regular.ttf
Executable file
BIN
app/src/main/res/font/mali_regular.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/mali_semibold.ttf
Executable file
BIN
app/src/main/res/font/mali_semibold.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/mali_semibolditalic.ttf
Executable file
BIN
app/src/main/res/font/mali_semibolditalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/sarabun_bold.ttf
Executable file
BIN
app/src/main/res/font/sarabun_bold.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/sarabun_bolditalic.ttf
Executable file
BIN
app/src/main/res/font/sarabun_bolditalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/sarabun_extrabold.ttf
Executable file
BIN
app/src/main/res/font/sarabun_extrabold.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/sarabun_extrabolditalic.ttf
Executable file
BIN
app/src/main/res/font/sarabun_extrabolditalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/sarabun_extralight.ttf
Executable file
BIN
app/src/main/res/font/sarabun_extralight.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/sarabun_extralightitalic.ttf
Executable file
BIN
app/src/main/res/font/sarabun_extralightitalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/sarabun_italic.ttf
Executable file
BIN
app/src/main/res/font/sarabun_italic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/sarabun_light.ttf
Executable file
BIN
app/src/main/res/font/sarabun_light.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/sarabun_lightitalic.ttf
Executable file
BIN
app/src/main/res/font/sarabun_lightitalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/sarabun_medium.ttf
Executable file
BIN
app/src/main/res/font/sarabun_medium.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/sarabun_mediumitalic.ttf
Executable file
BIN
app/src/main/res/font/sarabun_mediumitalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/sarabun_regular.ttf
Executable file
BIN
app/src/main/res/font/sarabun_regular.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/sarabun_semibold.ttf
Executable file
BIN
app/src/main/res/font/sarabun_semibold.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/sarabun_semibolditalic.ttf
Executable file
BIN
app/src/main/res/font/sarabun_semibolditalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/sarabun_thin.ttf
Executable file
BIN
app/src/main/res/font/sarabun_thin.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/sarabun_thinitalic.ttf
Executable file
BIN
app/src/main/res/font/sarabun_thinitalic.ttf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/voces_regular.ttf
Executable file
BIN
app/src/main/res/font/voces_regular.ttf
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user