New widget provider info

This commit is contained in:
serso 2015-02-20 16:20:10 +01:00
parent 746afd18c8
commit 14ee60eb6e
8 changed files with 82 additions and 38 deletions

View File

@ -122,7 +122,7 @@
<action android:name="org.solovyev.android.calculator.BUTTON_PRESSED"/> <action android:name="org.solovyev.android.calculator.BUTTON_PRESSED"/>
</intent-filter> </intent-filter>
<meta-data android:name="android.appwidget.provider" android:resource="@xml/calculator_widget_info"/> <meta-data android:name="android.appwidget.provider" android:resource="@xml/calculator_widget"/>
</receiver> </receiver>
<receiver android:icon="@drawable/ic_launcher" android:label="@string/c_app_widget_3x3_name" android:name=".widget.CalculatorWidgetProvider"> <receiver android:icon="@drawable/ic_launcher" android:label="@string/c_app_widget_3x3_name" android:name=".widget.CalculatorWidgetProvider">

View File

@ -169,8 +169,18 @@ public final class App {
App.screenMetrics = new ScreenMetrics(application); App.screenMetrics = new ScreenMetrics(application);
final List<Class<? extends AppWidgetProvider>> oldNotUsedWidgetClasses = findNotUsedWidgets(application); final List<Class<? extends AppWidgetProvider>> oldNotUsedWidgetClasses = findNotUsedWidgets(application);
for (Class<? extends AppWidgetProvider> oldNotUsedWidgetClass : oldNotUsedWidgetClasses) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
Android.enableComponent(application, oldNotUsedWidgetClass, false); for (Class<? extends AppWidgetProvider> oldNotUsedWidgetClass : oldNotUsedWidgetClasses) {
Android.enableComponent(application, oldNotUsedWidgetClass, false);
}
} else {
// smaller widgets should be still used for smaller screens
if (oldNotUsedWidgetClasses.contains(CalculatorWidgetProvider4x5.class)) {
Android.enableComponent(application, CalculatorWidgetProvider4x5.class, false);
}
if (oldNotUsedWidgetClasses.contains(CalculatorWidgetProvider4x4.class)) {
Android.enableComponent(application, CalculatorWidgetProvider4x4.class, false);
}
} }
App.initialized = true; App.initialized = true;

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2013 serso aka se.solovyev
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Contact details
~
~ Email: se.solovyev@gmail.com
~ Site: http://se.solovyev.org
-->
<appwidget-provider xmlns:a="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
a:initialKeyguardLayout="@layout/widget_layout_lockscreen"
a:initialLayout="@layout/widget_layout"
a:minHeight="250dp"
a:minResizeHeight="180dp"
a:minResizeWidth="180dp"
a:minWidth="250dp"
a:previewImage="@drawable/widget_preview"
a:resizeMode="horizontal|vertical"
a:widgetCategory="home_screen|keyguard"
tools:ignore="UnusedAttribute"/>

View File

@ -23,12 +23,12 @@
--> -->
<appwidget-provider xmlns:a="http://schemas.android.com/apk/res/android" <appwidget-provider xmlns:a="http://schemas.android.com/apk/res/android"
a:minWidth="180dp" xmlns:tools="http://schemas.android.com/tools"
a:minHeight="180dp"
a:initialLayout="@layout/widget_layout"
a:initialKeyguardLayout="@layout/widget_layout_lockscreen" a:initialKeyguardLayout="@layout/widget_layout_lockscreen"
a:widgetCategory="home_screen|keyguard" a:initialLayout="@layout/widget_layout"
a:minHeight="180dp"
a:minWidth="180dp"
a:previewImage="@drawable/widget_preview" a:previewImage="@drawable/widget_preview"
a:resizeMode="horizontal|vertical"> a:resizeMode="horizontal|vertical"
a:widgetCategory="home_screen|keyguard"
</appwidget-provider> tools:ignore="UnusedAttribute"/>

View File

@ -23,12 +23,10 @@
--> -->
<appwidget-provider xmlns:a="http://schemas.android.com/apk/res/android" <appwidget-provider xmlns:a="http://schemas.android.com/apk/res/android"
a:minWidth="180dp"
a:minHeight="180dp"
a:initialLayout="@layout/widget_layout"
a:initialKeyguardLayout="@layout/widget_layout_lockscreen" a:initialKeyguardLayout="@layout/widget_layout_lockscreen"
a:widgetCategory="home_screen|keyguard" a:initialLayout="@layout/widget_layout"
a:minHeight="180dp"
a:minWidth="180dp"
a:previewImage="@drawable/widget_preview" a:previewImage="@drawable/widget_preview"
a:resizeMode="horizontal|vertical"> a:resizeMode="horizontal|vertical"
a:widgetCategory="home_screen|keyguard"/>
</appwidget-provider>

View File

@ -23,12 +23,10 @@
--> -->
<appwidget-provider xmlns:a="http://schemas.android.com/apk/res/android" <appwidget-provider xmlns:a="http://schemas.android.com/apk/res/android"
a:minWidth="180dp"
a:minHeight="250dp"
a:initialLayout="@layout/widget_layout"
a:initialKeyguardLayout="@layout/widget_layout_lockscreen" a:initialKeyguardLayout="@layout/widget_layout_lockscreen"
a:widgetCategory="home_screen|keyguard" a:initialLayout="@layout/widget_layout"
a:minHeight="250dp"
a:minWidth="180dp"
a:previewImage="@drawable/widget_preview" a:previewImage="@drawable/widget_preview"
a:resizeMode="horizontal|vertical"> a:resizeMode="horizontal|vertical"
a:widgetCategory="home_screen|keyguard"/>
</appwidget-provider>

View File

@ -23,12 +23,14 @@
--> -->
<appwidget-provider xmlns:a="http://schemas.android.com/apk/res/android" <appwidget-provider xmlns:a="http://schemas.android.com/apk/res/android"
a:minWidth="250dp" xmlns:tools="http://schemas.android.com/tools"
a:minHeight="250dp"
a:initialLayout="@layout/widget_layout"
a:initialKeyguardLayout="@layout/widget_layout_lockscreen" a:initialKeyguardLayout="@layout/widget_layout_lockscreen"
a:widgetCategory="home_screen|keyguard" a:initialLayout="@layout/widget_layout"
a:minHeight="250dp"
a:minResizeHeight="180dp"
a:minResizeWidth="180dp"
a:minWidth="250dp"
a:previewImage="@drawable/widget_preview" a:previewImage="@drawable/widget_preview"
a:resizeMode="horizontal|vertical"> a:resizeMode="horizontal|vertical"
a:widgetCategory="home_screen|keyguard"
</appwidget-provider> tools:ignore="UnusedAttribute"/>

View File

@ -23,12 +23,12 @@
--> -->
<appwidget-provider xmlns:a="http://schemas.android.com/apk/res/android" <appwidget-provider xmlns:a="http://schemas.android.com/apk/res/android"
a:minWidth="250dp"
a:minHeight="320dp"
a:initialLayout="@layout/widget_layout"
a:initialKeyguardLayout="@layout/widget_layout_lockscreen" a:initialKeyguardLayout="@layout/widget_layout_lockscreen"
a:widgetCategory="home_screen|keyguard" a:initialLayout="@layout/widget_layout"
a:minHeight="320dp"
a:minResizeHeight="180dp"
a:minResizeWidth="180dp"
a:minWidth="250dp"
a:previewImage="@drawable/widget_preview" a:previewImage="@drawable/widget_preview"
a:resizeMode="horizontal|vertical"> a:resizeMode="horizontal|vertical"
a:widgetCategory="home_screen|keyguard"/>
</appwidget-provider>