Experimental wear tile

pull/204/head
M66B 3 years ago
parent c6c8708bb3
commit 000ac58410

@ -283,6 +283,8 @@ dependencies {
def work_version = "2.7.0-alpha05" def work_version = "2.7.0-alpha05"
def exif_version = "1.3.3" def exif_version = "1.3.3"
def biometric_version = "1.2.0-alpha03" def biometric_version = "1.2.0-alpha03"
def tile_wear_version = "1.0.0-alpha10"
def guava_version = "30.1.1-android"
def billingclient_version = "3.0.3" def billingclient_version = "3.0.3"
def javamail_version = "1.6.7" def javamail_version = "1.6.7"
def jsoup_version = "1.13.1" def jsoup_version = "1.13.1"
@ -398,6 +400,13 @@ dependencies {
// https://developer.android.com/jetpack/androidx/releases/biometric // https://developer.android.com/jetpack/androidx/releases/biometric
implementation "androidx.biometric:biometric:$biometric_version" implementation "androidx.biometric:biometric:$biometric_version"
// https://mvnrepository.com/artifact/androidx.wear.tiles/tiles
// https://developer.android.com/training/articles/wear-tiles
// https://github.com/google/guava
implementation "androidx.wear.tiles:tiles:$tile_wear_version"
debugImplementation "androidx.wear.tiles:tiles-renderer:$tile_wear_version"
implementation "com.google.guava:guava:$guava_version"
// https://developer.android.com/google/play/billing/billing_library_releases_notes // https://developer.android.com/google/play/billing/billing_library_releases_notes
// https://android-developers.googleblog.com/2020/06/meet-google-play-billing-library.html // https://android-developers.googleblog.com/2020/06/meet-google-play-billing-library.html
githubImplementation "com.android.billingclient:billing:$billingclient_version" githubImplementation "com.android.billingclient:billing:$billingclient_version"

@ -383,6 +383,20 @@
</intent-filter> </intent-filter>
</service> </service>
<service
android:name=".ServiceTileWear"
android:description="@string/app_name"
android:label="@string/app_name"
android:permission="com.google.android.wearable.permission.BIND_TILE_PROVIDER">
<intent-filter>
<action android:name="androidx.wear.tiles.action.BIND_TILE_PROVIDER" />
</intent-filter>
<meta-data
android:name="androidx.wear.tiles.PREVIEW"
android:resource="@mipmap/ic_launcher" />
</service>
<service <service
android:name=".ServicePowerControl" android:name=".ServicePowerControl"
android:enabled="false" android:enabled="false"

@ -0,0 +1,529 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="eu.faircode.email"
android:installLocation="internalOnly">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="com.android.vending.BILLING" />
<!-- OAuth -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission
android:name="android.permission.USE_CREDENTIALS"
android:maxSdkVersion="22" />
<uses-permission
android:name="android.permission.READ_PROFILE"
android:maxSdkVersion="22" />
<!-- https://github.com/leolin310148/ShortcutBadger/pull/368 -->
<uses-permission android:name="com.vivo.notification.permission.BADGE_ICON" />
<!-- https://developer.android.com/guide/topics/manifest/uses-feature-element#features-reference -->
<uses-feature
android:name="android.software.app_widgets"
android:required="false" />
<!--uses-feature
android:name="android.software.webview"
android:required="false" /-->
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.fingerprint"
android:required="false" />
<uses-sdk tools:overrideLibrary="androidx.wear.tiles.renderer" />
<!-- Android 11: https://developer.android.com/preview/privacy/package-visibility -->
<!-- https://developer.android.com/training/package-visibility/use-cases -->
<queries>
<!-- Customtabs -->
<!-- https://developers.google.com/web/updates/2020/07/custom-tabs-android-11#detecting_browsers_that_support_custom_tabs -->
<intent>
<action android:name="android.support.customtabs.action.CustomTabsService" />
</intent>
<intent>
<action android:name="android.intent.action.INSERT" />
</intent>
<intent>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.OPENABLE" />
<data android:mimeType="*/*" />
</intent>
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
<intent>
<action android:name="android.provider.MediaStore.RECORD_SOUND" />
</intent>
<package android:name="com.android.vending" />
<package android:name="org.sufficientlysecure.keychain" />
<package android:name="org.sufficientlysecure.keychain.debug" />
<intent>
<action android:name="org.openintents.openpgp.IOpenPgpService2" />
</intent>
<!-- https://android-developers.googleblog.com/2015/10/in-app-translations-in-android.html -->
<intent>
<action android:name="android.intent.action.PROCESS_TEXT" />
<data android:mimeType="text/plain" />
</intent>
<intent>
<action android:name="android.intent.action.TTS_SERVICE" />
</intent>
</queries>
<application
android:name=".ApplicationEx"
android:allowBackup="false"
android:appCategory="productivity"
android:forceDarkAllowed="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:requestLegacyExternalStorage="true"
android:resizeableActivity="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppThemeBlueOrangeLight">
<!-- https://developer.samsung.com/samsung-dex/modify-optimizing.html -->
<!-- https://developer.android.com/guide/webapps/managing-webview#metrics -->
<meta-data
android:name="android.webkit.WebView.MetricsOptOut"
android:value="true" />
<meta-data
android:name="android.webkit.WebView.EnableSafeBrowsing"
android:value="false" />
<meta-data
android:name="android.allow_multiple_resumed_activities"
android:value="true" />
<meta-data
android:name="com.google.android.gms.car.application"
android:resource="@xml/car" />
<!-- https://play.google.com/about/auto/developer-distribution-agreement-addendum/ -->
<meta-data
android:name="com.bugsnag.android.API_KEY"
android:value="9d2d57476a0614974449a3ec33f2604a" />
<activity
android:name=".ActivityMain"
android:excludeFromRecents="true"
android:exported="true"
android:launchMode="singleInstance"
android:theme="@style/Theme.AppCompat.Translucent">
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.APP_EMAIL" />
</intent-filter>
<intent-filter>
<action android:name="${applicationId}.REFRESH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="message" />
<data android:host="${applicationId}" />
</intent-filter>
</activity>
<activity
android:name=".ActivitySetup"
android:exported="false"
android:launchMode="singleTask"
android:parentActivityName=".ActivityMain" />
<activity
android:name=".ActivitySignature"
android:exported="false"
android:launchMode="singleTask"
android:parentActivityName=".ActivitySetup" />
<activity
android:name=".ActivityWidget"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
<activity
android:name=".ActivityWidgetSync"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
<activity
android:name=".ActivityWidgetUnified"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
<activity
android:name=".ActivityView"
android:exported="false"
android:launchMode="singleTask"
android:parentActivityName=".ActivityMain" />
<activity
android:name=".ActivitySearch"
android:enabled="false"
android:excludeFromRecents="true"
android:exported="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_search"
android:launchMode="singleTask"
android:theme="@style/Theme.AppCompat.Translucent">
<intent-filter>
<action android:name="android.intent.action.PROCESS_TEXT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="eu.faircode.email.search" />
</intent-filter>
</activity>
<activity
android:name=".ActivityAnswer"
android:enabled="false"
android:excludeFromRecents="true"
android:exported="true"
android:icon="@drawable/twotone_reply_24"
android:label="@string/app_answer"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.PROCESS_TEXT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity
android:name=".ActivityCompose"
android:exported="true"
android:launchMode="singleTask"
android:parentActivityName=".ActivityView">
<meta-data
android:name="android.service.chooser.chooser_target_service"
android:value="androidx.sharetarget.ChooserTargetServiceCompat" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="mailto" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="mailto" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
</activity>
<activity
android:name=".ActivityError"
android:exported="false"
android:launchMode="singleTask" />
<activity
android:name=".ActivityEML"
android:exported="true"
android:icon="@mipmap/ic_launcher"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="content" />
<data android:mimeType="message/rfc822" />
<data android:host="*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="content" />
<data android:mimeType="*/*" />
<data android:host="*" />
<data android:pathPattern=".*\\.eml" />
<data android:pathPattern=".*\\..*\\.eml" />
<data android:pathPattern=".*\\..*\\..*\\.eml" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.eml" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.eml" />
</intent-filter>
</activity>
<activity
android:name=".ActivityDSN"
android:exported="true"
android:icon="@mipmap/ic_launcher"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="content" />
<data android:mimeType="message/delivery-status" />
<data android:mimeType="message/disposition-notification" />
<data android:mimeType="text/rfc822-headers" />
<data android:host="*" />
</intent-filter>
</activity>
<activity
android:name=".ActivityBilling"
android:exported="false"
android:icon="@mipmap/ic_launcher"
android:launchMode="singleTask" />
<activity
android:name=".ActivityTileWear"
android:exported="true"
android:icon="@mipmap/ic_launcher"
android:launchMode="singleTask" />
<activity
android:name="net.openid.appauth.RedirectUriReceiverActivity"
android:exported="true"
tools:node="replace">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="oauth.faircode.eu"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="eu.faircode.email" />
</intent-filter>
</activity>
<service
android:name=".ServiceSynchronize"
android:exported="false"
android:foregroundServiceType="dataSync" />
<service
android:name=".ServiceSend"
android:exported="false"
android:foregroundServiceType="dataSync" />
<service
android:name=".ServiceUI"
android:exported="false" />
<service
android:name=".ServiceExternal"
android:exported="true"
android:foregroundServiceType="dataSync">
<intent-filter>
<action android:name="${applicationId}.POLL" />
<action android:name="${applicationId}.ENABLE" />
<action android:name="${applicationId}.DISABLE" />
<action android:name="${applicationId}.INTERVAL" />
<action android:name="${applicationId}.DISCONNECT.ME" />
</intent-filter>
</service>
<service
android:name=".ServiceTileSynchronize"
android:exported="true"
android:icon="@drawable/twotone_sync_disabled_24"
android:label="@string/app_name"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>
<service
android:name=".ServiceTileUnseen"
android:exported="true"
android:icon="@drawable/twotone_mail_outline_24"
android:label="@string/tile_unseen"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>
<service
android:name=".ServiceTileWear"
android:description="@string/app_name"
android:label="@string/app_name"
android:permission="com.google.android.wearable.permission.BIND_TILE_PROVIDER">
<intent-filter>
<action android:name="androidx.wear.tiles.action.BIND_TILE_PROVIDER" />
</intent-filter>
<meta-data
android:name="androidx.wear.tiles.PREVIEW"
android:resource="@mipmap/ic_launcher" />
</service>
<service
android:name=".ServicePowerControl"
android:enabled="false"
android:exported="true"
android:label="@string/app_name"
android:permission="android.permission.BIND_CONTROLS">
<intent-filter>
<action android:name="android.service.controls.ControlsProviderService" />
</intent-filter>
</service>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/fileprovider_paths" />
</provider>
<receiver
android:name=".Widget"
android:exported="true"
android:label="@string/title_widget_title_count">
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget" />
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
</receiver>
<receiver
android:name=".WidgetUnified"
android:exported="true"
android:label="@string/title_widget_title_list">
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_unified" />
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
</receiver>
<receiver
android:name=".WidgetSync"
android:exported="true"
android:label="@string/title_widget_title_sync">
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_sync" />
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
</receiver>
<service
android:name="WidgetUnifiedService"
android:exported="true"
android:permission="android.permission.BIND_REMOTEVIEWS" />
<receiver
android:name=".ReceiverAutoStart"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
<intent-filter>
<action android:name="android.app.action.SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED" />
</intent-filter>
</receiver>
</application>
</manifest>

@ -0,0 +1,40 @@
package eu.faircode.email;
import android.content.ComponentName;
import android.graphics.Color;
import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.activity.ComponentActivity;
import androidx.annotation.Nullable;
import androidx.wear.tiles.manager.TileUiClient;
public class ActivityTileWear extends ComponentActivity {
private TileUiClient mTileUiClient;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FrameLayout rootLayout = new FrameLayout(this);
FrameLayout.LayoutParams layoutparams =
new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
rootLayout.setLayoutParams(layoutparams);
rootLayout.setBackgroundColor(Color.BLACK);
setContentView(rootLayout);
mTileUiClient = new TileUiClient(this,
new ComponentName(this, ServiceTileWear.class), rootLayout);
mTileUiClient.connect();
}
@Override
protected void onDestroy() {
super.onDestroy();
mTileUiClient.close();
}
}

@ -380,6 +380,20 @@
</intent-filter> </intent-filter>
</service> </service>
<service
android:name=".ServiceTileWear"
android:description="@string/app_name"
android:label="@string/app_name"
android:permission="com.google.android.wearable.permission.BIND_TILE_PROVIDER">
<intent-filter>
<action android:name="androidx.wear.tiles.action.BIND_TILE_PROVIDER" />
</intent-filter>
<meta-data
android:name="androidx.wear.tiles.PREVIEW"
android:resource="@mipmap/ic_launcher" />
</service>
<service <service
android:name=".ServicePowerControl" android:name=".ServicePowerControl"
android:enabled="false" android:enabled="false"

@ -380,6 +380,20 @@
</intent-filter> </intent-filter>
</service> </service>
<service
android:name=".ServiceTileWear"
android:description="@string/app_name"
android:label="@string/app_name"
android:permission="com.google.android.wearable.permission.BIND_TILE_PROVIDER">
<intent-filter>
<action android:name="androidx.wear.tiles.action.BIND_TILE_PROVIDER" />
</intent-filter>
<meta-data
android:name="androidx.wear.tiles.PREVIEW"
android:resource="@mipmap/ic_launcher" />
</service>
<service <service
android:name=".ServicePowerControl" android:name=".ServicePowerControl"
android:enabled="false" android:enabled="false"

@ -418,6 +418,20 @@
</intent-filter> </intent-filter>
</service> </service>
<service
android:name=".ServiceTileWear"
android:description="@string/app_name"
android:label="@string/app_name"
android:permission="com.google.android.wearable.permission.BIND_TILE_PROVIDER">
<intent-filter>
<action android:name="androidx.wear.tiles.action.BIND_TILE_PROVIDER" />
</intent-filter>
<meta-data
android:name="androidx.wear.tiles.PREVIEW"
android:resource="@mipmap/ic_launcher" />
</service>
<service <service
android:name=".ServicePowerControl" android:name=".ServicePowerControl"
android:enabled="false" android:enabled="false"

@ -666,6 +666,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
EntityLog.log(ServiceSynchronize.this, "Widget update"); EntityLog.log(ServiceSynchronize.this, "Widget update");
Widget.update(ServiceSynchronize.this); Widget.update(ServiceSynchronize.this);
ServiceTileWear.update(ServiceSynchronize.this);
boolean badge = prefs.getBoolean("badge", true); boolean badge = prefs.getBoolean("badge", true);
boolean unseen_ignored = prefs.getBoolean("unseen_ignored", false); boolean unseen_ignored = prefs.getBoolean("unseen_ignored", false);

@ -0,0 +1,115 @@
package eu.faircode.email;
/*
This file is part of FairEmail.
FairEmail is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
FairEmail is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FairEmail. If not, see <http://www.gnu.org/licenses/>.
Copyright 2018-2021 by Marcel Bokhorst (M66B)
*/
import static androidx.wear.tiles.DimensionBuilders.dp;
import static androidx.wear.tiles.DimensionBuilders.expand;
import static androidx.wear.tiles.DimensionBuilders.wrap;
import android.content.Context;
import android.content.SharedPreferences;
import androidx.annotation.NonNull;
import androidx.preference.PreferenceManager;
import androidx.wear.tiles.LayoutElementBuilders;
import androidx.wear.tiles.RequestBuilders;
import androidx.wear.tiles.ResourceBuilders;
import androidx.wear.tiles.TileBuilders;
import androidx.wear.tiles.TileProviderService;
import androidx.wear.tiles.TimelineBuilders;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import java.text.NumberFormat;
import java.util.concurrent.Callable;
public class ServiceTileWear extends TileProviderService {
private static final String RESOURCES_VERSION = "1";
private static final ListeningExecutorService executor =
MoreExecutors.listeningDecorator(Helper.getBackgroundExecutor(1, "wear"));
@NonNull
@Override
protected ListenableFuture<TileBuilders.Tile> onTileRequest(
@NonNull RequestBuilders.TileRequest requestParams) {
DB db = DB.getInstance(this);
NumberFormat NF = NumberFormat.getInstance();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean unseen_ignored = prefs.getBoolean("unseen_ignored", false);
return executor.submit(new Callable<TileBuilders.Tile>() {
@Override
public TileBuilders.Tile call() throws Exception {
TupleMessageStats stats = db.message().getWidgetUnseen(null);
Integer unseen = (stats == null ? null : (unseen_ignored ? stats.notifying : stats.unseen));
LayoutElementBuilders.LayoutElement layout = LayoutElementBuilders.Row.builder()
.setWidth(wrap())
.setHeight(expand())
.setVerticalAlignment(LayoutElementBuilders.VERTICAL_ALIGN_CENTER)
.addContent(LayoutElementBuilders.Image.builder()
.setResourceId("mail")
.setWidth(dp(24f))
.setHeight(dp(24f)))
.addContent(LayoutElementBuilders.Spacer.builder()
.setWidth(dp(3f)))
.addContent(LayoutElementBuilders.Text.builder()
.setText(unseen == null ? "-" : NF.format(unseen)))
.build();
return TileBuilders.Tile.builder()
.setResourcesVersion(RESOURCES_VERSION)
.setTimeline(TimelineBuilders.Timeline.builder()
.addTimelineEntry(TimelineBuilders.TimelineEntry.builder().setLayout(
LayoutElementBuilders.Layout.builder().setRoot(layout))))
.build();
}
});
}
@NonNull
@Override
protected ListenableFuture<ResourceBuilders.Resources> onResourcesRequest(
@NonNull RequestBuilders.ResourcesRequest requestParams) {
return executor.submit(new Callable<ResourceBuilders.Resources>() {
@Override
public ResourceBuilders.Resources call() throws Exception {
return ResourceBuilders.Resources.builder()
.setVersion(RESOURCES_VERSION)
.addIdToImageMapping("mail",
ResourceBuilders.ImageResource.builder()
.setAndroidResourceByResId(ResourceBuilders.AndroidImageResourceByResId.builder()
.setResourceId(R.drawable.baseline_mail_24)
.build())
.build())
.build();
}
});
}
public static void update(Context context) {
TileProviderService.getUpdater(context).requestUpdate(ServiceTileWear.class);
}
}

@ -381,6 +381,20 @@
</intent-filter> </intent-filter>
</service> </service>
<service
android:name=".ServiceTileWear"
android:description="@string/app_name"
android:label="@string/app_name"
android:permission="com.google.android.wearable.permission.BIND_TILE_PROVIDER">
<intent-filter>
<action android:name="androidx.wear.tiles.action.BIND_TILE_PROVIDER" />
</intent-filter>
<meta-data
android:name="androidx.wear.tiles.PREVIEW"
android:resource="@mipmap/ic_launcher" />
</service>
<service <service
android:name=".ServicePowerControl" android:name=".ServicePowerControl"
android:enabled="false" android:enabled="false"

Loading…
Cancel
Save