Compare commits

...
1 Commits
Author SHA1 Message Date
Vaishno Singh 5c66f6c4dc fix(widget): fix 'Failed to load widget' by replacing View with FrameLayout, removing theme attrs & using PNG drawables (v1.2.3)
Build & Release Android APK / Build & Publish Release APK (push) Failing after 1m28s
2026-11-19 21:52:09 +05:30
6 changed files with 119 additions and 100 deletions
+2 -2
View File
@@ -11,8 +11,8 @@ android {
applicationId = "com.expapp.trigger"
minSdk = 24
targetSdk = 34
versionCode = 16
versionName = "1.2.2"
versionCode = 17
versionName = "1.2.3"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
@@ -57,6 +57,7 @@ class ServerWidgetProvider : AppWidgetProvider() {
appWidgetManager: AppWidgetManager,
appWidgetIds: IntArray
) {
try {
val repository = DeviceRepository(SharedPrefsStorage(context))
val devices = repository.getDevices()
@@ -67,13 +68,24 @@ class ServerWidgetProvider : AppWidgetProvider() {
// If device exists, fetch live status asynchronously
if (device != null && device.statusUrl.isNotBlank()) {
executor.execute {
try {
val status = TriggerClient().checkStatusSync(device)
mainHandler.post {
try {
renderWidget(context, appWidgetManager, appWidgetId, device, status)
} catch (e: Exception) {
e.printStackTrace()
}
}
} catch (e: Exception) {
e.printStackTrace()
}
}
}
}
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onReceive(context: Context, intent: Intent) {
@@ -131,6 +143,7 @@ class ServerWidgetProvider : AppWidgetProvider() {
status: NodeStatus?,
footerOverride: String? = null
) {
try {
val views = RemoteViews(context.packageName, R.layout.widget_server_control)
if (device == null) {
@@ -217,6 +230,9 @@ class ServerWidgetProvider : AppWidgetProvider() {
)
appWidgetManager.updateAppWidget(appWidgetId, views)
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun createTriggerPendingIntent(
Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

@@ -17,7 +17,7 @@
<ImageView
android:layout_width="18dp"
android:layout_height="18dp"
android:src="@drawable/ic_terminal"
android:src="@drawable/widget_ic_terminal"
android:contentDescription="Server" />
<LinearLayout
@@ -82,14 +82,13 @@
android:id="@+id/widget_btn_refresh"
android:layout_width="26dp"
android:layout_height="26dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="Refresh"
android:padding="3dp"
android:src="@drawable/ic_refresh" />
android:src="@drawable/widget_ic_refresh" />
</LinearLayout>
<!-- Spacer / Divider -->
<View
<!-- Spacer / Divider (FrameLayout is explicitly whitelisted in RemoteViews) -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="8dp"
+6 -2
View File
@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="250dp"
android:minHeight="100dp"
android:minWidth="220dp"
android:minHeight="90dp"
android:targetCellWidth="3"
android:targetCellHeight="2"
android:minResizeWidth="180dp"
android:minResizeHeight="70dp"
android:updatePeriodMillis="1800000"
android:initialLayout="@layout/widget_server_control"
android:resizeMode="horizontal|vertical"