summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Herndl <martin.herndl@gmail.com>2015-12-17 17:08:27 +0100
committerTom Powell <zifnab@zifnab06.net>2017-03-26 15:52:43 -0700
commit46ff6d3c1da73a685614279f7c25402ea72b1fd1 (patch)
tree740282290256519348d88f1612010c9f6199ed9f
parent28dc0daf4223227006a37805bd463bcbc2f33ff3 (diff)
downloadandroid_packages_apps_Trebuchet-46ff6d3c1da73a685614279f7c25402ea72b1fd1.zip
android_packages_apps_Trebuchet-46ff6d3c1da73a685614279f7c25402ea72b1fd1.tar.gz
android_packages_apps_Trebuchet-46ff6d3c1da73a685614279f7c25402ea72b1fd1.tar.bz2
Trebuchet: Add ability to disable the scroller completely
This change adds another toggle to the drawer settings which disables the app drawer scroller completely. There is already a setting which toggles between horizontal and vertical scroller, but I like my drawer if it's even cleaner and uses no scroller at all. Change-Id: Iad3efdafee264852f52e728341fd86d60452b05b
-rw-r--r--res/values/cm_strings.xml3
-rw-r--r--res/values/preferences_defaults.xml1
-rw-r--r--src/com/android/launcher3/BaseContainerView.java19
-rw-r--r--src/com/android/launcher3/OverviewSettingsPanel.java1
-rw-r--r--src/com/android/launcher3/allapps/AllAppsContainerView.java27
-rw-r--r--src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java20
-rw-r--r--src/com/android/launcher3/settings/SettingsProvider.java3
-rw-r--r--src/com/android/launcher3/widget/WidgetsContainerView.java23
8 files changed, 60 insertions, 37 deletions
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 7a2b84a..8d3527e 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -67,7 +67,8 @@
<string name="app_drawer_color">Drawer color</string>
<string name="app_drawer_color_dark">Dark</string>
<string name="app_drawer_color_light">Light</string>
- <string name="fast_scroller_type">Fast scroller</string>
+ <string name="fast_scroller">Fast scroller</string>
+ <string name="fast_scroller_type">Fast scroller type</string>
<string name="fast_scroller_type_horizontal">Horizontal</string>
<string name="fast_scroller_type_vertical">Vertical</string>
diff --git a/res/values/preferences_defaults.xml b/res/values/preferences_defaults.xml
index 23439c5..4413e7b 100644
--- a/res/values/preferences_defaults.xml
+++ b/res/values/preferences_defaults.xml
@@ -7,6 +7,7 @@
<bool name="preferences_interface_drawer_compact_default">false</bool>
<bool name="preferences_interface_drawer_dark_default">true</bool>
<bool name="preferences_interface_general_icons_large_default">false</bool>
+ <bool name="preferences_interface_use_scroller_default">true</bool>
<bool name="preferences_interface_use_horizontal_scrubber_default">true</bool>
<bool name="preferences_interface_drawer_search_default">true</bool>
</resources>
diff --git a/src/com/android/launcher3/BaseContainerView.java b/src/com/android/launcher3/BaseContainerView.java
index e4ca29c..dfc2d7b 100644
--- a/src/com/android/launcher3/BaseContainerView.java
+++ b/src/com/android/launcher3/BaseContainerView.java
@@ -49,6 +49,7 @@ public abstract class BaseContainerView extends LinearLayout implements Insettab
// The inset to apply to the edges and between the search bar and the container
private int mContainerBoundsInset;
private boolean mHasSearchBar;
+ private boolean mUseScroller;
private boolean mUseScrubber;
protected View mScrubberContainerView;
@@ -65,7 +66,8 @@ public abstract class BaseContainerView extends LinearLayout implements Insettab
public BaseContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
- mContainerBoundsInset = getResources().getDimensionPixelSize(R.dimen.container_bounds_inset);
+ mContainerBoundsInset = getResources().getDimensionPixelSize(
+ R.dimen.container_bounds_inset);
mScrubberHeight = getResources().getDimensionPixelSize(R.dimen.scrubber_height);
}
@@ -105,11 +107,14 @@ public abstract class BaseContainerView extends LinearLayout implements Insettab
public final void setScroller() {
Context context = getContext();
- boolean useHorizontalScroller= SettingsProvider.getBoolean(context,
+ mUseScroller = SettingsProvider.getBoolean(context,
+ SettingsProvider.SETTINGS_UI_USE_SCROLLER,
+ R.bool.preferences_interface_use_scroller_default);
+ mUseScrubber = SettingsProvider.getBoolean(context,
SettingsProvider.SETTINGS_UI_USE_HORIZONTAL_SCRUBBER,
R.bool.preferences_interface_use_horizontal_scrubber_default);
- mUseScrubber = useHorizontalScroller;
- if (mUseScrubber) {
+
+ if (mUseScroller && mUseScrubber) {
ViewStub stub = (ViewStub) findViewById(R.id.scrubber_container_stub);
mScrubberContainerView = stub.inflate();
if (mScrubberContainerView == null) {
@@ -130,11 +135,15 @@ public abstract class BaseContainerView extends LinearLayout implements Insettab
removeView(mScrubberContainerView);
BaseRecyclerView recyclerView = getRecyclerView();
if (recyclerView != null) {
- recyclerView.setUseScrollbar(true);
+ recyclerView.setUseScrollbar(mUseScroller);
}
}
}
+ public final boolean useScroller() {
+ return mUseScroller;
+ }
+
public final boolean useScrubber() {
return mUseScrubber;
}
diff --git a/src/com/android/launcher3/OverviewSettingsPanel.java b/src/com/android/launcher3/OverviewSettingsPanel.java
index 3e465d3..d912eef 100644
--- a/src/com/android/launcher3/OverviewSettingsPanel.java
+++ b/src/com/android/launcher3/OverviewSettingsPanel.java
@@ -45,6 +45,7 @@ public class OverviewSettingsPanel {
res.getString(R.string.icon_labels),
res.getString(R.string.app_drawer_style),
res.getString(R.string.app_drawer_color),
+ res.getString(R.string.fast_scroller),
res.getString(R.string.fast_scroller_type),
res.getString(R.string.home_screen_search_text)};
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index feb96df..5434e72 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -89,7 +89,8 @@ final class SimpleSectionMergeAlgorithm implements AlphabeticalAppsList.MergeAlg
private int mMaxAllowableMerges;
private CharsetEncoder mAsciiEncoder;
- public SimpleSectionMergeAlgorithm(int minAppsPerRow, int minRowsInMergedSection, int maxNumMerges) {
+ public SimpleSectionMergeAlgorithm(int minAppsPerRow, int minRowsInMergedSection,
+ int maxNumMerges) {
mMinAppsPerRow = minAppsPerRow;
mMinRowsInMergedSection = minRowsInMergedSection;
mMaxAllowableMerges = maxNumMerges;
@@ -252,7 +253,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
}
private void updateScrubber() {
- if (useScrubber()) {
+ if (useScroller() && useScrubber()) {
mScrubber.updateSections();
}
}
@@ -458,21 +459,20 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
// names)
int startInset = Math.max(mSectionNamesMargin, mAppsRecyclerView.getMaxScrollbarWidth());
int topBottomPadding = mRecyclerViewTopBottomPadding;
- final boolean useScubber = useScrubber();
+ final boolean useScrollerScrubber = useScroller() && useScrubber();
if (isRtl) {
mAppsRecyclerView.setPadding(padding.left + mAppsRecyclerView.getMaxScrollbarWidth(),
- topBottomPadding, padding.right + startInset, useScubber ?
- mScrubberHeight + topBottomPadding : topBottomPadding);
- if (useScubber) {
- mScrubberContainerView
- .setPadding(padding.left + mAppsRecyclerView.getMaxScrollbarWidth(),
- 0, padding.right, 0);
+ topBottomPadding, padding.right + startInset, useScrollerScrubber ?
+ mScrubberHeight + topBottomPadding : topBottomPadding);
+ if (useScrollerScrubber) {
+ mScrubberContainerView.setPadding(padding.left +
+ mAppsRecyclerView.getMaxScrollbarWidth(), 0, padding.right, 0);
}
} else {
mAppsRecyclerView.setPadding(padding.left + startInset, topBottomPadding,
- padding.right + mAppsRecyclerView.getMaxScrollbarWidth(),
- useScubber ? mScrubberHeight + topBottomPadding : topBottomPadding);
- if (useScubber) {
+ padding.right + mAppsRecyclerView.getMaxScrollbarWidth(), useScrollerScrubber ?
+ mScrubberHeight + topBottomPadding : topBottomPadding);
+ if (useScrollerScrubber) {
mScrubberContainerView.setPadding(padding.left, 0,
padding.right + mAppsRecyclerView.getMaxScrollbarWidth(), 0);
}
@@ -488,7 +488,8 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
mSearchBarContainerView.getLayoutParams();
lp.leftMargin = searchBarBounds.left - backgroundPadding.left;
lp.topMargin = searchBarBounds.top - backgroundPadding.top;
- lp.rightMargin = (getMeasuredWidth() - searchBarBounds.right) - backgroundPadding.right;
+ lp.rightMargin = (getMeasuredWidth() - searchBarBounds.right)
+ - backgroundPadding.right;
mSearchBarContainerView.requestLayout();
}
}
diff --git a/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java b/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
index 76b880e..e24dbe7 100644
--- a/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
+++ b/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
@@ -153,13 +153,19 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
break;
case 3:
current = SettingsProvider.getBoolean(mContext,
+ SettingsProvider.SETTINGS_UI_USE_SCROLLER,
+ R.bool.preferences_interface_use_scroller_default);
+ setSettingSwitch(stateView, settingSwitch, current);
+ break;
+ case 4:
+ current = SettingsProvider.getBoolean(mContext,
SettingsProvider.SETTINGS_UI_USE_HORIZONTAL_SCRUBBER,
R.bool.preferences_interface_use_horizontal_scrubber_default);
state = current ? res.getString(R.string.fast_scroller_type_horizontal)
: res.getString(R.string.fast_scroller_type_vertical);
setStateText(stateView, settingSwitch, state);
break;
- case 4:
+ case 5:
current = SettingsProvider.getBoolean(mContext,
SettingsProvider.SETTINGS_UI_DRAWER_SEARCH,
R.bool.preferences_interface_drawer_search_default);
@@ -279,14 +285,20 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
mLauncher.reloadAppDrawer();
break;
case 3:
+ onSettingsBooleanChanged(v,
+ SettingsProvider.SETTINGS_UI_USE_SCROLLER,
+ R.bool.preferences_interface_use_scroller_default);
+ mLauncher.reloadAppDrawer();
+ mLauncher.reloadWidgetView();
+ break;
+ case 4:
onScrollerTypeBooleanChanged(v,
SettingsProvider.SETTINGS_UI_USE_HORIZONTAL_SCRUBBER,
R.bool.preferences_interface_use_horizontal_scrubber_default);
mLauncher.reloadAppDrawer();
mLauncher.reloadWidgetView();
break;
- case 4:
-
+ case 5:
onSettingsBooleanChanged(v,
SettingsProvider.SETTINGS_UI_DRAWER_SEARCH,
R.bool.preferences_interface_drawer_search_default);
@@ -420,4 +432,4 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
settingSwitch.setVisibility(View.INVISIBLE);
stateView.setVisibility(View.INVISIBLE);
}
-} \ No newline at end of file
+}
diff --git a/src/com/android/launcher3/settings/SettingsProvider.java b/src/com/android/launcher3/settings/SettingsProvider.java
index 7c3a5e0..d67619c 100644
--- a/src/com/android/launcher3/settings/SettingsProvider.java
+++ b/src/com/android/launcher3/settings/SettingsProvider.java
@@ -33,8 +33,9 @@ public final class SettingsProvider {
public static final String SETTINGS_UI_DRAWER_HIDE_ICON_LABELS = "ui_drawer_hide_icon_labels";
public static final String SETTINGS_UI_DRAWER_STYLE_USE_COMPACT = "ui_drawer_style_compact";
public static final String SETTINGS_UI_DRAWER_DARK = "ui_drawer_dark";
- public static final String SETTINGS_UI_DRAWER_SEARCH = "ui_drawer_search";
+ public static final String SETTINGS_UI_USE_SCROLLER = "ui_scroller";
public static final String SETTINGS_UI_USE_HORIZONTAL_SCRUBBER = "ui_horizontal_scrubber";
+ public static final String SETTINGS_UI_DRAWER_SEARCH = "ui_drawer_search";
public static final String SETTINGS_UI_GENERAL_ICONS_LARGE = "ui_general_icons_large";
public static SharedPreferences get(Context context) {
diff --git a/src/com/android/launcher3/widget/WidgetsContainerView.java b/src/com/android/launcher3/widget/WidgetsContainerView.java
index 8bc6d59..fff60a1 100644
--- a/src/com/android/launcher3/widget/WidgetsContainerView.java
+++ b/src/com/android/launcher3/widget/WidgetsContainerView.java
@@ -125,7 +125,7 @@ public class WidgetsContainerView extends BaseContainerView
}
private void updateScrubber() {
- if (useScrubber()) {
+ if (useScroller() && useScrubber()) {
mScrubber.updateSections();
}
}
@@ -373,23 +373,20 @@ public class WidgetsContainerView extends BaseContainerView
int startInset = mView.getMaxScrollbarWidth();
int topBottomPadding = getPaddingTop();
- final boolean useScubber = useScrubber();
+ final boolean useScrollerScrubber = useScroller() && useScrubber();
if (isRtl) {
mView.setPadding(padding.left + mView.getMaxScrollbarWidth(),
- topBottomPadding, padding.right + startInset, useScubber ?
- mScrubberHeight + topBottomPadding : topBottomPadding);
- if (useScubber) {
- mScrubberContainerView
- .setPadding(padding.left,
- 0, padding.right, 0);
+ topBottomPadding, padding.right + startInset, useScrollerScrubber ?
+ mScrubberHeight + topBottomPadding : topBottomPadding);
+ if (useScrollerScrubber) {
+ mScrubberContainerView.setPadding(padding.left, 0, padding.right, 0);
}
} else {
mView.setPadding(padding.left + startInset, topBottomPadding,
- padding.right + mView.getMaxScrollbarWidth(),
- useScubber ? mScrubberHeight + topBottomPadding : topBottomPadding);
- if (useScubber) {
- mScrubberContainerView.setPadding(padding.left, 0,
- padding.right, 0);
+ padding.right + mView.getMaxScrollbarWidth(), useScrollerScrubber ?
+ mScrubberHeight + topBottomPadding : topBottomPadding);
+ if (useScrollerScrubber) {
+ mScrubberContainerView.setPadding(padding.left, 0, padding.right, 0);
mScrubberContainerView.setEnabled(true);
mScrubberContainerView.bringToFront();
}