mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-03-15 02:32:29 +00:00
try adding widget; add previews to each composable
This commit is contained in:
@@ -4,7 +4,6 @@ appWidgetInnerRadius attribute value
|
||||
-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners android:radius="?attr/appWidgetInnerRadius" />
|
||||
<solid android:color="?android:attr/colorAccent" />
|
||||
</shape>
|
||||
72
android/app/src/main/res/layout-v31/battery_widget.xml
Normal file
72
android/app/src/main/res/layout-v31/battery_widget.xml
Normal file
@@ -0,0 +1,72 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
style="@style/Widget.ALN.AppWidget.Container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:theme="@style/Theme.ALN.AppWidgetContainer">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_margin="0dp"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:contentDescription="something"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:src="@drawable/airpods_pro_left_notification"
|
||||
android:tint="@android:color/system_accent2_400"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/left_battery_widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@android:color/system_accent2_400"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="Left"
|
||||
tools:ignore="HardcodedText" />
|
||||
<ImageView
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:src="@drawable/airpods_pro_right_notification"
|
||||
android:tint="@android:color/system_accent2_400"
|
||||
android:layout_margin="0dp"
|
||||
android:contentDescription="something"
|
||||
android:gravity="center_vertical"
|
||||
tools:ignore="HardcodedText" />
|
||||
<TextView
|
||||
android:id="@+id/right_battery_widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@android:color/system_accent2_400"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="Right"
|
||||
tools:ignore="HardcodedText" />
|
||||
<ImageView
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:src="@drawable/airpods_pro_case_notification"
|
||||
android:tint="@android:color/system_accent2_400"
|
||||
android:contentDescription="something"
|
||||
android:layout_margin="0dp"
|
||||
android:gravity="center_vertical"
|
||||
tools:ignore="HardcodedText" />
|
||||
<TextView
|
||||
android:id="@+id/case_battery_widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@android:color/system_accent2_400"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="Case"
|
||||
tools:ignore="HardcodedText" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -1,19 +1,74 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
style="@style/Widget.ALN.AppWidget.Container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:theme="@style/Theme.ALN.AppWidgetContainer">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_margin="0dp"
|
||||
android:gravity="center">
|
||||
<ImageView
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:contentDescription="something"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:src="@drawable/airpods_pro_left_notification"
|
||||
android:tint="@color/popup_text"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/appwidget_text"
|
||||
style="@style/Widget.ALN.AppWidget.InnerView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="8dp"
|
||||
android:contentDescription="@string/appwidget_text"
|
||||
android:text="@string/appwidget_text"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold|italic" />
|
||||
<TextView
|
||||
android:id="@+id/left_battery_widget"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/popup_text"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="Left"
|
||||
tools:ignore="HardcodedText" />
|
||||
<ImageView
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:src="@drawable/airpods_pro_right_notification"
|
||||
android:tint="@color/popup_text"
|
||||
android:layout_margin="0dp"
|
||||
android:contentDescription="something"
|
||||
android:gravity="center_vertical"
|
||||
tools:ignore="HardcodedText" />
|
||||
<TextView
|
||||
android:id="@+id/right_battery_widget"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/popup_text"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="Right"
|
||||
tools:ignore="HardcodedText" />
|
||||
<ImageView
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:src="@drawable/airpods_pro_case_notification"
|
||||
android:tint="@color/popup_text"
|
||||
android:contentDescription="something"
|
||||
android:layout_margin="0dp"
|
||||
android:gravity="center_vertical"
|
||||
tools:ignore="HardcodedText" />
|
||||
<TextView
|
||||
android:id="@+id/case_battery_widget"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/popup_text"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="Case"
|
||||
tools:ignore="HardcodedText" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -2,4 +2,6 @@
|
||||
<resources>
|
||||
<color name="popup_background">#1C1B1E</color>
|
||||
<color name="popup_text">@color/white</color>
|
||||
<color name="widget_background">#1C1B1E</color>
|
||||
<color name="widget_text">@color/white</color>
|
||||
</resources>
|
||||
@@ -4,8 +4,6 @@
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="popup_background">#FFFFFF</color>
|
||||
<color name="popup_text">@color/black</color>
|
||||
<color name="light_blue_50">#FFE1F5FE</color>
|
||||
<color name="light_blue_200">#FF81D4FA</color>
|
||||
<color name="light_blue_600">#FF039BE5</color>
|
||||
<color name="light_blue_900">#FF01579B</color>
|
||||
<color name="widget_background">#87FFFFFF</color>
|
||||
<color name="widget_text">@color/black</color>
|
||||
</resources>
|
||||
@@ -1,7 +1,5 @@
|
||||
<resources>
|
||||
<string name="app_name">ALN</string>
|
||||
<string name="title_activity_custom_device">GATT Testing</string>
|
||||
<string name="appwidget_text">EXAMPLE</string>
|
||||
<string name="add_widget">Add widget</string>
|
||||
<string name="app_widget_description">This is an app widget description</string>
|
||||
<string name="app_widget_description">See your AirPods battery status right from your home screen!</string>
|
||||
</resources>
|
||||
@@ -5,12 +5,12 @@
|
||||
|
||||
<style name="Theme.ALN.AppWidgetContainerParent" parent="@android:style/Theme.DeviceDefault">
|
||||
<!-- Radius of the outer bound of widgets to make the rounded corners -->
|
||||
<item name="appWidgetRadius">16dp</item>
|
||||
<item name="appWidgetRadius">24dp</item>
|
||||
<!--
|
||||
Radius of the inner view's bound of widgets to make the rounded corners.
|
||||
It needs to be 8dp or less than the value of appWidgetRadius
|
||||
-->
|
||||
<item name="appWidgetInnerRadius">8dp</item>
|
||||
<item name="appWidgetInnerRadius">24dp</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.ALN.AppWidgetContainer" parent="Theme.ALN.AppWidgetContainerParent">
|
||||
|
||||
14
android/app/src/main/res/xml-v31/battery_widget_info.xml
Normal file
14
android/app/src/main/res/xml-v31/battery_widget_info.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:description="@string/app_widget_description"
|
||||
android:initialKeyguardLayout="@layout/battery_widget"
|
||||
android:initialLayout="@layout/battery_widget"
|
||||
android:minWidth="40dp"
|
||||
android:minHeight="40dp"
|
||||
android:previewImage="@drawable/example_appwidget_preview"
|
||||
android:previewLayout="@layout/battery_widget"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
android:targetCellWidth="1"
|
||||
android:targetCellHeight="1"
|
||||
android:updatePeriodMillis="86400000"
|
||||
android:widgetCategory="home_screen|keyguard" />
|
||||
Reference in New Issue
Block a user