Fix some various deprecated code bits in the widget

This commit is contained in:
Inhishonor
2025-08-11 13:22:07 -07:00
parent ac733021e8
commit 8659466477
2 changed files with 3 additions and 3 deletions
@@ -94,7 +94,7 @@ class WidgetAdapter(intent: Intent) : RemoteViewsService.RemoteViewsFactory {
* we'll return the max count + 1, where the last row just shows "View more conversations"
*/
override fun getCount(): Int {
val count = Math.min(conversations.size, MAX_CONVERSATIONS_COUNT)
val count = conversations.size.coerceAtMost(MAX_CONVERSATIONS_COUNT)
val shouldShowViewMore = count < conversations.size
return count + if (shouldShowViewMore) 1 else 0
}
@@ -26,7 +26,6 @@ import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.content.res.Configuration
import android.net.Uri
import android.os.Bundle
import android.widget.RemoteViews
import dagger.android.AndroidInjection
@@ -40,6 +39,7 @@ import dev.octoshrimpy.quik.receiver.StartActivityFromWidgetReceiver
import dev.octoshrimpy.quik.util.Preferences
import timber.log.Timber
import javax.inject.Inject
import androidx.core.net.toUri
class WidgetProvider : AppWidgetProvider() {
@@ -138,7 +138,7 @@ class WidgetProvider : AppWidgetProvider() {
val intent = Intent(context, WidgetService::class.java)
.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
.putExtra("small_widget", smallWidget)
intent.data = Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME))
intent.data = intent.toUri(Intent.URI_INTENT_SCHEME).toUri()
remoteViews.setRemoteAdapter(R.id.conversations, intent)
// compose new message image color and on click intent