summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.bp18
-rw-r--r--proguard.flags2
-rw-r--r--res/drawable/ic_delete_white_24dp.xml27
-rw-r--r--res/layout/live_wallpaper_preview.xml4
-rw-r--r--res/menu/menu_preview.xml6
-rw-r--r--res/values-as/strings.xml36
-rw-r--r--res/values-gu/strings.xml2
-rw-r--r--res/values-or/strings.xml36
-rw-r--r--res/values-ta/strings.xml2
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/com/android/wallpaper/livepicker/LiveWallpaperChange.java31
-rw-r--r--src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java36
12 files changed, 180 insertions, 22 deletions
diff --git a/Android.bp b/Android.bp
index 4164c0e..d451d87 100644
--- a/Android.bp
+++ b/Android.bp
@@ -30,15 +30,15 @@ android_app {
proguard_flags_files: ["proguard.flags"],
},
static_libs: [
- "android-support-annotations",
- "android-support-v7-appcompat",
- "android-support-compat",
- "android-support-core-utils",
- "android-support-core-ui",
- "android-support-fragment",
- "android-support-design",
- "android-support-transition",
- "android-support-v7-recyclerview",
+ "androidx.annotation_annotation",
+ "androidx.appcompat_appcompat",
+ "androidx.core_core",
+ "androidx.legacy_legacy-support-core-utils",
+ "androidx.legacy_legacy-support-core-ui",
+ "androidx.fragment_fragment",
+ "androidx.design_design",
+ "androidx.transition_transition",
+ "androidx.recyclerview_recyclerview",
],
resource_dirs: ["res"],
}
diff --git a/proguard.flags b/proguard.flags
index 5320720..cddd821 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -7,5 +7,5 @@
public <init>(android.content.Context, android.util.AttributeSet);
}
--keep class android.support.design.widget.CoordinatorLayout
+-keep class androidx.coordinatorlayout.widget.CoordinatorLayout
-keep class android.support.design.widget.BottomSheetBehavior \ No newline at end of file
diff --git a/res/drawable/ic_delete_white_24dp.xml b/res/drawable/ic_delete_white_24dp.xml
new file mode 100644
index 0000000..ca3b43f
--- /dev/null
+++ b/res/drawable/ic_delete_white_24dp.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+ 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?attr/colorControlNormal">
+
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M15,4L15,3L9,3v1L4,4v2h1v13c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2L19,6h1L20,4h-5zM17,19L7,19L7,6h10v13zM9,8h2v9L9,17zM13,8h2v9h-2z"/>
+
+</vector> \ No newline at end of file
diff --git a/res/layout/live_wallpaper_preview.xml b/res/layout/live_wallpaper_preview.xml
index fb8ab5c..5eb486f 100644
--- a/res/layout/live_wallpaper_preview.xml
+++ b/res/layout/live_wallpaper_preview.xml
@@ -39,7 +39,7 @@
android:layout_height="match_parent"
android:fitsSystemWindows="true">
- <android.support.design.widget.CoordinatorLayout
+ <androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -122,7 +122,7 @@
</RelativeLayout>
- </android.support.design.widget.CoordinatorLayout>
+ </androidx.coordinatorlayout.widget.CoordinatorLayout>
<android.widget.Toolbar android:id="@+id/toolbar"
android:layout_width="match_parent"
diff --git a/res/menu/menu_preview.xml b/res/menu/menu_preview.xml
index 471e506..87d17c9 100644
--- a/res/menu/menu_preview.xml
+++ b/res/menu/menu_preview.xml
@@ -28,4 +28,10 @@
android:showAsAction="always|withText"
android:actionLayout="@layout/set_wallpaper_action"/>
+ <item
+ android:id="@+id/delete_wallpaper"
+ android:icon="@drawable/ic_delete_white_24dp"
+ android:showAsAction="ifRoom"
+ android:title="@string/delete_live_wallpaper"/>
+
</menu>
diff --git a/res/values-as/strings.xml b/res/values-as/strings.xml
new file mode 100644
index 0000000..e027262
--- /dev/null
+++ b/res/values-as/strings.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+* Copyright (C) 2008 The Android Open Source Project
+*
+* 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.
+*/
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="application_name" msgid="4119979710394894209">"লাইভ ৱালপেপাৰ বাছনিকৰ্তা"</string>
+ <string name="live_wallpaper_picker_title" msgid="4811278937634144675">"লাইভ ৱালপেপাৰ বাছনি কৰক"</string>
+ <string name="live_wallpaper_picker_label" msgid="3218000114890071946">"লাইভ ৱালপেপাৰসমূহ"</string>
+ <string name="live_wallpaper_preview_title" msgid="1130080613611954763">"লাইভ ৱালপেপাৰৰ পূৰ্বদৰ্শন"</string>
+ <string name="configure_wallpaper" msgid="7396598925806288258">"ছেটিংসমূহ…"</string>
+ <string name="wallpaper_instructions" msgid="4215640646180727542">"ৱালপেপাৰ ছেট কৰক"</string>
+ <string name="live_wallpaper_empty" msgid="4278728108785853407">"কোনো লাইভ ৱালপেপাৰ নাই"</string>
+ <string name="set_live_wallpaper" msgid="2381437614949033266">"ৱালপেপাৰ ছেট কৰক"</string>
+ <string name="wallpaper_title_and_author" msgid="8891734217843935304">"<xliff:g id="AUTHOR">%2$s</xliff:g>ৰ <xliff:g id="TITLE">%1$s</xliff:g>"</string>
+ <string name="live_wallpaper_loading" msgid="2488371303130330734">"লাইভ ৱালপেপাৰ ল\'ড কৰি থকা হৈছে…"</string>
+ <string name="which_wallpaper_option_home_screen" msgid="6592329803583957023">"গৃহ স্ক্ৰীণ"</string>
+ <string name="which_wallpaper_option_home_screen_and_lock_screen" msgid="6170359719231147447">"গৃহ স্ক্ৰীণ আৰু লক স্ক্ৰীণ"</string>
+ <string name="collapse_attribution_panel" msgid="4998500891743118630">"ৱালপেপাৰ সম্পৰ্কীয় তথ্য়ৰ পেনেল সংকুচিত কৰক"</string>
+ <string name="expand_attribution_panel" msgid="3151357815478885438">"ৱালপেপাৰ সম্পৰ্কীয় তথ্য়ৰ পেনেল বিস্তাৰ কৰক"</string>
+</resources>
diff --git a/res/values-gu/strings.xml b/res/values-gu/strings.xml
index a42c0a7..8b924fe 100644
--- a/res/values-gu/strings.xml
+++ b/res/values-gu/strings.xml
@@ -22,7 +22,7 @@
<string name="application_name" msgid="4119979710394894209">"લાઇવ વૉલપેપર પીકર"</string>
<string name="live_wallpaper_picker_title" msgid="4811278937634144675">"લાઇવ વૉલપેપર પસંદ કરો"</string>
<string name="live_wallpaper_picker_label" msgid="3218000114890071946">"લાઇવ વૉલપેપર્સ"</string>
- <string name="live_wallpaper_preview_title" msgid="1130080613611954763">"લાઇવ વૉલપેપર પૂર્વાવલોકન"</string>
+ <string name="live_wallpaper_preview_title" msgid="1130080613611954763">"લાઇવ વૉલપેપર પ્રીવ્યૂ"</string>
<string name="configure_wallpaper" msgid="7396598925806288258">"સેટિંગ્સ…"</string>
<string name="wallpaper_instructions" msgid="4215640646180727542">"વૉલપેપર સેટ કરો"</string>
<string name="live_wallpaper_empty" msgid="4278728108785853407">"કોઈ લાઇવ વૉલપેપર્સ નથી."</string>
diff --git a/res/values-or/strings.xml b/res/values-or/strings.xml
new file mode 100644
index 0000000..718fc00
--- /dev/null
+++ b/res/values-or/strings.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+* Copyright (C) 2008 The Android Open Source Project
+*
+* 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.
+*/
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="application_name" msgid="4119979710394894209">"ଲାଇଭ୍‌ ୱାଲପେପର୍‌ ପିକର୍‌"</string>
+ <string name="live_wallpaper_picker_title" msgid="4811278937634144675">"ଲାଇଭ୍‌ ୱାଲପେପର୍‌ ଚୟନ କରନ୍ତୁ"</string>
+ <string name="live_wallpaper_picker_label" msgid="3218000114890071946">"ଲାଇଭ୍‌ ୱାଲପେପର୍‌"</string>
+ <string name="live_wallpaper_preview_title" msgid="1130080613611954763">"ଲାଇଭ୍‌ ୱାଲପେପରର ଝଲକ"</string>
+ <string name="configure_wallpaper" msgid="7396598925806288258">"ସେଟିଙ୍ଗ..."</string>
+ <string name="wallpaper_instructions" msgid="4215640646180727542">"ୱାଲପେପର୍‍ ସେଟ୍ କରନ୍ତୁ"</string>
+ <string name="live_wallpaper_empty" msgid="4278728108785853407">"କୌଣସି ଲାଇଭ୍‌ ୱାଲପେପର୍‌ ନାହିଁ"</string>
+ <string name="set_live_wallpaper" msgid="2381437614949033266">"ୱାଲପେପର୍‍ ସେଟ୍ କରନ୍ତୁ"</string>
+ <string name="wallpaper_title_and_author" msgid="8891734217843935304">"<xliff:g id="TITLE">%1$s</xliff:g>ଙ୍କ <xliff:g id="AUTHOR">%2$s</xliff:g>"</string>
+ <string name="live_wallpaper_loading" msgid="2488371303130330734">"ଲାଇଭ୍‌ ୱାଲପେପରଗୁଡ଼ିକୁ ଲୋଡ୍‌ କରାଯାଉଛି..."</string>
+ <string name="which_wallpaper_option_home_screen" msgid="6592329803583957023">"ହୋମ୍‌ ସ୍କ୍ରୀନ୍‌"</string>
+ <string name="which_wallpaper_option_home_screen_and_lock_screen" msgid="6170359719231147447">"ହୋମ୍‌ ସ୍କ୍ରୀନ୍‌ ଏବଂ ଲକ୍‌ ସ୍କ୍ରୀନ୍‌"</string>
+ <string name="collapse_attribution_panel" msgid="4998500891743118630">"ୱାଲପେପର୍‌ ସୂଚନା ପ୍ୟାନେଲକୁ ଛୋଟ କରନ୍ତୁ"</string>
+ <string name="expand_attribution_panel" msgid="3151357815478885438">"ୱାଲପେପର୍‌ ସୂଚନା ପ୍ୟାନେଲ୍‌ ବଢ଼ାନ୍ତୁ"</string>
+</resources>
diff --git a/res/values-ta/strings.xml b/res/values-ta/strings.xml
index 9e1cb1e..fc417f2 100644
--- a/res/values-ta/strings.xml
+++ b/res/values-ta/strings.xml
@@ -30,7 +30,7 @@
<string name="wallpaper_title_and_author" msgid="8891734217843935304">"<xliff:g id="TITLE">%1$s</xliff:g> வழங்கியது <xliff:g id="AUTHOR">%2$s</xliff:g>"</string>
<string name="live_wallpaper_loading" msgid="2488371303130330734">"நேரலை வால்பேப்பரை ஏற்றுகிறது…"</string>
<string name="which_wallpaper_option_home_screen" msgid="6592329803583957023">"முகப்புத் திரை"</string>
- <string name="which_wallpaper_option_home_screen_and_lock_screen" msgid="6170359719231147447">"முகப்புத் திரையும் பூட்டுத் திரையும்"</string>
+ <string name="which_wallpaper_option_home_screen_and_lock_screen" msgid="6170359719231147447">"முகப்புத் திரையும் லாக் ஸ்கிரீனும்"</string>
<string name="collapse_attribution_panel" msgid="4998500891743118630">"வால்பேப்பரின் தகவல் பேனலைச் சுருக்கும் பொத்தான்"</string>
<string name="expand_attribution_panel" msgid="3151357815478885438">"வால்பேப்பரின் தகவல் பேனலை விரிக்கும் பொத்தான்"</string>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 99e48e6..0206a43 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -31,6 +31,8 @@
<string name="live_wallpaper_preview_title">Live wallpaper preview</string>
<!-- List item for configuring the current wallpaper -->
<string name="configure_wallpaper">Settings…</string>
+ <!-- List item for deleting the current wallpaper -->
+ <string name="delete_live_wallpaper">Delete</string>
<!-- Button label on Wallpaper Gallery screen; user selects this button to set a specific wallpaper -->
<string name="wallpaper_instructions">Set wallpaper</string>
<!-- Warning message, no live wallpapers available. -->
diff --git a/src/com/android/wallpaper/livepicker/LiveWallpaperChange.java b/src/com/android/wallpaper/livepicker/LiveWallpaperChange.java
index efaf563..724e791 100644
--- a/src/com/android/wallpaper/livepicker/LiveWallpaperChange.java
+++ b/src/com/android/wallpaper/livepicker/LiveWallpaperChange.java
@@ -20,12 +20,18 @@ import android.app.WallpaperInfo;
import android.app.WallpaperManager;
import android.content.ComponentName;
import android.content.Intent;
+import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.content.pm.ServiceInfo;
+import android.os.Bundle;
import android.os.Parcelable;
import android.service.wallpaper.WallpaperService;
import android.util.Log;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
@@ -33,6 +39,7 @@ import java.util.List;
public class LiveWallpaperChange extends LiveWallpaperPreview {
private static final String TAG = "CHANGE_LIVE_WALLPAPER";
+ private static final String KEY_ACTION_DELETE_LIVE_WALLPAPER = "action_delete_live_wallpaper";
@Override
protected void init() {
@@ -65,8 +72,7 @@ public class LiveWallpaperChange extends LiveWallpaperPreview {
finish();
return;
}
-
- initUI(info);
+ initUI(info, getDeleteAction(ri.serviceInfo));
return;
}
}
@@ -75,4 +81,25 @@ public class LiveWallpaperChange extends LiveWallpaperPreview {
Log.w(TAG, "Not a live wallpaper: " + comp);
finish();
}
+
+ @Nullable
+ private String getDeleteAction(@NonNull ServiceInfo serviceInfo) {
+ if (!isPackagePreInstalled(serviceInfo.applicationInfo)) {
+ Log.d(TAG, "This wallpaper is not pre-installed.");
+ return null;
+ }
+
+ final Bundle metaData = serviceInfo.metaData;
+ if (metaData != null) {
+ return metaData.getString(KEY_ACTION_DELETE_LIVE_WALLPAPER);
+ }
+ return null;
+ }
+
+ private boolean isPackagePreInstalled(ApplicationInfo info) {
+ if (info != null && (info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
+ return true;
+ }
+ return false;
+ }
}
diff --git a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
index 25ce3a4..6056859 100644
--- a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
+++ b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
@@ -60,6 +60,8 @@ import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toolbar;
+import androidx.annotation.Nullable;
+
import java.io.IOException;
public class LiveWallpaperPreview extends Activity {
@@ -75,6 +77,7 @@ public class LiveWallpaperPreview extends Activity {
private String mPackageName;
private Intent mWallpaperIntent;
private Intent mSettingsIntent;
+ private Intent mDeleteIntent;
private TextView mAttributionTitle;
private TextView mAttributionSubtitle1;
@@ -98,10 +101,10 @@ public class LiveWallpaperPreview extends Activity {
setResult(RESULT_CANCELED);
finish();
}
- initUI(info);
+ initUI(info, null /* deleteAction */);
}
- protected void initUI(WallpaperInfo info) {
+ protected void initUI(WallpaperInfo info, @Nullable String deleteAction) {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
@@ -146,6 +149,12 @@ public class LiveWallpaperPreview extends Activity {
mWallpaperConnection = new WallpaperConnection(mWallpaperIntent);
populateAttributionPane(info);
+
+ if (!TextUtils.isEmpty(deleteAction)) {
+ mDeleteIntent = new Intent(deleteAction);
+ mDeleteIntent.setPackage(info.getPackageName());
+ mDeleteIntent.putExtra(EXTRA_LIVE_WALLPAPER_INFO, info);
+ }
}
private void populateAttributionPane(WallpaperInfo info) {
@@ -269,6 +278,7 @@ public class LiveWallpaperPreview extends Activity {
menu.findItem(R.id.configure).setVisible(mSettingsIntent != null);
menu.findItem(R.id.set_wallpaper).getActionView().setOnClickListener(
this::setLiveWallpaper);
+ menu.findItem(R.id.delete_wallpaper).setVisible(mDeleteIntent != null);
return super.onCreateOptionsMenu(menu);
}
@@ -317,6 +327,13 @@ public class LiveWallpaperPreview extends Activity {
mWallpaperManager.setWallpaperOffsets(windowToken, 0.5f, 0.0f);
}
+ private void deleteLiveWallpaper() {
+ if (mDeleteIntent != null) {
+ startService(mDeleteIntent);
+ finish();
+ }
+ }
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
@@ -326,6 +343,10 @@ public class LiveWallpaperPreview extends Activity {
} else if (id == R.id.set_wallpaper) {
setLiveWallpaper(getWindow().getDecorView());
return true;
+ } else if (id == R.id.delete_wallpaper) {
+ // TODO(b/122505782): Need delete confirm dialog.
+ deleteLiveWallpaper();
+ return true;
} else if (id == android.R.id.home) {
onBackPressed();
return true;
@@ -458,16 +479,17 @@ public class LiveWallpaperPreview extends Activity {
mService = null;
}
}
-
+
public void onServiceConnected(ComponentName name, IBinder service) {
if (mWallpaperConnection == this) {
mService = IWallpaperService.Stub.asInterface(service);
try {
+ final int displayId = getWindow().getDecorView().getDisplay().getDisplayId();
final View root = getWindow().getDecorView();
mService.attach(this, root.getWindowToken(),
LayoutParams.TYPE_APPLICATION_MEDIA,
true, root.getWidth(), root.getHeight(),
- new Rect(0, 0, 0, 0));
+ new Rect(0, 0, 0, 0), displayId);
} catch (RemoteException e) {
Log.w(LOG_TAG, "Failed attaching wallpaper; clearing", e);
}
@@ -482,7 +504,7 @@ public class LiveWallpaperPreview extends Activity {
}
}
- public void attachEngine(IWallpaperEngine engine) {
+ public void attachEngine(IWallpaperEngine engine, int displayId) {
synchronized (this) {
if (mConnected) {
mEngine = engine;
@@ -506,7 +528,8 @@ public class LiveWallpaperPreview extends Activity {
}
@Override
- public void onWallpaperColorsChanged(WallpaperColors colors) throws RemoteException {
+ public void onWallpaperColorsChanged(WallpaperColors colors, int displayId)
+ throws RemoteException {
}
@@ -516,6 +539,7 @@ public class LiveWallpaperPreview extends Activity {
mLoading.animate()
.alpha(0f)
.setDuration(220)
+ .setStartDelay(300)
.setInterpolator(AnimationUtils.loadInterpolator(LiveWallpaperPreview.this,
android.R.interpolator.fast_out_linear_in))
.withEndAction(() -> mLoading.setVisibility(View.INVISIBLE));