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
private fun btnSendActions(binding: ActivityHomeBinding) { | |
if (binding?.editTextUserName?.text?.toString()?.isNotBlank()!!) { | |
moveForward(WelcomeActivity(), EXTRA_PARAM_USER_NAME, binding.editTextUserName.text.toString()) | |
} | |
else showAlertDialog("Please, fill input correctly.") | |
} |
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
private fun btnSendActions(binding: ActivityHomeBinding) { | |
if (binding?.editTextUserName?.text?.toString()?.isNotBlank()!!) { | |
val intent = Intent(this, WelcomeActivity().javaClass) | |
intent.putExtra(EXTRA_PARAM_USER_NAME, binding.editTextUserName.text.toString()) | |
startActivity(intent) | |
return | |
} | |
val alert = AlertDialog.Builder(this).create() | |
alert.setMessage("Please, fill input correctly.") |
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
if ( binding != null | |
&& binding.editTextUserName != null | |
&& binding.editTextUserName.getText() != null | |
&& binding.editTextUserName.getText().toString() != null | |
&& binding.editTextUserName.getText().toString().length() > 0 ) |
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
fun Activity.moveForward(activity: Activity, param: String, paramValue: String) { | |
val intent = Intent(this, activity.javaClass) | |
if(paramValue != null) { intent.putExtra(param, paramValue) } | |
startActivity(intent) | |
} | |
fun Activity.showAlertDialog(message: String) { | |
val alert = AlertDialog.Builder(this).create() | |
alert.setMessage(message) | |
alert.setButton(Dialog.BUTTON_POSITIVE, "OK") { _, _ -> alert.dismiss() } |
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
<?xml version="1.0" encoding="utf-8"?> | |
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools"> | |
<data> | |
<variable | |
name="user" | |
type="com.gcherubini.model.User" /> | |
</data> |
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
data class User ( val name: String ) |
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 bread = "bread" | |
val myNewBread = bread?.let { "Brand new $it" } | |
print(myNewBread) |
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
intent?.extras?.getString(EXTRA_PARAM_USER_NAME)?.let { | |
binding?.user = User(it) | |
} |
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
if(getIntent() != null | |
&& getIntent().getExtras() != null | |
&& getIntent().getExtras().getString(EXTRA_PARAM_USER_NAME) != null | |
&& binding != null) { | |
User user = new User(getIntent().getExtras().getString(EXTRA_PARAM_USER_NAME)); | |
binding.setUser(user); | |
} |
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
if (binding?.editTextUserName?.text?.toString()?.isNotBlank()!!) |