From d784b52040dc1d688b5f98c186038ab188669040 Mon Sep 17 00:00:00 2001 From: Raj Yengisetty Date: Mon, 10 Nov 2014 10:35:00 -0800 Subject: Customizeable Dynamic Grid: - Presets - Comfortable (+0) - Cozy (+1) - Condensed (+2) - Custom option with min, max Reordering items in the settings pane for better organization Modifying Settings Layout for readability Conflicts: res/layout/settings_pane_list_item.xml res/values/cm_strings.xml src/com/android/launcher3/DeviceProfile.java src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java Change-Id: I5c926b6ca4b2ed73c263ef34eeb368caeb7af9b5 --- src/com/android/launcher3/Launcher.java | 49 +++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'src/com/android/launcher3/Launcher.java') diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index c4311bcdb..3cf032e53 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -274,6 +274,7 @@ public class Launcher extends Activity private DragController mDragController; private View mWeightWatcher; private TransitionEffectsFragment mTransitionEffectsFragment; + private DynamicGridSizeFragment mDynamicGridSizeFragment; private LauncherClings mLauncherClings; protected HiddenFolderFragment mHiddenFolderFragment; @@ -1144,6 +1145,12 @@ public class Launcher extends Activity if (f != null) { mTransitionEffectsFragment.setEffect(); } + f = getFragmentManager().findFragmentByTag( + DynamicGridSizeFragment.DYNAMIC_GRID_SIZE_FRAGMENT); + if (f != null) { + mDynamicGridSizeFragment.setSize(); + mWorkspace.hideOutlines(); + } Fragment f1 = getFragmentManager().findFragmentByTag( HiddenFolderFragment.HIDDEN_FOLDER_FRAGMENT); if (f1 != null && !mHiddenFolderAuth) { @@ -1250,6 +1257,38 @@ public class Launcher extends Activity popupMenu.show(); } + public void onClickDynamicGridSizeButton() { + FragmentManager fragmentManager = getFragmentManager(); + FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + + mDynamicGridSizeFragment = new DynamicGridSizeFragment(); + fragmentTransaction.replace(R.id.launcher, mDynamicGridSizeFragment, + DynamicGridSizeFragment.DYNAMIC_GRID_SIZE_FRAGMENT); + fragmentTransaction.commit(); + } + + public void setDynamicGridSize(DeviceProfile.GridSize size) { + SettingsProvider.putInt(this, + SettingsProvider.SETTINGS_UI_DYNAMIC_GRID_SIZE, size.getValue()); + + updateDynamicGrid(); + + mOverviewSettingsPanel.notifyDataSetInvalidated(); + + FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); + fragmentTransaction + .setCustomAnimations(0, R.anim.exit_out_right); + fragmentTransaction + .remove(mDynamicGridSizeFragment).commit(); + + mDarkPanel.setVisibility(View.VISIBLE); + ObjectAnimator anim = ObjectAnimator.ofFloat( + mDarkPanel, "alpha", 0.3f, 0.0f); + anim.start(); + anim.addListener(mAnimatorListener); + + } + public void onClickTransitionEffectButton(View v, final boolean pageOrDrawer) { Bundle bundle = new Bundle(); bundle.putBoolean(TransitionEffectsFragment.PAGE_OR_DRAWER_SCROLL_SELECT, @@ -1257,7 +1296,6 @@ public class Launcher extends Activity FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); - mTransitionEffectsFragment = new TransitionEffectsFragment(); mTransitionEffectsFragment.setArguments(bundle); fragmentTransaction.setCustomAnimations(0, 0); @@ -1279,11 +1317,6 @@ public class Launcher extends Activity newTransitionEffect).commit(); TransitionEffect.setFromString(pagedView, newTransitionEffect); - // Reset Settings Changed - SharedPreferences.Editor editor = mSharedPrefs.edit(); - editor.putBoolean(SettingsProvider.SETTINGS_CHANGED, false); - editor.commit(); - mOverviewSettingsPanel.notifyDataSetInvalidated(); FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); @@ -2623,8 +2656,12 @@ public class Launcher extends Activity } else if (mWorkspace.isInOverviewMode()) { Fragment f = getFragmentManager().findFragmentByTag( TransitionEffectsFragment.TRANSITION_EFFECTS_FRAGMENT); + Fragment f2 = getFragmentManager().findFragmentByTag( + DynamicGridSizeFragment.DYNAMIC_GRID_SIZE_FRAGMENT); if (f != null) { mTransitionEffectsFragment.setEffect(); + } else if (f2 != null) { + mDynamicGridSizeFragment.setSize(); } else { mWorkspace.exitOverviewMode(true); } -- cgit v1.2.3