diff options
author | cretin45 <cretin45@gmail.com> | 2015-11-30 16:38:47 -0800 |
---|---|---|
committer | cretin45 <cretin45@gmail.com> | 2015-12-03 16:44:28 -0800 |
commit | ecfa0ff337cf2feae19e651470c1ca05926430f2 (patch) | |
tree | 3ed466a564f64ba259b9ec50b72e79bb27e87263 /src/com/android/launcher3/allapps | |
parent | 4cc0018c15a8cf2ab58f00929de6a5bd034ddb86 (diff) | |
download | android_packages_apps_Trebuchet-ecfa0ff337cf2feae19e651470c1ca05926430f2.tar.gz android_packages_apps_Trebuchet-ecfa0ff337cf2feae19e651470c1ca05926430f2.tar.bz2 android_packages_apps_Trebuchet-ecfa0ff337cf2feae19e651470c1ca05926430f2.zip |
Trebuchet: Add app drawer settings
Change-Id: I040420608de64bedc6e9832268796cdf801f5c21
Diffstat (limited to 'src/com/android/launcher3/allapps')
-rw-r--r-- | src/com/android/launcher3/allapps/AllAppsContainerView.java | 39 | ||||
-rw-r--r-- | src/com/android/launcher3/allapps/AllAppsGridAdapter.java | 8 |
2 files changed, 28 insertions, 19 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 0a94be766..b82cd2d0a 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -48,6 +48,7 @@ import com.android.launcher3.LauncherTransitionable; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.Workspace; +import com.android.launcher3.settings.SettingsProvider; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.Thunk; @@ -189,12 +190,9 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc Resources res = context.getResources(); mLauncher = (Launcher) context; - mSectionNamesMargin = mSectionStrategy == SECTION_STRATEGY_GRID ? - res.getDimensionPixelSize(R.dimen.all_apps_grid_view_start_margin) : - res.getDimensionPixelSize(R.dimen.all_apps_grid_view_start_margin_with_sections); mApps = new AlphabeticalAppsList(context); mAdapter = new AllAppsGridAdapter(mLauncher, mApps, this, mLauncher, - this, mSectionStrategy, mGridTheme); + this); mApps.setAdapter(mAdapter); mLayoutManager = mAdapter.getLayoutManager(); mItemDecoration = mAdapter.getItemDecoration(); @@ -254,23 +252,35 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc } private void updateScrubber() { - if (userScrubber()) { + if (useScrubber()) { mScrubber.updateSections(); } } - public void setSectionStrategy(int sectionStrategy) { - Resources res = getResources(); - mSectionStrategy = sectionStrategy; - mSectionNamesMargin = mSectionStrategy == SECTION_STRATEGY_GRID ? + public List<AppInfo> getApps() { + return mApps.getApps(); + } + + private void updateSectionStrategy() { + Context context = getContext(); + Resources res = context.getResources(); + boolean useCompactGrid = SettingsProvider.getBoolean(context, + SettingsProvider.SETTINGS_UI_DRAWER_STYLE_USE_COMPACT, + R.bool.preferences_interface_drawer_compact_default); + mSectionStrategy = useCompactGrid ? SECTION_STRATEGY_GRID : SECTION_STRATEGY_RAGGED; + mSectionNamesMargin = useCompactGrid ? res.getDimensionPixelSize(R.dimen.all_apps_grid_view_start_margin) : res.getDimensionPixelSize(R.dimen.all_apps_grid_view_start_margin_with_sections); mAdapter.setSectionStrategy(mSectionStrategy); mAppsRecyclerView.setSectionStrategy(mSectionStrategy); } - public void setGridTheme(int gridTheme) { - mGridTheme = gridTheme; + private void updateGridTheme() { + Context context = getContext(); + boolean useDarkColor= SettingsProvider.getBoolean(context, + SettingsProvider.SETTINGS_UI_DRAWER_DARK, + R.bool.preferences_interface_drawer_dark_default); + mGridTheme = useDarkColor ? GRID_THEME_DARK : GRID_THEME_LIGHT; mAdapter.setGridTheme(mGridTheme); updateBackgroundAndPaddings(true); } @@ -365,14 +375,15 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc // Load the all apps recycler view mAppsRecyclerView = (AllAppsRecyclerView) findViewById(R.id.apps_list_view); mAppsRecyclerView.setApps(mApps); - mAppsRecyclerView.setSectionStrategy(mSectionStrategy); mAppsRecyclerView.setLayoutManager(mLayoutManager); mAppsRecyclerView.setAdapter(mAdapter); mAppsRecyclerView.setHasFixedSize(true); if (mItemDecoration != null) { mAppsRecyclerView.addItemDecoration(mItemDecoration); } - + setScroller(); + updateGridTheme(); + updateSectionStrategy(); updateBackgroundAndPaddings(); } @@ -442,7 +453,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc // names) int startInset = Math.max(mSectionNamesMargin, mAppsRecyclerView.getMaxScrollbarWidth()); int topBottomPadding = mRecyclerViewTopBottomPadding; - final boolean useScubber = userScrubber(); + final boolean useScubber = useScrubber(); if (isRtl) { mAppsRecyclerView.setPadding(padding.left + mAppsRecyclerView.getMaxScrollbarWidth(), topBottomPadding, padding.right + startInset, useScubber ? diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java index 17d106731..a736f7770 100644 --- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java +++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java @@ -361,7 +361,7 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter. public AllAppsGridAdapter(Launcher launcher, AlphabeticalAppsList apps, View.OnTouchListener touchListener, View.OnClickListener iconClickListener, - View.OnLongClickListener iconLongClickListener, int sectionStrategy, int gridTheme) { + View.OnLongClickListener iconLongClickListener) { Resources res = launcher.getResources(); mLauncher = launcher; mApps = apps; @@ -374,8 +374,6 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter. mTouchListener = touchListener; mIconClickListener = iconClickListener; mIconLongClickListener = iconLongClickListener; - mSectionStrategy = sectionStrategy; - mGridTheme = gridTheme; mSectionNamesMargin = mSectionStrategy == AllAppsContainerView.SECTION_STRATEGY_GRID ? res.getDimensionPixelSize(R.dimen.all_apps_grid_view_start_margin) : @@ -607,8 +605,8 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter. mSectionTextPaint.setColor(mLauncher.getResources().getColor(sectionTextColorId)); Resources res = mLauncher.getResources(); mAllAppsTextColor = mGridTheme == AllAppsContainerView.GRID_THEME_DARK ? - res.getColor(R.color.all_apps_grid_section_text_color_dark) : - res.getColor(R.color.all_apps_grid_section_text_color); + res.getColor(R.color.quantum_panel_text_color_dark) : + res.getColor(R.color.quantum_panel_text_color); } /** |