From 26294b1d54311461d3bb036f41e9ac8977bed0a6 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Mon, 6 Dec 2021 00:34:27 +0330 Subject: [PATCH] Update Simple-Commons and remove useless annotations The reason they were needed was the linter couldn't understand their usage when they aren't in the same project but with the updated Simple-Commons it now can. --- app/build.gradle | 2 +- .../simplemobiletools/clock/activities/ReminderActivity.kt | 2 +- .../kotlin/com/simplemobiletools/clock/extensions/Context.kt | 4 ---- .../com/simplemobiletools/clock/receivers/AlarmReceiver.kt | 2 -- .../com/simplemobiletools/clock/services/TimerService.kt | 3 --- 5 files changed, 2 insertions(+), 11 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1afdc0fe..a43d6d3c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -67,7 +67,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:307941253d' + implementation 'com.github.SimpleMobileTools:Simple-Commons:eee4809d37' implementation 'com.facebook.stetho:stetho:1.5.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.2' implementation 'com.shawnlin:number-picker:2.4.6' diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt index 96bd67fb..b3d64ed9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt @@ -77,7 +77,7 @@ class ReminderActivity : SimpleActivity() { } } - @SuppressLint("NewApi") + @SuppressLint("ClickableViewAccessibility") private fun setupAlarmButtons() { reminder_stop.beGone() reminder_draggable_background.startAnimation(AnimationUtils.loadAnimation(this, R.anim.pulsing_animation)) diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Context.kt index d63114b6..01b37003 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Context.kt @@ -1,6 +1,5 @@ package com.simplemobiletools.clock.extensions -import android.annotation.SuppressLint import android.app.* import android.appwidget.AppWidgetManager import android.content.ComponentName @@ -182,7 +181,6 @@ fun Context.updateWidgets() { } } -@SuppressLint("NewApi") fun Context.scheduleNextWidgetUpdate() { val widgetsCnt = AppWidgetManager.getInstance(applicationContext)?.getAppWidgetIds(ComponentName(applicationContext, MyWidgetDateTimeProvider::class.java)) ?: return @@ -267,7 +265,6 @@ fun Context.showAlarmNotification(alarm: Alarm) { } } -@SuppressLint("NewApi") fun Context.getTimerNotification(timer: Timer, pendingIntent: PendingIntent, addDeleteIntent: Boolean): Notification { var soundUri = timer.soundUri if (soundUri == SILENT) { @@ -351,7 +348,6 @@ fun Context.getHideAlarmPendingIntent(alarm: Alarm): PendingIntent { return PendingIntent.getBroadcast(this, alarm.id, intent, PendingIntent.FLAG_UPDATE_CURRENT) } -@SuppressLint("NewApi") fun Context.getAlarmNotification(pendingIntent: PendingIntent, alarm: Alarm): Notification { val soundUri = alarm.soundUri if (soundUri != SILENT) { diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/receivers/AlarmReceiver.kt b/app/src/main/kotlin/com/simplemobiletools/clock/receivers/AlarmReceiver.kt index 60200b52..8ce05c83 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/receivers/AlarmReceiver.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/receivers/AlarmReceiver.kt @@ -1,6 +1,5 @@ package com.simplemobiletools.clock.receivers -import android.annotation.SuppressLint import android.app.NotificationChannel import android.app.NotificationManager import android.app.PendingIntent @@ -21,7 +20,6 @@ import com.simplemobiletools.commons.helpers.isOreoPlus class AlarmReceiver : BroadcastReceiver() { - @SuppressLint("NewApi") override fun onReceive(context: Context, intent: Intent) { val id = intent.getIntExtra(ALARM_ID, -1) val alarm = context.dbHelper.getAlarmWithId(id) ?: return diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/services/TimerService.kt b/app/src/main/kotlin/com/simplemobiletools/clock/services/TimerService.kt index f1716056..c18db6cf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/services/TimerService.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/services/TimerService.kt @@ -1,13 +1,11 @@ package com.simplemobiletools.clock.services -import android.annotation.TargetApi import android.app.Notification import android.app.NotificationChannel import android.app.NotificationManager import android.app.Service import android.content.Context import android.content.Intent -import android.os.Build import android.os.IBinder import androidx.core.app.NotificationCompat import androidx.core.content.ContextCompat @@ -86,7 +84,6 @@ class TimerService : Service() { bus.unregister(this) } - @TargetApi(Build.VERSION_CODES.O) private fun notification(title: String, contentText: String, firstRunningTimerId: Int): Notification { val channelId = "simple_alarm_timer" val label = getString(R.string.timer)