Skip to content
Snippets Groups Projects
Commit a9d20997 authored by Mohamed Amine Younes Bouacida's avatar Mohamed Amine Younes Bouacida
Browse files

tv profile account creation: fix the cancel behavior

+ when the user presses the back button, keep the modifications
+ minor code refactoring

Change-Id: I7dc39ebcad50cb7dbee84e10130fe4506e6be6f8
Gitlab: #628
parent 23da6b7c
Branches
Tags
No related merge requests found
...@@ -209,18 +209,35 @@ public class TVProfileCreationFragment extends RingGuidedStepFragment<ProfileCre ...@@ -209,18 +209,35 @@ public class TVProfileCreationFragment extends RingGuidedStepFragment<ProfileCre
} }
public long onGuidedActionEditedAndProceed(GuidedAction action) { public long onGuidedActionEditedAndProceed(GuidedAction action) {
if (action.getId() == USER_NAME) { switch ((int) action.getId()){
case USER_NAME:
String username = action.getEditTitle().toString(); String username = action.getEditTitle().toString();
presenter.fullNameUpdated(username); presenter.fullNameUpdated(username);
if (TextUtils.isEmpty(username)) if (username.isEmpty())
action.setTitle(getString(R.string.profile_name_hint)); action.setTitle(getString(R.string.profile_name_hint));
else else
action.setTitle(username); action.setTitle(username);
} else if (action.getId() == CAMERA) { break;
case CAMERA:
presenter.cameraClick(); presenter.cameraClick();
} else if (action.getId() == GALLERY) { break;
case GALLERY:
presenter.galleryClick(); presenter.galleryClick();
break;
} }
return super.onGuidedActionEditedAndProceed(action); return super.onGuidedActionEditedAndProceed(action);
} }
@Override
public void onGuidedActionEditCanceled(GuidedAction action) {
if ((int) action.getId() == USER_NAME) {
String username = action.getEditTitle().toString();
presenter.fullNameUpdated(username);
if (TextUtils.isEmpty(username))
action.setTitle(getString(R.string.profile_name_hint));
else
action.setTitle(username);
}
super.onGuidedActionEditCanceled(action);
}
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment