Commit 57a1e323 authored by PANKAJ KUMAR's avatar PANKAJ KUMAR

Further Cleanup

parent 630d3e89
......@@ -12,7 +12,7 @@
android:label="@string/app_name"
android:theme="@style/AppTheme"
tools:replace="android:icon,android:theme">
<activity android:name="com.sudogeeks.talking_reminder.ReadTheMessage"></activity>
<activity android:name="com.sudogeeks.talking_reminder.ReadReminderTextService"></activity>
<activity android:name="com.sudogeeks.talking_reminder.ReminderReceiveActivity">
<intent-filter>
......@@ -67,7 +67,7 @@
</provider>
<service
android:name="com.sudogeeks.talking_reminder.ReadTheMessage"
android:name="com.sudogeeks.talking_reminder.ReadReminderTextService"
android:enabled="true" />
</application>
......
package com.sudogeeks.talking_reminder;
......@@ -24,17 +23,12 @@ public class AlarmReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
int mReceivedID = Integer.parseInt(intent.getStringExtra(ReminderEditActivity.EXTRA_REMINDER_ID));
//
//Get notification title from Reminder Database
//Get notification title from Reminder Database
ReminderDatabase rb = new ReminderDatabase(context);
Reminder reminder = rb.getReminder(mReceivedID);
String mTitle = reminder.getTitle();
// Create intent to open ReminderEditActivity on notification click
Intent editIntent = new Intent(context, ReminderEditActivity.class);
editIntent.putExtra(ReminderEditActivity.EXTRA_REMINDER_ID, Integer.toString(mReceivedID));
......@@ -54,42 +48,33 @@ public class AlarmReceiver extends BroadcastReceiver {
//
// NotificationManager nManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
// nManager.notify(mReceivedID, mBuilder.build());
NotificationHelper notificationHelper = new NotificationHelper(context,intent);
NotificationHelper notificationHelper = new NotificationHelper(context, intent);
NotificationCompat.Builder nb = notificationHelper.getChannelNotification();
notificationHelper.getManager().notify(mReceivedID, nb.build());
// tts
// context.startService(new Intent(context, ReadReminderTextService.class));
// context.startService(new Intent(context, ReadTheMessage.class));
Intent i = new Intent(context, ReadTheMessage.class);
Intent i = new Intent(context, ReadReminderTextService.class);
i.putExtra("MyTitle", mTitle);
context.startService(i);
context.startService(i);
context.startService(i);
//context.startService(new Intent(context, ReadTheMessage.class));
//context.startService(new Intent(context, ReadReminderTextService.class));
// Intent speechIntent = new Intent();
// speechIntent.setClass(context, ReadTheMessage.class);
// speechIntent.setClass(context, ReadReminderTextService.class);
// speechIntent.putExtra("MESSAGE",mTitle );
// speechIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
// context.startActivity(speechIntent);
////
// Intent speechIntent = new Intent();
// speechIntent.putExtra("MESSAGE", "Bluetooth is on.");
// ReadTheMessage.enqueueWork(context, speechIntent);
// ReadReminderTextService.enqueueWork(context, speechIntent);
//
......@@ -137,7 +122,7 @@ public class AlarmReceiver extends BroadcastReceiver {
// Start alarm using initial notification time and repeat interval time
mAlarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME,
SystemClock.elapsedRealtime() + diffTime,
RepeatTime , mPendingIntent);
RepeatTime, mPendingIntent);
// Restart alarm if device is rebooted
ComponentName receiver = new ComponentName(context, BootReceiver.class);
......
package com.sudogeeks.talking_reminder;
import android.content.BroadcastReceiver;
......@@ -11,6 +10,12 @@ import java.util.List;
public class BootReceiver extends BroadcastReceiver {
// Constant values in milliseconds
private static final long milMinute = 60000L;
private static final long milHour = 3600000L;
private static final long milDay = 86400000L;
private static final long milWeek = 604800000L;
private static final long milMonth = 2592000000L;
private String mTitle;
private String mTime;
private String mDate;
......@@ -22,18 +27,9 @@ public class BootReceiver extends BroadcastReceiver {
private String[] mTimeSplit;
private int mYear, mMonth, mHour, mMinute, mDay, mReceivedID;
private long mRepeatTime;
private Calendar mCalendar;
private AlarmReceiver mAlarmReceiver;
// Constant values in milliseconds
private static final long milMinute = 60000L;
private static final long milHour = 3600000L;
private static final long milDay = 86400000L;
private static final long milWeek = 604800000L;
private static final long milMonth = 2592000000L;
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
......
package com.sudogeeks.talking_reminder;
// Class to create DateTime objects for easy sorting
......@@ -7,12 +6,13 @@ public class DateTimeSorter {
public String mDateTime;
public DateTimeSorter(int index, String DateTime){
public DateTimeSorter(int index, String DateTime) {
mIndex = index;
mDateTime = DateTime;
}
public DateTimeSorter(){}
public DateTimeSorter() {
}
public int getIndex() {
......
package com.sudogeeks.talking_reminder;
//package com.example.application.alarmmanagerproject;
import androidx.core.app.NotificationCompat;
import android.annotation.TargetApi;
import android.app.NotificationChannel;
......@@ -10,10 +9,12 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.os.Build;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.speech.tts.TextToSpeech;
import androidx.core.app.NotificationCompat;
public class NotificationHelper extends ContextWrapper {
public static final String channelID = "channelID";
......@@ -22,12 +23,13 @@ public class NotificationHelper extends ContextWrapper {
PendingIntent mClick;
private NotificationManager mManager;
private TextToSpeech t1;
// public Uri getFileUri(){
// public Uri getFileUri(){
//
//
// return
// }
public NotificationHelper(Context base,Intent intent) {
public NotificationHelper(Context base, Intent intent) {
super(base);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createChannel();
......@@ -64,27 +66,27 @@ public class NotificationHelper extends ContextWrapper {
public NotificationCompat.Builder getChannelNotification() {
//t1.speak(mTitle, TextToSpeech.QUEUE_FLUSH, null);
//t1.speak(mTitle, TextToSpeech.QUEUE_FLUSH, null);
// t1.synthesizeToFile(mTitle, null, "/SDCARD/speak1.wav");
// t1.synthesizeToFile(mTitle, null, "/SDCARD/speak1.wav");
//Uri alarmSound = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + getPackageName() + "/raw/sample");
return new NotificationCompat.Builder(getApplicationContext(), channelID)
.setLargeIcon(BitmapFactory.decodeResource(getApplicationContext().getResources(), R.mipmap.ic_launcher))
.setSmallIcon(R.drawable.ic_alarm_on_white_24dp)
.setContentTitle(getApplicationContext().getResources().getString(R.string.app_name))
.setTicker(mTitle)
.setContentText(mTitle)
//.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM))
.setSmallIcon(R.drawable.ic_alarm_on_white_24dp)
.setContentTitle(getApplicationContext().getResources().getString(R.string.app_name))
.setTicker(mTitle)
.setContentText(mTitle)
//.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM))
// .setSound(Uri.fromFile(new File("SDCARD/s1.mp3")))
//.setSound(null)
//.setSound(null)
.setPriority(NotificationManager.IMPORTANCE_HIGH)
.setContentIntent(mClick)
.setAutoCancel(true)
.setOnlyAlertOnce(true);
.setContentIntent(mClick)
.setAutoCancel(true)
.setOnlyAlertOnce(true);
}
public TextToSpeech getTextToSpeech(){
public TextToSpeech getTextToSpeech() {
return t1;
}
}
......
package com.sudogeeks.talking_reminder;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.speech.tts.TextToSpeech;
import android.content.Intent;
import java.util.Locale;
public class ReadTheMessage extends Service implements TextToSpeech.OnInitListener, TextToSpeech.OnUtteranceCompletedListener {
public class ReadReminderTextService extends Service implements TextToSpeech.OnInitListener, TextToSpeech.OnUtteranceCompletedListener {
private TextToSpeech mTts;
private String spokenText;
......@@ -18,11 +17,11 @@ public class ReadTheMessage extends Service implements TextToSpeech.OnInitListen
public void onCreate() {
mTts = new TextToSpeech(this, this);
// This is a good place to set spokenText
// spokenText="raushan raushan raushan raushan";
// spokenText="raushan raushan raushan raushan";
}
@Override
public int onStartCommand (Intent intent, int flags, int startId) {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
spokenText = intent.getStringExtra("MyTitle");
return START_STICKY;
}
......@@ -35,10 +34,6 @@ public class ReadTheMessage extends Service implements TextToSpeech.OnInitListen
mTts.speak(spokenText, TextToSpeech.QUEUE_ADD, null);
}
}
}
......
package com.sudogeeks.talking_reminder;
// Reminder class
......@@ -13,7 +12,7 @@ public class Reminder {
private String mActive;
public Reminder(int ID, String Title, String Date, String Time, String Repeat, String RepeatNo, String RepeatType, String Active){
public Reminder(int ID, String Title, String Date, String Time, String Repeat, String RepeatNo, String RepeatType, String Active) {
mID = ID;
mTitle = Title;
mDate = Date;
......@@ -24,7 +23,7 @@ public class Reminder {
mActive = Active;
}
public Reminder(String Title, String Date, String Time, String Repeat, String RepeatNo, String RepeatType, String Active){
public Reminder(String Title, String Date, String Time, String Repeat, String RepeatNo, String RepeatType, String Active) {
mTitle = Title;
mDate = Date;
mTime = Time;
......@@ -34,7 +33,8 @@ public class Reminder {
mActive = Active;
}
public Reminder(){}
public Reminder() {
}
public int getID() {
return mID;
......
package com.sudogeeks.talking_reminder;
import android.content.ContentValues;
......@@ -64,15 +63,15 @@ public class ReminderDatabase extends SQLiteOpenHelper {
}
// Adding new Reminder
public int addReminder(Reminder reminder){
public int addReminder(Reminder reminder) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_TITLE , reminder.getTitle());
values.put(KEY_DATE , reminder.getDate());
values.put(KEY_TIME , reminder.getTime());
values.put(KEY_REPEAT , reminder.getRepeat());
values.put(KEY_REPEAT_NO , reminder.getRepeatNo());
values.put(KEY_TITLE, reminder.getTitle());
values.put(KEY_DATE, reminder.getDate());
values.put(KEY_TIME, reminder.getTime());
values.put(KEY_REPEAT, reminder.getRepeat());
values.put(KEY_REPEAT_NO, reminder.getRepeatNo());
values.put(KEY_REPEAT_TYPE, reminder.getRepeatType());
values.put(KEY_ACTIVE, reminder.getActive());
......@@ -83,7 +82,7 @@ public class ReminderDatabase extends SQLiteOpenHelper {
}
// Getting single Reminder
public Reminder getReminder(int id){
public Reminder getReminder(int id) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_REMINDERS, new String[]
......@@ -98,7 +97,7 @@ public class ReminderDatabase extends SQLiteOpenHelper {
KEY_ACTIVE
}, KEY_ID + "=?",
new String[] {String.valueOf(id)}, null, null, null, null);
new String[]{String.valueOf(id)}, null, null, null, null);
if (cursor != null)
cursor.moveToFirst();
......@@ -111,7 +110,7 @@ public class ReminderDatabase extends SQLiteOpenHelper {
}
// Getting all Reminders
public List<Reminder> getAllReminders(){
public List<Reminder> getAllReminders() {
List<Reminder> reminderList = new ArrayList<>();
// Select all Query
......@@ -121,8 +120,8 @@ public class ReminderDatabase extends SQLiteOpenHelper {
Cursor cursor = db.rawQuery(selectQuery, null);
// Looping through all rows and adding to list
if(cursor.moveToFirst()){
do{
if (cursor.moveToFirst()) {
do {
Reminder reminder = new Reminder();
reminder.setID(Integer.parseInt(cursor.getString(0)));
reminder.setTitle(cursor.getString(1));
......@@ -141,24 +140,24 @@ public class ReminderDatabase extends SQLiteOpenHelper {
}
// Getting Reminders Count
public int getRemindersCount(){
public int getRemindersCount() {
String countQuery = "SELECT * FROM " + TABLE_REMINDERS;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(countQuery,null);
Cursor cursor = db.rawQuery(countQuery, null);
cursor.close();
return cursor.getCount();
}
// Updating single Reminder
public int updateReminder(Reminder reminder){
public int updateReminder(Reminder reminder) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_TITLE , reminder.getTitle());
values.put(KEY_DATE , reminder.getDate());
values.put(KEY_TIME , reminder.getTime());
values.put(KEY_REPEAT , reminder.getRepeat());
values.put(KEY_REPEAT_NO , reminder.getRepeatNo());
values.put(KEY_TITLE, reminder.getTitle());
values.put(KEY_DATE, reminder.getDate());
values.put(KEY_TIME, reminder.getTime());
values.put(KEY_REPEAT, reminder.getRepeat());
values.put(KEY_REPEAT_NO, reminder.getRepeatNo());
values.put(KEY_REPEAT_TYPE, reminder.getRepeatType());
values.put(KEY_ACTIVE, reminder.getActive());
......@@ -168,7 +167,7 @@ public class ReminderDatabase extends SQLiteOpenHelper {
}
// Deleting single Reminder
public void deleteReminder(Reminder reminder){
public void deleteReminder(Reminder reminder) {
SQLiteDatabase db = this.getWritableDatabase();
db.delete(TABLE_REMINDERS, KEY_ID + "=?",
new String[]{String.valueOf(reminder.getID())});
......
package com.sudogeeks.talking_reminder;
import android.app.AlertDialog;
......@@ -30,6 +29,22 @@ import java.util.Calendar;
public class ReminderEditActivity extends AppCompatActivity {
// Constant Intent String
public static final String EXTRA_REMINDER_ID = "Reminder_ID";
// Values for orientation change
private static final String KEY_TITLE = "title_key";
private static final String KEY_TIME = "time_key";
private static final String KEY_DATE = "date_key";
private static final String KEY_REPEAT = "repeat_key";
private static final String KEY_REPEAT_NO = "repeat_no_key";
private static final String KEY_REPEAT_TYPE = "repeat_type_key";
private static final String KEY_ACTIVE = "active_key";
// Constant values in milliseconds
private static final long milMinute = 60000L;
private static final long milHour = 3600000L;
private static final long milDay = 86400000L;
private static final long milWeek = 604800000L;
private static final long milMonth = 2592000000L;
private Toolbar mToolbar;
private EditText mTitleText;
private TextView mDateText, mTimeText, mRepeatText, mRepeatNoText, mRepeatTypeText;
......@@ -53,42 +68,22 @@ public class ReminderEditActivity extends AppCompatActivity {
private ReminderDatabase rb;
private AlarmReceiver mAlarmReceiver;
// Constant Intent String
public static final String EXTRA_REMINDER_ID = "Reminder_ID";
// Values for orientation change
private static final String KEY_TITLE = "title_key";
private static final String KEY_TIME = "time_key";
private static final String KEY_DATE = "date_key";
private static final String KEY_REPEAT = "repeat_key";
private static final String KEY_REPEAT_NO = "repeat_no_key";
private static final String KEY_REPEAT_TYPE = "repeat_type_key";
private static final String KEY_ACTIVE = "active_key";
// Constant values in milliseconds
private static final long milMinute = 60000L;
private static final long milHour = 3600000L;
private static final long milDay = 86400000L;
private static final long milWeek = 604800000L;
private static final long milMonth = 2592000000L;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_reminder);
// Initialize Views
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mTitleText = (EditText) findViewById(R.id.reminder_title);
mDateText = (TextView) findViewById(R.id.set_date);
mTimeText = (TextView) findViewById(R.id.set_time);
mRepeatText = (TextView) findViewById(R.id.set_repeat);
mRepeatNoText = (TextView) findViewById(R.id.set_repeat_no);
mRepeatTypeText = (TextView) findViewById(R.id.set_repeat_type);
// mFAB1 = (FloatingActionButton) findViewById(R.id.starred1);
mToolbar = findViewById(R.id.toolbar);
mTitleText = findViewById(R.id.reminder_title);
mDateText = findViewById(R.id.set_date);
mTimeText = findViewById(R.id.set_time);
mRepeatText = findViewById(R.id.set_repeat);
mRepeatNoText = findViewById(R.id.set_repeat_no);
mRepeatTypeText = findViewById(R.id.set_repeat_type);
// mFAB1 = (FloatingActionButton) findViewById(R.id.starred1);
//mFAB2 = (FloatingActionButton) findViewById(R.id.starred2);
mRepeatSwitch = (Switch) findViewById(R.id.repeat_switch);
mRepeatSwitch = findViewById(R.id.repeat_switch);
// Setup Toolbar
setSupportActionBar(mToolbar);
......@@ -99,7 +94,8 @@ public class ReminderEditActivity extends AppCompatActivity {
// Setup Reminder Title EditText
mTitleText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
......@@ -108,7 +104,8 @@ public class ReminderEditActivity extends AppCompatActivity {
}
@Override
public void afterTextChanged(Editable s) {}
public void afterTextChanged(Editable s) {
}
});
// Get reminder id from intent
......@@ -125,8 +122,8 @@ public class ReminderEditActivity extends AppCompatActivity {
System.out.println("**********************************");
}
else {*/
// Get reminder id from intent
mReceivedReminder = rb.getReminder(mReceivedID);
// Get reminder id from intent
mReceivedReminder = rb.getReminder(mReceivedID);
//}
// Get values from reminder
......@@ -210,7 +207,7 @@ public class ReminderEditActivity extends AppCompatActivity {
// To save state on device rotation
@Override
protected void onSaveInstanceState (Bundle outState) {
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putCharSequence(KEY_TITLE, mTitleText.getText());
......@@ -228,7 +225,7 @@ public class ReminderEditActivity extends AppCompatActivity {
}
// On clicking Time picker
public void setTime(View v){
public void setTime(View v) {
Calendar now = Calendar.getInstance();
TimePickerDialog timePickerDialog = new TimePickerDialog(this,
new TimePickerDialog.OnTimeSetListener() {
......@@ -250,7 +247,7 @@ public class ReminderEditActivity extends AppCompatActivity {
}
// On clicking Date picker
public void setDate(View v){
public void setDate(View v) {
Calendar now = Calendar.getInstance();
DatePickerDialog datePickerDialog = new DatePickerDialog(this,
new DatePickerDialog.OnDateSetListener() {
......@@ -259,10 +256,10 @@ public class ReminderEditActivity extends AppCompatActivity {
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
mDay = dayOfMonth;
mMonth = monthOfYear+1;
mMonth = monthOfYear + 1;
mYear = year;
mDate = mDay + "/" + mMonth + "/" + mYear;
mDateText.setText(mDate);;
mDateText.setText(mDate);
}
}, mYear, mMonth, mDay);
datePickerDialog.show();
......@@ -324,7 +321,7 @@ public class ReminderEditActivity extends AppCompatActivity {
}
// On clicking repeat type button
public void selectRepeatType(View v){
public void selectRepeatType(View v) {
final String[] items = new String[5];
items[0] = "Minute";
......@@ -350,7 +347,7 @@ public class ReminderEditActivity extends AppCompatActivity {
}
// On clicking repeat interval button
public void setRepeatNo(View v){
public void setRepeatNo(View v) {
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Enter Number");
......@@ -366,8 +363,7 @@ public class ReminderEditActivity extends AppCompatActivity {
mRepeatNo = Integer.toString(1);
mRepeatNoText.setText(mRepeatNo);
mRepeatText.setText("Every " + mRepeatNo + " " + mRepeatType + "(s)");
}
else {
} else {
mRepeatNo = input.getText().toString().trim();
mRepeatNoText.setText(mRepeatNo);
mRepeatText.setText("Every " + mRepeatNo + " " + mRepeatType + "(s)");
......@@ -383,7 +379,7 @@ public class ReminderEditActivity extends AppCompatActivity {
}
// On clicking the update button
public void updateReminder(){
public void updateReminder() {
// Set new values in the reminder
mReceivedReminder.setTitle(mTitle);
mReceivedReminder.setDate(mDate);
......
package com.sudogeeks.talking_reminder;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
......@@ -13,31 +10,31 @@ import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import org.json.JSONObject;
import java.io.InputStream;
import java.util.Calendar;
public class ReminderReceiveActivity extends AppCompatActivity {
private static final long milMinute = 60000L;
private static final long milHour = 3600000L;
private static final long milDay = 86400000L;
private static final long milWeek = 604800000L;
private static final long milMonth = 2592000000L;
private Toolbar mToolbar;
private EditText mTitleText;
private TextView mDateText, mTimeText, mRepeatText, mRepeatNoText, mRepeatTypeText;
private String mRepeat;
private String mRepeatType;
private String mRepeatType;
private String mRepeatNo;
private Calendar mCalendar;
private int mYear, mMonth, mHour, mMinute, mDay;
private long mRepeatTime;
private String mActive;
private static final long milMinute = 60000L;
private static final long milHour = 3600000L;
private static final long milDay = 86400000L;
private static final long milWeek = 604800000L;
private static final long milMonth = 2592000000L;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -54,21 +51,21 @@ public class ReminderReceiveActivity extends AppCompatActivity {
//by default
mActive = "true";
// Setup Toolbar
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mToolbar = findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
getSupportActionBar().setTitle(R.string.activity_add_reminder_label);
//Get the file from intent
Intent intent = getIntent();
Uri fileUri = intent.getData();
StringBuilder reminderJson=new StringBuilder();
if (intent.getType().equals("text/"+Utility.FILE_EXTENSION)) {
StringBuilder reminderJson = new StringBuilder();
if (intent.getType().equals("text/" + Utility.FILE_EXTENSION)) {
try {
InputStream in = getContentResolver().openInputStream(fileUri);
InputStream in = getContentResolver().openInputStream(fileUri);
int i;
while ((i=in.read()) != -1)
reminderJson.append((char)i);
while ((i = in.read()) != -1)
reminderJson.append((char) i);
//System.out.println("******************************************************************");
//System.out.println(sb.toString());
//System.out.println("******************************************************************");
......@@ -79,27 +76,26 @@ public class ReminderReceiveActivity extends AppCompatActivity {
try {
JSONObject obj = new JSONObject(reminderJson.toString());
//Reminder talkingReminder=new Reminder();
mTitleText = (EditText) findViewById(R.id.reminder_title);
mDateText = (TextView) findViewById(R.id.set_date);
mTimeText = (TextView) findViewById(R.id.set_time);
mRepeatText = (TextView) findViewById(R.id.set_repeat);
mRepeatNoText = (TextView) findViewById(R.id.set_repeat_no);
mRepeatTypeText = (TextView) findViewById(R.id.set_repeat_type);
mTitleText = findViewById(R.id.reminder_title);
mDateText = findViewById(R.id.set_date);
mTimeText = findViewById(R.id.set_time);
mRepeatText = findViewById(R.id.set_repeat);
mRepeatNoText = findViewById(R.id.set_repeat_no);
mRepeatTypeText = findViewById(R.id.set_repeat_type);
mRepeat=obj.getString("mRepeat");
mRepeatType=obj.getString("mRepeatType");
mRepeatNo=obj.getString("mRepeatNo");
mRepeat = obj.getString("mRepeat");
mRepeatType = obj.getString("mRepeatType");
mRepeatNo = obj.getString("mRepeatNo");
mTitleText.setText(obj.getString("mTitle"));
mDateText.setText(obj.getString("mDate"));
mTimeText.setText(obj.getString("mTime"));
mRepeatText.setText("Every "+obj.getString("mRepeatNo")+" "+ obj.getString("mRepeatType")+"(s)");
mRepeatText.setText("Every " + obj.getString("mRepeatNo") + " " + obj.getString("mRepeatType") + "(s)");
mRepeatNoText.setText(obj.getString("mRepeatNo"));
mRepeatTypeText.setText(obj.getString("mRepeatType"));
}
catch (Throwable t){
} catch (Throwable t) {
t.printStackTrace();
}
......@@ -111,7 +107,7 @@ public class ReminderReceiveActivity extends AppCompatActivity {
}
}
public void saveSendReminder(){
public void saveSendReminder() {
ReminderDatabase rb = new ReminderDatabase(this);
// Creating Reminder
......
......@@ -3,7 +3,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
......@@ -15,7 +14,7 @@
android:minHeight="?attr/actionBarSize"
app:contentInsetLeft="0dp"
app:contentInsetStart="16dp"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:theme="@style/AppTheme.NoActionBar"
android:background="?attr/colorPrimary" />
<androidx.recyclerview.widget.RecyclerView
......
<resources>
<color name="primary">#37474f</color>
<color name="primary_dark">#263238</color>
<color name="accent">#78909c</color>
<color name="primary">#008577</color>
<color name="primary_dark">#00574B</color>
<color name="accent">#D81B60</color>
</resources>
\ No newline at end of file
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="AppTheme.Base"/>
<style name="AppTheme" parent="AppTheme.Base"/>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.Base" parent="Theme.AppCompat.NoActionBar">
<item name="colorPrimary">@color/primary</item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment