mirror of
https://github.com/darkmoonight/Rain.git
synced 2025-06-28 20:19:58 +00:00
widget fix
This commit is contained in:
parent
23cd9b9c12
commit
c65f80f079
6 changed files with 71 additions and 5 deletions
|
@ -25,12 +25,14 @@ class OreoWidget : HomeWidgetProvider() {
|
||||||
SizeFCompat(40.0f, 0.0f),
|
SizeFCompat(40.0f, 0.0f),
|
||||||
SizeFCompat(100.0f, 0.0f),
|
SizeFCompat(100.0f, 0.0f),
|
||||||
SizeFCompat(230.0f, 0.0f),
|
SizeFCompat(230.0f, 0.0f),
|
||||||
|
SizeFCompat(280.0f, 0.0f),
|
||||||
)
|
)
|
||||||
appWidgetManager.updateAppWidget(appWidgetId, supportedSizes) {
|
appWidgetManager.updateAppWidget(appWidgetId, supportedSizes) {
|
||||||
val layoutId = when (it) {
|
val layoutId = when (it) {
|
||||||
supportedSizes[0] -> R.layout.oreo_widget_mini
|
supportedSizes[0] -> R.layout.oreo_widget_mini
|
||||||
supportedSizes[1] -> R.layout.oreo_widget_small
|
supportedSizes[1] -> R.layout.oreo_widget_small
|
||||||
else -> R.layout.oreo_widget_medium
|
supportedSizes[2] -> R.layout.oreo_widget_medium
|
||||||
|
else -> R.layout.oreo_widget_big
|
||||||
}
|
}
|
||||||
RemoteViews(context.packageName, layoutId).apply {
|
RemoteViews(context.packageName, layoutId).apply {
|
||||||
val pendingIntent = HomeWidgetLaunchIntent.getActivity(
|
val pendingIntent = HomeWidgetLaunchIntent.getActivity(
|
||||||
|
|
54
android/app/src/main/res/layout/oreo_widget_big.xml
Normal file
54
android/app/src/main/res/layout/oreo_widget_big.xml
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
style="@style/Widget.Android.AppWidget.Container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:theme="@style/Theme.Android.AppWidgetContainer"
|
||||||
|
android:id="@+id/widget_day_oreo">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/widget_day_weather"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<TextClock
|
||||||
|
android:id="@+id/widget_day_time"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:fontFamily="@font/ubuntu"
|
||||||
|
android:format12Hour="@string/date_format_widget_oreo_big_style"
|
||||||
|
android:format24Hour="@string/date_format_widget_oreo_big_style"
|
||||||
|
android:shadowDx="1"
|
||||||
|
android:shadowDy="1"
|
||||||
|
android:shadowRadius="1"
|
||||||
|
android:textSize="@dimen/widget_large_title_text_size"
|
||||||
|
tools:ignore="ObsoleteLayoutParam"
|
||||||
|
tools:text="Saturday, September 30 │ " />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/widget_day_icon"
|
||||||
|
android:layout_width="@dimen/widget_mini_weather_icon_size"
|
||||||
|
android:layout_height="@dimen/widget_mini_weather_icon_size"
|
||||||
|
android:src="@drawable/cloud"
|
||||||
|
tools:ignore="ContentDescription,ImageContrastCheck" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_day_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/little_margin"
|
||||||
|
android:fontFamily="@font/ubuntu"
|
||||||
|
android:shadowDx="1"
|
||||||
|
android:shadowDy="1"
|
||||||
|
android:shadowRadius="1"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Material.Large"
|
||||||
|
android:textSize="@dimen/widget_large_title_text_size"
|
||||||
|
tools:text="28°" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
|
@ -34,8 +34,8 @@
|
||||||
<!-- text. -->
|
<!-- text. -->
|
||||||
<dimen name="main_title_text_size">96sp</dimen>
|
<dimen name="main_title_text_size">96sp</dimen>
|
||||||
<dimen name="design_title_text_size">48sp</dimen>
|
<dimen name="design_title_text_size">48sp</dimen>
|
||||||
<dimen name="large_title_text_size">20sp</dimen>
|
<dimen name="large_title_text_size">22sp</dimen>
|
||||||
<dimen name="title_text_size">16sp</dimen>
|
<dimen name="title_text_size">18sp</dimen>
|
||||||
<dimen name="content_text_size">14sp</dimen>
|
<dimen name="content_text_size">14sp</dimen>
|
||||||
<dimen name="subtitle_text_size">12sp</dimen>
|
<dimen name="subtitle_text_size">12sp</dimen>
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@
|
||||||
56dp. -->
|
56dp. -->
|
||||||
<dimen name="widget_standard_weather_icon_size">48dp</dimen>
|
<dimen name="widget_standard_weather_icon_size">48dp</dimen>
|
||||||
<dimen name="widget_little_weather_icon_size">36dp</dimen>
|
<dimen name="widget_little_weather_icon_size">36dp</dimen>
|
||||||
<dimen name="widget_mini_weather_icon_size">24dp</dimen>
|
<dimen name="widget_mini_weather_icon_size">28dp</dimen>
|
||||||
<dimen name="widget_design_title_text_size">28sp</dimen>
|
<dimen name="widget_design_title_text_size">24sp</dimen>
|
||||||
<dimen name="widget_large_title_text_size">@dimen/large_title_text_size</dimen> <!-- 20sp. -->
|
<dimen name="widget_large_title_text_size">@dimen/large_title_text_size</dimen> <!-- 20sp. -->
|
||||||
<dimen name="widget_title_text_size">@dimen/title_text_size</dimen> <!-- 16sp. -->
|
<dimen name="widget_title_text_size">@dimen/title_text_size</dimen> <!-- 16sp. -->
|
||||||
<dimen name="widget_subtitle_text_size">@dimen/subtitle_text_size</dimen> <!-- 12sp. -->
|
<dimen name="widget_subtitle_text_size">@dimen/subtitle_text_size</dimen> <!-- 12sp. -->
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_widget_description">Oreo Widget</string>
|
<string name="app_widget_description">Oreo Widget</string>
|
||||||
<string name="date_format_widget_oreo_style">EEE, d MMM │</string>
|
<string name="date_format_widget_oreo_style">EEE, d MMM │</string>
|
||||||
|
<string name="date_format_widget_oreo_big_style">EEEE, d MMM │</string>
|
||||||
</resources>
|
</resources>
|
|
@ -1058,6 +1058,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.0.9"
|
version: "5.0.9"
|
||||||
|
workmanager:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: workmanager
|
||||||
|
sha256: ed13530cccd28c5c9959ad42d657cd0666274ca74c56dea0ca183ddd527d3a00
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.5.2"
|
||||||
xdg_directories:
|
xdg_directories:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -23,6 +23,7 @@ dependencies:
|
||||||
geocoding: ^2.1.0
|
geocoding: ^2.1.0
|
||||||
geolocator: ^10.1.0
|
geolocator: ^10.1.0
|
||||||
home_widget: ^0.3.0
|
home_widget: ^0.3.0
|
||||||
|
workmanager: ^0.5.2
|
||||||
google_fonts: ^6.1.0
|
google_fonts: ^6.1.0
|
||||||
flutter_glow: ^0.3.0
|
flutter_glow: ^0.3.0
|
||||||
time_machine: ^0.9.17
|
time_machine: ^0.9.17
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue