diff --git a/app/build.gradle b/app/build.gradle
index 175b137..4b9e4d5 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -23,4 +23,6 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
+ compile 'com.github.bumptech.glide:glide:3.6.1'
+ compile 'io.realm:realm-android:0.87.1'
}
diff --git a/app/src/main/java/slidenerd/vivz/bucketdrops/ActivityMain.java b/app/src/main/java/slidenerd/vivz/bucketdrops/ActivityMain.java
index 44bf38b..e836fb2 100644
--- a/app/src/main/java/slidenerd/vivz/bucketdrops/ActivityMain.java
+++ b/app/src/main/java/slidenerd/vivz/bucketdrops/ActivityMain.java
@@ -1,13 +1,48 @@
package slidenerd.vivz.bucketdrops;
-import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageView;
+
+import com.bumptech.glide.Glide;
public class ActivityMain extends AppCompatActivity {
+ Toolbar mToolbar;
+ Button mBtnAdd;
+ private View.OnClickListener mBtnAddListener = new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ showDialogAdd();
+ }
+ };
+
+ private void showDialogAdd() {
+ DialogAdd dialog = new DialogAdd();
+ dialog.show(getSupportFragmentManager(),"Add");
+ }
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
+ mToolbar = (Toolbar) findViewById(R.id.toolbar);
+ mBtnAdd = (Button) findViewById(R.id.btn_add);
+
+ mBtnAdd.setOnClickListener(mBtnAddListener);
+ setSupportActionBar(mToolbar);
+ initBackgroundImage();
+ }
+
+ private void initBackgroundImage() {
+ ImageView background = (ImageView) findViewById(R.id.iv_background);
+ Glide.with(this)
+ .load(R.drawable.background)
+ .centerCrop()
+ .into(background);
}
}
diff --git a/app/src/main/java/slidenerd/vivz/bucketdrops/DialogAdd.java b/app/src/main/java/slidenerd/vivz/bucketdrops/DialogAdd.java
new file mode 100644
index 0000000..f78fb75
--- /dev/null
+++ b/app/src/main/java/slidenerd/vivz/bucketdrops/DialogAdd.java
@@ -0,0 +1,77 @@
+package slidenerd.vivz.bucketdrops;
+
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v4.app.DialogFragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.DatePicker;
+import android.widget.EditText;
+import android.widget.ImageButton;
+
+import io.realm.Realm;
+import io.realm.RealmConfiguration;
+import slidenerd.vivz.bucketdrops.beans.Drop;
+
+/**
+ * Created by vivz on 28/12/15.
+ */
+public class DialogAdd extends DialogFragment {
+
+ private ImageButton mBtnClose;
+ private EditText mInputWhat;
+ private DatePicker mInputWhen;
+ private Button mBtnAdd;
+
+ private View.OnClickListener mBtnClickListener = new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ int id =v.getId();
+ switch (id){
+ case R.id.btn_add_it:
+ addAction();
+ break;
+ }
+ dismiss();
+ }
+ };
+
+ private void addAction() {
+ //get the value of the 'goal' or 'to-do'
+ //get the time when it was added
+ String what=mInputWhat.getText().toString();
+ long now = System.currentTimeMillis();
+ RealmConfiguration configuration=new RealmConfiguration.Builder(getActivity()).build();
+ Realm.setDefaultConfiguration(configuration);
+ Realm realm=Realm.getDefaultInstance();
+ Drop drop= new Drop(what, now, 0, false);
+ realm.beginTransaction();
+ realm.copyToRealm(drop);
+ realm.commitTransaction();
+ realm.close();
+
+ }
+
+ public DialogAdd() {
+ }
+
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.dialog_add, container, false);
+ }
+
+ @Override
+ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ mBtnClose = (ImageButton) view.findViewById(R.id.btn_close);
+ mInputWhat = (EditText) view.findViewById(R.id.et_drop);
+ mInputWhen = (DatePicker) view.findViewById(R.id.bpv_date);
+ mBtnAdd = (Button) view.findViewById(R.id.btn_add_it);
+
+ mBtnClose.setOnClickListener(mBtnClickListener);
+ mBtnAdd.setOnClickListener(mBtnClickListener);
+ }
+}
diff --git a/app/src/main/java/slidenerd/vivz/bucketdrops/beans/Drop.java b/app/src/main/java/slidenerd/vivz/bucketdrops/beans/Drop.java
new file mode 100644
index 0000000..418802b
--- /dev/null
+++ b/app/src/main/java/slidenerd/vivz/bucketdrops/beans/Drop.java
@@ -0,0 +1,57 @@
+package slidenerd.vivz.bucketdrops.beans;
+
+import io.realm.RealmObject;
+import io.realm.annotations.PrimaryKey;
+
+/**
+ * Created by vivz on 30/12/15.
+ */
+public class Drop extends RealmObject {
+ public Drop(String what, long added, long when, boolean completed) {
+ this.what = what;
+ this.added = added;
+ this.when = when;
+ this.completed = completed;
+ }
+
+ private String what;
+ @PrimaryKey
+ private long added;
+ private long when;
+ private boolean completed;
+
+ public Drop() {
+ }
+
+ public String getWhat() {
+ return what;
+ }
+
+ public void setWhat(String what) {
+ this.what = what;
+ }
+
+ public long getAdded() {
+ return added;
+ }
+
+ public void setAdded(long added) {
+ this.added = added;
+ }
+
+ public long getWhen() {
+ return when;
+ }
+
+ public void setWhen(long when) {
+ this.when = when;
+ }
+
+ public boolean isCompleted() {
+ return completed;
+ }
+
+ public void setCompleted(boolean completed) {
+ this.completed = completed;
+ }
+}
diff --git a/app/src/main/res/color/btn_add_color.xml b/app/src/main/res/color/btn_add_color.xml
new file mode 100644
index 0000000..bcfe559
--- /dev/null
+++ b/app/src/main/res/color/btn_add_color.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable-hdpi/ic_close.png b/app/src/main/res/drawable-hdpi/ic_close.png
new file mode 100644
index 0000000..0d83919
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_close.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_close.png b/app/src/main/res/drawable-mdpi/ic_close.png
new file mode 100644
index 0000000..385abea
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_close.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_close.png b/app/src/main/res/drawable-xhdpi/ic_close.png
new file mode 100644
index 0000000..1b79d0b
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_close.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_close.png b/app/src/main/res/drawable-xxhdpi/ic_close.png
new file mode 100644
index 0000000..783a624
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_close.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_close.png b/app/src/main/res/drawable-xxxhdpi/ic_close.png
new file mode 100644
index 0000000..6e484ec
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_close.png differ
diff --git a/app/src/main/res/drawable/android.png b/app/src/main/res/drawable/android.png
new file mode 100644
index 0000000..799d0a1
Binary files /dev/null and b/app/src/main/res/drawable/android.png differ
diff --git a/app/src/main/res/drawable/background.png b/app/src/main/res/drawable/background.png
new file mode 100755
index 0000000..04b98d6
Binary files /dev/null and b/app/src/main/res/drawable/background.png differ
diff --git a/app/src/main/res/drawable/bg_btn_add_it.xml b/app/src/main/res/drawable/bg_btn_add_it.xml
new file mode 100644
index 0000000..8751a08
--- /dev/null
+++ b/app/src/main/res/drawable/bg_btn_add_it.xml
@@ -0,0 +1,16 @@
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/logo_large.png b/app/src/main/res/drawable/logo_large.png
new file mode 100644
index 0000000..e0cd775
Binary files /dev/null and b/app/src/main/res/drawable/logo_large.png differ
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 0e4bb05..e582ca3 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -3,14 +3,18 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingBottom="@dimen/activity_vertical_margin"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
tools:context="slidenerd.vivz.bucketdrops.ActivityMain">
-
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/dialog_add.xml b/app/src/main/res/layout/dialog_add.xml
new file mode 100644
index 0000000..04bd9bc
--- /dev/null
+++ b/app/src/main/res/layout/dialog_add.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/empty_drops.xml b/app/src/main/res/layout/empty_drops.xml
new file mode 100644
index 0000000..83c6a05
--- /dev/null
+++ b/app/src/main/res/layout/empty_drops.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/toolbar.xml b/app/src/main/res/layout/toolbar.xml
new file mode 100644
index 0000000..52c055f
--- /dev/null
+++ b/app/src/main/res/layout/toolbar.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 3ab3e9c..07eedc0 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -3,4 +3,7 @@
#3F51B5
#303F9F
#FF4081
+ #B691FF
+ #05FFCA
+ #241543
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 47c8224..e3c850b 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -2,4 +2,21 @@
16dp
16dp
+
+
+ 2dp
+ 2dp
+ 1dp
+
+
+ 192dp
+ 84dp
+
+
+ 24dp
+ 8dp
+ 60dp
+ 28sp
+ 36dp
+ 18sp
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1fe4f6c..8bf3cf7 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,3 +1,7 @@
BucketDrops
+ Add a drop
+ sans-serif-thin
+ What is it?
+ Add It
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 5885930..5e404d9 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,7 +1,7 @@
-