summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaj Yengisetty <rajesh@cyngn.com>2014-07-07 21:44:16 (GMT)
committerRajesh Yengisetty <rajesh@cyngn.com>2014-07-08 01:01:39 (GMT)
commit37bab8f1d631ffbe491f1d8858b159d65f3a9afc (patch)
treea619bc46de53b0f6973beccda3fce7437552b40c
parent92921aa2f933c25f0d7bfee5f1bf506bd3a436ab (diff)
downloadandroid_packages_apps_Trebuchet-37bab8f1d631ffbe491f1d8858b159d65f3a9afc.zip
android_packages_apps_Trebuchet-37bab8f1d631ffbe491f1d8858b159d65f3a9afc.tar.gz
android_packages_apps_Trebuchet-37bab8f1d631ffbe491f1d8858b159d65f3a9afc.tar.bz2
Minimize greedy UI updating for Live Settings
Change-Id: Ib475af4bea7d45e36ca87be6b66a60d15018aa5b
-rw-r--r--src/com/android/launcher3/Launcher.java35
-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.java16
4 files changed, 44 insertions, 22 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index ab3f1da..997e28f 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -287,7 +287,7 @@ public class Launcher extends Activity
private View mAllAppsButton;
- private SearchDropTargetBar mSearchDropTargetBar;
+ protected SearchDropTargetBar mSearchDropTargetBar;
private AppsCustomizeLayout mAppsCustomizeLayout;
private AppsCustomizePagedView mAppsCustomizeContent;
private boolean mAutoAdvanceRunning = false;
@@ -306,6 +306,8 @@ public class Launcher extends Activity
private boolean mWorkspaceLoading = true;
+ private boolean mDynamicGridUpdateRequired = false;
+
private boolean mPaused = true;
private boolean mRestoring;
private boolean mWaitingForResult;
@@ -427,8 +429,6 @@ public class Launcher extends Activity
public void onReceive(Context context, Intent intent) {
// Update the workspace
updateDynamicGrid();
- mWorkspace.hideOutlines();
- mSearchDropTargetBar.showSearchBar(false);
}
};
@@ -1060,6 +1060,9 @@ public class Launcher extends Activity
}
super.onResume();
+
+ updateGridIfNeeded();
+
if(isGelIntegrationEnabled() && isGelIntegrationSupported()) {
GelIntegrationHelper.getInstance().handleGelResume();
}
@@ -1194,9 +1197,6 @@ public class Launcher extends Activity
if (mWorkspace.getCustomContentCallbacks() != null) {
mWorkspace.getCustomContentCallbacks().onHide();
}
-
- //Reset the OverviewPanel position
- ((SlidingUpPanelLayout) mOverviewPanel).collapsePane();
}
QSBScroller mQsbScroller = new QSBScroller() {
@@ -2116,6 +2116,8 @@ public class Launcher extends Activity
}
super.onNewIntent(intent);
+ updateGridIfNeeded();
+
// Close the menu
if (Intent.ACTION_MAIN.equals(intent.getAction())) {
// also will cancel mWaitingForResult.
@@ -4924,17 +4926,30 @@ 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() {
diff --git a/src/com/android/launcher3/OverviewSettingsPanel.java b/src/com/android/launcher3/OverviewSettingsPanel.java
index 4466c15..d7994f3 100644
--- a/src/com/android/launcher3/OverviewSettingsPanel.java
+++ b/src/com/android/launcher3/OverviewSettingsPanel.java
@@ -197,8 +197,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() {
@@ -220,6 +218,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 1fd4b1b..3464790 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -2176,12 +2176,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) {
@@ -2360,6 +2363,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 4b0d408..7fb15fc 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);
@@ -243,7 +243,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();
@@ -261,7 +261,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)) {
@@ -269,7 +269,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)) {
@@ -277,21 +277,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.search_screen_left_text)) &&
((Integer)v.getTag() == OverviewSettingsPanel.HOME_SETTINGS_POSITION)) {
@@ -312,7 +310,7 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
R.bool.preferences_interface_homescreen_search_screen_left_default);
mLauncher.restoreGelSetting();
mLauncher.getWorkspace().updatePageScrollForCustomPage(!current);
- mLauncher.updateDynamicGrid();
+ mLauncher.setUpdateDynamicGrid();
}
} else if (value.equals(res
.getString(R.string.grid_size_text))) {