Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Talking Reminder
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
RAUSHAN RAJ
Talking Reminder
Commits
8c87a0cf
Commit
8c87a0cf
authored
Nov 26, 2019
by
RAUSHAN RAJ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Firebase auth and data pushing working
parent
e9ed32f3
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
310 additions
and
145 deletions
+310
-145
README.md
README.md
+2
-2
app/build.gradle
app/build.gradle
+6
-6
app/src/main/java/com/sudogeeks/talking_reminder/AlarmReceiver.java
...in/java/com/sudogeeks/talking_reminder/AlarmReceiver.java
+26
-6
app/src/main/java/com/sudogeeks/talking_reminder/BootReceiver.java
...ain/java/com/sudogeeks/talking_reminder/BootReceiver.java
+2
-2
app/src/main/java/com/sudogeeks/talking_reminder/MainActivity.java
...ain/java/com/sudogeeks/talking_reminder/MainActivity.java
+136
-33
app/src/main/java/com/sudogeeks/talking_reminder/NotificationHelper.java
...va/com/sudogeeks/talking_reminder/NotificationHelper.java
+3
-3
app/src/main/java/com/sudogeeks/talking_reminder/ReminderAddActivity.java
...a/com/sudogeeks/talking_reminder/ReminderAddActivity.java
+29
-13
app/src/main/java/com/sudogeeks/talking_reminder/ReminderDO.java
.../main/java/com/sudogeeks/talking_reminder/ReminderDO.java
+29
-5
app/src/main/java/com/sudogeeks/talking_reminder/ReminderDatabase.java
...java/com/sudogeeks/talking_reminder/ReminderDatabase.java
+39
-39
app/src/main/java/com/sudogeeks/talking_reminder/ReminderEditActivity.java
.../com/sudogeeks/talking_reminder/ReminderEditActivity.java
+21
-21
app/src/main/java/com/sudogeeks/talking_reminder/ReminderReceiveActivity.java
...m/sudogeeks/talking_reminder/ReminderReceiveActivity.java
+4
-4
app/src/main/res/menu/main_menu.xml
app/src/main/res/menu/main_menu.xml
+8
-8
app/src/main/res/values/colors.xml
app/src/main/res/values/colors.xml
+2
-0
app/src/main/res/values/strings.xml
app/src/main/res/values/strings.xml
+2
-1
app/src/main/res/values/styles.xml
app/src/main/res/values/styles.xml
+1
-2
No files found.
README.md
View file @
8c87a0cf
# Remindly
# Remindly
Android reminder app
Android reminder
DO
app
Features
Features
-------
-------
-
Material Design UI
-
Material Design UI
-
Repeating reminder
s
. Set intervals in minutes, hours, days, weeks and months
-
Repeating reminder
DOS
. Set intervals in minutes, hours, days, weeks and months
-
Completely free and ad-free
-
Completely free and ad-free
...
...
app/build.gradle
View file @
8c87a0cf
...
@@ -7,7 +7,7 @@ android {
...
@@ -7,7 +7,7 @@ android {
buildToolsVersion
"29.0.2"
buildToolsVersion
"29.0.2"
defaultConfig
{
defaultConfig
{
applicationId
"com.
blanyal.remindme
"
applicationId
"com.
sudogeeks.talking_reminder
"
minSdkVersion
16
minSdkVersion
16
targetSdkVersion
29
targetSdkVersion
29
versionCode
2
versionCode
2
...
@@ -41,13 +41,13 @@ dependencies {
...
@@ -41,13 +41,13 @@ dependencies {
implementation
'org.jetbrains:annotations-java5:15.0'
implementation
'org.jetbrains:annotations-java5:15.0'
// add the Firebase SDK Dependencies
// add the Firebase SDK Dependencies
//
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation
'com.google.firebase:firebase-analytics:17.2.0'
//
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation
'com.google.firebase:firebase-database:19.2.0'
//
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation
'com.google.firebase:firebase-auth:19.1.0'
//
implementation 'com.firebaseui:firebase-ui-auth:6.0.2'
implementation
'com.firebaseui:firebase-ui-auth:6.0.2'
// implementation 'com.google.firebase:firebase-appindexing:19.0.0'
// implementation 'com.google.firebase:firebase-appindexing:19.0.0'
// implementation 'com.google.firebase:firebase-firestore:21.2.0'
// implementation 'com.google.firebase:firebase-firestore:21.2.0'
// implementation 'com.google.gms:google-services:4.3.2'
// implementation 'com.google.gms:google-services:4.3.2'
// implementation 'com.google.firebase:firebase-storage:19.1.0'
// implementation 'com.google.firebase:firebase-storage:19.1.0'
}
}
//apply plugin: 'com.google.gms.google-services'
apply
plugin:
'com.google.gms.google-services'
\ No newline at end of file
\ No newline at end of file
app/src/main/java/com/sudogeeks/talking_reminder/AlarmReceiver.java
View file @
8c87a0cf
...
@@ -14,19 +14,33 @@ import androidx.core.app.NotificationCompat;
...
@@ -14,19 +14,33 @@ import androidx.core.app.NotificationCompat;
import
java.util.Calendar
;
import
java.util.Calendar
;
/** \brief A class to do something
*
* description class ke andar
*
*
*
*
*/
public
class
AlarmReceiver
extends
BroadcastReceiver
{
public
class
AlarmReceiver
extends
BroadcastReceiver
{
AlarmManager
mAlarmManager
;
AlarmManager
mAlarmManager
;
PendingIntent
mPendingIntent
;
PendingIntent
mPendingIntent
;
@Override
@Override
/** description
* @param context: what context is
* @return void
*
*
*/
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
int
mReceivedID
=
Integer
.
parseInt
(
intent
.
getStringExtra
(
ReminderEditActivity
.
EXTRA_REMINDER_ID
));
int
mReceivedID
=
Integer
.
parseInt
(
intent
.
getStringExtra
(
ReminderEditActivity
.
EXTRA_REMINDER_ID
));
//Get notification title from Reminder Database
//Get notification title from Reminder
DO
Database
ReminderDatabase
rb
=
new
ReminderDatabase
(
context
);
ReminderDatabase
rb
=
new
ReminderDatabase
(
context
);
Reminder
reminder
=
rb
.
getReminder
(
mReceivedID
);
Reminder
DO
reminderDO
=
rb
.
getReminder
(
mReceivedID
);
String
mTitle
=
reminder
.
getTitle
();
String
mTitle
=
reminder
DO
.
getTitle
();
// Create intent to open ReminderEditActivity on notification click
// Create intent to open ReminderEditActivity on notification click
...
@@ -80,10 +94,16 @@ public class AlarmReceiver extends BroadcastReceiver {
...
@@ -80,10 +94,16 @@ public class AlarmReceiver extends BroadcastReceiver {
}
}
/**
*
* @param context
* @param calendar
* @param ID
*/
public
void
setAlarm
(
Context
context
,
Calendar
calendar
,
int
ID
)
{
public
void
setAlarm
(
Context
context
,
Calendar
calendar
,
int
ID
)
{
mAlarmManager
=
(
AlarmManager
)
context
.
getSystemService
(
Context
.
ALARM_SERVICE
);
mAlarmManager
=
(
AlarmManager
)
context
.
getSystemService
(
Context
.
ALARM_SERVICE
);
// Put Reminder ID in Intent Extra
// Put Reminder
DO
ID in Intent Extra
Intent
intent
=
new
Intent
(
context
,
AlarmReceiver
.
class
);
Intent
intent
=
new
Intent
(
context
,
AlarmReceiver
.
class
);
intent
.
putExtra
(
ReminderEditActivity
.
EXTRA_REMINDER_ID
,
Integer
.
toString
(
ID
));
intent
.
putExtra
(
ReminderEditActivity
.
EXTRA_REMINDER_ID
,
Integer
.
toString
(
ID
));
mPendingIntent
=
PendingIntent
.
getBroadcast
(
context
,
ID
,
intent
,
PendingIntent
.
FLAG_CANCEL_CURRENT
);
mPendingIntent
=
PendingIntent
.
getBroadcast
(
context
,
ID
,
intent
,
PendingIntent
.
FLAG_CANCEL_CURRENT
);
...
@@ -109,7 +129,7 @@ public class AlarmReceiver extends BroadcastReceiver {
...
@@ -109,7 +129,7 @@ public class AlarmReceiver extends BroadcastReceiver {
public
void
setRepeatAlarm
(
Context
context
,
Calendar
calendar
,
int
ID
,
long
RepeatTime
)
{
public
void
setRepeatAlarm
(
Context
context
,
Calendar
calendar
,
int
ID
,
long
RepeatTime
)
{
mAlarmManager
=
(
AlarmManager
)
context
.
getSystemService
(
Context
.
ALARM_SERVICE
);
mAlarmManager
=
(
AlarmManager
)
context
.
getSystemService
(
Context
.
ALARM_SERVICE
);
// Put Reminder ID in Intent Extra
// Put Reminder
DO
ID in Intent Extra
Intent
intent
=
new
Intent
(
context
,
AlarmReceiver
.
class
);
Intent
intent
=
new
Intent
(
context
,
AlarmReceiver
.
class
);
intent
.
putExtra
(
ReminderEditActivity
.
EXTRA_REMINDER_ID
,
Integer
.
toString
(
ID
));
intent
.
putExtra
(
ReminderEditActivity
.
EXTRA_REMINDER_ID
,
Integer
.
toString
(
ID
));
mPendingIntent
=
PendingIntent
.
getBroadcast
(
context
,
ID
,
intent
,
PendingIntent
.
FLAG_CANCEL_CURRENT
);
mPendingIntent
=
PendingIntent
.
getBroadcast
(
context
,
ID
,
intent
,
PendingIntent
.
FLAG_CANCEL_CURRENT
);
...
@@ -135,7 +155,7 @@ public class AlarmReceiver extends BroadcastReceiver {
...
@@ -135,7 +155,7 @@ public class AlarmReceiver extends BroadcastReceiver {
public
void
cancelAlarm
(
Context
context
,
int
ID
)
{
public
void
cancelAlarm
(
Context
context
,
int
ID
)
{
mAlarmManager
=
(
AlarmManager
)
context
.
getSystemService
(
Context
.
ALARM_SERVICE
);
mAlarmManager
=
(
AlarmManager
)
context
.
getSystemService
(
Context
.
ALARM_SERVICE
);
// Cancel Alarm using Reminder ID
// Cancel Alarm using Reminder
DO
ID
mPendingIntent
=
PendingIntent
.
getBroadcast
(
context
,
ID
,
new
Intent
(
context
,
AlarmReceiver
.
class
),
0
);
mPendingIntent
=
PendingIntent
.
getBroadcast
(
context
,
ID
,
new
Intent
(
context
,
AlarmReceiver
.
class
),
0
);
mAlarmManager
.
cancel
(
mPendingIntent
);
mAlarmManager
.
cancel
(
mPendingIntent
);
...
...
app/src/main/java/com/sudogeeks/talking_reminder/BootReceiver.java
View file @
8c87a0cf
...
@@ -38,9 +38,9 @@ public class BootReceiver extends BroadcastReceiver {
...
@@ -38,9 +38,9 @@ public class BootReceiver extends BroadcastReceiver {
mCalendar
=
Calendar
.
getInstance
();
mCalendar
=
Calendar
.
getInstance
();
mAlarmReceiver
=
new
AlarmReceiver
();
mAlarmReceiver
=
new
AlarmReceiver
();
List
<
Reminder
>
reminders
=
rb
.
getAllReminders
();
List
<
Reminder
DO
>
reminderDOS
=
rb
.
getAllReminders
();
for
(
Reminder
rm
:
reminders
)
{
for
(
Reminder
DO
rm
:
reminderDOS
)
{
mReceivedID
=
rm
.
getID
();
mReceivedID
=
rm
.
getID
();
mRepeat
=
rm
.
getRepeat
();
mRepeat
=
rm
.
getRepeat
();
mRepeatNo
=
rm
.
getRepeatNo
();
mRepeatNo
=
rm
.
getRepeatNo
();
...
...
app/src/main/java/com/sudogeeks/talking_reminder/MainActivity.java
View file @
8c87a0cf
This diff is collapsed.
Click to expand it.
app/src/main/java/com/sudogeeks/talking_reminder/NotificationHelper.java
View file @
8c87a0cf
...
@@ -36,10 +36,10 @@ public class NotificationHelper extends ContextWrapper {
...
@@ -36,10 +36,10 @@ public class NotificationHelper extends ContextWrapper {
}
}
int
mReceivedID
=
Integer
.
parseInt
(
intent
.
getStringExtra
(
ReminderEditActivity
.
EXTRA_REMINDER_ID
));
int
mReceivedID
=
Integer
.
parseInt
(
intent
.
getStringExtra
(
ReminderEditActivity
.
EXTRA_REMINDER_ID
));
//
//
//Get notification title from Reminder Database
//Get notification title from Reminder
DO
Database
ReminderDatabase
rb
=
new
ReminderDatabase
(
base
);
ReminderDatabase
rb
=
new
ReminderDatabase
(
base
);
Reminder
reminder
=
rb
.
getReminder
(
mReceivedID
);
Reminder
DO
reminderDO
=
rb
.
getReminder
(
mReceivedID
);
mTitle
=
reminder
.
getTitle
();
mTitle
=
reminder
DO
.
getTitle
();
// Create intent to open ReminderEditActivity on notification click
// Create intent to open ReminderEditActivity on notification click
Intent
editIntent
=
new
Intent
(
base
,
ReminderEditActivity
.
class
);
Intent
editIntent
=
new
Intent
(
base
,
ReminderEditActivity
.
class
);
...
...
app/src/main/java/com/sudogeeks/talking_reminder/ReminderAddActivity.java
View file @
8c87a0cf
...
@@ -31,6 +31,10 @@ import androidx.core.content.ContextCompat;
...
@@ -31,6 +31,10 @@ import androidx.core.content.ContextCompat;
import
androidx.core.content.FileProvider
;
import
androidx.core.content.FileProvider
;
import
com.google.android.material.floatingactionbutton.FloatingActionButton
;
import
com.google.android.material.floatingactionbutton.FloatingActionButton
;
import
com.google.firebase.auth.FirebaseAuth
;
import
com.google.firebase.auth.FirebaseUser
;
import
com.google.firebase.database.DatabaseReference
;
import
com.google.firebase.database.FirebaseDatabase
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
import
com.google.gson.GsonBuilder
;
...
@@ -71,6 +75,10 @@ public class ReminderAddActivity extends AppCompatActivity {
...
@@ -71,6 +75,10 @@ public class ReminderAddActivity extends AppCompatActivity {
private
String
mRepeatType
;
private
String
mRepeatType
;
private
String
mActive
;
private
String
mActive
;
private
FirebaseAuth
firebaseAuth
=
FirebaseAuth
.
getInstance
();
private
FirebaseDatabase
firebaseDatabase
=
FirebaseDatabase
.
getInstance
();
private
DatabaseReference
dbReference
=
firebaseDatabase
.
getReference
().
child
(
"reminders"
);
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
...
@@ -109,7 +117,7 @@ public class ReminderAddActivity extends AppCompatActivity {
...
@@ -109,7 +117,7 @@ public class ReminderAddActivity extends AppCompatActivity {
mDate
=
mDay
+
"/"
+
mMonth
+
"/"
+
mYear
;
mDate
=
mDay
+
"/"
+
mMonth
+
"/"
+
mYear
;
mTime
=
mHour
+
":"
+
mMinute
;
mTime
=
mHour
+
":"
+
mMinute
;
// Setup Reminder Title EditText
// Setup Reminder
DO
Title EditText
mTitleText
.
addTextChangedListener
(
new
TextWatcher
()
{
mTitleText
.
addTextChangedListener
(
new
TextWatcher
()
{
@Override
@Override
...
@@ -358,16 +366,16 @@ public class ReminderAddActivity extends AppCompatActivity {
...
@@ -358,16 +366,16 @@ public class ReminderAddActivity extends AppCompatActivity {
mRepeatNoText = (TextView) findViewById(R.id.set_repeat_no);
mRepeatNoText = (TextView) findViewById(R.id.set_repeat_no);
mRepeatTypeText = (TextView) findViewById(R.id.set_repeat_type);
mRepeatTypeText = (TextView) findViewById(R.id.set_repeat_type);
*/
*/
Reminder
talkingReminder
=
new
Reminder
();
Reminder
DO
talkingReminderDO
=
new
ReminderDO
();
talkingReminder
.
setTitle
(
mTitle
);
talkingReminder
DO
.
setTitle
(
mTitle
);
talkingReminder
.
setDate
(
mDate
);
talkingReminder
DO
.
setDate
(
mDate
);
talkingReminder
.
setTime
(
mTime
);
talkingReminder
DO
.
setTime
(
mTime
);
talkingReminder
.
setRepeat
(
mRepeat
);
talkingReminder
DO
.
setRepeat
(
mRepeat
);
talkingReminder
.
setRepeatNo
(
mRepeatNo
);
talkingReminder
DO
.
setRepeatNo
(
mRepeatNo
);
talkingReminder
.
setRepeatType
(
mRepeatType
);
talkingReminder
DO
.
setRepeatType
(
mRepeatType
);
Gson
gson
=
new
GsonBuilder
().
setPrettyPrinting
().
create
();
Gson
gson
=
new
GsonBuilder
().
setPrettyPrinting
().
create
();
//String fileName=Environment.getExternalStorageDirectory()+"talkingReminder.json";
//String fileName=Environment.getExternalStorageDirectory()+"talkingReminder
DO
.json";
//First write the data to a temporary file
//First write the data to a temporary file
FileOutputStream
outputStream
;
FileOutputStream
outputStream
;
...
@@ -384,7 +392,7 @@ public class ReminderAddActivity extends AppCompatActivity {
...
@@ -384,7 +392,7 @@ public class ReminderAddActivity extends AppCompatActivity {
}
}
try
{
try
{
String
fileContents
=
gson
.
toJson
(
talkingReminder
);
String
fileContents
=
gson
.
toJson
(
talkingReminder
DO
);
outputStream
=
openFileOutput
(
filename
,
Context
.
MODE_PRIVATE
);
outputStream
=
openFileOutput
(
filename
,
Context
.
MODE_PRIVATE
);
outputStream
.
write
(
fileContents
.
getBytes
());
outputStream
.
write
(
fileContents
.
getBytes
());
outputStream
.
close
();
outputStream
.
close
();
...
@@ -403,8 +411,16 @@ public class ReminderAddActivity extends AppCompatActivity {
...
@@ -403,8 +411,16 @@ public class ReminderAddActivity extends AppCompatActivity {
public
void
saveReminder
()
{
public
void
saveReminder
()
{
ReminderDatabase
rb
=
new
ReminderDatabase
(
this
);
ReminderDatabase
rb
=
new
ReminderDatabase
(
this
);
// Creating Reminder
// Creating ReminderDO
int
ID
=
rb
.
addReminder
(
new
Reminder
(
mTitle
,
mDate
,
mTime
,
mRepeat
,
mRepeatNo
,
mRepeatType
,
mActive
));
int
ID
=
rb
.
addReminder
(
new
ReminderDO
(
mTitle
,
mDate
,
mTime
,
mRepeat
,
mRepeatNo
,
mRepeatType
,
mActive
));
//Storing Reminders in firebase database
ReminderDO
reminderDO
=
new
ReminderDO
(
mTitle
,
mDate
,
mTime
,
mRepeat
,
mRepeatNo
,
mRepeatType
,
mActive
);
FirebaseUser
user
=
firebaseAuth
.
getCurrentUser
();
reminderDO
.
setOwnerID
(
user
.
getEmail
());
reminderDO
.
setReceiverID
(
"null"
);
dbReference
.
child
(
user
.
getUid
()).
push
().
setValue
(
reminderDO
);
// Set up calender for creating the notification
// Set up calender for creating the notification
mCalendar
.
set
(
Calendar
.
MONTH
,
--
mMonth
);
mCalendar
.
set
(
Calendar
.
MONTH
,
--
mMonth
);
...
@@ -473,7 +489,7 @@ public class ReminderAddActivity extends AppCompatActivity {
...
@@ -473,7 +489,7 @@ public class ReminderAddActivity extends AppCompatActivity {
mTitleText
.
setText
(
mTitle
);
mTitleText
.
setText
(
mTitle
);
if
(
mTitleText
.
getText
().
toString
().
trim
().
length
()
==
0
)
if
(
mTitleText
.
getText
().
toString
().
trim
().
length
()
==
0
)
mTitleText
.
setError
(
"Reminder Title cannot be blank!"
);
mTitleText
.
setError
(
"Reminder
DO
Title cannot be blank!"
);
else
{
else
{
saveReminder
();
saveReminder
();
...
...
app/src/main/java/com/sudogeeks/talking_reminder/ReminderDO.java
View file @
8c87a0cf
package
com.sudogeeks.talking_reminder
;
package
com.sudogeeks.talking_reminder
;
// Reminder class
import
lombok.Data
;
public
class
Reminder
{
import
lombok.EqualsAndHashCode
;
import
lombok.ToString
;
// ReminderDO class
//@Data
@Data
public
class
ReminderDO
{
private
int
mID
;
private
int
mID
;
private
String
mTitle
;
private
String
mTitle
;
private
String
mDate
;
private
String
mDate
;
...
@@ -10,9 +16,11 @@ public class Reminder {
...
@@ -10,9 +16,11 @@ public class Reminder {
private
String
mRepeatNo
;
private
String
mRepeatNo
;
private
String
mRepeatType
;
private
String
mRepeatType
;
private
String
mActive
;
private
String
mActive
;
private
String
ownerID
=
null
;
//Email Id of the owner/creater of the reminder
private
String
receiverID
=
null
;
//Email Id of the receiver of the reminder;
public
Reminder
(
int
ID
,
String
Title
,
String
Date
,
String
Time
,
String
Repeat
,
String
RepeatNo
,
String
RepeatType
,
String
Active
)
{
public
Reminder
DO
(
int
ID
,
String
Title
,
String
Date
,
String
Time
,
String
Repeat
,
String
RepeatNo
,
String
RepeatType
,
String
Active
)
{
mID
=
ID
;
mID
=
ID
;
mTitle
=
Title
;
mTitle
=
Title
;
mDate
=
Date
;
mDate
=
Date
;
...
@@ -23,7 +31,7 @@ public class Reminder {
...
@@ -23,7 +31,7 @@ public class Reminder {
mActive
=
Active
;
mActive
=
Active
;
}
}
public
Reminder
(
String
Title
,
String
Date
,
String
Time
,
String
Repeat
,
String
RepeatNo
,
String
RepeatType
,
String
Active
)
{
public
Reminder
DO
(
String
Title
,
String
Date
,
String
Time
,
String
Repeat
,
String
RepeatNo
,
String
RepeatType
,
String
Active
)
{
mTitle
=
Title
;
mTitle
=
Title
;
mDate
=
Date
;
mDate
=
Date
;
mTime
=
Time
;
mTime
=
Time
;
...
@@ -33,7 +41,23 @@ public class Reminder {
...
@@ -33,7 +41,23 @@ public class Reminder {
mActive
=
Active
;
mActive
=
Active
;
}
}
public
Reminder
()
{
ReminderDO
()
{
}
public
String
getOwnerID
()
{
return
ownerID
;
}
public
void
setOwnerID
(
String
ownerID
)
{
this
.
ownerID
=
ownerID
;
}
public
String
getReceiverID
()
{
return
receiverID
;
}
public
void
setReceiverID
(
String
receiverID
)
{
this
.
receiverID
=
receiverID
;
}
}
public
int
getID
()
{
public
int
getID
()
{
...
...
app/src/main/java/com/sudogeeks/talking_reminder/ReminderDatabase.java
View file @
8c87a0cf
...
@@ -62,18 +62,18 @@ public class ReminderDatabase extends SQLiteOpenHelper {
...
@@ -62,18 +62,18 @@ public class ReminderDatabase extends SQLiteOpenHelper {
onCreate
(
db
);
onCreate
(
db
);
}
}
// Adding new Reminder
// Adding new Reminder
DO
public
int
addReminder
(
Reminder
reminder
)
{
public
int
addReminder
(
Reminder
DO
reminderDO
)
{
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
ContentValues
values
=
new
ContentValues
();
ContentValues
values
=
new
ContentValues
();
values
.
put
(
KEY_TITLE
,
reminder
.
getTitle
());
values
.
put
(
KEY_TITLE
,
reminder
DO
.
getTitle
());
values
.
put
(
KEY_DATE
,
reminder
.
getDate
());
values
.
put
(
KEY_DATE
,
reminder
DO
.
getDate
());
values
.
put
(
KEY_TIME
,
reminder
.
getTime
());
values
.
put
(
KEY_TIME
,
reminder
DO
.
getTime
());
values
.
put
(
KEY_REPEAT
,
reminder
.
getRepeat
());
values
.
put
(
KEY_REPEAT
,
reminder
DO
.
getRepeat
());
values
.
put
(
KEY_REPEAT_NO
,
reminder
.
getRepeatNo
());
values
.
put
(
KEY_REPEAT_NO
,
reminder
DO
.
getRepeatNo
());
values
.
put
(
KEY_REPEAT_TYPE
,
reminder
.
getRepeatType
());
values
.
put
(
KEY_REPEAT_TYPE
,
reminder
DO
.
getRepeatType
());
values
.
put
(
KEY_ACTIVE
,
reminder
.
getActive
());
values
.
put
(
KEY_ACTIVE
,
reminder
DO
.
getActive
());
// Inserting Row
// Inserting Row
long
ID
=
db
.
insert
(
TABLE_REMINDERS
,
null
,
values
);
long
ID
=
db
.
insert
(
TABLE_REMINDERS
,
null
,
values
);
...
@@ -81,8 +81,8 @@ public class ReminderDatabase extends SQLiteOpenHelper {
...
@@ -81,8 +81,8 @@ public class ReminderDatabase extends SQLiteOpenHelper {
return
(
int
)
ID
;
return
(
int
)
ID
;
}
}
// Getting single Reminder
// Getting single Reminder
DO
public
Reminder
getReminder
(
int
id
)
{
public
Reminder
DO
getReminder
(
int
id
)
{
SQLiteDatabase
db
=
this
.
getReadableDatabase
();
SQLiteDatabase
db
=
this
.
getReadableDatabase
();
Cursor
cursor
=
db
.
query
(
TABLE_REMINDERS
,
new
String
[]
Cursor
cursor
=
db
.
query
(
TABLE_REMINDERS
,
new
String
[]
...
@@ -102,16 +102,16 @@ public class ReminderDatabase extends SQLiteOpenHelper {
...
@@ -102,16 +102,16 @@ public class ReminderDatabase extends SQLiteOpenHelper {
if
(
cursor
!=
null
)
if
(
cursor
!=
null
)
cursor
.
moveToFirst
();
cursor
.
moveToFirst
();
Reminder
reminder
=
new
Reminder
(
Integer
.
parseInt
(
cursor
.
getString
(
0
)),
cursor
.
getString
(
1
),
Reminder
DO
reminderDO
=
new
ReminderDO
(
Integer
.
parseInt
(
cursor
.
getString
(
0
)),
cursor
.
getString
(
1
),
cursor
.
getString
(
2
),
cursor
.
getString
(
3
),
cursor
.
getString
(
4
),
cursor
.
getString
(
2
),
cursor
.
getString
(
3
),
cursor
.
getString
(
4
),
cursor
.
getString
(
5
),
cursor
.
getString
(
6
),
cursor
.
getString
(
7
));
cursor
.
getString
(
5
),
cursor
.
getString
(
6
),
cursor
.
getString
(
7
));
return
reminder
;
return
reminder
DO
;
}
}
// Getting all Reminders
// Getting all Reminders
public
List
<
Reminder
>
getAllReminders
()
{
public
List
<
Reminder
DO
>
getAllReminders
()
{
List
<
Reminder
>
reminder
List
=
new
ArrayList
<>();
List
<
Reminder
DO
>
reminderDO
List
=
new
ArrayList
<>();
// Select all Query
// Select all Query
String
selectQuery
=
"SELECT * FROM "
+
TABLE_REMINDERS
;
String
selectQuery
=
"SELECT * FROM "
+
TABLE_REMINDERS
;
...
@@ -122,21 +122,21 @@ public class ReminderDatabase extends SQLiteOpenHelper {
...
@@ -122,21 +122,21 @@ public class ReminderDatabase extends SQLiteOpenHelper {
// Looping through all rows and adding to list
// Looping through all rows and adding to list
if
(
cursor
.
moveToFirst
())
{
if
(
cursor
.
moveToFirst
())
{
do
{
do
{
Reminder
reminder
=
new
Reminder
();
Reminder
DO
reminderDO
=
new
ReminderDO
();
reminder
.
setID
(
Integer
.
parseInt
(
cursor
.
getString
(
0
)));
reminder
DO
.
setID
(
Integer
.
parseInt
(
cursor
.
getString
(
0
)));
reminder
.
setTitle
(
cursor
.
getString
(
1
));
reminder
DO
.
setTitle
(
cursor
.
getString
(
1
));
reminder
.
setDate
(
cursor
.
getString
(
2
));
reminder
DO
.
setDate
(
cursor
.
getString
(
2
));
reminder
.
setTime
(
cursor
.
getString
(
3
));
reminder
DO
.
setTime
(
cursor
.
getString
(
3
));
reminder
.
setRepeat
(
cursor
.
getString
(
4
));
reminder
DO
.
setRepeat
(
cursor
.
getString
(
4
));
reminder
.
setRepeatNo
(
cursor
.
getString
(
5
));
reminder
DO
.
setRepeatNo
(
cursor
.
getString
(
5
));
reminder
.
setRepeatType
(
cursor
.
getString
(
6
));
reminder
DO
.
setRepeatType
(
cursor
.
getString
(
6
));
reminder
.
setActive
(
cursor
.
getString
(
7
));
reminder
DO
.
setActive
(
cursor
.
getString
(
7
));
// Adding Reminders to list
// Adding Reminders to list
reminder
List
.
add
(
reminder
);
reminder
DOList
.
add
(
reminderDO
);
}
while
(
cursor
.
moveToNext
());
}
while
(
cursor
.
moveToNext
());
}
}
return
reminderList
;
return
reminder
DO
List
;
}
}
// Getting Reminders Count
// Getting Reminders Count
...
@@ -149,28 +149,28 @@ public class ReminderDatabase extends SQLiteOpenHelper {
...
@@ -149,28 +149,28 @@ public class ReminderDatabase extends SQLiteOpenHelper {
return
cursor
.
getCount
();
return
cursor
.
getCount
();
}
}
// Updating single Reminder
// Updating single Reminder
DO
public
int
updateReminder
(
Reminder
reminder
)
{
public
int
updateReminder
(
Reminder
DO
reminderDO
)
{
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
ContentValues
values
=
new
ContentValues
();
ContentValues
values
=
new
ContentValues
();
values
.
put
(
KEY_TITLE
,
reminder
.
getTitle
());
values
.
put
(
KEY_TITLE
,
reminder
DO
.
getTitle
());
values
.
put
(
KEY_DATE
,
reminder
.
getDate
());
values
.
put
(
KEY_DATE
,
reminder
DO
.
getDate
());
values
.
put
(
KEY_TIME
,
reminder
.
getTime
());
values
.
put
(
KEY_TIME
,
reminder
DO
.
getTime
());
values
.
put
(
KEY_REPEAT
,
reminder
.
getRepeat
());
values
.
put
(
KEY_REPEAT
,
reminder
DO
.
getRepeat
());
values
.
put
(
KEY_REPEAT_NO
,
reminder
.
getRepeatNo
());
values
.
put
(
KEY_REPEAT_NO
,
reminder
DO
.
getRepeatNo
());
values
.
put
(
KEY_REPEAT_TYPE
,
reminder
.
getRepeatType
());
values
.
put
(
KEY_REPEAT_TYPE
,
reminder
DO
.
getRepeatType
());
values
.
put
(
KEY_ACTIVE
,
reminder
.
getActive
());
values
.
put
(
KEY_ACTIVE
,
reminder
DO
.
getActive
());
// Updating row
// Updating row
return
db
.
update
(
TABLE_REMINDERS
,
values
,
KEY_ID
+
"=?"
,
return
db
.
update
(
TABLE_REMINDERS
,
values
,
KEY_ID
+
"=?"
,
new
String
[]{
String
.
valueOf
(
reminder
.
getID
())});
new
String
[]{
String
.
valueOf
(
reminder
DO
.
getID
())});
}
}
// Deleting single Reminder
// Deleting single Reminder
DO
public
void
deleteReminder
(
Reminder
reminder
)
{
public
void
deleteReminder
(
Reminder
DO
reminderDO
)
{
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
db
.
delete
(
TABLE_REMINDERS
,
KEY_ID
+
"=?"
,
db
.
delete
(
TABLE_REMINDERS
,
KEY_ID
+
"=?"
,
new
String
[]{
String
.
valueOf
(
reminder
.
getID
())});
new
String
[]{
String
.
valueOf
(
reminder
DO
.
getID
())});
db
.
close
();
db
.
close
();
}
}
}
}
app/src/main/java/com/sudogeeks/talking_reminder/ReminderEditActivity.java
View file @
8c87a0cf
...
@@ -64,7 +64,7 @@ public class ReminderEditActivity extends AppCompatActivity {
...
@@ -64,7 +64,7 @@ public class ReminderEditActivity extends AppCompatActivity {
private
int
mYear
,
mMonth
,
mHour
,
mMinute
,
mDay
;
private
int
mYear
,
mMonth
,
mHour
,
mMinute
,
mDay
;
private
long
mRepeatTime
;
private
long
mRepeatTime
;
private
Calendar
mCalendar
;
private
Calendar
mCalendar
;
private
Reminder
mReceivedReminder
;
private
Reminder
DO
mReceivedReminderDO
;
private
ReminderDatabase
rb
;
private
ReminderDatabase
rb
;
private
AlarmReceiver
mAlarmReceiver
;
private
AlarmReceiver
mAlarmReceiver
;
...
@@ -91,7 +91,7 @@ public class ReminderEditActivity extends AppCompatActivity {
...
@@ -91,7 +91,7 @@ public class ReminderEditActivity extends AppCompatActivity {
getSupportActionBar
().
setDisplayHomeAsUpEnabled
(
true
);
getSupportActionBar
().
setDisplayHomeAsUpEnabled
(
true
);
getSupportActionBar
().
setHomeButtonEnabled
(
true
);
getSupportActionBar
().
setHomeButtonEnabled
(
true
);
// Setup Reminder Title EditText
// Setup Reminder
DO
Title EditText
mTitleText
.
addTextChangedListener
(
new
TextWatcher
()
{
mTitleText
.
addTextChangedListener
(
new
TextWatcher
()
{
@Override
@Override
public
void
beforeTextChanged
(
CharSequence
s
,
int
start
,
int
count
,
int
after
)
{
public
void
beforeTextChanged
(
CharSequence
s
,
int
start
,
int
count
,
int
after
)
{
...
@@ -116,24 +116,24 @@ public class ReminderEditActivity extends AppCompatActivity {
...
@@ -116,24 +116,24 @@ public class ReminderEditActivity extends AppCompatActivity {
/*Intent intent = getIntent();
/*Intent intent = getIntent();
if(intent.getType().equals("text/"+Utility.FILE_EXTENSION)){
if(intent.getType().equals("text/"+Utility.FILE_EXTENSION)){
mReceivedReminder.setTitle(intent.getStringExtra("mTitle"));
mReceivedReminder
DO
.setTitle(intent.getStringExtra("mTitle"));
System.out.println("**********************************");
System.out.println("**********************************");
System.out.println(mReceivedReminder.getTitle());
System.out.println(mReceivedReminder
DO
.getTitle());
System.out.println("**********************************");
System.out.println("**********************************");
}
}
else {*/
else {*/
// Get reminder id from intent
// Get reminder id from intent
mReceivedReminder
=
rb
.
getReminder
(
mReceivedID
);
mReceivedReminder
DO
=
rb
.
getReminder
(
mReceivedID
);
//}
//}
// Get values from reminder
// Get values from reminder
mTitle
=
mReceivedReminder
.
getTitle
();
mTitle
=
mReceivedReminder
DO
.
getTitle
();
mDate
=
mReceivedReminder
.
getDate
();
mDate
=
mReceivedReminder
DO
.
getDate
();
mTime
=
mReceivedReminder
.
getTime
();
mTime
=
mReceivedReminder
DO
.
getTime
();
mRepeat
=
mReceivedReminder
.
getRepeat
();
mRepeat
=
mReceivedReminder
DO
.
getRepeat
();
mRepeatNo
=
mReceivedReminder
.
getRepeatNo
();
mRepeatNo
=
mReceivedReminder
DO
.
getRepeatNo
();
mRepeatType
=
mReceivedReminder
.
getRepeatType
();
mRepeatType
=
mReceivedReminder
DO
.
getRepeatType
();
mActive
=
mReceivedReminder
.
getActive
();
mActive
=
mReceivedReminder
DO
.
getActive
();
// Setup TextViews using reminder values
// Setup TextViews using reminder values
mTitleText
.
setText
(
mTitle
);
mTitleText
.
setText
(
mTitle
);
...
@@ -381,16 +381,16 @@ public class ReminderEditActivity extends AppCompatActivity {
...
@@ -381,16 +381,16 @@ public class ReminderEditActivity extends AppCompatActivity {
// On clicking the update button
// On clicking the update button
public
void
updateReminder
()
{
public
void
updateReminder
()
{
// Set new values in the reminder
// Set new values in the reminder
mReceivedReminder
.
setTitle
(
mTitle
);
mReceivedReminder
DO
.
setTitle
(
mTitle
);
mReceivedReminder
.
setDate
(
mDate
);
mReceivedReminder
DO
.
setDate
(
mDate
);
mReceivedReminder
.
setTime
(
mTime
);
mReceivedReminder
DO
.
setTime
(
mTime
);
mReceivedReminder
.
setRepeat
(
mRepeat
);
mReceivedReminder
DO
.
setRepeat
(
mRepeat
);
mReceivedReminder
.
setRepeatNo
(
mRepeatNo
);
mReceivedReminder
DO
.
setRepeatNo
(
mRepeatNo
);
mReceivedReminder
.
setRepeatType
(
mRepeatType
);
mReceivedReminder
DO
.
setRepeatType
(
mRepeatType
);
mReceivedReminder
.
setActive
(
mActive
);
mReceivedReminder
DO
.
setActive
(
mActive
);
// Update reminder
// Update reminder
rb
.
updateReminder
(
mReceivedReminder
);
rb
.
updateReminder
(
mReceivedReminder
DO
);
// Set up calender for creating the notification
// Set up calender for creating the notification
mCalendar
.
set
(
Calendar
.
MONTH
,
--
mMonth
);
mCalendar
.
set
(
Calendar
.
MONTH
,
--
mMonth
);
...
@@ -461,7 +461,7 @@ public class ReminderEditActivity extends AppCompatActivity {
...
@@ -461,7 +461,7 @@ public class ReminderEditActivity extends AppCompatActivity {
mTitleText
.
setText
(
mTitle
);
mTitleText
.
setText
(
mTitle
);
if
(
mTitleText
.
getText
().
toString
().
length
()
==
0
)
if
(
mTitleText
.
getText
().
toString
().
length
()
==
0
)
mTitleText
.
setError
(
"Reminder Title cannot be blank!"
);
mTitleText
.
setError
(
"Reminder
DO
Title cannot be blank!"
);
else
{
else
{
updateReminder
();
updateReminder
();
...
...
app/src/main/java/com/sudogeeks/talking_reminder/ReminderReceiveActivity.java
View file @
8c87a0cf
...
@@ -75,7 +75,7 @@ public class ReminderReceiveActivity extends AppCompatActivity {
...
@@ -75,7 +75,7 @@ public class ReminderReceiveActivity extends AppCompatActivity {
try
{
try
{
JSONObject
obj
=
new
JSONObject
(
reminderJson
.
toString
());
JSONObject
obj
=
new
JSONObject
(
reminderJson
.
toString
());
//Reminder
talkingReminder=new Reminder
();
//Reminder
DO talkingReminder=new ReminderDO
();
mTitleText
=
findViewById
(
R
.
id
.
reminder_title
);
mTitleText
=
findViewById
(
R
.
id
.
reminder_title
);
mDateText
=
findViewById
(
R
.
id
.
set_date
);
mDateText
=
findViewById
(
R
.
id
.
set_date
);
mTimeText
=
findViewById
(
R
.
id
.
set_time
);
mTimeText
=
findViewById
(
R
.
id
.
set_time
);
...
@@ -102,7 +102,7 @@ public class ReminderReceiveActivity extends AppCompatActivity {
...
@@ -102,7 +102,7 @@ public class ReminderReceiveActivity extends AppCompatActivity {
/*Intent senderIntent = new Intent(context, ReminderEditActivity.class);
/*Intent senderIntent = new Intent(context, ReminderEditActivity.class);
senderIntent.putExtra("received", true);
senderIntent.putExtra("received", true);
senderIntent.putExtra("mTitle", "First Receive Reminder test");
senderIntent.putExtra("mTitle", "First Receive Reminder
DO
test");
startActivity(senderIntent);*/
startActivity(senderIntent);*/
}
}
}
}
...
@@ -110,8 +110,8 @@ public class ReminderReceiveActivity extends AppCompatActivity {
...
@@ -110,8 +110,8 @@ public class ReminderReceiveActivity extends AppCompatActivity {
public
void
saveSendReminder
()
{
public
void
saveSendReminder
()
{
ReminderDatabase
rb
=
new
ReminderDatabase
(
this
);
ReminderDatabase
rb
=
new
ReminderDatabase
(
this
);
// Creating Reminder
// Creating Reminder
DO
int
ID
=
rb
.
addReminder
(
new
Reminder
(
mTitleText
.
getText
().
toString
(),
mDateText
.
getText
().
toString
(),
mTimeText
.
getText
().
toString
(),
mRepeat
,
mRepeatNoText
.
getText
().
toString
(),
mRepeatTypeText
.
getText
().
toString
(),
mActive
));
int
ID
=
rb
.
addReminder
(
new
Reminder
DO
(
mTitleText
.
getText
().
toString
(),
mDateText
.
getText
().
toString
(),
mTimeText
.
getText
().
toString
(),
mRepeat
,
mRepeatNoText
.
getText
().
toString
(),
mRepeatTypeText
.
getText
().
toString
(),
mActive
));
// Set up calender for creating the notification
// Set up calender for creating the notification
...
...
app/src/main/res/menu/main_menu.xml
View file @
8c87a0cf
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
tools:context=
"com.blanyal.talking_reminder.MainActivity"
>
tools:context=
"com.sudogeeks.talking_reminder.MainActivity"
>
<item
<!-- <item android:id="@+id/action_licenses"-->
android:id=
"@+id/sign_out"
<!-- android:title="@string/title_activity_licenses"-->
android:orderInCategory=
"100"
<!-- app:showAsAction="never"/>-->
android:title=
"@string/sign_out"
app:showAsAction=
"never"
/>
</menu>
</menu>
\ No newline at end of file
app/src/main/res/values/colors.xml
View file @
8c87a0cf
...
@@ -3,4 +3,6 @@
...
@@ -3,4 +3,6 @@
<color
name=
"primary"
>
#008577
</color>
<color
name=
"primary"
>
#008577
</color>
<color
name=
"primary_dark"
>
#00574B
</color>
<color
name=
"primary_dark"
>
#00574B
</color>
<color
name=
"accent"
>
#D81B60
</color>
<color
name=
"accent"
>
#D81B60
</color>
<color
name=
"textheader"
>
#ffffff
</color>
<color
name=
"textbody"
>
#000000
</color>
</resources>
</resources>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
8c87a0cf
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
<string
name=
"action_discard_reminder"
>
Discard Reminder
</string>
<string
name=
"action_discard_reminder"
>
Discard Reminder
</string>
<string
name=
"action_save_reminder"
>
Save Reminder
</string>
<string
name=
"action_save_reminder"
>
Save Reminder
</string>
<string
name=
"no_reminders"
>
Click on the plus button below to begin creating your reminders!
</string>
<string
name=
"no_reminders"
>
Click on the plus button below to begin creating your reminderDOS!
</string>
<string
name=
"sign_out"
>
sign_out
</string>
</resources>
</resources>
app/src/main/res/values/styles.xml
View file @
8c87a0cf
<resources>
<resources>
<!-- Base application theme. -->
<!-- Base application theme. -->
<style
name=
"AppTheme"
parent=
"AppTheme.Base"
/
>
<!-- <style name="AppTheme" parent="AppTheme.Base"/>--
>
<style
name=
"AppTheme.NoActionBar"
>
<style
name=
"AppTheme.NoActionBar"
>
<item
name=
"windowActionBar"
>
false
</item>
<item
name=
"windowActionBar"
>
false
</item>
...
@@ -17,5 +17,4 @@
...
@@ -17,5 +17,4 @@
<item
name=
"android:windowNoTitle"
>
true
</item>
<item
name=
"android:windowNoTitle"
>
true
</item>
<item
name=
"windowActionModeOverlay"
>
true
</item>
<item
name=
"windowActionModeOverlay"
>
true
</item>
</style>
</style>
</resources>
</resources>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment