diff options
-rw-r--r-- | res/values-en-rCA/strings.xml | 36 | ||||
-rw-r--r-- | res/values-en-rXC/strings.xml | 36 | ||||
-rw-r--r-- | src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java | 24 |
3 files changed, 89 insertions, 7 deletions
diff --git a/res/values-en-rCA/strings.xml b/res/values-en-rCA/strings.xml new file mode 100644 index 0000000..11d49ec --- /dev/null +++ b/res/values-en-rCA/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">"Live Wallpaper Picker"</string> + <string name="live_wallpaper_picker_title" msgid="4811278937634144675">"Select live wallpaper"</string> + <string name="live_wallpaper_picker_label" msgid="3218000114890071946">"Live wallpapers"</string> + <string name="live_wallpaper_preview_title" msgid="1130080613611954763">"Live wallpaper preview"</string> + <string name="configure_wallpaper" msgid="7396598925806288258">"Settings…"</string> + <string name="wallpaper_instructions" msgid="4215640646180727542">"Set wallpaper"</string> + <string name="live_wallpaper_empty" msgid="4278728108785853407">"No live wallpapers."</string> + <string name="set_live_wallpaper" msgid="2381437614949033266">"Set wallpaper"</string> + <string name="wallpaper_title_and_author" msgid="8891734217843935304">"<xliff:g id="TITLE">%1$s</xliff:g> by <xliff:g id="AUTHOR">%2$s</xliff:g>"</string> + <string name="live_wallpaper_loading" msgid="2488371303130330734">"Loading live wallpaper…"</string> + <string name="which_wallpaper_option_home_screen" msgid="6592329803583957023">"Home screen"</string> + <string name="which_wallpaper_option_home_screen_and_lock_screen" msgid="6170359719231147447">"Home screen and lock screen"</string> + <string name="collapse_attribution_panel" msgid="4998500891743118630">"Collapse wallpaper info panel"</string> + <string name="expand_attribution_panel" msgid="3151357815478885438">"Expand wallpaper info panel"</string> +</resources> diff --git a/res/values-en-rXC/strings.xml b/res/values-en-rXC/strings.xml new file mode 100644 index 0000000..8f6082e --- /dev/null +++ b/res/values-en-rXC/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">"Live Wallpaper Picker"</string> + <string name="live_wallpaper_picker_title" msgid="4811278937634144675">"Select live wallpaper"</string> + <string name="live_wallpaper_picker_label" msgid="3218000114890071946">"Live Wallpapers"</string> + <string name="live_wallpaper_preview_title" msgid="1130080613611954763">"Live wallpaper preview"</string> + <string name="configure_wallpaper" msgid="7396598925806288258">"Settings…"</string> + <string name="wallpaper_instructions" msgid="4215640646180727542">"Set wallpaper"</string> + <string name="live_wallpaper_empty" msgid="4278728108785853407">"No live wallpapers."</string> + <string name="set_live_wallpaper" msgid="2381437614949033266">"Set wallpaper"</string> + <string name="wallpaper_title_and_author" msgid="8891734217843935304">"<xliff:g id="TITLE">%1$s</xliff:g> by <xliff:g id="AUTHOR">%2$s</xliff:g>"</string> + <string name="live_wallpaper_loading" msgid="2488371303130330734">"Loading live wallpaper…"</string> + <string name="which_wallpaper_option_home_screen" msgid="6592329803583957023">"Home screen"</string> + <string name="which_wallpaper_option_home_screen_and_lock_screen" msgid="6170359719231147447">"Home screen and lock screen"</string> + <string name="collapse_attribution_panel" msgid="4998500891743118630">"Collapse wallpaper info panel"</string> + <string name="expand_attribution_panel" msgid="3151357815478885438">"Expand wallpaper info panel"</string> +</resources> diff --git a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java index 6dab5c6..25ce3a4 100644 --- a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java +++ b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java @@ -27,6 +27,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.ServiceConnection; +import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.res.Resources.NotFoundException; import android.graphics.Rect; @@ -71,9 +72,9 @@ public class LiveWallpaperPreview extends Activity { private WallpaperManager mWallpaperManager; private WallpaperConnection mWallpaperConnection; - private String mSettings; private String mPackageName; private Intent mWallpaperIntent; + private Intent mSettingsIntent; private TextView mAttributionTitle; private TextView mAttributionSubtitle1; @@ -115,11 +116,23 @@ public class LiveWallpaperPreview extends Activity { mSpacer = findViewById(R.id.spacer); mLoading = findViewById(R.id.loading); - mSettings = info.getSettingsActivity(); mPackageName = info.getPackageName(); mWallpaperIntent = new Intent(WallpaperService.SERVICE_INTERFACE) .setClassName(info.getPackageName(), info.getServiceName()); + final String settingsActivity = info.getSettingsActivity(); + if (settingsActivity != null) { + mSettingsIntent = new Intent(); + mSettingsIntent.setComponent(new ComponentName(mPackageName, settingsActivity)); + mSettingsIntent.putExtra(WallpaperSettingsActivity.EXTRA_PREVIEW_MODE, true); + final PackageManager pm = getPackageManager(); + final ActivityInfo activityInfo = mSettingsIntent.resolveActivityInfo(pm, 0); + if (activityInfo == null) { + Log.e(LOG_TAG, "Couldn't find settings activity: " + settingsActivity); + mSettingsIntent = null; + } + } + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setActionBar(toolbar); getActionBar().setDisplayHomeAsUpEnabled(true); @@ -253,7 +266,7 @@ public class LiveWallpaperPreview extends Activity { @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_preview, menu); - menu.findItem(R.id.configure).setVisible(mSettings != null); + menu.findItem(R.id.configure).setVisible(mSettingsIntent != null); menu.findItem(R.id.set_wallpaper).getActionView().setOnClickListener( this::setLiveWallpaper); return super.onCreateOptionsMenu(menu); @@ -308,10 +321,7 @@ public class LiveWallpaperPreview extends Activity { public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.configure) { - Intent intent = new Intent(); - intent.setComponent(new ComponentName(mPackageName, mSettings)); - intent.putExtra(WallpaperSettingsActivity.EXTRA_PREVIEW_MODE, true); - startActivity(intent); + startActivity(mSettingsIntent); return true; } else if (id == R.id.set_wallpaper) { setLiveWallpaper(getWindow().getDecorView()); |