Skip to content
Snippets Groups Projects
Commit 6c11f62b authored by Unknown's avatar Unknown
Browse files

onActivityResult with Kotlin safety

parent 2b494cb0
No related branches found
No related tags found
No related merge requests found
Pipeline #
Loading
Loading
@@ -267,11 +267,11 @@ class AddIssueActivity : MorphActivity() {
}
}
 
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
REQUEST_LABEL -> if (resultCode == Activity.RESULT_OK) {
val label = Parcels.unwrap<Label>(data.getParcelableExtra<Parcelable>(AddLabelActivity.KEY_LABEL))
val label = Parcels.unwrap<Label>(data?.getParcelableExtra<Parcelable>(AddLabelActivity.KEY_LABEL))
if (adapterLabels.containsLabel(label)) {
Snackbar.make(root, R.string.label_already_added, Snackbar.LENGTH_SHORT)
.show()
Loading
Loading
Loading
Loading
@@ -96,11 +96,11 @@ class AddLabelActivity : BaseActivity() {
load()
}
 
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
REQUEST_NEW_LABEL -> if (resultCode == Activity.RESULT_OK) {
val newLabel = Parcels.unwrap<Label>(data.getParcelableExtra<Parcelable>(AddNewLabelActivity.KEY_NEW_LABEL))
val newLabel = Parcels.unwrap<Label>(data?.getParcelableExtra<Parcelable>(AddNewLabelActivity.KEY_NEW_LABEL))
adapterLabel.addLabel(newLabel)
}
}
Loading
Loading
Loading
Loading
@@ -95,7 +95,7 @@ class AttachActivity : BaseActivity() {
project = Parcels.unwrap<Project>(intent.getParcelableExtra<Parcelable>(KEY_PROJECT))
}
 
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
EasyImage.handleActivityResult(requestCode, resultCode, data, this, object : DefaultCallback() {
override fun onImagePickerError(e: Exception?, source: EasyImage.ImageSource?, type: Int) {
Loading
Loading
Loading
Loading
@@ -232,11 +232,11 @@ class IssueActivity : BaseActivity() {
}
}
 
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
REQUEST_ATTACH -> if (resultCode == Activity.RESULT_OK) {
val response = Parcels.unwrap<FileUploadResponse>(data.getParcelableExtra<Parcelable>(AttachActivity.KEY_FILE_UPLOAD_RESPONSE))
val response = Parcels.unwrap<FileUploadResponse>(data?.getParcelableExtra<Parcelable>(AttachActivity.KEY_FILE_UPLOAD_RESPONSE))
progress.visibility = View.GONE
sendMessageView.appendText(response.markdown)
} else {
Loading
Loading
Loading
Loading
@@ -40,7 +40,7 @@ class LaunchActivity : BaseActivity() {
figureOutWhatToDo()
}
 
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
REQUEST_DEVICE_AUTH -> if (resultCode == Activity.RESULT_OK) {
Loading
Loading
Loading
Loading
@@ -205,11 +205,11 @@ class LoginActivity : BaseActivity() {
textUrl.setText(R.string.url_gitlab)
}
 
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
REQUEST_PRIVATE_TOKEN -> if (resultCode == Activity.RESULT_OK) {
val token = data.getStringExtra(WebLoginActivity.EXTRA_TOKEN)
val token = data?.getStringExtra(WebLoginActivity.EXTRA_TOKEN)
textInputLayoutToken.editText!!.setText(token)
}
}
Loading
Loading
Loading
Loading
@@ -152,11 +152,11 @@ class ProjectActivity : BaseActivity() {
}
}
 
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
REQUEST_BRANCH_OR_TAG -> if (resultCode == Activity.RESULT_OK) {
ref = Parcels.unwrap<Ref>(data.getParcelableExtra<Parcelable>(PickBranchOrTagActivity.EXTRA_REF))
ref = Parcels.unwrap<Ref>(data?.getParcelableExtra<Parcelable>(PickBranchOrTagActivity.EXTRA_REF))
broadcastLoad()
}
}
Loading
Loading
Loading
Loading
@@ -74,11 +74,11 @@ class ProjectFeedWidgetConfigureActivity : BaseActivity() {
loadAccounts()
}
 
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
REQUEST_PROJECT -> if (resultCode == Activity.RESULT_OK) {
val project = Parcels.unwrap<Project>(data.getParcelableExtra<Parcelable>(ProjectFeedWidgetConfigureProjectActivity.EXTRA_PROJECT))
val project = Parcels.unwrap<Project>(data?.getParcelableExtra<Parcelable>(ProjectFeedWidgetConfigureProjectActivity.EXTRA_PROJECT))
saveWidgetConfig(account!!, project)
}
}
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment