Skip to content

Commit f63c511

Browse files
committed
Fixed Issue: #27
1 parent a7efde9 commit f63c511

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void addItem(final Activity activity) {
9898
.title(R.string.info_add_new_title)
9999
.customView(R.layout.flash_dialog_add_edit_item, true)
100100
.positiveText(R.string.info_template_add)
101-
.negativeText(R.string.info_template_delete)
101+
.negativeText(R.string.info_template_cancel)
102102
.build();
103103

104104
final EditText question = (EditText) dialog.findViewById(R.id.flash_question);
@@ -152,16 +152,16 @@ public void onClick(View v) {
152152

153153

154154
@Override
155-
public void editItem(final Activity activity, int position) {
155+
public void editItem(final Activity activity, final int position) {
156156
mIsPhotoAttached = true;
157157

158158
FlashCardModel data = mData.get(position);
159159

160160
final MaterialDialog dialog = new MaterialDialog.Builder(activity)
161-
.title(R.string.info_add_new_title)
161+
.title(R.string.info_edit_title)
162162
.customView(R.layout.flash_dialog_add_edit_item, true)
163-
.positiveText(R.string.info_template_add)
164-
.negativeText(R.string.info_template_delete)
163+
.positiveText(R.string.info_template_ok)
164+
.negativeText(R.string.info_template_cancel)
165165
.build();
166166

167167
final EditText question = (EditText) dialog.findViewById(R.id.flash_question);
@@ -207,7 +207,7 @@ public void onClick(View v) {
207207
String questionText = question.getText().toString();
208208
String answerText = answer.getText().toString();
209209
String hintText = answerHint.getText().toString();
210-
mData.add(new FlashCardModel(questionText, answerText, hintText, bitmap));
210+
mData.set(position, new FlashCardModel(questionText, answerText, hintText, bitmap));
211211
mAdapter.notifyDataSetChanged();
212212
}
213213

source-code/app/src/main/res/values/strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@
5050
<string name="info_template_edit">Edit</string>
5151
<string name="info_template_add">Add</string>
5252
<string name="info_template_delete">Delete</string>
53+
<string name="info_template_ok">OK</string>
54+
<string name="info_template_cancel">Cancel</string>
5355
<string name="info_add_new_title">Add new item</string>
56+
<string name="info_edit_title">Edit item</string>
5457
<string name="info_delete_item_content">Are you sure you want to delete this item?</string>
5558
<string name="info_template">InfoTemplate</string>
5659

0 commit comments

Comments
 (0)