diff options
19 files changed, 42 insertions, 132 deletions
diff --git a/res/drawable-hdpi/ic_theme_customize.png b/res/drawable-hdpi/ic_theme_customize.png Binary files differdeleted file mode 100644 index 2ce535c..0000000 --- a/res/drawable-hdpi/ic_theme_customize.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_theme_delete.png b/res/drawable-hdpi/ic_theme_delete.png Binary files differdeleted file mode 100644 index eeefe21..0000000 --- a/res/drawable-hdpi/ic_theme_delete.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_theme_reset.png b/res/drawable-hdpi/ic_theme_reset.png Binary files differdeleted file mode 100644 index 8d1ead9..0000000 --- a/res/drawable-hdpi/ic_theme_reset.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_theme_customize.png b/res/drawable-mdpi/ic_theme_customize.png Binary files differdeleted file mode 100644 index 56f306e..0000000 --- a/res/drawable-mdpi/ic_theme_customize.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_theme_delete.png b/res/drawable-mdpi/ic_theme_delete.png Binary files differdeleted file mode 100644 index 93bb424..0000000 --- a/res/drawable-mdpi/ic_theme_delete.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_theme_reset.png b/res/drawable-mdpi/ic_theme_reset.png Binary files differdeleted file mode 100644 index 4d124ab..0000000 --- a/res/drawable-mdpi/ic_theme_reset.png +++ /dev/null diff --git a/res/drawable-xhdpi/ic_theme_customize.png b/res/drawable-xhdpi/ic_theme_customize.png Binary files differdeleted file mode 100644 index 8da38ea..0000000 --- a/res/drawable-xhdpi/ic_theme_customize.png +++ /dev/null diff --git a/res/drawable-xhdpi/ic_theme_delete.png b/res/drawable-xhdpi/ic_theme_delete.png Binary files differdeleted file mode 100644 index e105869..0000000 --- a/res/drawable-xhdpi/ic_theme_delete.png +++ /dev/null diff --git a/res/drawable-xhdpi/ic_theme_reset.png b/res/drawable-xhdpi/ic_theme_reset.png Binary files differdeleted file mode 100644 index 1e35a25..0000000 --- a/res/drawable-xhdpi/ic_theme_reset.png +++ /dev/null diff --git a/res/drawable-xxhdpi/ic_theme_customize.png b/res/drawable-xxhdpi/ic_theme_customize.png Binary files differdeleted file mode 100644 index 8e0db4c..0000000 --- a/res/drawable-xxhdpi/ic_theme_customize.png +++ /dev/null diff --git a/res/drawable-xxhdpi/ic_theme_delete.png b/res/drawable-xxhdpi/ic_theme_delete.png Binary files differdeleted file mode 100644 index e2eac6e..0000000 --- a/res/drawable-xxhdpi/ic_theme_delete.png +++ /dev/null diff --git a/res/drawable-xxhdpi/ic_theme_reset.png b/res/drawable-xxhdpi/ic_theme_reset.png Binary files differdeleted file mode 100644 index e8885df..0000000 --- a/res/drawable-xxhdpi/ic_theme_reset.png +++ /dev/null diff --git a/res/layout/title_card.xml b/res/layout/title_card.xml index 61efa88..0529009 100644 --- a/res/layout/title_card.xml +++ b/res/layout/title_card.xml @@ -49,13 +49,6 @@ android:textColor="@color/theme_author_text_color" android:textSize="14dp" /> </LinearLayout> - <ImageView - android:id="@+id/customize" - android:layout_width="47dp" - android:layout_height="match_parent" - android:scaleType="center" - android:src="@drawable/ic_theme_customize" - android:background="@drawable/theme_card_action_item_background"/> <ImageView android:id="@+id/overflow" @@ -65,29 +58,8 @@ android:layout_marginEnd="8dp" android:scaleType="center" android:src="@drawable/ic_overflow_dark" - android:visibility="gone" android:background="@drawable/theme_card_action_item_background"/> - <ImageView - android:id="@+id/delete" - android:layout_width="36dp" - android:layout_height="match_parent" - android:layout_marginStart="1dp" - android:layout_marginEnd="8dp" - android:scaleType="center" - android:src="@drawable/ic_theme_delete" - android:background="@drawable/theme_card_action_item_background"/> - - <ImageView - android:id="@+id/reset" - android:layout_width="36dp" - android:layout_height="match_parent" - android:layout_marginStart="1dp" - android:layout_marginEnd="8dp" - android:scaleType="center" - android:src="@drawable/ic_theme_reset" - android:visibility="gone" - android:background="@drawable/theme_card_action_item_background"/> </LinearLayout> <ProgressBar android:id="@+id/apply_progress" diff --git a/res/menu/overflow.xml b/res/menu/overflow.xml index 26353be..d03f190 100644 --- a/res/menu/overflow.xml +++ b/res/menu/overflow.xml @@ -18,12 +18,12 @@ <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:id="@+id/group_popupmenu"> + <item android:id="@+id/menu_customize" + android:title="@string/menu_customize"/> + <item android:id="@+id/menu_delete" android:title="@string/menu_delete"/> - <!-- Will be added back in once UX is available for this function - <item android:id="@+id/menu_author" - android:title="@string/menu_author_info"/> - --> + <item android:id="@+id/menu_reset" android:title="@string/menu_reset"/> </group> diff --git a/res/values/strings.xml b/res/values/strings.xml index 0850936..ecd0601 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -53,7 +53,7 @@ <string name="ringtone_label">Ringtone</string> <!-- Overflow menu --> - <string name="menu_author_info">Author</string> + <string name="menu_customize">Customize</string> <string name="menu_delete">Delete</string> <string name="menu_reset">Reset theme</string> 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; |