summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaj Yengisetty <rajesh@cyngn.com>2014-11-10 18:35:01 (GMT)
committerAdnan <adnan@cyngn.com>2014-11-19 23:53:57 (GMT)
commit506b0b660d7e8ee198c5f1052191bfea8968addf (patch)
tree3b1251d161ad25a24fe12a8588933ab7e5c1f6b8
parent38971be4230e2b33daf15be37822f70f81dfe81c (diff)
downloadandroid_packages_apps_Trebuchet-506b0b660d7e8ee198c5f1052191bfea8968addf.zip
android_packages_apps_Trebuchet-506b0b660d7e8ee198c5f1052191bfea8968addf.tar.gz
android_packages_apps_Trebuchet-506b0b660d7e8ee198c5f1052191bfea8968addf.tar.bz2
Minimize greedy UI updating for Live Settings
Conflicts: src/com/android/launcher3/Launcher.java src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java Change-Id: Ib475af4bea7d45e36ca87be6b66a60d15018aa5b
-rw-r--r--src/com/android/launcher3/Launcher.java44
-rw-r--r--src/com/android/launcher3/OverviewSettingsPanel.java7
-rw-r--r--src/com/android/launcher3/Workspace.java8
-rw-r--r--src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java14
4 files changed, 53 insertions, 20 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 3cf032e..c3f357c 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -315,6 +315,8 @@ public class Launcher extends Activity
private boolean mWorkspaceLoading = true;
+ private boolean mDynamicGridUpdateRequired = false;
+
private boolean mPaused = true;
private boolean mRestoring;
private boolean mWaitingForResult;
@@ -435,8 +437,6 @@ public class Launcher extends Activity
public void onReceive(Context context, Intent intent) {
// Update the workspace
updateDynamicGrid();
- mWorkspace.hideOutlines();
- mSearchDropTargetBar.showSearchBar(false);
}
};
@@ -1052,6 +1052,13 @@ public class Launcher extends Activity
}
super.onResume();
+
+ updateGridIfNeeded();
+
+ if(isGelIntegrationEnabled() && isGelIntegrationSupported()) {
+ GelIntegrationHelper.getInstance().handleGelResume();
+ }
+
// Restore the previous launcher state
if (mOnResumeState == State.WORKSPACE) {
showWorkspace(false);
@@ -1179,9 +1186,6 @@ public class Launcher extends Activity
if (mWorkspace.getCustomContentCallbacks() != null) {
mWorkspace.getCustomContentCallbacks().onHide();
}
-
- //Reset the OverviewPanel position
- ((SlidingUpPanelLayout) mOverviewPanel).collapsePane();
}
QSBScroller mQsbScroller = new QSBScroller() {
@@ -2102,6 +2106,8 @@ public class Launcher extends Activity
}
super.onNewIntent(intent);
+ updateGridIfNeeded();
+
// Close the menu
if (Intent.ACTION_MAIN.equals(intent.getAction())) {
// also will cancel mWaitingForResult.
@@ -5525,16 +5531,36 @@ public class Launcher extends Activity
}
public void updateDynamicGrid() {
- mSearchDropTargetBar.setupQSB(this);
- mSearchDropTargetBar.hideSearchBar(false);
+ mSearchDropTargetBar.setupQSB(Launcher.this);
initializeDynamicGrid();
- mGrid.layout(this);
- mWorkspace.showOutlines();
+ mGrid.layout(Launcher.this);
// Synchronized reload
mModel.startLoader(true, mWorkspace.getCurrentPage());
+ mWorkspace.updateCustomContentVisibility();
+
+ }
+
+ public void setUpdateDynamicGrid() {
+ mDynamicGridUpdateRequired = true;
+ }
+
+ public boolean updateGridIfNeeded() {
+ if (mDynamicGridUpdateRequired) {
+ updateDynamicGrid();
+ mDynamicGridUpdateRequired = false;
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean isSearchBarEnabled() {
+ return SettingsProvider.getBoolean(this,
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_SEARCH,
+ R.bool.preferences_interface_homescreen_search_default);
}
}
diff --git a/src/com/android/launcher3/OverviewSettingsPanel.java b/src/com/android/launcher3/OverviewSettingsPanel.java
index f943083..91f7f0d 100644
--- a/src/com/android/launcher3/OverviewSettingsPanel.java
+++ b/src/com/android/launcher3/OverviewSettingsPanel.java
@@ -179,8 +179,6 @@ public class OverviewSettingsPanel {
((SlidingUpPanelLayout) mOverviewPanel).setPanelHeight(isAllAppsVisible ?
res.getDimensionPixelSize(R.dimen.settings_pane_handle)
: res.getDimensionPixelSize(R.dimen.sliding_panel_padding));
-
- ((SlidingUpPanelLayout) mOverviewPanel).collapsePane();
}
public void notifyDataSetInvalidated() {
@@ -202,6 +200,11 @@ public class OverviewSettingsPanel {
AnimationDrawable frameAnimation = (AnimationDrawable) mAnimatedArrow.getBackground();
frameAnimation.start();
+
+ if (mLauncher.updateGridIfNeeded()) {
+ mLauncher.getWorkspace().showOutlines();
+ mLauncher.mSearchDropTargetBar.showSearchBar(false);
+ }
}
@Override
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index f2388ce..13ee53f 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -2154,12 +2154,15 @@ public class Workspace extends SmoothPagedView
}
public void exitOverviewMode(int snapPage, boolean animated) {
+ ((SlidingUpPanelLayout) mLauncher.getOverviewPanel()).collapsePane();
+
enableOverviewMode(false, snapPage, animated);
}
private void enableOverviewMode(boolean enable, int snapPage, boolean animated) {
- //Check to see if Settings need to taken
+ // Check to see if new Settings need to taken
reloadSettings();
+ mLauncher.updateGridIfNeeded();
State finalState = Workspace.State.OVERVIEW;
if (!enable) {
@@ -2313,6 +2316,9 @@ public class Workspace extends SmoothPagedView
if (snapPage == -1) {
snapPage = getPageNearestToCenterOfScreen();
}
+ if (hasCustomContent()) {
+ snapPage = Math.max(1, snapPage);
+ }
snapToPage(snapPage, duration, mZoomInInterpolator);
for (int i = 0; i < getChildCount(); i++) {
diff --git a/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java b/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
index e4ba5da..0daf142 100644
--- a/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
+++ b/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
@@ -71,7 +71,7 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
if (title.equals(res
.getString(R.string.home_screen_search_text))) {
- boolean current = mLauncher.shouldShowSearchBar();
+ boolean current = mLauncher.isSearchBarEnabled();
String state = current ? res.getString(
R.string.setting_state_on) : res.getString(
R.string.setting_state_off);
@@ -232,7 +232,7 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
v,
SettingsProvider.SETTINGS_UI_HOMESCREEN_SEARCH,
R.bool.preferences_interface_homescreen_search_default);
- mLauncher.updateDynamicGrid();
+ mLauncher.setUpdateDynamicGrid();
} else if (value.equals(res
.getString(R.string.drawer_sorting_text))) {
onClickTransitionEffectButton();
@@ -250,7 +250,7 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
v,
SettingsProvider.SETTINGS_UI_GENERAL_ICONS_LARGE,
R.bool.preferences_interface_general_icons_large_default);
- mLauncher.updateDynamicGrid();
+ mLauncher.setUpdateDynamicGrid();
} else if (value.equals(res
.getString(R.string.icon_labels)) &&
((Integer)v.getTag() == OverviewSettingsPanel.HOME_SETTINGS_POSITION)) {
@@ -258,7 +258,7 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
v,
SettingsProvider.SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS,
R.bool.preferences_interface_homescreen_hide_icon_labels_default);
- mLauncher.updateDynamicGrid();
+ mLauncher.setUpdateDynamicGrid();
} else if (value.equals(res
.getString(R.string.icon_labels)) &&
((Integer)v.getTag() == OverviewSettingsPanel.DRAWER_SETTINGS_POSITION)) {
@@ -266,21 +266,19 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
v,
SettingsProvider.SETTINGS_UI_DRAWER_HIDE_ICON_LABELS,
R.bool.preferences_interface_drawer_hide_icon_labels_default);
- mLauncher.updateDynamicGrid();
+ mLauncher.setUpdateDynamicGrid();
} else if (value.equals(res.getString(R.string.protected_app_settings))) {
Intent intent = new Intent();
intent.setClassName(OverviewSettingsPanel.ANDROID_SETTINGS,
OverviewSettingsPanel.ANDROID_PROTECTED_APPS);
mLauncher.startActivity(intent);
- } else if (value.equals(res.getString(R.string.protected_app_settings))) {
-
} else if (value.equals(res
.getString(R.string.scrolling_wallpaper))) {
onSettingsBooleanChanged(
v,
SettingsProvider.SETTINGS_UI_HOMESCREEN_SCROLLING_WALLPAPER_SCROLL,
R.bool.preferences_interface_homescreen_scrolling_wallpaper_scroll_default);
- mLauncher.updateDynamicGrid();
+ mLauncher.setUpdateDynamicGrid();
} else if (value.equals(res
.getString(R.string.grid_size_text))) {
mLauncher.onClickDynamicGridSizeButton();