summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLuis Vidal <lvidal@cyngn.com>2016-02-25 12:30:31 -0800
committerLuis Vidal <lvidal@Luiss-MacBook-Pro-2.local>2016-03-01 14:56:18 -0800
commitcdc0bbdf4a7200f6af481db7fab33ea6f94be4c8 (patch)
tree4b42705090adb604fa065e3b4114f96c5b2fc55f /src
parent9ba2bc96d84cdf363475225c1059efe2d2380835 (diff)
downloadpackages_apps_ThemeChooser-cdc0bbdf4a7200f6af481db7fab33ea6f94be4c8.tar.gz
packages_apps_ThemeChooser-cdc0bbdf4a7200f6af481db7fab33ea6f94be4c8.tar.bz2
packages_apps_ThemeChooser-cdc0bbdf4a7200f6af481db7fab33ea6f94be4c8.zip
Show FAB when an external image or None is selected
Fix to show the FAB when an external image or None is selected from the Wallpaper or Lockscreen cards. Change-Id: I911b4374ddc80186ee2699e8782d6e5ca48ee32f TICKET: CHOOSER-116 TICKET: CHOOSER-117
Diffstat (limited to 'src')
-rw-r--r--src/com/cyngn/theme/chooser/ChooserActivity.java2
-rw-r--r--src/com/cyngn/theme/chooser/MyThemeFragment.java8
-rw-r--r--src/com/cyngn/theme/chooser/ThemeFragment.java44
3 files changed, 40 insertions, 14 deletions
diff --git a/src/com/cyngn/theme/chooser/ChooserActivity.java b/src/com/cyngn/theme/chooser/ChooserActivity.java
index 75d81f9..ee6f7db 100644
--- a/src/com/cyngn/theme/chooser/ChooserActivity.java
+++ b/src/com/cyngn/theme/chooser/ChooserActivity.java
@@ -761,6 +761,7 @@ public class ChooserActivity extends FragmentActivity
ThemeFragment f = getCurrentFragment();
if (f != null) {
f.setWallpaperImageUri(uri);
+ showSaveApplyButton();
}
}
} else if (resultCode == RESULT_OK && requestCode == REQUEST_PICK_LOCKSCREEN_IMAGE) {
@@ -769,6 +770,7 @@ public class ChooserActivity extends FragmentActivity
ThemeFragment f = getCurrentFragment();
if (f != null) {
f.setLockscreenImageUri(uri);
+ showSaveApplyButton();
}
}
} else {
diff --git a/src/com/cyngn/theme/chooser/MyThemeFragment.java b/src/com/cyngn/theme/chooser/MyThemeFragment.java
index 67a49d2..800faea 100644
--- a/src/com/cyngn/theme/chooser/MyThemeFragment.java
+++ b/src/com/cyngn/theme/chooser/MyThemeFragment.java
@@ -385,6 +385,14 @@ public class MyThemeFragment extends ThemeFragment {
componentsToApply.put(component, selectedPkg);
}
}
+ if (mExternalLockscreenUri != null) {
+ if (mCurrentTheme.containsKey(ThemesColumns.MODIFIES_LIVE_LOCK_SCREEN)) {
+ componentsToApply.put(ThemesColumns.MODIFIES_LIVE_LOCK_SCREEN, LOCKSCREEN_NONE);
+ }
+ if (mCurrentTheme.containsKey(ThemesColumns.MODIFIES_LOCKSCREEN)) {
+ componentsToApply.put(ThemesColumns.MODIFIES_LOCKSCREEN, LOCKSCREEN_NONE);
+ }
+ }
}
return componentsToApply;
}
diff --git a/src/com/cyngn/theme/chooser/ThemeFragment.java b/src/com/cyngn/theme/chooser/ThemeFragment.java
index 7cd04ff..577ffc9 100644
--- a/src/com/cyngn/theme/chooser/ThemeFragment.java
+++ b/src/com/cyngn/theme/chooser/ThemeFragment.java
@@ -193,6 +193,7 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
private static final int DEFAULT_CLOCK_COLOR = Color.WHITE;
protected static final String WALLPAPER_NONE = "";
+ protected static final String LOCKSCREEN_NONE = "";
protected static final String ARG_PACKAGE_NAME = "pkgName";
protected static final String ARG_COMPONENT_ID = "cmpntId";
@@ -652,10 +653,18 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
}
});
if (isSuccess) {
+ if (mExternalLockscreenUri != null) {
+ // Handle setting an external wallpaper in a separate thread
+ // Need to do this AFTER ThemeMgr is done processing our change request.
+ // The external lock screen that we just applied would be removed when
+ // the change request is setting/clearing the lock screen
+ new Thread(mApplyExternalLockscreenRunnable).start();
+ }
Map<String, String> appliedComponents = getComponentsToApply();
- String modLLS = appliedComponents.get(MODIFIES_LIVE_LOCK_SCREEN);
- if (modLLS != null) {
- if (TextUtils.equals(modLLS, "")) {
+ boolean modLLS = appliedComponents.containsKey(MODIFIES_LIVE_LOCK_SCREEN);
+ if (modLLS) {
+ String pkgName = appliedComponents.get(MODIFIES_LIVE_LOCK_SCREEN);
+ if (pkgName.equals(LOCKSCREEN_NONE)) {
setLiveLockScreenAsKeyguard(false);
} else {
setLiveLockScreenAsKeyguard(true);
@@ -707,8 +716,12 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
mExternalLockscreenUri = uri;
final Point size = new Point(mLockScreenCard.getWidth(), mLockScreenCard.getHeight());
final Drawable wp = getWallpaperDrawableFromUri(uri, size);
+ if (mLockScreenCard.isShowingEmptyView()) {
+ mLockScreenCard.setEmptyViewEnabled(false);
+ }
mLockScreenCard.setWallpaper(wp);
// remove the entry from mSelectedComponentsMap
+ mSelectedComponentsMap.remove(ThemesColumns.MODIFIES_LIVE_LOCK_SCREEN);
mSelectedComponentsMap.remove(ThemesColumns.MODIFIES_LOCKSCREEN);
}
@@ -983,10 +996,6 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
// Handle setting an external wallpaper in a separate thread
new Thread(mApplyExternalWallpaperRunnable).start();
}
- if (mExternalLockscreenUri != null) {
- // Handle setting an external wallpaper in a separate thread
- new Thread(mApplyExternalLockscreenRunnable).start();
- }
}
mExpanded = false;
}
@@ -1570,16 +1579,20 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
&& (mBaseThemeSupportedComponents.contains(MODIFIES_LOCKSCREEN) ||
mBaseThemeSupportedComponents.contains(MODIFIES_LIVE_LOCK_SCREEN)))) {
if (isLiveLockScreen) {
- if (mSelectedComponentsMap.containsKey(MODIFIES_LOCKSCREEN)) {
- mSelectedComponentsMap.put(MODIFIES_LOCKSCREEN, "");
- }
mSelectedComponentsMap.put(MODIFIES_LIVE_LOCK_SCREEN, pkgName);
+ if (mCurrentTheme.containsKey(MODIFIES_LOCKSCREEN)) {
+ mSelectedComponentsMap.put(MODIFIES_LOCKSCREEN, LOCKSCREEN_NONE);
+ } else {
+ mSelectedComponentsMap.remove(MODIFIES_LOCKSCREEN);
+ }
setCardTitle(mLockScreenCard, pkgName,
getString(R.string.live_lock_screen_label));
} else {
mSelectedComponentsMap.put(MODIFIES_LOCKSCREEN, pkgName);
- if (mSelectedComponentsMap.containsKey(MODIFIES_LIVE_LOCK_SCREEN)) {
- mSelectedComponentsMap.put(MODIFIES_LIVE_LOCK_SCREEN, "");
+ if (mCurrentTheme.containsKey(MODIFIES_LIVE_LOCK_SCREEN)) {
+ mSelectedComponentsMap.put(MODIFIES_LIVE_LOCK_SCREEN, LOCKSCREEN_NONE);
+ } else {
+ mSelectedComponentsMap.remove(MODIFIES_LIVE_LOCK_SCREEN);
}
setCardTitle(mLockScreenCard, pkgName, getString(R.string.lockscreen_label));
}
@@ -2065,6 +2078,7 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
mSelectedComponentsMap.put(ThemesColumns.MODIFIES_LAUNCHER, WALLPAPER_NONE);
setCardTitle(mWallpaperCard, WALLPAPER_NONE,
getString(R.string.wallpaper_label));
+ getChooserActivity().showSaveApplyButton();
} else if (ComponentSelector.EXTERNAL_WALLPAPER.equals(pkgName)) {
// Check if we have READ_EXTERNAL_STORAGE permission and if not request it,
// otherwise let the user pick an image
@@ -2093,15 +2107,17 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
|| MODIFIES_LIVE_LOCK_SCREEN.equals(component)) {
if (pkgName != null && TextUtils.isEmpty(pkgName)) {
mLockScreenCard.setWallpaper(null);
- mSelectedComponentsMap.put(ThemesColumns.MODIFIES_LOCKSCREEN, WALLPAPER_NONE);
+ mSelectedComponentsMap.put(ThemesColumns.MODIFIES_LOCKSCREEN, LOCKSCREEN_NONE);
+
if(mSelectedComponentsMap.containsKey(MODIFIES_LIVE_LOCK_SCREEN)) {
- mSelectedComponentsMap.put(MODIFIES_LIVE_LOCK_SCREEN,WALLPAPER_NONE);
+ mSelectedComponentsMap.put(MODIFIES_LIVE_LOCK_SCREEN, LOCKSCREEN_NONE);
}
setCardTitle(mLockScreenCard, WALLPAPER_NONE,
getString(R.string.lockscreen_label));
if (mLockScreenCard.isShowingEmptyView()) {
mLockScreenCard.setEmptyViewEnabled(false);
}
+ getChooserActivity().showSaveApplyButton();
} else if (ComponentSelector.EXTERNAL_WALLPAPER.equals(pkgName)) {
// Check if we have READ_EXTERNAL_STORAGE permission and if not request it,
// otherwise let the user pick an image