mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-31 19:20:34 +00:00
Fix widget issues
This commit is contained in:
parent
b146895a52
commit
011af84c31
11 changed files with 28 additions and 10 deletions
|
|
@ -152,7 +152,7 @@ android {
|
|||
buildConfigField "String", "TESTING_LEVEL", "\"production\""
|
||||
resConfigs "en", "bg", "de", "en-rGB", "es", "fr", "hr-rHR", "in", "it", "iw", "ja", "ko", "lt", "nl", "pl", "pt-rBR", "pt-rPT", "ru", "tr", "zh", "zh-rTW"
|
||||
|
||||
versionCode 3109
|
||||
versionCode 3117
|
||||
versionName "3.4.2"
|
||||
|
||||
targetSdkVersion 31
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 4.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 8 KiB |
|
|
@ -10,4 +10,12 @@ fun withImmutableFlag(flags: Int): Int {
|
|||
} else {
|
||||
flags
|
||||
}
|
||||
}
|
||||
|
||||
fun withMutableFlag(flags: Int): Int {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
flags + PendingIntent.FLAG_MUTABLE
|
||||
} else {
|
||||
flags
|
||||
}
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@ import androidx.core.app.NotificationCompat
|
|||
import androidx.core.app.RemoteInput
|
||||
import androidx.core.os.bundleOf
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.extensions.withImmutableFlag
|
||||
import com.habitrpg.android.habitica.extensions.withMutableFlag
|
||||
import com.habitrpg.android.habitica.receivers.LocalNotificationActionReceiver
|
||||
import com.habitrpg.android.habitica.ui.helpers.EmojiParser
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ class ReceivedPrivateMessageLocalNotification(context: Context, identifier: Stri
|
|||
PendingIntent.getBroadcast(
|
||||
context, senderID.hashCode(),
|
||||
intent,
|
||||
withImmutableFlag(PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
withMutableFlag(PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
)
|
||||
|
||||
val action: NotificationCompat.Action =
|
||||
|
|
|
|||
|
|
@ -678,6 +678,7 @@ class NavigationDrawerFragment : DialogFragment() {
|
|||
updateItem(promotedItem)
|
||||
} else {
|
||||
promotedItem.subtitle = null
|
||||
promotedItem.pillText = null
|
||||
updateItem(promotedItem)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import android.util.AttributeSet
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.widget.doOnTextChanged
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.databinding.ValidatingEditTextBinding
|
||||
import com.habitrpg.android.habitica.extensions.layoutInflater
|
||||
|
|
@ -51,5 +52,13 @@ class ValidatingEditText @JvmOverloads constructor(
|
|||
}
|
||||
(this.parent as? ViewGroup)?.forceLayout()
|
||||
}
|
||||
binding.editText.doOnTextChanged { text, start, before, count ->
|
||||
if (binding.errorText.visibility == View.VISIBLE) {
|
||||
if (validator?.invoke(text.toString()) == true) {
|
||||
binding.errorText.visibility = View.GONE
|
||||
(this.parent as? ViewGroup)?.forceLayout()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -78,6 +78,8 @@ class AvatarStatsWidgetProvider : BaseWidgetProvider() {
|
|||
remoteViews.setViewVisibility(R.id.detail_info_view, View.GONE)
|
||||
}
|
||||
|
||||
|
||||
|
||||
return remoteViews
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +100,8 @@ class AvatarStatsWidgetProvider : BaseWidgetProvider() {
|
|||
val mpValueString = "" + stats.mp?.toInt() + "/" + stats.maxMP
|
||||
|
||||
for (widgetId in allWidgetIds) {
|
||||
var remoteViews = RemoteViews(context.packageName, R.layout.widget_avatar_stats)
|
||||
val options = appWidgetManager.getAppWidgetOptions(widgetId)
|
||||
val remoteViews = sizeRemoteViews(context, options, widgetId)
|
||||
|
||||
remoteViews.setTextViewText(R.id.TV_hp_value, healthValueString)
|
||||
remoteViews.setTextViewText(R.id.exp_TV_value, expValueString)
|
||||
|
|
@ -146,10 +149,7 @@ class AvatarStatsWidgetProvider : BaseWidgetProvider() {
|
|||
val openApp = PendingIntent.getActivity(context, 0, openAppIntent, withImmutableFlag(PendingIntent.FLAG_UPDATE_CURRENT))
|
||||
remoteViews.setOnClickPendingIntent(android.R.id.background, openApp)
|
||||
|
||||
val options = appWidgetManager.getAppWidgetOptions(widgetId)
|
||||
remoteViews = sizeRemoteViews(context, options, widgetId)
|
||||
|
||||
appWidgetManager.updateAppWidget(widgetId, remoteViews)
|
||||
appWidgetManager.updateAppWidget(allWidgetIds, remoteViews)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.31'
|
||||
ext.kotlin_version = '1.6.0'
|
||||
|
||||
repositories {
|
||||
google()
|
||||
|
|
@ -12,7 +12,7 @@ buildscript {
|
|||
classpath 'com.android.tools.build:gradle:7.0.3'
|
||||
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
||||
classpath 'com.google.gms:google-services:4.3.10'
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.0'
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
|
||||
classpath "io.realm:realm-gradle-plugin:10.8.1"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.18.1"
|
||||
|
|
|
|||
Loading…
Reference in a new issue