Skip to content

Instantly share code, notes, and snippets.

View serhatleventyavas's full-sized avatar
🎯
Focusing

Serhat Levent Yavaş serhatleventyavas

🎯
Focusing
View GitHub Profile
@serhatleventyavas
serhatleventyavas / TextInputLayout.kt
Created November 9, 2020 08:32
TextInputLayout Kotlin Example
val relativeLayout = view.findViewById<RelativeLayout>(R.id.edit_profile_relative_layout)
val emailTextInputLayout = TextInputLayout(requireContext(), null, R.style.Widget_MaterialComponents_TextInputLayout_OutlinedBox)
val emailTextInputLayoutParams : LinearLayout.LayoutParams = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
)
emailTextInputLayout.hint = "Please Enter Email Address"
emailTextInputLayout.boxBackgroundMode = TextInputLayout.BOX_BACKGROUND_OUTLINE
emailTextInputLayout.setBackgroundColor(Color.WHITE)
emailTextInputLayoutParams.setMargins(0,0,0,10)
@SuppressLint("Recycle")
class CurrencyEditText @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = com.google.android.material.R.attr.editTextStyle
): TextInputEditText(context, attrs, defStyleAttr) {
private var current = ""
private val editText = this@CurrencyEditText
private var currency = ""
import android.content.res.Configuration
import android.content.res.Resources
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.google.android.material.snackbar.Snackbar
fun requestTaskDirection(requestedUrl: String) {
viewModelScope.launch {
var routes: List<List<HashMap<String, String>>> = listOf()
withContext(Dispatchers.IO) {
// background io thread
val responseString = getDirectionFromPlaceApi(requestedUrl)
routes = parseDirection(responseString)
}
var points: ArrayList<LatLng>? = null