Merge "Disable update logic for market button." into jb-ub-now-indigo-rose

This commit is contained in:
Winson Chung 2013-09-30 23:05:13 +00:00 committed by Android (Google) Code Review
commit f9e8640fcc
2 changed files with 48 additions and 35 deletions

View File

@ -12,7 +12,7 @@
<!-- AllApps/Customize/AppsCustomize -->
<!-- The alpha of the AppsCustomize bg in spring loaded mode -->
<integer name="config_appsCustomizeSpringLoadedBgAlpha">45</integer>
<integer name="config_appsCustomizeSpringLoadedBgAlpha">65</integer>
<integer name="config_workspaceUnshrinkTime">300</integer>
<!-- Out of 100, the percent to shrink the workspace during spring loaded mode. -->
<integer name="config_workspaceSpringLoadShrinkPercentage">80</integer>

View File

@ -281,8 +281,6 @@ public class Launcher extends Activity
private static HashMap<Long, FolderInfo> sFolders = new HashMap<Long, FolderInfo>();
private Intent mAppMarketIntent = null;
// Related to the auto-advancing of widgets
private final int ADVANCE_MSG = 1;
private final int mAdvanceInterval = 20000;
@ -301,6 +299,9 @@ public class Launcher extends Activity
private static Drawable.ConstantState[] sVoiceSearchIcon = new Drawable.ConstantState[2];
private static Drawable.ConstantState[] sAppMarketIcon = new Drawable.ConstantState[2];
private Intent mAppMarketIntent = null;
private static final boolean DISABLE_MARKET_BUTTON = true;
private Drawable mWorkspaceBackgroundDrawable;
private final ArrayList<Integer> mSynchronouslyBoundPages = new ArrayList<Integer>();
@ -513,7 +514,9 @@ public class Launcher extends Activity
int coi = getCurrentOrientationIndexForGlobalIcons();
if (sGlobalSearchIcon[coi] == null || sVoiceSearchIcon[coi] == null ||
sAppMarketIcon[coi] == null) {
updateAppMarketIcon();
if (!DISABLE_MARKET_BUTTON) {
updateAppMarketIcon();
}
searchVisible = updateGlobalSearchIcon();
voiceVisible = updateVoiceSearchIcon(searchVisible);
}
@ -525,7 +528,7 @@ public class Launcher extends Activity
updateVoiceSearchIcon(sVoiceSearchIcon[coi]);
voiceVisible = true;
}
if (sAppMarketIcon[coi] != null) {
if (!DISABLE_MARKET_BUTTON && sAppMarketIcon[coi] != null) {
updateAppMarketIcon(sAppMarketIcon[coi]);
}
if (mSearchDropTargetBar != null) {
@ -1527,7 +1530,9 @@ public class Launcher extends Activity
}
// When Launcher comes back to foreground, a different Activity might be responsible for
// the app market intent, so refresh the icon
updateAppMarketIcon();
if (!DISABLE_MARKET_BUTTON) {
updateAppMarketIcon();
}
clearTypedText();
}
}
@ -2270,10 +2275,12 @@ public class Launcher extends Activity
}
public void onClickAppMarketButton(View v) {
if (mAppMarketIntent != null) {
startActivitySafely(v, mAppMarketIntent, "app market");
} else {
Log.e(TAG, "Invalid app market intent.");
if (!DISABLE_MARKET_BUTTON) {
if (mAppMarketIntent != null) {
startActivitySafely(v, mAppMarketIntent, "app market");
} else {
Log.e(TAG, "Invalid app market intent.");
}
}
}
@ -3376,35 +3383,39 @@ public class Launcher extends Activity
* Sets the app market icon
*/
private void updateAppMarketIcon() {
final View marketButton = findViewById(R.id.market_button);
Intent intent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_APP_MARKET);
// Find the app market activity by resolving an intent.
// (If multiple app markets are installed, it will return the ResolverActivity.)
ComponentName activityName = intent.resolveActivity(getPackageManager());
if (activityName != null) {
int coi = getCurrentOrientationIndexForGlobalIcons();
mAppMarketIntent = intent;
sAppMarketIcon[coi] = updateTextButtonWithIconFromExternalActivity(
R.id.market_button, activityName, R.drawable.ic_launcher_market_holo,
TOOLBAR_ICON_METADATA_NAME);
marketButton.setVisibility(View.VISIBLE);
} else {
// We should hide and disable the view so that we don't try and restore the visibility
// of it when we swap between drag & normal states from IconDropTarget subclasses.
marketButton.setVisibility(View.GONE);
marketButton.setEnabled(false);
if (!DISABLE_MARKET_BUTTON) {
final View marketButton = findViewById(R.id.market_button);
Intent intent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_APP_MARKET);
// Find the app market activity by resolving an intent.
// (If multiple app markets are installed, it will return the ResolverActivity.)
ComponentName activityName = intent.resolveActivity(getPackageManager());
if (activityName != null) {
int coi = getCurrentOrientationIndexForGlobalIcons();
mAppMarketIntent = intent;
sAppMarketIcon[coi] = updateTextButtonWithIconFromExternalActivity(
R.id.market_button, activityName, R.drawable.ic_launcher_market_holo,
TOOLBAR_ICON_METADATA_NAME);
marketButton.setVisibility(View.VISIBLE);
} else {
// We should hide and disable the view so that we don't try and restore the visibility
// of it when we swap between drag & normal states from IconDropTarget subclasses.
marketButton.setVisibility(View.GONE);
marketButton.setEnabled(false);
}
}
}
private void updateAppMarketIcon(Drawable.ConstantState d) {
// Ensure that the new drawable we are creating has the approprate toolbar icon bounds
Resources r = getResources();
Drawable marketIconDrawable = d.newDrawable(r);
int w = r.getDimensionPixelSize(R.dimen.toolbar_external_icon_width);
int h = r.getDimensionPixelSize(R.dimen.toolbar_external_icon_height);
marketIconDrawable.setBounds(0, 0, w, h);
if (!DISABLE_MARKET_BUTTON) {
// Ensure that the new drawable we are creating has the approprate toolbar icon bounds
Resources r = getResources();
Drawable marketIconDrawable = d.newDrawable(r);
int w = r.getDimensionPixelSize(R.dimen.toolbar_external_icon_width);
int h = r.getDimensionPixelSize(R.dimen.toolbar_external_icon_height);
marketIconDrawable.setBounds(0, 0, w, h);
updateTextButtonWithDrawable(R.id.market_button, marketIconDrawable);
updateTextButtonWithDrawable(R.id.market_button, marketIconDrawable);
}
}
@Override
@ -3826,7 +3837,9 @@ public class Launcher extends Activity
// Update the market app icon as necessary (the other icons will be managed in response to
// package changes in bindSearchablesChanged()
updateAppMarketIcon();
if (!DISABLE_MARKET_BUTTON) {
updateAppMarketIcon();
}
mWorkspaceLoading = false;
if (upgradePath) {