summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBharadwaj Narasimha <bnarasimha@cyngn.com>2016-08-31 13:02:56 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-09-03 13:44:11 -0700
commitf40ac25917a17e2d482d9b69edd9a0b14097847b (patch)
tree9bdd618b8c58cacd3aa188aebd6224929a90e403 /src
parent7e4390fef0dfba5f80b0ef0c4e0665ac45f84b99 (diff)
downloadpackages_apps_ThemeChooser-f40ac25917a17e2d482d9b69edd9a0b14097847b.zip
packages_apps_ThemeChooser-f40ac25917a17e2d482d9b69edd9a0b14097847b.tar.gz
packages_apps_ThemeChooser-f40ac25917a17e2d482d9b69edd9a0b14097847b.tar.bz2
Move actions in theme card to overflow menu
Moved the customize,delete and reset in the title card to an overflow menu to free up some space in the title card for the theme and author names. TICKET:CYNGNOS-3279 Change-Id: I0c4defd82369e4840efac420b1629493b280b168
Diffstat (limited to 'src')
-rw-r--r--src/android/support/v4/view/ThemeViewPager.java4
-rw-r--r--src/org/cyanogenmod/theme/chooser2/MyThemeFragment.java13
-rw-r--r--src/org/cyanogenmod/theme/chooser2/ThemeFragment.java115
-rw-r--r--src/org/cyanogenmod/theme/widget/ThemeTagLayout.java4
4 files changed, 37 insertions, 99 deletions
diff --git a/src/android/support/v4/view/ThemeViewPager.java b/src/android/support/v4/view/ThemeViewPager.java
index 1cde715..b430f5f 100644
--- a/src/android/support/v4/view/ThemeViewPager.java
+++ b/src/android/support/v4/view/ThemeViewPager.java
@@ -66,10 +66,8 @@ public class ThemeViewPager extends ViewPager {
if (!mExpanded && isEnabled() && !mIsAnimating) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
- intercept = getChildCount() > 0 && !isTouching(R.id.customize, ev)
+ intercept = getChildCount() > 0
&& !isTouching(R.id.overflow, ev)
- && !isTouching(R.id.reset, ev)
- && !isTouching(R.id.delete, ev)
&& !isTouching(R.id.confirm_cancel_overlay, ev)
&& !isTouching(R.id.customize_reset_theme_layout, ev);
break;
diff --git a/src/org/cyanogenmod/theme/chooser2/MyThemeFragment.java b/src/org/cyanogenmod/theme/chooser2/MyThemeFragment.java
index 490b568..108d91c 100644
--- a/src/org/cyanogenmod/theme/chooser2/MyThemeFragment.java
+++ b/src/org/cyanogenmod/theme/chooser2/MyThemeFragment.java
@@ -124,7 +124,6 @@ public class MyThemeFragment extends ThemeFragment {
if (PreferenceUtils.hasThemeBeenUpdated(getActivity(), mBaseThemePkgName)) {
mThemeTagLayout.setUpdatedTagEnabled(true);
}
- mDelete.setVisibility(View.GONE);
setCustomized(isThemeCustomized());
return v;
}
@@ -163,17 +162,6 @@ public class MyThemeFragment extends ThemeFragment {
}
@Override
- protected boolean onPopupMenuItemClick(MenuItem item) {
- switch(item.getItemId()) {
- case R.id.menu_reset:
- resetTheme();
- return true;
- }
-
- return super.onPopupMenuItemClick(item);
- }
-
- @Override
public void collapse(boolean applyTheme) {
super.collapse(applyTheme);
if (mSurfaceView != null) mSurfaceView.setVisibility(View.VISIBLE);
@@ -327,7 +315,6 @@ public class MyThemeFragment extends ThemeFragment {
};
private void setCustomized(boolean customized) {
- mReset.setVisibility(customized ? View.VISIBLE : View.GONE);
mThemeTagLayout.setCustomizedTagEnabled(customized);
}
diff --git a/src/org/cyanogenmod/theme/chooser2/ThemeFragment.java b/src/org/cyanogenmod/theme/chooser2/ThemeFragment.java
index 6a73598..e4dd0fc 100644
--- a/src/org/cyanogenmod/theme/chooser2/ThemeFragment.java
+++ b/src/org/cyanogenmod/theme/chooser2/ThemeFragment.java
@@ -267,10 +267,7 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
protected ViewGroup mTitleLayout;
protected TextView mTitle;
protected TextView mAuthor;
- protected ImageView mCustomize;
protected ImageView mOverflow;
- protected ImageView mDelete;
- protected ImageView mReset;
protected ProgressBar mProgress;
// Additional Card Views
@@ -462,11 +459,31 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
if (CURRENTLY_APPLIED_THEME.equals(mPkgName) ||
mPkgName.equals(Utils.getDefaultThemePackageName(getActivity())) ||
mPkgName.equals(ThemeConfig.SYSTEM_DEFAULT)) {
- menu.findItem(R.id.menu_delete).setEnabled(false);
+ menu.findItem(R.id.menu_delete).setVisible(false);
+ if(mThemeTagLayout.isCustomizedTagEnabled()) {
+ menu.findItem(R.id.menu_reset).setVisible(true);
+ menu.findItem(R.id.menu_reset).setEnabled(true);
+ }
+ else {
+ menu.findItem(R.id.menu_reset).setVisible(false);
+ menu.findItem(R.id.menu_reset).setEnabled(false);
+ }
}
- if (!mThemeTagLayout.isCustomizedTagEnabled()) {
+ if(!mThemeTagLayout.isAppliedTagEnabled()) {
+ menu.findItem(R.id.menu_delete).setEnabled(true);
menu.findItem(R.id.menu_reset).setVisible(false);
}
+ if(mThemeTagLayout.isAppliedTagEnabled()) {
+ if(mThemeTagLayout.isCustomizedTagEnabled()) {
+ menu.findItem(R.id.menu_reset).setVisible(true);
+ menu.findItem(R.id.menu_reset).setEnabled(true);
+ }
+ else {
+ menu.findItem(R.id.menu_reset).setVisible(true);
+ menu.findItem(R.id.menu_reset).setEnabled(false);
+ }
+
+ }
popupmenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
@@ -477,35 +494,6 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
popupmenu.show();
}
});
- mCustomize = (ImageView) v.findViewById(R.id.customize);
- mCustomize.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- if (!isShowingConfirmCancelOverlay() && !isShowingCustomizeResetLayout()) {
- getChooserActivity().expand();
- }
- }
- });
-
- mDelete = (ImageView) v.findViewById(R.id.delete);
- mDelete.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- showDeleteThemeOverlay();
- }
- });
- if (Utils.getDefaultThemePackageName(getActivity()).equals(mPkgName) ||
- ThemeConfig.SYSTEM_DEFAULT.equals(mPkgName)) {
- mDelete.setVisibility(View.GONE);
- }
-
- mReset = (ImageView) v.findViewById(R.id.reset);
- mReset.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- showResetThemeOverlay();
- }
- });
- mReset.setVisibility(View.GONE);
if (!Utils.hasNavigationBar(getActivity())) {
adjustScrollViewPaddingTop();
@@ -566,20 +554,8 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
if (isThemeProcessing()) {
tm.registerProcessingListener(this);
mProcessingThemeLayout.setVisibility(View.VISIBLE);
- mCustomize.setVisibility(View.INVISIBLE);
- mCustomize.setAlpha(0f);
- if (mDelete.getVisibility() != View.GONE) {
- mDelete.setVisibility(View.INVISIBLE);
- mDelete.setAlpha(0f);
- }
mProcessingResources = true;
} else {
- mCustomize.setVisibility(View.VISIBLE);
- mCustomize.setAlpha(1f);
- if (mDelete.getVisibility() != View.GONE) {
- mDelete.setVisibility(View.VISIBLE);
- mDelete.setAlpha(1f);
- }
mProcessingResources = false;
}
}
@@ -770,17 +746,20 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
}
protected boolean onPopupMenuItemClick(MenuItem item) {
+ int id = item.getItemId();
switch(item.getItemId()) {
- /* TODO: Add back in once there is UX available for this feature
- case R.id.menu_author:
- Toast.makeText(getActivity(),
- "Not supported",
- Toast.LENGTH_LONG).show();
- break;
- */
case R.id.menu_delete:
showDeleteThemeOverlay();
break;
+ case R.id.menu_customize:
+ //showResetThemeOverlay();
+ if (!isShowingConfirmCancelOverlay() && !isShowingCustomizeResetLayout()) {
+ getChooserActivity().expand();
+ }
+ break;
+ case R.id.menu_reset:
+ showResetThemeOverlay();
+ break;
}
return true;
@@ -911,7 +890,6 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
if (applyTheme) {
final boolean customized = isThemeCustomized();
mThemeTagLayout.setCustomizedTagEnabled(customized);
- mReset.setVisibility(customized ? View.VISIBLE : View.GONE);
}
//Move the theme preview so that it is near the center of page per spec
@@ -2510,7 +2488,6 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
.setInterpolator(new AccelerateInterpolator())
.start();
mProgress.startAnimation(scaleAnim);
- if (mThemeResetting) mReset.setVisibility(View.GONE);
}
private void animateContentIn() {
@@ -2542,18 +2519,6 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
set.start();
}
- private void disableActionButtons() {
- mCustomize.setEnabled(false);
- mDelete.setEnabled(false);
- mReset.setEnabled(false);
- }
-
- private void enableActionButtons() {
- mCustomize.setEnabled(true);
- mDelete.setEnabled(true);
- mReset.setEnabled(true);
- }
-
public boolean isShowingConfirmCancelOverlay() {
return mConfirmCancelOverlay.getVisibility() == View.VISIBLE;
}
@@ -2584,8 +2549,6 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
tv.setText(String.format(getString(R.string.per_app_theme_removal_warning),
mTitle.getText()));
}
-
- disableActionButtons();
mClickableView.setSoundEffectsEnabled(false);
}
@@ -2603,7 +2566,6 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
anim.setDuration(ANIMATE_APPLY_LAYOUT_DURATION);
anim.alpha(1f).start();
- disableActionButtons();
mClickableView.setSoundEffectsEnabled(false);
}
@@ -2621,7 +2583,6 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
anim.setDuration(ANIMATE_APPLY_LAYOUT_DURATION);
anim.alpha(1f).start();
- disableActionButtons();
mClickableView.setSoundEffectsEnabled(false);
}
@@ -2660,7 +2621,6 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
}
});
- enableActionButtons();
mClickableView.setSoundEffectsEnabled(true);
}
@@ -2683,7 +2643,6 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
anim.setDuration(ANIMATE_APPLY_LAYOUT_DURATION);
anim.alpha(1f).start();
- disableActionButtons();
mClickableView.setSoundEffectsEnabled(false);
}
@@ -2724,7 +2683,6 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
}
});
- enableActionButtons();
mClickableView.setSoundEffectsEnabled(true);
}
@@ -2745,16 +2703,7 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
mProcessingThemeLayout.setVisibility(View.GONE);
}
}).setDuration(ANIMATE_APPLY_LAYOUT_DURATION).start();
- mCustomize.setVisibility(View.VISIBLE);
- mCustomize.setAlpha(0f);
- mCustomize.animate().alpha(1f).setDuration(ANIMATE_APPLY_LAYOUT_DURATION).start();
- if (mDelete.getVisibility() != View.GONE) {
- mDelete.setVisibility(View.VISIBLE);
- mDelete.setAlpha(0f);
- mDelete.animate().alpha(1f).setDuration(ANIMATE_APPLY_LAYOUT_DURATION).start();
- }
- enableActionButtons();
mClickableView.setSoundEffectsEnabled(true);
}
diff --git a/src/org/cyanogenmod/theme/widget/ThemeTagLayout.java b/src/org/cyanogenmod/theme/widget/ThemeTagLayout.java
index 701b78b..1f8aebc 100644
--- a/src/org/cyanogenmod/theme/widget/ThemeTagLayout.java
+++ b/src/org/cyanogenmod/theme/widget/ThemeTagLayout.java
@@ -68,6 +68,10 @@ public class ThemeTagLayout extends LinearLayout {
}
}
+ public boolean isAppliedTagEnabled() {
+ return findViewById(R.id.tag_applied) != null;
+ }
+
public void setCustomizedTagEnabled(boolean enabled) {
if (enabled) {
if (findViewById(R.id.tag_customized) != null) return;