@@ -21,18 +21,15 @@ public class LinkingValidatorDialog extends Dialog implements AdapterView.OnItem
2121
2222 private enum ROUTING_TYPE { CANONICAL_URL , DEEPLINK_PATH , CUSTOM }
2323 private ROUTING_TYPE routingType ;
24- private Button ctaButton ;
25- private Spinner linkingValidatorDropdownMenu ;
26- private TextView linkingValidatorText ;
27- private EditText linkingValidatorEditText ;
28- private LinearLayout customKVPField ;
29- private LinearLayout linkingValidatorRowsLayout ;
24+ private final Button ctaButton ;
25+ private final Spinner linkingValidatorDropdownMenu ;
26+ private final TextView linkingValidatorText ;
27+ private final EditText linkingValidatorEditText ;
28+ private final LinearLayout customKVPField ;
29+ private final LinearLayout linkingValidatorRowsLayout ;
3030 private int step = 1 ;
3131 private String routingKey = "" ;
3232 private String routingValue = "" ;
33- private EditText customKeyEditText ;
34- private EditText customValueEditText ;
35- private Context context ;
3633 private LinkingValidatorDialogRowItem row1 ;
3734 private LinkingValidatorDialogRowItem row2 ;
3835 private LinkingValidatorDialogRowItem row3 ;
@@ -42,7 +39,6 @@ private enum ROUTING_TYPE { CANONICAL_URL, DEEPLINK_PATH, CUSTOM }
4239
4340 public LinkingValidatorDialog (final Context context ) {
4441 super (context );
45- this .context = context ;
4642 requestWindowFeature (Window .FEATURE_NO_TITLE );
4743 this .setContentView (R .layout .dialog_linking_validator );
4844
@@ -59,10 +55,16 @@ public LinkingValidatorDialog(final Context context) {
5955 ctaButton = findViewById (R .id .linkingValidatorButton );
6056 ctaButton .setText (LinkingValidatorConstants .step1ButtonText );
6157 ctaButton .setOnClickListener (view -> {
62- if (step == 1 ) {
63- LoadStep2Screen ();
64- } else {
65- GenerateBranchLinks ();
58+ switch (step ) {
59+ case 1 :
60+ LoadStep2Screen ();
61+ break ;
62+ case 2 :
63+ GenerateBranchLinks ();
64+ break ;
65+ case 3 :
66+ CloseDialog ();
67+ break ;
6668 }
6769 });
6870
@@ -132,13 +134,15 @@ void LoadStep2Screen() {
132134 }
133135
134136 void GenerateBranchLinks () {
137+ step ++;
135138 linkingValidatorEditText .setVisibility (View .GONE );
139+ customKVPField .setVisibility (View .GONE );
136140 linkingValidatorText .setVisibility (View .GONE );
137141 ctaButton .setText (LinkingValidatorConstants .step3ButtonText );
138142 linkingValidatorRowsLayout .setVisibility (View .VISIBLE );
139143
140- customKeyEditText = findViewById (R .id .keyEditText );
141- customValueEditText = findViewById (R .id .valueEditText );
144+ EditText customKeyEditText = findViewById (R .id .keyEditText );
145+ EditText customValueEditText = findViewById (R .id .valueEditText );
142146
143147 //if routing key is empty, it is a custom key outside of $canonical_url and $deeplink_path
144148 if (routingKey .isEmpty ()) {
@@ -153,4 +157,8 @@ void GenerateBranchLinks() {
153157 row5 .InitializeRow (LinkingValidatorConstants .linkingValidatorRow5Title , LinkingValidatorConstants .infoButton5Copy , LinkingValidatorConstants .debugButton5Copy , routingKey , routingValue , "warmStartUseCase" , false , 4 );
154158 row6 .InitializeRow (LinkingValidatorConstants .linkingValidatorRow6Title , LinkingValidatorConstants .infoButton6Copy , LinkingValidatorConstants .debugButton6Copy , routingKey , routingValue , "foregroundClickUseCase" , false , 5 );
155159 }
160+
161+ private void CloseDialog () {
162+ this .dismiss ();
163+ }
156164}
0 commit comments