Skip to content
Snippets Groups Projects
Commit 70f0c8ed authored by adi.bk's avatar adi.bk
Browse files

Extract the value of SwitchCompat and send it to the server while creating and editing issues

parent 9607da8d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -8,6 +8,7 @@ import android.os.Parcelable
import android.support.design.widget.Snackbar
import android.support.design.widget.TextInputLayout
import android.support.v7.app.AlertDialog
import android.support.v7.widget.SwitchCompat
import android.support.v7.widget.Toolbar
import android.text.TextUtils
import android.view.View
Loading
Loading
@@ -87,6 +88,8 @@ class AddIssueActivity : MorphActivity() {
lateinit var rootAddLabels: ViewGroup
@BindView(R.id.list_labels)
lateinit var listLabels: AdapterFlowLayout
@BindView(R.id.confidential_switch)
lateinit var switchConfidential: SwitchCompat
 
lateinit var adapterLabels: AddIssueLabelAdapter
lateinit var teleprinter: Teleprinter
Loading
Loading
@@ -239,6 +242,7 @@ class AddIssueActivity : MorphActivity() {
if (!TextUtils.isEmpty(issue!!.description)) {
textDescription.setText(issue!!.description)
}
switchConfidential.isChecked = issue!!.isConfidential
}
 
private fun setAssignees() {
Loading
Loading
@@ -324,14 +328,15 @@ class AddIssueActivity : MorphActivity() {
textDescription.text.toString(),
assigneeId,
milestoneId,
labelsCommaSeperated)
labelsCommaSeperated,
switchConfidential.isChecked)
} else {
textInputLayoutTitle.error = getString(R.string.required_field)
}
}
 
private fun createOrSaveIssue(title: String, description: String, assigneeId: Long?,
milestoneId: Long?, labels: String?) {
milestoneId: Long?, labels: String?, isConfidential: Boolean) {
if (issue == null) {
observeUpdate(App.get().gitLab.createIssue(
project.id,
Loading
Loading
@@ -339,7 +344,8 @@ class AddIssueActivity : MorphActivity() {
description,
assigneeId,
milestoneId,
labels))
labels,
isConfidential))
} else {
observeUpdate(App.get().gitLab.updateIssue(project.id,
issue!!.id,
Loading
Loading
@@ -347,7 +353,8 @@ class AddIssueActivity : MorphActivity() {
description,
assigneeId,
milestoneId,
labels))
labels,
isConfidential))
}
}
 
Loading
Loading
Loading
Loading
@@ -252,7 +252,8 @@ interface GitLab {
@Field("description") description: String,
@Field("assignee_id") assigneeId: Long?,
@Field("milestone_id") milestoneId: Long?,
@Field("labels") commaSeparatedLabelNames: String?): Single<Issue>
@Field("labels") commaSeparatedLabelNames: String?,
@Field("confidential") isConfidential: Boolean): Single<Issue>
 
@PUT(API_VERSION + "/projects/{id}/issues/{issue_id}")
fun updateIssue(@Path("id") projectId: Long,
Loading
Loading
@@ -261,7 +262,8 @@ interface GitLab {
@Query("description") description: String,
@Query("assignee_id") assigneeId: Long?,
@Query("milestone_id") milestoneId: Long?,
@Query("labels") commaSeparatedLabelNames: String?): Single<Issue>
@Query("labels") commaSeparatedLabelNames: String?,
@Query("confidential") isConfidential: Boolean): Single<Issue>
 
@PUT(API_VERSION + "/projects/{id}/issues/{issue_id}")
fun updateIssueStatus(@Path("id") projectId: Long,
Loading
Loading
Loading
Loading
@@ -58,6 +58,8 @@ public class Issue {
UserBasic assignee;
@JsonField(name = "author")
UserBasic author;
@JsonField(name = "confidential")
boolean confidential;
 
public Issue() {
}
Loading
Loading
@@ -117,6 +119,10 @@ public class Issue {
.build();
}
 
public boolean isConfidential() {
return confidential;
}
@Override
public boolean equals(Object o) {
if (!(o instanceof Issue)) {
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