From dd5cd30ce3af1be37f685e2b86705d967ac6893f Mon Sep 17 00:00:00 2001 From: Nick DeGroot Date: Mon, 20 Mar 2017 10:54:45 -0700 Subject: [PATCH 01/11] Added ability to delete existing assignments. --- README.md | 1 + app/app.iml | 1 + app/build.gradle | 6 +++--- app/src/main/AndroidManifest.xml | 10 ++++------ .../java/com/nbdeg/unityplanner/editAssignment.java | 8 ++++++++ .../main/java/com/nbdeg/unityplanner/editClass.java | 13 +++++++++++++ .../main/res/layout/activity_edit_assignment.xml | 9 +++++++++ app/src/main/res/layout/activity_edit_class.xml | 8 ++++++++ app/src/main/res/values/strings.xml | 4 +--- 9 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 app/src/main/java/com/nbdeg/unityplanner/editClass.java create mode 100644 app/src/main/res/layout/activity_edit_class.xml diff --git a/README.md b/README.md index da91f6c..b560e3c 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,4 @@ The student planner app created to unify and simplify your school life. This app is being used as a project to help me learn Android Development. + diff --git a/app/app.iml b/app/app.iml index 9d777ba..4d8f89a 100644 --- a/app/app.iml +++ b/app/app.iml @@ -99,6 +99,7 @@ + diff --git a/app/build.gradle b/app/build.gradle index a8ee65e..d0ee73a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -33,21 +33,21 @@ dependencies { compile('com.google.api-client:google-api-client-android:1.22.0') { exclude group: 'org.apache.httpcomponents' } + + + compile 'com.android.support:appcompat-v7:25.3.0' compile 'com.android.support:design:25.3.0' compile 'com.android.support:cardview-v7:25.3.0' compile 'com.android.support:recyclerview-v7:25.3.0' compile 'com.android.support:support-v4:25.3.0' compile 'com.android.support.constraint:constraint-layout:1.0.0-beta3' - compile 'com.google.firebase:firebase-core:10.2.0' compile 'com.google.firebase:firebase-auth:10.2.0' compile 'com.google.firebase:firebase-messaging:10.2.0' compile 'com.google.firebase:firebase-database:10.2.0' - compile 'com.firebaseui:firebase-ui-auth:1.2.0' compile 'com.firebaseui:firebase-ui-database:1.2.0' - compile 'com.google.android.gms:play-services-auth:10.2.0' compile 'pub.devrel:easypermissions:0.2.1' compile 'com.squareup.picasso:picasso:2.5.2' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e205169..1750bc4 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,16 +13,14 @@ android:label="@string/app_name" android:supportsRtl="false" android:theme="@style/AppTheme"> - - - + @@ -47,7 +45,6 @@ android:host="https://www.nbdeg.com" android:pathPrefix="/unityplanner" android:scheme="http" /> - + - - + + \ No newline at end of file diff --git a/app/src/main/java/com/nbdeg/unityplanner/editAssignment.java b/app/src/main/java/com/nbdeg/unityplanner/editAssignment.java index 5c87aa2..4e2693e 100644 --- a/app/src/main/java/com/nbdeg/unityplanner/editAssignment.java +++ b/app/src/main/java/com/nbdeg/unityplanner/editAssignment.java @@ -7,6 +7,7 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; +import android.view.View; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.SeekBar; @@ -40,6 +41,7 @@ public class editAssignment extends AppCompatActivity { private String assignmentExtra; private Date assignmentDueDate; private String oldAssignmentID; + private DatabaseReference assignmentReference; Database db = new Database(); @@ -104,6 +106,7 @@ public void onDataChange(DataSnapshot dataSnapshot) { assignmentExtra = assignment.getExtra(); assignmentDueDate = new Date(assignment.getDueDate()); percentComplete = assignment.getPercent(); + assignmentReference = userSnapshot.getRef(); // Set Existing Data mAssignmentName.setText(assignmentName); @@ -147,4 +150,9 @@ public boolean onOptionsItemSelected(MenuItem item) { return super.onOptionsItemSelected(item); } + + public void deleteAssignment(View view) { + assignmentReference.removeValue(); + startActivity(new Intent(editAssignment.this, MainActivity.class)); + } } diff --git a/app/src/main/java/com/nbdeg/unityplanner/editClass.java b/app/src/main/java/com/nbdeg/unityplanner/editClass.java new file mode 100644 index 0000000..706a22e --- /dev/null +++ b/app/src/main/java/com/nbdeg/unityplanner/editClass.java @@ -0,0 +1,13 @@ +package com.nbdeg.unityplanner; + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; + +public class editClass extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_edit_class); + } +} diff --git a/app/src/main/res/layout/activity_edit_assignment.xml b/app/src/main/res/layout/activity_edit_assignment.xml index b6ccdd8..e9ba0d0 100644 --- a/app/src/main/res/layout/activity_edit_assignment.xml +++ b/app/src/main/res/layout/activity_edit_assignment.xml @@ -113,4 +113,13 @@ android:padding="5dp" android:background="@null" /> +