Skip to content

Commit

Permalink
Added Constants.java and video walkthrough gif.
Browse files Browse the repository at this point in the history
  • Loading branch information
davepen committed Feb 11, 2017
1 parent 258d5ba commit cb00937
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Pre-work - *Name of App Here*
# Pre-work - ToDo

ToDo is an android app that allows building a todo list and basic todo items management functionality including adding new items, editing and deleting an existing item.

Submitted by: David Penaskovic

Time spent: 5 hours spent in total
Time spent: 5 hours

## User Stories

Expand All @@ -31,7 +31,7 @@ The following **additional** features are implemented:

Here's a walkthrough of implemented user stories:

<img src='http://i.imgur.com/link/to/your/gif/file.gif' title='Video Walkthrough' width='' alt='Video Walkthrough' />
<img src='http://imgur.com/HQnuipk title=ToDo 'Video Walkthrough' width='' alt='Video Walkthrough' />

GIF created with [LiceCap](http://www.cockos.com/licecap/).

Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/com/dpenaskovic/todo/Constants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.dpenaskovic.todo;

public class Constants
{
public static final String INTENT_KEY_EDIT_TEXT = "text";
public static final String INTENT_KEY_EDIT_POSITION = "position";
}
8 changes: 4 additions & 4 deletions app/src/main/java/com/dpenaskovic/todo/EditItemActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ protected void onCreate(Bundle savedInstanceState)
buttonSave = (Button)findViewById(R.id.button);
buttonSave.setOnClickListener(new SaveButtonClickListener());

String textToEdit = getIntent().getStringExtra("text");
editItemArrayPosition = getIntent().getIntExtra("position", 0);
String textToEdit = getIntent().getStringExtra(Constants.INTENT_KEY_EDIT_TEXT);
editItemArrayPosition = getIntent().getIntExtra(Constants.INTENT_KEY_EDIT_POSITION, 0);

etItem.setText(textToEdit);
etItem.setSelection(textToEdit.length());
Expand All @@ -35,8 +35,8 @@ private class SaveButtonClickListener implements View.OnClickListener
public void onClick(View view)
{
Intent intent = new Intent();
intent.putExtra("text", etItem.getText().toString());
intent.putExtra("position", editItemArrayPosition);
intent.putExtra(Constants.INTENT_KEY_EDIT_TEXT, etItem.getText().toString());
intent.putExtra(Constants.INTENT_KEY_EDIT_POSITION, editItemArrayPosition);

setResult(RESULT_OK, intent);
finish();
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/dpenaskovic/todo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
String tappedItemText = itemsAdapter.getItem(position);

Intent intent = new Intent(MainActivity.this, EditItemActivity.class);
intent.putExtra("text", tappedItemText);
intent.putExtra("position", position);
intent.putExtra(Constants.INTENT_KEY_EDIT_TEXT, tappedItemText);
intent.putExtra(Constants.INTENT_KEY_EDIT_POSITION, position);
startActivityForResult(intent, REQUEST_CODE_EDIT_ITEM);
}
}
Expand Down

0 comments on commit cb00937

Please sign in to comment.