Commit 2e4405e8 authored by wanglei's avatar wanglei

...

parent 5db9c537
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<!-- required设置为true,无相机设备google play上不会分发 --> <!-- required设置为true,无相机设备google play上不会分发 -->
<uses-feature <uses-feature
android:name="android.hardware.camera" android:name="android.hardware.camera"
...@@ -15,6 +16,7 @@ ...@@ -15,6 +16,7 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" /> <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<queries> <queries>
<intent> <intent>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
...@@ -37,12 +39,23 @@ ...@@ -37,12 +39,23 @@
android:theme="@style/Theme.BrowserWhite" android:theme="@style/Theme.BrowserWhite"
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
tools:targetApi="34"> tools:targetApi="34">
<receiver
android:name=".ui.widget.BrowserAppWidget"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/browser_app_widget_info" />
</receiver>
<activity <activity
android:theme="@style/splash.theme"
android:name=".ui.activity.splash.Splash2Activity" android:name=".ui.activity.splash.Splash2Activity"
android:exported="true" android:exported="true"
android:launchMode="singleTask"> android:launchMode="singleTask"
android:theme="@style/splash.theme">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
...@@ -90,7 +103,6 @@ ...@@ -90,7 +103,6 @@
android:launchMode="singleTop" android:launchMode="singleTop"
android:screenOrientation="portrait" android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" /> tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity <activity
android:name=".ui.activity.download.WebDownloadManagerActivity" android:name=".ui.activity.download.WebDownloadManagerActivity"
android:exported="false" android:exported="false"
...@@ -163,7 +175,6 @@ ...@@ -163,7 +175,6 @@
android:launchMode="singleTop" android:launchMode="singleTop"
android:screenOrientation="portrait" android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" /> tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity <activity
android:name=".ui.activity.labelstack.LabelStackActivity" android:name=".ui.activity.labelstack.LabelStackActivity"
android:exported="false" android:exported="false"
......
package com.base.browserwhite.ui.widget
import android.appwidget.AppWidgetManager
import android.appwidget.AppWidgetProvider
import android.content.Context
import android.widget.RemoteViews
import com.base.browserwhite.R
/**
* Implementation of App Widget functionality.
*/
class BrowserAppWidget : AppWidgetProvider() {
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
// There may be multiple widgets active, so update all of them
for (appWidgetId in appWidgetIds) {
updateAppWidget(context, appWidgetManager, appWidgetId)
}
}
override fun onEnabled(context: Context) {
// Enter relevant functionality for when the first widget is created
}
override fun onDisabled(context: Context) {
// Enter relevant functionality for when the last widget is disabled
}
}
internal fun updateAppWidget(context: Context, appWidgetManager: AppWidgetManager, appWidgetId: Int) {
// Construct the RemoteViews object
val views = RemoteViews(context.packageName, R.layout.browser_app_widget)
views.setTextViewText(R.id.tv_app_name, context.resources.getString(R.string.app_name))
views.setTextViewText(R.id.tv_percent, "80%")
// Instruct the widget manager to update the widget
appWidgetManager.updateAppWidget(appWidgetId, views)
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?><!--
Background for widgets to make the rounded corners based on the
appWidgetRadius attribute value
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="?attr/appWidgetRadius" />
<solid android:color="?android:attr/colorBackground" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?><!--
Background for views inside widgets to make the rounded corners based on the
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>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#DF2C28" />
<corners android:radius="12dp" />
</shape>
\ No newline at end of file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/Widget.BrowserWhite.AppWidget.Container"
android:layout_width="wrap_content"
android:layout_height="110dp"
android:background="@drawable/bg_ffffff_15"
android:theme="@style/Theme.BrowserWhite.AppWidgetContainer">
<RelativeLayout
android:layout_width="120dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical">
<ImageView
android:id="@+id/iv_icon"
android:layout_width="23dp"
android:layout_height="23dp"
android:layout_marginTop="10dp"
android:src="@mipmap/x_logo_widget"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/tv_app_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@id/iv_icon"
android:layout_alignBottom="@id/iv_icon"
android:layout_marginStart="3dp"
android:layout_toEndOf="@id/iv_icon"
android:ellipsize="end"
android:gravity="center_vertical"
android:includeFontPadding="false"
android:paddingBottom="2dp"
android:singleLine="true"
android:textColor="#666666"
android:textSize="12sp"
tools:text="Al Browser&amp;Privacy" />
<TextView
android:id="@+id/tv_percent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/iv_icon"
android:layout_alignParentStart="true"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_toStartOf="@id/tv_clean"
android:singleLine="true"
android:textColor="#DF2C28"
android:textSize="21sp"
tools:text="88%.." />
<TextView
android:id="@+id/tv_clean"
android:layout_width="54dp"
android:layout_height="25dp"
android:layout_alignTop="@id/tv_percent"
android:layout_alignBottom="@id/tv_percent"
android:layout_alignParentEnd="true"
android:background="@drawable/bg_df2c28_12"
android:gravity="center"
android:text="Clean"
android:textColor="@color/white"
android:textSize="11sp"
tools:ignore="HardcodedText" />
</RelativeLayout>
<ImageView
android:layout_width="1px"
android:layout_height="63dp"
android:layout_gravity="center_vertical"
android:layout_marginHorizontal="2dp"
android:background="#EFEFEF"
tools:ignore="ContentDescription" />
<LinearLayout
android:layout_width="180dp"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/ll_4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:visibility="visible"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginBottom="6dp"
android:src="@mipmap/notifi_process"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Process"
android:textColor="#666666"
android:textSize="12sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginBottom="6dp"
android:src="@mipmap/notifi_news"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="News"
android:textColor="#666666"
android:textSize="12sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginBottom="6dp"
android:src="@mipmap/notifi_scancode"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ScanQR"
android:textColor="#666666"
android:textSize="12sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Having themes.xml for night-v31 because of the priority order of the resource qualifiers.
-->
<style name="Theme.BrowserWhite.AppWidgetContainerParent" parent="@android:style/Theme.DeviceDefault.DayNight">
<item name="appWidgetRadius">@android:dimen/system_app_widget_background_radius</item>
<item name="appWidgetInnerRadius">@android:dimen/system_app_widget_inner_radius</item>
</style>
</resources>
\ No newline at end of file
<resources>
<style name="Widget.BrowserWhite.AppWidget.Container" parent="android:Widget">
<item name="android:id">@android:id/background</item>
<item name="android:padding">?attr/appWidgetPadding</item>
<item name="android:background">@drawable/app_widget_background</item>
</style>
<style name="Widget.BrowserWhite.AppWidget.InnerView" parent="android:Widget">
<item name="android:padding">?attr/appWidgetPadding</item>
<item name="android:background">@drawable/app_widget_inner_view_background</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
</resources>
\ No newline at end of file
<resources>
<style name="Widget.BrowserWhite.AppWidget.Container" parent="android:Widget">
<item name="android:id">@android:id/background</item>
<item name="android:padding">?attr/appWidgetPadding</item>
<item name="android:background">@drawable/app_widget_background</item>
<item name="android:clipToOutline">true</item>
</style>
<style name="Widget.BrowserWhite.AppWidget.InnerView" parent="android:Widget">
<item name="android:padding">?attr/appWidgetPadding</item>
<item name="android:background">@drawable/app_widget_inner_view_background</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:clipToOutline">true</item>
</style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Having themes.xml for v31 variant because @android:dimen/system_app_widget_background_radius
and @android:dimen/system_app_widget_internal_padding requires API level 31
-->
<style name="Theme.BrowserWhite.AppWidgetContainerParent" parent="@android:style/Theme.DeviceDefault.DayNight">
<item name="appWidgetRadius">@android:dimen/system_app_widget_background_radius</item>
<item name="appWidgetInnerRadius">@android:dimen/system_app_widget_inner_radius</item>
</style>
</resources>
\ No newline at end of file
<resources>
<declare-styleable name="AppWidgetAttrs">
<attr name="appWidgetPadding" format="dimension" />
<attr name="appWidgetInnerRadius" format="dimension" />
<attr name="appWidgetRadius" format="dimension" />
</declare-styleable>
</resources>
\ No newline at end of file
...@@ -4,4 +4,8 @@ ...@@ -4,4 +4,8 @@
<color name="white">#FFFFFFFF</color> <color name="white">#FFFFFFFF</color>
<color name="black_a_70">#B3000000</color> <color name="black_a_70">#B3000000</color>
<color name="color_cbcdd7">#cbcdd7</color> <color name="color_cbcdd7">#cbcdd7</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>
</resources> </resources>
\ No newline at end of file
...@@ -17,4 +17,10 @@ ...@@ -17,4 +17,10 @@
<dimen name="dp_7">7dp</dimen> <dimen name="dp_7">7dp</dimen>
<dimen name="dp_20">20dp</dimen> <dimen name="dp_20">20dp</dimen>
<dimen name="dp_26">26dp</dimen> <dimen name="dp_26">26dp</dimen>
<!--
Refer to App Widget Documentation for margin information
http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
-->
<dimen name="widget_margin">0dp</dimen>
</resources> </resources>
\ No newline at end of file
...@@ -3,4 +3,7 @@ ...@@ -3,4 +3,7 @@
<string name="facebook_app_id">421266364258459</string> <string name="facebook_app_id">421266364258459</string>
<!-- TODO: Remove or change this placeholder text --> <!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string> <string name="hello_blank_fragment">Hello blank fragment</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>
</resources> </resources>
\ No newline at end of file
<resources>
<style name="Widget.BrowserWhite.AppWidget.Container" parent="android:Widget">
<item name="android:id">@android:id/background</item>
<item name="android:background">?android:attr/colorBackground</item>
</style>
<style name="Widget.BrowserWhite.AppWidget.InnerView" parent="android:Widget">
<item name="android:background">?android:attr/colorBackground</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
</resources>
\ No newline at end of file
...@@ -12,4 +12,19 @@ ...@@ -12,4 +12,19 @@
<item name="android:windowFullscreen">false</item> <item name="android:windowFullscreen">false</item>
</style> </style>
<style name="Theme.BrowserWhite.AppWidgetContainerParent" parent="@android:style/Theme.DeviceDefault">
<!-- Radius of the outer bound of widgets to make the rounded corners -->
<item name="appWidgetRadius">16dp</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>
</style>
<style name="Theme.BrowserWhite.AppWidgetContainer" parent="Theme.BrowserWhite.AppWidgetContainerParent">
<!-- Apply padding to avoid the content of the widget colliding with the rounded corners -->
<item name="appWidgetPadding">16dp</item>
</style>
</resources> </resources>
\ No newline at end of file
<?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/browser_app_widget"
android:initialLayout="@layout/browser_app_widget"
android:minWidth="350dp"
android:minHeight="110dp"
android:previewImage="@mipmap/yulantu"
android:previewLayout="@layout/browser_app_widget"
android:resizeMode="none"
android:targetCellWidth="3"
android:targetCellHeight="1"
android:updatePeriodMillis="86400000"
android:widgetCategory="home_screen" />
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment