From dd6c992943a139ce277768b5715e276cfa974f91 Mon Sep 17 00:00:00 2001 From: Gilles Debunne Date: Mon, 25 Oct 2010 11:23:41 -0700 Subject: Made Launcher and AllApps use the new Tabs holo theme. Style temp settings removed, now provided by default: https://android-git.corp.google.com/g/#change,76118 Hacks to focus first tab removed as it has been fixed in: https://android-git.corp.google.com/g/#change,75393 Bug 3008765 Change-Id: Id9121cf3bfc3be08380bec1a45cf447b5fe96422 --- src/com/android/launcher2/AllAppsTabbed.java | 28 ++++------------------ src/com/android/launcher2/Launcher.java | 36 ++++++++++------------------ 2 files changed, 16 insertions(+), 48 deletions(-) diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java index cc6a14907..ac6484db8 100644 --- a/src/com/android/launcher2/AllAppsTabbed.java +++ b/src/com/android/launcher2/AllAppsTabbed.java @@ -16,24 +16,20 @@ package com.android.launcher2; -import java.util.ArrayList; +import com.android.launcher.R; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; -import android.animation.ValueAnimator; import android.animation.ObjectAnimator; +import android.animation.ValueAnimator; import android.content.Context; import android.content.res.Resources; -import android.graphics.Color; import android.util.AttributeSet; import android.util.Log; import android.view.View; -import android.widget.RelativeLayout; import android.widget.TabHost; -import android.widget.TabWidget; -import android.widget.TextView; -import com.android.launcher.R; +import java.util.ArrayList; /** * Implements a tabbed version of AllApps2D. @@ -86,18 +82,6 @@ public class AllAppsTabbed extends TabHost implements AllAppsView { label = mContext.getString(R.string.all_apps_tab_downloaded); addTab(newTabSpec(TAG_DOWNLOADED).setIndicator(label).setContent(contentFactory)); - // TEMP: just styling the tab widget to be a bit nicer until we get the actual - // new assets - TabWidget tabWidget = getTabWidget(); - for (int i = 0; i < tabWidget.getChildCount(); ++i) { - RelativeLayout tab = (RelativeLayout) tabWidget.getChildTabViewAt(i); - TextView text = (TextView) tab.getChildAt(1); - text.setTextSize(20.0f); - text.setPadding(20, 0, 20, 0); - text.setShadowLayer(1.0f, 0.0f, 1.0f, Color.BLACK); - tab.setBackgroundDrawable(null); - } - setOnTabChangedListener(new OnTabChangeListener() { public void onTabChanged(String tabId) { // animate the changing of the tab content by fading pages in and out @@ -106,6 +90,7 @@ public class AllAppsTabbed extends TabHost implements AllAppsView { ValueAnimator alphaAnim = ObjectAnimator.ofFloat(mAllApps, "alpha", alpha, 0.0f). setDuration(duration); alphaAnim.addListener(new AnimatorListenerAdapter() { + @Override public void onAnimationEnd(Animator animation) { String tag = getCurrentTabTag(); if (tag == TAG_ALL) { @@ -127,11 +112,6 @@ public class AllAppsTabbed extends TabHost implements AllAppsView { } }); - // TEMP: Working around a bug in tab host where the current tab does not initially have a - // highlight on it by selecting something else, then selecting the actual tab we want.. - setCurrentTab(1); - setCurrentTab(0); - // It needs to be INVISIBLE so that it will be measured in the layout. // Otherwise the animations is messed up when we show it for the first time. setVisibility(INVISIBLE); diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index baec7e3f4..9eddbf206 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -17,15 +17,15 @@ package com.android.launcher2; -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.ValueAnimator; import com.android.common.Search; import com.android.launcher.R; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; -import android.animation.AnimatorSet; +import android.animation.ValueAnimator; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; @@ -53,7 +53,6 @@ import android.content.res.TypedArray; import android.database.ContentObserver; import android.graphics.Bitmap; import android.graphics.Canvas; -import android.graphics.Color; import android.graphics.Rect; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; @@ -90,11 +89,9 @@ import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.PopupWindow; -import android.widget.RelativeLayout; import android.widget.TabHost; import android.widget.TabHost.OnTabChangeListener; import android.widget.TabHost.TabContentFactory; -import android.widget.TabWidget; import android.widget.TextView; import android.widget.Toast; @@ -301,18 +298,6 @@ public final class Launcher extends Activity mHomeCustomizationDrawer.addTab(mHomeCustomizationDrawer.newTabSpec(SHORTCUTS_TAG) .setIndicator(shortcutsLabel).setContent(contentFactory)); - // TEMP: just styling the tab widget to be a bit nicer until we get the actual - // new assets - TabWidget tabWidget = mHomeCustomizationDrawer.getTabWidget(); - for (int i = 0; i < tabWidget.getChildCount(); ++i) { - RelativeLayout tab = (RelativeLayout) tabWidget.getChildTabViewAt(i); - TextView text = (TextView) tab.getChildAt(1); - text.setTextSize(20.0f); - text.setPadding(20, 0, 20, 0); - text.setShadowLayer(1.0f, 0.0f, 1.0f, Color.BLACK); - tab.setBackgroundDrawable(null); - } - mHomeCustomizationDrawer.setOnTabChangedListener(new OnTabChangeListener() { public void onTabChanged(String tabId) { // animate the changing of the tab content by fading pages in and out @@ -322,6 +307,7 @@ public final class Launcher extends Activity "alpha", alpha, 0.0f); alphaAnim.setDuration(duration); alphaAnim.addListener(new AnimatorListenerAdapter() { + @Override public void onAnimationEnd(Animator animation) { String tag = mHomeCustomizationDrawer.getCurrentTabTag(); if (tag == WIDGETS_TAG) { @@ -351,11 +337,6 @@ public final class Launcher extends Activity alphaAnim.start(); } }); - - // TEMP: Working around a bug in tab host where the current tab does not initially have - // a highlight on it by selecting something else, then selecting the actual tab we want.. - mHomeCustomizationDrawer.setCurrentTab(1); - mHomeCustomizationDrawer.setCurrentTab(0); } setupViews(); @@ -424,6 +405,7 @@ public final class Launcher extends Activity final LocaleConfiguration localeConfiguration = sLocaleConfiguration; new Thread("WriteLocaleConfiguration") { + @Override public void run() { writeConfiguration(Launcher.this, localeConfiguration); } @@ -2306,9 +2288,11 @@ public final class Launcher extends Activity Animator anim = ObjectAnimator.ofFloat(view, "alpha", show ? 1.0f : 0.0f); anim.setDuration(duration); anim.addListener(new AnimatorListenerAdapter() { + @Override public void onAnimationStart(Animator animation) { if (showing) showToolbarButton(view); } + @Override public void onAnimationEnd(Animator animation) { if (hiding) hideToolbarButton(view); } @@ -2409,6 +2393,7 @@ public final class Launcher extends Activity scaleAnim.setDuration(duration); scaleAnim.setInterpolator(new DecelerateInterpolator()); scaleAnim.addListener(new AnimatorListenerAdapter() { + @Override public void onAnimationStart(Animator animation) { // Prepare the position toView.setTranslationX(0.0f); @@ -2472,6 +2457,7 @@ public final class Launcher extends Activity scaleAnim.setDuration(duration); scaleAnim.setInterpolator(new AccelerateInterpolator()); mStateAnimation.addListener(new AnimatorListenerAdapter() { + @Override public void onAnimationEnd(Animator animation) { fromView.setVisibility(View.GONE); fromView.setScaleX(1.0f); @@ -2531,10 +2517,12 @@ public final class Launcher extends Activity if (mStateAnimation != null) mStateAnimation.cancel(); mStateAnimation = new AnimatorSet(); mStateAnimation.addListener(new AnimatorListenerAdapter() { + @Override public void onAnimationStart(Animator animation) { toView.setVisibility(View.VISIBLE); toView.setY(toViewStartY); } + @Override public void onAnimationEnd(Animator animation) { fromView.setVisibility(View.GONE); } -- cgit v1.2.3