mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-20 20:59:00 +00:00
Move handling to update tag handling to another method.
This commit is contained in:
parent
67d6626382
commit
1a246610f2
1 changed files with 22 additions and 15 deletions
|
|
@ -612,27 +612,34 @@ public class TasksFragment extends BaseMainFragment implements OnCheckedChangeLi
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
EditText tagEditText = (EditText)editTagDialogView.findViewById(R.id.tagEditText);
|
||||
String newTagName = tagEditText.getText().toString();
|
||||
|
||||
if(newTagName.equals("")) {
|
||||
return;
|
||||
}
|
||||
|
||||
UiUtils.dismissKeyboard(activity,tagEditText);
|
||||
|
||||
if(newTagName.equals(tag.getName())) {
|
||||
if(attemptUpdateTag(tagEditText,tag)) {
|
||||
alert.dismiss();
|
||||
return;
|
||||
}
|
||||
|
||||
String uuid = tag.getId();
|
||||
tag.setName(newTagName);
|
||||
EventBus.getDefault().post(new UpdateTagCommand(tag, uuid));
|
||||
alert.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean attemptUpdateTag(EditText tagEditText, Tag tag) {
|
||||
String newTagName = tagEditText.getText().toString();
|
||||
boolean dismiss = true;
|
||||
|
||||
if(newTagName.equals("")) {
|
||||
dismiss = false;
|
||||
return dismiss;
|
||||
}
|
||||
|
||||
UiUtils.dismissKeyboard(activity,tagEditText);
|
||||
|
||||
if(newTagName.equals(tag.getName())) {
|
||||
return dismiss;
|
||||
}
|
||||
|
||||
String uuid = tag.getId();
|
||||
tag.setName(newTagName);
|
||||
EventBus.getDefault().post(new UpdateTagCommand(tag, uuid));
|
||||
return dismiss;
|
||||
}
|
||||
|
||||
public void showDeleteTagDialog(AlertDialog d, Tag tag) {
|
||||
AlertDialog confirmDeleteAlert = new AlertDialog.Builder(this.activity)
|
||||
.setTitle(getString(R.string.confirm_delete_tag_title)).setMessage(getString(R.string.confirm_delete_tag_message))
|
||||
|
|
|
|||
Loading…
Reference in a new issue