diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 7ac24c77..169fd0dd 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -12,6 +12,7 @@
+
diff --git a/app/app.iml b/app/app.iml
index 2a197e74..bad6c30c 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -4,6 +4,8 @@
+
+
@@ -17,7 +19,8 @@
-
+
+
@@ -28,20 +31,18 @@
-
-
-
-
+
+
+
-
-
-
+
+
@@ -50,13 +51,6 @@
-
-
-
-
-
-
-
@@ -64,6 +58,13 @@
+
+
+
+
+
+
+
@@ -85,63 +86,33 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 865b2779..49444745 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -10,12 +10,12 @@ android {
storePassword ''
}
}
- compileSdkVersion 23
+ compileSdkVersion 26
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.avjindersinghsekhon.minimaltodo"
minSdkVersion 16
- targetSdkVersion 23
+ targetSdkVersion 26
versionCode 3
versionName "1.2"
}
@@ -39,8 +39,8 @@ dependencies {
implementation 'com.wdullaer:materialdatetimepicker:1.5.1'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.github.ganfra:material-spinner:1.1.0'
- implementation 'com.android.support:recyclerview-v7:23.1.0'
- implementation 'com.android.support:design:23.1.0'
- implementation 'com.android.support:appcompat-v7:23.1.0'
- implementation 'com.android.support:support-v13:23.1.0'
+ implementation 'com.android.support:recyclerview-v7:26.1.0'
+ implementation 'com.android.support:design:26.1.0'
+ implementation 'com.android.support:appcompat-v7:26.1.0'
+ implementation 'com.android.support:support-v13:26.1.0'
}
diff --git a/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/About/AboutActivity.java b/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/About/AboutActivity.java
index 95463fdb..b786597d 100644
--- a/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/About/AboutActivity.java
+++ b/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/About/AboutActivity.java
@@ -44,7 +44,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// mId = (UUID)i.getSerializableExtra(TodoNotificationService.TODOUUID);
- final Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
+ final Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
if (backArrow != null) {
backArrow.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
}
diff --git a/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Settings/SettingsActivity.java b/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Settings/SettingsActivity.java
index 30f5b588..22a529d2 100644
--- a/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Settings/SettingsActivity.java
+++ b/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Settings/SettingsActivity.java
@@ -40,7 +40,7 @@ protected void onCreate(Bundle savedInstanceState) {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
- final Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
+ final Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
if (backArrow != null) {
backArrow.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
diff --git a/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/TodoNotificationService.java b/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/TodoNotificationService.java
index 87f379bb..4ab641f8 100644
--- a/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/TodoNotificationService.java
+++ b/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/TodoNotificationService.java
@@ -2,10 +2,14 @@
import android.app.IntentService;
import android.app.Notification;
+import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
+import android.os.Build;
+import android.support.v4.app.NotificationCompat;
+import android.support.v4.app.NotificationManagerCompat;
import android.util.Log;
import com.example.avjindersinghsekhon.minimaltodo.R;
@@ -19,23 +23,44 @@ public class TodoNotificationService extends IntentService {
private String mTodoText;
private UUID mTodoUUID;
private Context mContext;
+
+ private NotificationManagerCompat notificationManagerCompat;
+ private static String CHANNEL_ID = "CHAN_ID";
public TodoNotificationService() {
super("TodoNotificationService");
}
-
+
+ @Override
+ public void onCreate () {
+ super.onCreate();
+ notificationManagerCompat = NotificationManagerCompat.from(this);
+ createNotificationChannel();
+ }
+
+ private void createNotificationChannel(){
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ CharSequence name = "channel";
+ String description = "channeldesc";
+ int importance = NotificationManager.IMPORTANCE_DEFAULT;
+ NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
+ channel.setDescription(description);
+ NotificationManager notificationManager = getSystemService(NotificationManager.class);
+ notificationManager.createNotificationChannel(channel);
+ }
+ }
+
@Override
protected void onHandleIntent(Intent intent) {
mTodoText = intent.getStringExtra(TODOTEXT);
mTodoUUID = (UUID) intent.getSerializableExtra(TODOUUID);
- Log.d("OskarSchindler", "onHandleIntent called");
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Intent i = new Intent(this, ReminderActivity.class);
i.putExtra(TodoNotificationService.TODOUUID, mTodoUUID);
Intent deleteIntent = new Intent(this, DeleteNotificationService.class);
deleteIntent.putExtra(TODOUUID, mTodoUUID);
- Notification notification = new Notification.Builder(this)
+ Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID)
.setContentTitle(mTodoText)
.setSmallIcon(R.drawable.ic_done_white_24dp)
.setAutoCancel(true)
@@ -43,26 +68,7 @@ protected void onHandleIntent(Intent intent) {
.setDeleteIntent(PendingIntent.getService(this, mTodoUUID.hashCode(), deleteIntent, PendingIntent.FLAG_UPDATE_CURRENT))
.setContentIntent(PendingIntent.getActivity(this, mTodoUUID.hashCode(), i, PendingIntent.FLAG_UPDATE_CURRENT))
.build();
-
- manager.notify(100, notification);
-// Uri defaultRingone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
-// MediaPlayer mp = new MediaPlayer();
-// try{
-// mp.setDataSource(this, defaultRingone);
-// mp.setAudioStreamType(AudioManager.STREAM_NOTIFICATION);
-// mp.prepare();
-// mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
-// @Override
-// public void onCompletion(MediaPlayer mp) {
-// mp.release();
-// }
-// });
-// mp.start();
-//
-// }
-// catch (Exception e){
-// e.printStackTrace();
-// }
-
+
+ notificationManagerCompat.notify(100, notification);
}
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 19f8ae7a..4a4298c7 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -14,7 +14,6 @@
>
-
-
+
diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml
index 946ea4e6..1d4b1a15 100644
--- a/app/src/main/res/layout/fragment_main.xml
+++ b/app/src/main/res/layout/fragment_main.xml
@@ -1,9 +1,9 @@
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:orientation="vertical"
+ android:gravity="center"
+ android:layout_height="match_parent">
-
-
diff --git a/app/src/main/res/layout/list_circle_try.xml b/app/src/main/res/layout/list_circle_try.xml
index 86280a23..4f6ee11c 100644
--- a/app/src/main/res/layout/list_circle_try.xml
+++ b/app/src/main/res/layout/list_circle_try.xml
@@ -5,7 +5,7 @@
android:layout_marginBottom="1dp"
android:gravity="center"
android:orientation="horizontal"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools">