Skip to content

Commit aa75264

Browse files
authored
Merge pull request #11 from SimpleAppProjects/develop
v5.8.3
2 parents 94733e5 + 0f7c209 commit aa75264

21 files changed

+153
-56
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ android {
1414
minSdkVersion rootProject.minSdkVersion
1515
targetSdkVersion rootProject.targetSdkVersion
1616
// NOTE: Version Code Format (TargetSDK, Version Name, Build Number, Variant Code (Android: 00, WearOS: 01)
17-
versionCode 335820400
18-
versionName "5.8.2"
17+
versionCode 335830000
18+
versionName "5.8.3"
1919

2020
vectorDrawables.useSupportLibrary true
2121
}

app/src/main/AndroidManifest.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,14 @@
358358
<provider
359359
android:name="androidx.startup.InitializationProvider"
360360
android:authorities="${applicationId}.androidx-startup"
361-
tools:node="remove" />
361+
android:exported="false"
362+
tools:node="merge">
363+
<!-- If you are using androidx.startup to initialize other components -->
364+
<meta-data
365+
android:name="androidx.work.WorkManagerInitializer"
366+
android:value="androidx.startup"
367+
tools:node="remove" />
368+
</provider>
362369

363370
<service
364371
android:name="androidx.work.impl.foreground.SystemForegroundService"

app/src/main/java/com/thewizrd/simpleweather/widgets/WidgetUpdaterHelper.kt

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,21 @@ import com.thewizrd.shared_resources.weatherdata.model.HourlyForecast
3232
import com.thewizrd.shared_resources.weatherdata.model.Weather
3333
import com.thewizrd.simpleweather.R
3434
import com.thewizrd.simpleweather.main.MainActivity
35-
import com.thewizrd.simpleweather.widgets.preferences.*
35+
import com.thewizrd.simpleweather.widgets.preferences.KEY_BGCOLOR
36+
import com.thewizrd.simpleweather.widgets.preferences.KEY_BGCOLORCODE
37+
import com.thewizrd.simpleweather.widgets.preferences.KEY_BGSTYLE
38+
import com.thewizrd.simpleweather.widgets.preferences.KEY_FORECASTOPTION
39+
import com.thewizrd.simpleweather.widgets.preferences.KEY_ICONSIZE
40+
import com.thewizrd.simpleweather.widgets.preferences.KEY_TEXTSIZE
41+
import com.thewizrd.simpleweather.widgets.preferences.KEY_TXTCOLORCODE
3642
import com.thewizrd.simpleweather.widgets.remoteviews.CustomBackgroundWidgetRemoteViewCreator
3743
import com.thewizrd.simpleweather.widgets.remoteviews.WidgetRemoteViewCreator
3844
import com.thewizrd.weather_api.weatherModule
39-
import kotlinx.coroutines.*
45+
import kotlinx.coroutines.Deferred
46+
import kotlinx.coroutines.Dispatchers
47+
import kotlinx.coroutines.async
48+
import kotlinx.coroutines.awaitAll
49+
import kotlinx.coroutines.coroutineScope
4050
import java.time.ZonedDateTime
4151
import java.time.temporal.ChronoUnit
4252
import kotlin.math.min
@@ -312,6 +322,32 @@ object WidgetUpdaterHelper {
312322
WidgetUtils.setMaxForecastLength(appWidgetId, forecasts.size)
313323
WidgetUtils.setMaxHrForecastLength(appWidgetId, hourlyForecasts.size)
314324

325+
if (info.widgetType == WidgetType.Widget4x1) {
326+
updateViews.removeAllViews(R.id.layout_container)
327+
updateViews.addView(
328+
R.id.layout_container, RemoteViews(
329+
context.packageName,
330+
if (forecastPanel != null && hrForecastPanel != null) {
331+
R.layout.app_widget_forecast_layout_anim
332+
} else {
333+
R.layout.app_widget_forecast_layout
334+
}
335+
)
336+
)
337+
} else if (info.widgetType == WidgetType.Widget4x2) {
338+
updateViews.removeAllViews(R.id.forecast_container)
339+
updateViews.addView(
340+
R.id.forecast_container, RemoteViews(
341+
context.packageName,
342+
if (forecastPanel != null && hrForecastPanel != null) {
343+
R.layout.app_widget_forecast_layout_anim
344+
} else {
345+
R.layout.app_widget_forecast_layout
346+
}
347+
)
348+
)
349+
}
350+
315351
if (forecastPanel != null) {
316352
updateViews.addView(R.id.forecast_layout, forecastPanel)
317353
}

app/src/main/res/layout/app_widget_4x1.xml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,7 @@
2222
android:layout_weight="1"
2323
android:orientation="horizontal"
2424
android:padding="8dp"
25-
android:baselineAligned="false">
26-
27-
<ViewFlipper
28-
android:id="@+id/forecast_layout"
29-
android:layout_width="match_parent"
30-
android:layout_height="wrap_content"
31-
android:layout_gravity="center_vertical"
32-
android:autoStart="true"
33-
android:flipInterval="10000"
34-
android:inAnimation="@anim/widget_fade_in"
35-
android:outAnimation="@anim/widget_fade_out" />
36-
37-
</LinearLayout>
25+
android:baselineAligned="false" />
3826

3927
<LinearLayout
4028
android:layout_width="match_parent"

app/src/main/res/layout/app_widget_4x1_nolocation.xml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,7 @@
2424
android:layout_weight="1"
2525
android:orientation="horizontal"
2626
android:padding="8dp"
27-
android:baselineAligned="false">
28-
29-
<ViewFlipper
30-
android:id="@+id/forecast_layout"
31-
android:layout_width="match_parent"
32-
android:layout_height="wrap_content"
33-
android:layout_gravity="center_vertical"
34-
android:autoStart="true"
35-
android:flipInterval="10000"
36-
android:inAnimation="@anim/widget_fade_in"
37-
android:outAnimation="@anim/widget_fade_out" />
38-
39-
</LinearLayout>
27+
android:baselineAligned="false" />
4028

4129
<RelativeLayout
4230
android:layout_width="wrap_content"

app/src/main/res/layout/app_widget_4x2.xml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
android:id="@+id/panda_container"
1818
android:layout_width="match_parent"
1919
android:layout_height="wrap_content"
20-
android:layout_alignTop="@id/forecast_layout"
21-
android:layout_alignBottom="@id/forecast_layout"
20+
android:layout_alignTop="@id/forecast_container"
21+
android:layout_alignBottom="@id/forecast_container"
2222
android:adjustViewBounds="true"
2323
android:scaleType="fitXY"
2424
tools:background="@color/colorOnPrimary" />
@@ -67,7 +67,7 @@
6767
android:id="@+id/layout_container"
6868
android:layout_width="match_parent"
6969
android:layout_height="wrap_content"
70-
android:layout_above="@id/forecast_layout"
70+
android:layout_above="@id/forecast_container"
7171
android:layout_alignParentTop="true"
7272
android:orientation="vertical"
7373
android:padding="8dp">
@@ -205,14 +205,10 @@
205205

206206
</LinearLayout>
207207

208-
<ViewFlipper
209-
android:id="@+id/forecast_layout"
208+
<FrameLayout
209+
android:id="@+id/forecast_container"
210210
android:layout_width="match_parent"
211211
android:layout_height="wrap_content"
212-
android:layout_alignParentBottom="true"
213-
android:autoStart="true"
214-
android:flipInterval="10000"
215-
android:inAnimation="@anim/widget_fade_in"
216-
android:outAnimation="@anim/widget_fade_out" />
212+
android:layout_alignParentBottom="true" />
217213

218214
</RelativeLayout>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:id="@+id/forecast_layout"
4+
android:layout_width="match_parent"
5+
android:layout_height="wrap_content"
6+
android:layout_alignParentBottom="true"
7+
android:layout_gravity="center_vertical"
8+
android:autoStart="true"
9+
android:flipInterval="10000" />
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:id="@+id/forecast_layout"
4+
android:layout_width="match_parent"
5+
android:layout_height="wrap_content"
6+
android:layout_alignParentBottom="true"
7+
android:layout_gravity="center_vertical"
8+
android:autoStart="true"
9+
android:flipInterval="10000"
10+
android:inAnimation="@anim/widget_fade_in"
11+
android:outAnimation="@anim/widget_fade_out" />

wearapp/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ android {
1414
minSdkVersion 26
1515
targetSdkVersion rootProject.targetSdkVersion
1616
// NOTE: Version Code Format (TargetSDK, Version Name, Build Number, Variant Code (Android: 00, WearOS: 01)
17-
versionCode 335820401
18-
versionName "5.8.2"
17+
versionCode 335830001
18+
versionName "5.8.3"
1919

2020
vectorDrawables.useSupportLibrary true
2121
}

wearapp/src/main/java/com/thewizrd/simpleweather/preferences/SettingsActivity.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ import androidx.preference.ListPreference
2828
import androidx.preference.Preference
2929
import androidx.preference.PreferenceCategory
3030
import androidx.preference.SwitchPreference
31+
import androidx.recyclerview.widget.RecyclerView
3132
import androidx.wear.remote.interactions.RemoteActivityHelper
3233
import androidx.wear.widget.ConfirmationOverlay
34+
import androidx.wear.widget.WearableLinearLayoutManager
3335
import com.thewizrd.common.helpers.LocationPermissionLauncher
3436
import com.thewizrd.common.helpers.backgroundLocationPermissionEnabled
3537
import com.thewizrd.common.helpers.getBackgroundLocationRationale
@@ -117,6 +119,10 @@ class SettingsActivity : WearableListenerActivity() {
117119

118120
supportFragmentManager.addOnBackStackChangedListener {
119121
fragmentOnBackPressedCallback.isEnabled = supportFragmentManager.backStackEntryCount > 0
122+
123+
supportFragmentManager.findFragmentById(android.R.id.content)?.let { f ->
124+
f.view?.requestFocus()
125+
}
120126
}
121127

122128
// Display the fragment as the main content.
@@ -1004,5 +1010,9 @@ class SettingsActivity : WearableListenerActivity() {
10041010
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
10051011
setPreferencesFromResource(R.xml.pref_oslibs, rootKey)
10061012
}
1013+
1014+
override fun onCreateLayoutManager(): RecyclerView.LayoutManager {
1015+
return WearableLinearLayoutManager(context, null)
1016+
}
10071017
}
10081018
}

0 commit comments

Comments
 (0)