mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-02-26 02:43:34 +00:00
add iOS style battery widget
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#DA000000" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
14
android/app/src/main/res/drawable/button_background.xml
Normal file
14
android/app/src/main/res/drawable/button_background.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#121212" />
|
||||
<corners android:radius="16dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#404040" />
|
||||
<corners android:radius="12dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,15 +1,13 @@
|
||||
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:fromDegrees="-90"
|
||||
<rotate
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:fromDegrees="270"
|
||||
android:toDegrees="270">
|
||||
<shape
|
||||
android:shape="ring"
|
||||
android:innerRadiusRatio="3"
|
||||
android:thicknessRatio="8"
|
||||
android:innerRadiusRatio="3.0"
|
||||
android:thickness="6dp"
|
||||
android:useLevel="true">
|
||||
<gradient
|
||||
android:type="sweep"
|
||||
android:useLevel="true"
|
||||
android:startColor="#00ff00"
|
||||
android:endColor="#00ff00" />
|
||||
<solid android:color="#00D85B" />
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
||||
</rotate>
|
||||
</rotate>
|
||||
|
||||
15
android/app/src/main/res/drawable/ic_power.xml
Normal file
15
android/app/src/main/res/drawable/ic_power.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="88.06dp"
|
||||
android:height="140.66dp"
|
||||
android:viewportWidth="88.06"
|
||||
android:viewportHeight="140.66">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M0,0h88.06v140.66h-88.06z"
|
||||
android:strokeAlpha="0"
|
||||
android:fillAlpha="0"/>
|
||||
<path
|
||||
android:pathData="M0,77.55C0,79.99 1.88,81.8 4.5,81.8L39.81,81.8L21.19,132.42C18.75,138.86 25.44,142.3 29.63,137.05L86.44,66.05C87.5,64.74 88.06,63.49 88.06,62.05C88.06,59.67 86.19,57.8 83.56,57.8L48.25,57.8L66.88,7.17C69.31,0.74 62.63,-2.7 58.44,2.61L1.63,73.55C0.56,74.92 0,76.17 0,77.55Z"
|
||||
android:fillColor="#ffffff"
|
||||
android:fillAlpha="0.85"/>
|
||||
</vector>
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid
|
||||
android:color="@color/popup_background" >
|
||||
android:color="@color/popup_background">
|
||||
</solid>
|
||||
|
||||
<padding
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape
|
||||
android:shape="ring"
|
||||
android:innerRadiusRatio="3.0"
|
||||
android:thickness="6dp">
|
||||
<solid android:color="#49474E" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
19
android/app/src/main/res/drawable/smartphone.xml
Normal file
19
android/app/src/main/res/drawable/smartphone.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="80.31dp"
|
||||
android:height="132.44dp"
|
||||
android:viewportWidth="80.31"
|
||||
android:viewportHeight="132.44">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M0,0h80.31v132.44h-80.31z"
|
||||
android:strokeAlpha="0"
|
||||
android:fillAlpha="0"/>
|
||||
<path
|
||||
android:pathData="M12.44,114.31C11.06,114.31 10.06,113.31 10.06,111.94L10.06,12.44C10.06,11 11,10.06 12.44,10.06L67.88,10.06C69.31,10.06 70.25,11 70.25,12.44L70.25,111.94C70.25,113.31 69.31,114.31 67.88,114.31Z"
|
||||
android:fillColor="#ffffff"
|
||||
android:fillAlpha="0.2125"/>
|
||||
<path
|
||||
android:pathData="M7.75,132.31L72.56,132.31C77.13,132.31 80.31,129.13 80.31,124.56L80.31,7.75C80.31,3.19 77.13,0 72.56,0L7.75,0C3.19,0 0,3.19 0,7.75L0,124.56C0,129.13 3.25,132.31 7.75,132.31ZM12.44,114.31C11.06,114.31 10.06,113.31 10.06,111.94L10.06,12.44C10.06,11 11,10.06 12.44,10.06L67.88,10.06C69.31,10.06 70.25,11 70.25,12.44L70.25,111.94C70.25,113.31 69.31,114.31 67.88,114.31Z"
|
||||
android:fillColor="#ffffff"
|
||||
android:fillAlpha="0.85"/>
|
||||
</vector>
|
||||
9
android/app/src/main/res/drawable/widget_background.xml
Normal file
9
android/app/src/main/res/drawable/widget_background.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<padding android:bottom="0dp" android:left="0dp" android:right="0dp" android:top="0dp" />
|
||||
<solid android:color="#222222" />
|
||||
<corners android:radius="32dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -2,28 +2,106 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
style="@style/Widget.ALN.AppWidget.Container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="0dp"
|
||||
android:padding="0dp"
|
||||
android:id="@+id/battery_widget"
|
||||
android:theme="@style/Theme.ALN.AppWidgetContainer"
|
||||
android:background="@drawable/blur_background">
|
||||
android:background="@drawable/widget_background">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal"
|
||||
android:layout_margin="0dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
android:id="@android:id/background"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:id="@+id/phone_battery_widget_container"
|
||||
android:orientation="vertical">
|
||||
<FrameLayout
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_margin="0dp"
|
||||
android:padding="6dp"
|
||||
android:layout_gravity="center">
|
||||
<ProgressBar
|
||||
android:id="@+id/phone_battery_progress_background"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:indeterminate="false"
|
||||
android:max="100"
|
||||
android:progress="100"
|
||||
android:progressDrawable="@drawable/progress_bar_background" />
|
||||
<ProgressBar
|
||||
android:id="@+id/phone_battery_progress"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:indeterminate="false"
|
||||
android:max="100"
|
||||
android:progress="50"
|
||||
android:progressDrawable="@drawable/circular_progress_bar" />
|
||||
<ImageView
|
||||
android:id="@+id/phone_charging_icon"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="top|center_horizontal"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/ic_power"
|
||||
android:visibility="gone"
|
||||
android:tint="@color/white"
|
||||
tools:ignore="HardcodedText" />
|
||||
<ImageView
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:src="@drawable/smartphone"
|
||||
android:tint="@color/white"
|
||||
android:layout_gravity="center"
|
||||
android:importantForAccessibility="no"
|
||||
tools:ignore="HardcodedText" />
|
||||
</FrameLayout>
|
||||
<TextView
|
||||
android:id="@+id/phone_battery_widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/white"
|
||||
android:fontFamily="@font/sf_pro"
|
||||
android:gravity="center"
|
||||
android:textFontWeight="300"
|
||||
android:text="Phone"
|
||||
tools:ignore="HardcodedText" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
<FrameLayout
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_margin="0dp"
|
||||
android:padding="6dp"
|
||||
android:layout_gravity="center">
|
||||
<ProgressBar
|
||||
android:id="@+id/left_battery_progress_background"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:indeterminate="false"
|
||||
android:max="100"
|
||||
android:progress="100"
|
||||
android:progressDrawable="@drawable/progress_bar_background" />
|
||||
<ProgressBar
|
||||
android:id="@+id/left_battery_progress"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
@@ -31,22 +109,36 @@
|
||||
android:layout_height="match_parent"
|
||||
android:indeterminate="false"
|
||||
android:max="100"
|
||||
android:progress="50"
|
||||
android:progressDrawable="@drawable/circular_progress_bar" />
|
||||
<ImageView
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:id="@+id/left_charging_icon"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="top|center_horizontal"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/ic_power"
|
||||
android:visibility="gone"
|
||||
android:tint="@color/white"
|
||||
tools:ignore="HardcodedText" />
|
||||
<ImageView
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:src="@drawable/airpods_pro_left_notification"
|
||||
android:tint="@color/popup_text"
|
||||
android:tint="@color/white"
|
||||
android:layout_gravity="center"
|
||||
android:importantForAccessibility="no"
|
||||
tools:ignore="HardcodedText" />
|
||||
</FrameLayout>
|
||||
<TextView
|
||||
android:id="@+id/left_battery_widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/popup_text"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/white"
|
||||
android:fontFamily="@font/sf_pro"
|
||||
android:gravity="center"
|
||||
android:textFontWeight="300"
|
||||
android:text="Left"
|
||||
tools:ignore="HardcodedText" />
|
||||
</LinearLayout>
|
||||
@@ -54,13 +146,24 @@
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
<FrameLayout
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_margin="0dp"
|
||||
android:padding="6dp"
|
||||
android:layout_gravity="center">
|
||||
<ProgressBar
|
||||
android:id="@+id/right_battery_progress_background"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:indeterminate="false"
|
||||
android:max="100"
|
||||
android:progress="100"
|
||||
android:progressDrawable="@drawable/progress_bar_background" />
|
||||
<ProgressBar
|
||||
android:id="@+id/right_battery_progress"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
@@ -70,10 +173,21 @@
|
||||
android:max="100"
|
||||
android:progressDrawable="@drawable/circular_progress_bar" />
|
||||
<ImageView
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:id="@+id/right_charging_icon"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="top|center_horizontal"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/ic_power"
|
||||
android:visibility="gone"
|
||||
android:tint="@color/white"
|
||||
tools:ignore="HardcodedText" />
|
||||
<ImageView
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/airpods_pro_right_notification"
|
||||
android:tint="@color/popup_text"
|
||||
android:tint="@color/white"
|
||||
android:layout_gravity="center"
|
||||
tools:ignore="HardcodedText" />
|
||||
</FrameLayout>
|
||||
@@ -81,8 +195,10 @@
|
||||
android:id="@+id/right_battery_widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/popup_text"
|
||||
android:textSize="24sp"
|
||||
android:textFontWeight="300"
|
||||
android:textColor="@color/white"
|
||||
android:fontFamily="@font/sf_pro"
|
||||
android:gravity="center"
|
||||
android:text="Right"
|
||||
tools:ignore="HardcodedText" />
|
||||
@@ -91,13 +207,24 @@
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
<FrameLayout
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_margin="0dp"
|
||||
android:padding="6dp"
|
||||
android:layout_gravity="center">
|
||||
<ProgressBar
|
||||
android:id="@+id/case_battery_progress_background"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:indeterminate="false"
|
||||
android:max="100"
|
||||
android:progress="100"
|
||||
android:progressDrawable="@drawable/progress_bar_background" />
|
||||
<ProgressBar
|
||||
android:id="@+id/case_battery_progress"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
@@ -107,10 +234,21 @@
|
||||
android:max="100"
|
||||
android:progressDrawable="@drawable/circular_progress_bar" />
|
||||
<ImageView
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:id="@+id/case_charging_icon"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_gravity="top|center_horizontal"
|
||||
android:src="@drawable/ic_power"
|
||||
android:visibility="gone"
|
||||
android:tint="@color/white"
|
||||
tools:ignore="HardcodedText" />
|
||||
<ImageView
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/airpods_pro_case_notification"
|
||||
android:tint="@color/popup_text"
|
||||
android:tint="@color/white"
|
||||
android:layout_gravity="center"
|
||||
tools:ignore="HardcodedText" />
|
||||
</FrameLayout>
|
||||
@@ -118,9 +256,11 @@
|
||||
android:id="@+id/case_battery_widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/popup_text"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/white"
|
||||
android:gravity="center"
|
||||
android:fontFamily="@font/sf_pro"
|
||||
android:textFontWeight="300"
|
||||
android:text="Case"
|
||||
tools:ignore="HardcodedText" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
android:layout_margin="16.dp"
|
||||
android:id="@+id/linear_layout"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/shape">
|
||||
android:background="@drawable/popup_shape">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -4,17 +4,11 @@
|
||||
<style name="Theme.ALN" parent="android:Theme.Material.Light.NoActionBar" />
|
||||
|
||||
<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">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">24dp</item>
|
||||
<item name="appWidgetRadius">32dp</item>
|
||||
<item name="appWidgetPadding">0dp</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.ALN.AppWidgetContainer" parent="Theme.ALN.AppWidgetContainerParent">
|
||||
<!-- Apply padding to avoid the content of the widget colliding with the rounded corners -->
|
||||
<item name="appWidgetPadding">16dp</item>
|
||||
<item name="appWidgetPadding">0dp</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -1,14 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:description="@string/app_widget_description"
|
||||
android:initialKeyguardLayout="@layout/battery_widget"
|
||||
android:initialLayout="@layout/battery_widget"
|
||||
android:minWidth="40dp"
|
||||
android:minWidth="180dp"
|
||||
android:minHeight="40dp"
|
||||
android:previewImage="@drawable/example_appwidget_preview"
|
||||
android:previewLayout="@layout/battery_widget"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
android:targetCellWidth="1"
|
||||
android:targetCellWidth="3"
|
||||
android:targetCellHeight="1"
|
||||
android:updatePeriodMillis="300000"
|
||||
android:widgetCategory="home_screen|keyguard" />
|
||||
android:widgetCategory="home_screen|keyguard"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
Reference in New Issue
Block a user