diff options
author | d34d <clark@cyngn.com> | 2016-03-25 10:09:10 -0700 |
---|---|---|
committer | d34d <clark@cyngn.com> | 2016-03-28 08:53:37 -0700 |
commit | a8da1f0e15abcd1f5a3af57e2c9c095512b5e8bf (patch) | |
tree | dd8dab3fc735d6511b666f388a0ab601a888bb1a | |
parent | f69eb01be834be1e9dff4a6273ebb8fa91f0064e (diff) | |
download | packages_apps_ThemeChooser-a8da1f0e15abcd1f5a3af57e2c9c095512b5e8bf.zip packages_apps_ThemeChooser-a8da1f0e15abcd1f5a3af57e2c9c095512b5e8bf.tar.gz packages_apps_ThemeChooser-a8da1f0e15abcd1f5a3af57e2c9c095512b5e8bf.tar.bz2 |
Add pick lock screen wallpaper action
This action will be used to launch the ThemeChooser into the current
theme and show the lock screen wallpaper card.
Change-Id: Ifffcd86c57b5e96a967d23287504cdd632793e9b
TICKET: CYNGNOS-2296
-rw-r--r-- | AndroidManifest.xml | 2 | ||||
-rw-r--r-- | src/com/cyngn/theme/chooser/ChooserActivity.java | 29 | ||||
-rw-r--r-- | src/com/cyngn/theme/chooser/ComponentSelector.java | 16 | ||||
-rw-r--r-- | src/com/cyngn/theme/chooser/MyThemeFragment.java | 7 | ||||
-rw-r--r-- | src/com/cyngn/theme/chooser/ThemeFragment.java | 10 | ||||
-rw-r--r-- | src/com/cyngn/theme/util/CursorLoaderHelper.java | 4 |
6 files changed, 25 insertions, 43 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 9b4a491..b9ad322 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -70,7 +70,7 @@ <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <intent-filter> - <action android:name="com.cyngn.intent.action.PICK_ANIMATED_LOCK_SCREEN" /> + <action android:name="com.cyngn.intent.action.PICK_LOCK_SCREEN_WALLPAPER" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> diff --git a/src/com/cyngn/theme/chooser/ChooserActivity.java b/src/com/cyngn/theme/chooser/ChooserActivity.java index b697a7e..be0ed84 100644 --- a/src/com/cyngn/theme/chooser/ChooserActivity.java +++ b/src/com/cyngn/theme/chooser/ChooserActivity.java @@ -35,7 +35,6 @@ import android.renderscript.ScriptIntrinsicBlur; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; -import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.view.ThemeViewPager; import android.support.v4.view.ViewPager; @@ -100,8 +99,8 @@ public class ChooserActivity extends FragmentActivity "com.cyngn.themes.action.THEME_REMOVED_FROM_CHOOSER"; private static final String EXTRA_PACKAGE = "package"; - private static final String ACTION_PICK_ANIMATED_LOCK_SCREEN = - "com.cyngn.intent.action.PICK_ANIMATED_LOCK_SCREEN"; + private static final String ACTION_PICK_LOCK_SCREEN_WALLPAPER = + "com.cyngn.intent.action.PICK_LOCK_SCREEN_WALLPAPER"; /** * Request code for picking an external wallpaper @@ -156,7 +155,7 @@ public class ChooserActivity extends FragmentActivity private boolean mIsPickingImage = false; private boolean mRestartLoaderOnCollapse = false; private boolean mActivityResuming = false; - private boolean mShowAnimatedLockScreensOnly = false; + private boolean mShowLockScreenWallpaper = false; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -214,8 +213,8 @@ public class ChooserActivity extends FragmentActivity mContainerYOffset = 0; } if (f != null) f.fadeInCards(); - if (mShowAnimatedLockScreensOnly) { - mShowAnimatedLockScreensOnly = false; + if (mShowLockScreenWallpaper) { + mShowLockScreenWallpaper = false; mSelector.resetComponentType(); } } @@ -401,15 +400,11 @@ public class ChooserActivity extends FragmentActivity getCallingPackage())) { mThemeToApply = intent.getStringExtra(EXTRA_PKGNAME); } - } else if (action.equals(ACTION_PICK_ANIMATED_LOCK_SCREEN)) { - mShowAnimatedLockScreensOnly = true; + } else if (action.equals(ACTION_PICK_LOCK_SCREEN_WALLPAPER)) { + mShowLockScreenWallpaper = true; } } - public boolean getShowAnimatedLockScreeOnly() { - return mShowAnimatedLockScreensOnly; - } - private String getSelectedTheme(String requestedTheme) { String[] projection = { ThemesColumns.PRESENT_AS_THEME }; String selection = ThemesColumns.PKG_NAME + "=?"; @@ -704,8 +699,8 @@ public class ChooserActivity extends FragmentActivity mContainerYOffset = 0; } if (f != null) f.fadeInCards(); - if (mShowAnimatedLockScreensOnly) { - mShowAnimatedLockScreensOnly = false; + if (mShowLockScreenWallpaper) { + mShowLockScreenWallpaper = false; mSelector.resetComponentType(); } } else if (mExpanded) { @@ -795,7 +790,7 @@ public class ChooserActivity extends FragmentActivity ((TransitionDrawable) d).startTransition((int) ANIMATE_CONTENT_IN_BLUR_DURATION); } - if (!mShowAnimatedLockScreensOnly) { + if (!mShowLockScreenWallpaper) { AnimatorSet set = new AnimatorSet(); set.play(ObjectAnimator.ofFloat(mContainer, "alpha", 0f, 1f) .setDuration(ANIMATE_CONTENT_IN_ALPHA_DURATION)) @@ -1010,7 +1005,7 @@ public class ChooserActivity extends FragmentActivity final String pkgName = mInstalledThemes.get(position); if (pkgName.equals(mAppliedBaseTheme)) { f = MyThemeFragment.newInstance(mAppliedBaseTheme, mAppliedThemeTitle, - mAppliedThemeAuthor, mAnimateContentIn, mShowAnimatedLockScreensOnly); + mAppliedThemeAuthor, mAnimateContentIn, mShowLockScreenWallpaper); wallpaperCmpntId = mCurrentWallpaperCmpntId; } else { f = ThemeFragment.newInstance(pkgName, mAnimateContentIn); @@ -1163,7 +1158,7 @@ public class ChooserActivity extends FragmentActivity set.setStartDelay(mAnimateContentInDelay); set.start(); mContainer.setVisibility(View.VISIBLE); - getCurrentFragment().showAnimatedLockScreenCard(); + getCurrentFragment().showLockScreenCard(); } }, ANIMATE_CARDS_IN_DURATION); } diff --git a/src/com/cyngn/theme/chooser/ComponentSelector.java b/src/com/cyngn/theme/chooser/ComponentSelector.java index bceb43b..92397f0 100644 --- a/src/com/cyngn/theme/chooser/ComponentSelector.java +++ b/src/com/cyngn/theme/chooser/ComponentSelector.java @@ -3,7 +3,6 @@ */ package com.cyngn.theme.chooser; -import android.content.ContentResolver; import android.content.Context; import android.content.pm.PackageManager; import android.content.res.Resources; @@ -15,13 +14,10 @@ import android.graphics.Typeface; import android.graphics.drawable.BitmapDrawable; import android.media.MediaPlayer; import android.media.RingtoneManager; -import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; -import android.provider.Settings; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; -import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.text.TextUtils; import android.util.AttributeSet; @@ -63,7 +59,6 @@ import static cyanogenmod.providers.ThemesContract.ThemesColumns.MODIFIES_NAVIGA import static cyanogenmod.providers.ThemesContract.ThemesColumns.MODIFIES_ICONS; import static cyanogenmod.providers.ThemesContract.ThemesColumns.MODIFIES_FONTS; -import static com.cyngn.theme.util.CursorLoaderHelper.LOADER_ID_LIVE_LOCK_SCREEN; import static com.cyngn.theme.util.CursorLoaderHelper.LOADER_ID_STATUS_BAR; import static com.cyngn.theme.util.CursorLoaderHelper.LOADER_ID_FONT; import static com.cyngn.theme.util.CursorLoaderHelper.LOADER_ID_ICONS; @@ -357,8 +352,7 @@ public class ComponentSelector extends LinearLayout return LOADER_ID_ALARM; } if (MODIFIES_LOCKSCREEN.equals(component)) { - return (showAnimatedLockScreenOnly()) ? LOADER_ID_LIVE_LOCK_SCREEN - : LOADER_ID_LOCKSCREEN; + return LOADER_ID_LOCKSCREEN; } return -1; } @@ -547,10 +541,6 @@ public class ComponentSelector extends LinearLayout return newSoundView(cursor, container, position, mComponentType); } if (MODIFIES_LOCKSCREEN.equals(mComponentType)) { - if (showAnimatedLockScreenOnly()) { - return newWallpapersView(cursor, container, position + EXTRA_WALLPAPER_COMPONENTS, - cursor.getColumnIndex(PreviewColumns.LIVE_LOCK_SCREEN_THUMBNAIL), true); - } boolean isLiveLockScreen = false; if (position >= EXTRA_WALLPAPER_COMPONENTS) { cursor.moveToPosition(position - EXTRA_WALLPAPER_COMPONENTS); @@ -876,10 +866,6 @@ public class ComponentSelector extends LinearLayout } }; - private boolean showAnimatedLockScreenOnly() { - return ((ChooserActivity)mContext).getShowAnimatedLockScreeOnly(); - } - private class ThemesObserver extends ContentObserver { public ThemesObserver() { super(null); diff --git a/src/com/cyngn/theme/chooser/MyThemeFragment.java b/src/com/cyngn/theme/chooser/MyThemeFragment.java index e4f582b..8306e55 100644 --- a/src/com/cyngn/theme/chooser/MyThemeFragment.java +++ b/src/com/cyngn/theme/chooser/MyThemeFragment.java @@ -70,7 +70,7 @@ public class MyThemeFragment extends ThemeFragment { static MyThemeFragment newInstance(String baseThemePkgName, String baseThemeName, String baseThemeAuthor, boolean skipLoadingAnim, - boolean showAnimatedLockScreensOnly) { + boolean animateToLockScreenCard) { MyThemeFragment f = new MyThemeFragment(); Bundle args = new Bundle(); args.putString(ARG_PACKAGE_NAME, CURRENTLY_APPLIED_THEME); @@ -78,7 +78,7 @@ public class MyThemeFragment extends ThemeFragment { args.putString(ARG_BASE_THEME_NAME, baseThemeName); args.putString(ARG_BASE_THEME_AUTHOR, baseThemeAuthor); args.putBoolean(ARG_SKIP_LOADING_ANIM, skipLoadingAnim); - args.putBoolean(ARG_SHOW_ANIMATED_LOCK_SCREEN_ONLY, showAnimatedLockScreensOnly); + args.putBoolean(ARG_ANIMATE_TO_LOCK_SCREEN_CARD, animateToLockScreenCard); f.setArguments(args); return f; } @@ -93,7 +93,8 @@ public class MyThemeFragment extends ThemeFragment { mBaseThemePkgName = getArguments().getString(ARG_BASE_THEME_PACKAGE_NAME); mBaseThemeName = getArguments().getString(ARG_BASE_THEME_NAME); mBaseThemeAuthor = getArguments().getString(ARG_BASE_THEME_AUTHOR); - mShowAnimatedLockScreenSelectorAfterContentLoaded = getArguments().getBoolean(ARG_SHOW_ANIMATED_LOCK_SCREEN_ONLY); + mShowLockScreenSelectorAfterContentLoaded = getArguments().getBoolean( + ARG_ANIMATE_TO_LOCK_SCREEN_CARD); mSurfaceView = createSurfaceView(); populateBaseThemeSupportedComponents(mBaseThemePkgName); } diff --git a/src/com/cyngn/theme/chooser/ThemeFragment.java b/src/com/cyngn/theme/chooser/ThemeFragment.java index 5ca238f..7bf983a 100644 --- a/src/com/cyngn/theme/chooser/ThemeFragment.java +++ b/src/com/cyngn/theme/chooser/ThemeFragment.java @@ -195,7 +195,7 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb protected static final String ARG_PACKAGE_NAME = "pkgName"; protected static final String ARG_COMPONENT_ID = "cmpntId"; protected static final String ARG_SKIP_LOADING_ANIM = "skipLoadingAnim"; - protected static final String ARG_SHOW_ANIMATED_LOCK_SCREEN_ONLY = "showAnimatedLockScreenOnly"; + protected static final String ARG_ANIMATE_TO_LOCK_SCREEN_CARD = "animateToLockScreenCard"; private static final String LLS_PACKAGE_NAME = "com.cyngn.lockscreen.live"; private static final String LLS_PROVIDER_NAME = @@ -322,7 +322,7 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb private static final int mThemeVersion = ThemeVersion.getVersion(); - protected boolean mShowAnimatedLockScreenSelectorAfterContentLoaded; + protected boolean mShowLockScreenSelectorAfterContentLoaded; protected enum CustomizeResetAction { Customize, @@ -1346,9 +1346,9 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb animateContentIn(); } }); - if (mShowAnimatedLockScreenSelectorAfterContentLoaded) { + if (mShowLockScreenSelectorAfterContentLoaded) { getChooserActivity().expandContentAndAnimateLockScreenCardIn(); - mShowAnimatedLockScreenSelectorAfterContentLoaded = false; + mShowLockScreenSelectorAfterContentLoaded = false; } break; case LOADER_ID_STATUS_BAR: @@ -2896,7 +2896,7 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb scrollAnimator.start(); } - public void showAnimatedLockScreenCard() { + public void showLockScreenCard() { mHandler.postDelayed(new Runnable() { @Override public void run() { diff --git a/src/com/cyngn/theme/util/CursorLoaderHelper.java b/src/com/cyngn/theme/util/CursorLoaderHelper.java index 3d773e3..5992779 100644 --- a/src/com/cyngn/theme/util/CursorLoaderHelper.java +++ b/src/com/cyngn/theme/util/CursorLoaderHelper.java @@ -169,8 +169,8 @@ public class CursorLoaderHelper { selection = MODIFIES_ALARMS + "=?"; break; case LOADER_ID_LOCKSCREEN: - selection = MODIFIES_LOCKSCREEN + "=? OR " + MODIFIES_LIVE_LOCK_SCREEN + "=?"; - selectionArgs = new String[] { "1", "1" }; + selection = MODIFIES_LOCKSCREEN + "=?"; + selectionArgs = new String[] { "1" }; if (mThemeVersion >= 3) { projection = new String[]{ PreviewColumns.LOCK_WALLPAPER_THUMBNAIL, |