diff --git a/starter-code/.idea/.name b/starter-code/.idea/.name
new file mode 100644
index 0000000..5e37776
--- /dev/null
+++ b/starter-code/.idea/.name
@@ -0,0 +1 @@
+starter-code
\ No newline at end of file
diff --git a/starter-code/.idea/compiler.xml b/starter-code/.idea/compiler.xml
new file mode 100644
index 0000000..9a8b7e5
--- /dev/null
+++ b/starter-code/.idea/compiler.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/starter-code/.idea/copyright/profiles_settings.xml b/starter-code/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/starter-code/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/starter-code/.idea/gradle.xml b/starter-code/.idea/gradle.xml
new file mode 100644
index 0000000..39139a6
--- /dev/null
+++ b/starter-code/.idea/gradle.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/starter-code/.idea/misc.xml b/starter-code/.idea/misc.xml
new file mode 100644
index 0000000..95f0f03
--- /dev/null
+++ b/starter-code/.idea/misc.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/starter-code/.idea/modules.xml b/starter-code/.idea/modules.xml
new file mode 100644
index 0000000..b66c03c
--- /dev/null
+++ b/starter-code/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/starter-code/.idea/runConfigurations.xml b/starter-code/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/starter-code/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/starter-code/.idea/vcs.xml b/starter-code/.idea/vcs.xml
new file mode 100644
index 0000000..6564d52
--- /dev/null
+++ b/starter-code/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/starter-code/app/src/main/java/generalassembly/yuliyakaleda/startercode/MainActivity.java b/starter-code/app/src/main/java/generalassembly/yuliyakaleda/startercode/MainActivity.java
index 55d1d3a..e9882d9 100644
--- a/starter-code/app/src/main/java/generalassembly/yuliyakaleda/startercode/MainActivity.java
+++ b/starter-code/app/src/main/java/generalassembly/yuliyakaleda/startercode/MainActivity.java
@@ -1,27 +1,77 @@
package generalassembly.yuliyakaleda.startercode;
-import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ListView;
import android.widget.TextView;
-public class MainActivity extends AppCompatActivity {
+import java.util.ArrayList;
+
+public class MainActivity extends AppCompatActivity implements View.OnClickListener {
+
+ ArrayList mArrayList;
+ ArrayAdapter mArrayAdapter;
+ TextView mTextView;
+ EditText mEditText;
+ Button mButton;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+
+ //TODO: set up all the view and event listeners.
+ final ListView listView = (ListView) findViewById(R.id.listview);
+ mTextView = (TextView) findViewById(R.id.textview);
+ mEditText = (EditText) findViewById(R.id.edittext);
+ mButton = (Button) findViewById(R.id.button);
+
+ mArrayList = new ArrayList();
+ mArrayAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, mArrayList);
+ listView.setAdapter(mArrayAdapter);
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+ mButton.setOnClickListener(this);
+ }
- //TODO: set up all the view and event listeners.
- }
- @Override
- public void onClick(View v) {
- // TODO: 1. get the text from the input field
- // 2. animate it in the center of the screen
- // 3. add it to the list wish
- // 4. clear the input field
- }
+ @Override
+ public void onClick(View v) {
+ if (!mEditText.getText().toString().isEmpty()) {
+ mTextView.setText(mEditText.getText().toString());
+
+ Animation animation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.animation);
+
+
+ animation.setAnimationListener(new Animation.AnimationListener() {
+ @Override
+ public void onAnimationStart(Animation animation) {
+ mEditText.setText("");
+ }
+
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ mArrayAdapter.insert(mTextView.getText().toString(), 0);
+ mArrayAdapter.notifyDataSetChanged();
+ mTextView.setText("");
+ }
+
+ @Override
+ public void onAnimationRepeat(Animation animation) {
+
+ }
+ });
+
+ mTextView.startAnimation(animation);
+ } else {
+ mEditText.setError("Please enter your wish");
+ }
+ }
}
+
diff --git a/starter-code/app/src/main/res/anim/animation.xml b/starter-code/app/src/main/res/anim/animation.xml
index 88c2c7c..53d4f78 100644
--- a/starter-code/app/src/main/res/anim/animation.xml
+++ b/starter-code/app/src/main/res/anim/animation.xml
@@ -1,11 +1,27 @@
-
-
- />
-
-
- />
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/starter-code/app/src/main/res/layout/activity_main.xml b/starter-code/app/src/main/res/layout/activity_main.xml
index b326849..5f2179c 100644
--- a/starter-code/app/src/main/res/layout/activity_main.xml
+++ b/starter-code/app/src/main/res/layout/activity_main.xml
@@ -1,14 +1,54 @@
-
+
+
+
+
+
+
+
+