Skip to content

Commit 8b20518

Browse files
authored
Merge pull request #304 from free4murad/match-bug
Match template input validation #303
2 parents 1161827 + 2780304 commit 8b20518

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

source-code/app/src/main/java/org/buildmlearn/toolkit/templates/MatchTemplate.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import android.view.View;
1111
import android.widget.BaseAdapter;
1212
import android.widget.EditText;
13-
13+
import android.widget.Toast;
1414

1515
import org.buildmlearn.toolkit.R;
1616
import org.buildmlearn.toolkit.matchtemplate.fragment.SplashFragment;
@@ -61,6 +61,9 @@ private static boolean validated(Context context, EditText title, EditText first
6161
second_list_title.hasFocus();
6262
second_list_title.setError(context.getString(R.string.match_second_list_title));
6363
return false;
64+
} else if (first_list_titleText.equalsIgnoreCase(second_list_titleText)){
65+
Toast.makeText(context, "Title of two lists cannot be same.", Toast.LENGTH_SHORT).show();
66+
return false;
6467
}
6568

6669
return true;
@@ -82,6 +85,9 @@ private static boolean validated(Context context, EditText first_list_title, Edi
8285
second_list_title.hasFocus();
8386
second_list_title.setError(context.getString(R.string.match_second_list_title));
8487
return false;
88+
} else if (second_list_titleText.equals(first_list_titleText)){
89+
Toast.makeText(context, "Two options cannot be same.", Toast.LENGTH_SHORT).show();
90+
return false;
8591
}
8692

8793
return true;

0 commit comments

Comments
 (0)