-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
user model update in sample, corrected annotation for method update i…
…n lib
- Loading branch information
luca
committed
Oct 21, 2019
1 parent
3681fec
commit 05e4e92
Showing
25 changed files
with
282 additions
and
95 deletions.
There are no files selected for viewing
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
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
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
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
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
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
72 changes: 72 additions & 0 deletions
72
sampleapp/src/main/java/com/kirkbushman/sampleapp/activities/UserUpdateActivity.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.kirkbushman.sampleapp.activities | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.kirkbushman.sampleapp.R | ||
import com.kirkbushman.sampleapp.SampleApplication | ||
import com.kirkbushman.sampleapp.doAsync | ||
import com.kirkbushman.sampleapp.showToast | ||
import com.kirkbushman.zammad.models.User | ||
import kotlinx.android.synthetic.main.activity_user_update.* | ||
|
||
class UserUpdateActivity : AppCompatActivity() { | ||
|
||
companion object { | ||
|
||
private const val PARAM_USER = "intent_param_user" | ||
|
||
fun start(context: Context, user: User) { | ||
|
||
val intent = Intent(context, UserUpdateActivity::class.java) | ||
intent.putExtra(PARAM_USER, user) | ||
|
||
context.startActivity(intent) | ||
} | ||
} | ||
|
||
private val client by lazy { SampleApplication.instance.getClient() } | ||
private val user by lazy { intent.getParcelableExtra<User>(PARAM_USER)!! } | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_user_update) | ||
|
||
user_firstname.setText(user.firstname) | ||
user_lastname.setText(user.lastname) | ||
user_active.isChecked = user.active | ||
user_email.setText(user.email) | ||
user_phone.setText(user.phone) | ||
user_mobile.setText(user.mobile) | ||
user_note.setText(user.note) | ||
|
||
bttn_submit.setOnClickListener { | ||
|
||
val firstname = user_firstname.text.toString() | ||
val lastname = user_lastname.text.toString() | ||
val active = user_active.isChecked | ||
val email = user_email.text.toString() | ||
val phone = user_phone.text.toString() | ||
val mobile = user_mobile.text.toString() | ||
val note = user_note.text.toString() | ||
|
||
doAsync(doWork = { | ||
|
||
client?.updateUser( | ||
id = user.id, | ||
firstname = firstname, | ||
lastname = lastname, | ||
active = active, | ||
email = email, | ||
phone = phone, | ||
mobile = mobile, | ||
note = note | ||
) | ||
}, onPost = { | ||
|
||
showToast("User Updated!") | ||
}) | ||
} | ||
} | ||
} |
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
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
7 changes: 0 additions & 7 deletions
7
sampleapp/src/main/java/com/kirkbushman/sampleapp/controllers/OnOrganizationCallback.kt
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
sampleapp/src/main/java/com/kirkbushman/sampleapp/controllers/OnPriorityCallback.kt
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
sampleapp/src/main/java/com/kirkbushman/sampleapp/controllers/OnStateCallback.kt
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
.../sampleapp/controllers/OnGroupCallback.kt → .../sampleapp/controllers/OnUpDelCallback.kt
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
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
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
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
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
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
Oops, something went wrong.