-
-
Save Redrield/c56e8741eb6eee98761f2fa4e0a07fdb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val pref = getSharedPreferences(getString(R.string.shared_preferences_key), Context.MODE_PRIVATE) | |
scrollView { | |
relativeLayout { | |
val layout = gridLayout { | |
columnCount = 2 | |
alignmentMode = GridLayout.ALIGN_BOUNDS | |
// Pre game | |
textView { | |
text = "Team number" | |
id = ID_TEXT_TEAM_NUMBER | |
} | |
editText { | |
text = 4069.toString().toEditable() | |
id = ID_TEAM_NUMBER | |
} | |
textView { | |
text = "Colour" | |
id = ID_TEXT_COLOUR | |
} | |
editText { | |
text = pref.getString("COLOUR", "Red").toEditable() | |
id = ID_COLOUR | |
} | |
textView { | |
text = "Match number" | |
id = ID_TEXT_MATCH_NUMBER | |
} | |
editText { | |
text = pref.getInt("MATCH_NUMBER", 1).toString().toEditable() | |
id = ID_MATCH_NUMBER | |
} | |
}.lparams(width = matchParent, height = matchParent).applyRecursively { | |
if(it is TextView || it is EditText) { | |
when (it.id) { | |
in 1..127 -> { | |
it.lparams { | |
setGravity(Gravity.START) | |
marginStart = dip(20) | |
} | |
} | |
in 128..1000000 -> { | |
it.lparams { | |
setGravity(Gravity.END) | |
marginEnd = dip(20) | |
} | |
} | |
} | |
} | |
} | |
button { | |
text = "Submit" | |
}.lparams { | |
below(layout) | |
topMargin = dip(50) | |
centerHorizontally() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment