diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 61a9130..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 5cd135a..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index 0380d8d..0000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index d5d35ec..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 797acea..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 63d7bd1..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# Nullvoid_Subscription-Manager \ No newline at end of file diff --git a/app/src/main/java/com/polymath/subscriptionmanager/EditorActivity.java b/app/src/main/java/com/polymath/subscriptionmanager/EditorActivity.java index 0d62c7e..5794df9 100644 --- a/app/src/main/java/com/polymath/subscriptionmanager/EditorActivity.java +++ b/app/src/main/java/com/polymath/subscriptionmanager/EditorActivity.java @@ -1,8 +1,15 @@ package com.polymath.subscriptionmanager; import android.content.ContentValues; + +import android.database.sqlite.SQLiteDatabase; +import android.os.Bundle; + +import android.content.Intent; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; +import android.provider.CalendarContract; + import android.view.Menu; import android.view.MenuItem; import android.widget.EditText; @@ -16,6 +23,12 @@ import com.polymath.subscriptionmanager.data.SubscriptionContract.*; import com.polymath.subscriptionmanager.data.SubscriptionDbHelper; + + +import java.util.Calendar; +import java.util.GregorianCalendar; + + public class EditorActivity extends AppCompatActivity { private EditText mNameEditText; @@ -85,6 +98,30 @@ private void insertCalendarIntent() //TODO:Throw Calendar Intent + + //Extracting the End Date from the StartDate + GregorianCalendar endDate = new GregorianCalendar(year, month, date); + endDate.add(Calendar.DAY_OF_MONTH, days-1); + + //Making a calendar Intent + Intent calIntent = new Intent(Intent.ACTION_INSERT); + calIntent.setType("vnd.android.cursor.item/event"); + calIntent.putExtra(CalendarContract.Events.TITLE, "Subscription Reminder for "+nameString); + calIntent.putExtra(CalendarContract.Events.DESCRIPTION, "This is the reminder by the Subscription Reminder app to cancel " + + "your subscription for the service "+nameString+". Your subscription will auto-renew tomorrow. Please " + + "cancel your subscription now to avoid being charged for the next session period :)"); + + + calIntent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, false); + calIntent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, + endDate.getTimeInMillis()+32400000); + calIntent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, + endDate.getTimeInMillis()+32700000); + + //Throw Calendar Intent + startActivity(calIntent); + + //TODO:Display }