diff options
author | Winson Chung <winsonc@google.com> | 2011-07-06 20:41:23 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2011-07-07 14:10:47 -0700 |
commit | 649723cfb3d73af16dd02462725700897ca60e38 (patch) | |
tree | c270e40a9c6e0d155a21ea8f13f56607de8077fe /src | |
parent | c07918d0053fc7d2a19d7b013565a5d2e7d4af51 (diff) | |
download | android_packages_apps_Trebuchet-649723cfb3d73af16dd02462725700897ca60e38.tar.gz android_packages_apps_Trebuchet-649723cfb3d73af16dd02462725700897ca60e38.tar.bz2 android_packages_apps_Trebuchet-649723cfb3d73af16dd02462725700897ca60e38.zip |
Updating assets.
- Tweaking search bar layout.
Change-Id: I9624fa4284135858d3e19b8b8e4710b5dd746042
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/AppsCustomizePagedView.java | 5 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 12 | ||||
-rw-r--r-- | src/com/android/launcher2/PagedView.java | 41 |
3 files changed, 25 insertions, 33 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java index e55a55c75..888d3d38c 100644 --- a/src/com/android/launcher2/AppsCustomizePagedView.java +++ b/src/com/android/launcher2/AppsCustomizePagedView.java @@ -1179,11 +1179,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen // should stop this now. } - @Override - protected int getPageWidthForScrollingIndicator() { - return getPageContentWidth(); - } - /* * We load an extra page on each side to prevent flashes from scrolling and loading of the * widget previews in the background with the AsyncTasks. diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 0c052a758..5c9e4dd76 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -2748,12 +2748,12 @@ public final class Launcher extends Activity ComponentName activityName = searchManager.getGlobalSearchActivity(); if (activityName != null) { sGlobalSearchIcon = updateButtonWithIconFromExternalActivity( - R.id.search_button, activityName, R.drawable.ic_generic_search); + R.id.search_button, activityName, R.drawable.ic_search_normal_holo); searchButton.setVisibility(View.VISIBLE); - searchDivider.setVisibility(View.VISIBLE); + if (searchDivider != null) searchDivider.setVisibility(View.VISIBLE); } else { searchButton.setVisibility(View.GONE); - searchDivider.setVisibility(View.GONE); + if (searchDivider != null) searchDivider.setVisibility(View.GONE); } } @@ -2769,11 +2769,11 @@ public final class Launcher extends Activity ComponentName activityName = intent.resolveActivity(getPackageManager()); if (activityName != null) { sVoiceSearchIcon = updateButtonWithIconFromExternalActivity( - R.id.voice_button, activityName, R.drawable.ic_voice_search); - searchDivider.setVisibility(View.VISIBLE); + R.id.voice_button, activityName, R.drawable.ic_voice_search_holo); + if (searchDivider != null) searchDivider.setVisibility(View.VISIBLE); voiceButton.setVisibility(View.VISIBLE); } else { - searchDivider.setVisibility(View.GONE); + if (searchDivider != null) searchDivider.setVisibility(View.GONE); voiceButton.setVisibility(View.GONE); } } diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index a90d32fbf..81e876fdb 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -1641,7 +1641,7 @@ public abstract class PagedView extends ViewGroup { } protected boolean isScrollingIndicatorEnabled() { - return true; + return !LauncherApplication.isScreenLarge(); } protected void flashScrollingIndicator() { @@ -1655,7 +1655,6 @@ public abstract class PagedView extends ViewGroup { } protected void showScrollingIndicator() { - if (LauncherApplication.isScreenLarge()) return; if (getChildCount() <= 1) return; if (!isScrollingIndicatorEnabled()) return; @@ -1668,7 +1667,6 @@ public abstract class PagedView extends ViewGroup { } protected void hideScrollingIndicator(boolean immediately) { - if (LauncherApplication.isScreenLarge()) return; if (getChildCount() <= 1) return; if (!isScrollingIndicatorEnabled()) return; @@ -1682,7 +1680,6 @@ public abstract class PagedView extends ViewGroup { } private void updateScrollingIndicator() { - if (LauncherApplication.isScreenLarge()) return; if (getChildCount() <= 1) return; if (!isScrollingIndicatorEnabled()) return; @@ -1692,19 +1689,19 @@ public abstract class PagedView extends ViewGroup { } } - protected int getPageWidthForScrollingIndicator() { - return getMeasuredWidth(); - } - private void updateScrollingIndicatorPosition() { + if (!isScrollingIndicatorEnabled()) return; + // We can make the page width smaller to make it look more centered - int pageWidth = getPageWidthForScrollingIndicator(); - int pageOffset = (getMeasuredWidth() - pageWidth) / 2; - int maxPageWidth = getChildCount() * pageWidth; + getScrollingIndicatorTrack(); + int pageWidth = mScrollTrack.getMeasuredWidth() - mScrollTrack.getPaddingLeft() - + mScrollTrack.getPaddingRight(); + int maxPageWidth = getChildCount() * getMeasuredWidth(); float offset = (float) getScrollX() / maxPageWidth; int indicatorWidth = pageWidth / getChildCount(); int indicatorCenterOffset = indicatorWidth / 2 - mScrollIndicator.getMeasuredWidth() / 2; - int indicatorPos = (int) (offset * pageWidth) + pageOffset + indicatorCenterOffset; + int indicatorPos = (int) (offset * pageWidth) + mScrollTrack.getPaddingLeft() + + indicatorCenterOffset; mScrollIndicator.setTranslationX(indicatorPos); mScrollIndicator.invalidate(); } @@ -1718,20 +1715,20 @@ public abstract class PagedView extends ViewGroup { } public void showScrollIndicatorTrack() { - if (!LauncherApplication.isScreenLarge()) { - getScrollingIndicatorTrack(); - if (mScrollTrack != null) { - mScrollTrack.setVisibility(View.VISIBLE); - } + if (!isScrollingIndicatorEnabled()) return; + + getScrollingIndicatorTrack(); + if (mScrollTrack != null) { + mScrollTrack.setVisibility(View.VISIBLE); } } public void hideScrollIndicatorTrack() { - if (!LauncherApplication.isScreenLarge()) { - getScrollingIndicatorTrack(); - if (mScrollTrack != null) { - mScrollTrack.setVisibility(View.GONE); - } + if (!isScrollingIndicatorEnabled()) return; + + getScrollingIndicatorTrack(); + if (mScrollTrack != null) { + mScrollTrack.setVisibility(View.GONE); } } |