Loading res/values/integers.xml 0 → 100644 +22 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- /* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ --> <resources> <integer name="promise_icon_alpha">127</integer> </resources> No newline at end of file res/values/strings.xml +11 −0 Original line number Diff line number Diff line Loading @@ -262,4 +262,15 @@ s --> <string name="wallpaper_button_text">Wallpapers</string> <!-- Text for settings button --> <string name="settings_button_text">Settings</string> <!-- Label on an icon that references an uninstalled package, that is going to be installed at some point. [CHAR_LIMIT=15] --> <string name="package_state_enqueued">Waiting</string> <!-- Label on an icon that references an uninstalled package, that is currently being downloaded. [CHAR_LIMIT=15] --> <string name="package_state_downloading">Downloading</string> <!-- Label on an icon that references an uninstalled package, that is currently being installed. [CHAR_LIMIT=15] --> <string name="package_state_installing">Installing</string> <!-- Label on an icon that references an uninstalled package, for which we have no information about when it might be installed. [CHAR_LIMIT=15] --> <string name="package_state_unknown">Unknown</string> <!-- Label on an icon that references an uninstalled package, for which restore from market has failed. [CHAR_LIMIT=15] --> <string name="package_state_error">Error</string> </resources> src/com/android/launcher3/BubbleTextView.java +63 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.graphics.Region; import android.graphics.Region.Op; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; import android.view.MotionEvent; import android.widget.TextView; Loading @@ -43,6 +44,10 @@ public class BubbleTextView extends TextView { static final float PADDING_H = 8.0f; static final float PADDING_V = 3.0f; private static final String TAG = "BubbleTextView"; private static final boolean DEBUG = false; private int mPrevAlpha = -1; private HolographicOutlineHelper mOutlineHelper; Loading @@ -64,6 +69,11 @@ public class BubbleTextView extends TextView { private boolean mStayPressed; private CheckLongPressHelper mLongPressHelper; private int mInstallState; private int mState; private CharSequence mDefaultText = ""; public BubbleTextView(Context context) { super(context); Loading Loading @@ -108,11 +118,14 @@ public class BubbleTextView extends TextView { LauncherAppState app = LauncherAppState.getInstance(); DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); setCompoundDrawables(null, Utilities.createIconDrawable(b), null, null); Drawable iconDrawable = Utilities.createIconDrawable(b); setCompoundDrawables(null, iconDrawable, null, null); setCompoundDrawablePadding(grid.iconDrawablePaddingPx); setText(info.title); setTag(info); if (info.isPromise()) { setState(ShortcutInfo.PACKAGE_STATE_UNKNOWN); // TODO: persist this state somewhere } } @Override Loading Loading @@ -392,4 +405,52 @@ public class BubbleTextView extends TextView { mLongPressHelper.cancelLongPress(); } public void setState(int state) { if (mState == ShortcutInfo.PACKAGE_STATE_DEFAULT && mState != state) { mDefaultText = getText(); } mState = state; applyState(); } private void applyState() { int alpha = getResources().getInteger(R.integer.promise_icon_alpha); if (DEBUG) Log.d(TAG, "applying icon state: " + mState); switch(mState) { case ShortcutInfo.PACKAGE_STATE_DEFAULT: super.setText(mDefaultText); alpha = 255; break; case ShortcutInfo.PACKAGE_STATE_ENQUEUED: setText(R.string.package_state_enqueued); break; case ShortcutInfo.PACKAGE_STATE_DOWNLOADING: setText(R.string.package_state_downloading); break; case ShortcutInfo.PACKAGE_STATE_INSTALLING: setText(R.string.package_state_installing); break; case ShortcutInfo.PACKAGE_STATE_ERROR: setText(R.string.package_state_error); break; case ShortcutInfo.PACKAGE_STATE_UNKNOWN: default: setText(R.string.package_state_unknown); break; } if (DEBUG) Log.d(TAG, "setting icon alpha to: " + alpha); Drawable[] drawables = getCompoundDrawables(); for (int i = 0; i < drawables.length; i++) { if (drawables[i] != null) { drawables[i].setAlpha(alpha); } } } } src/com/android/launcher3/IconCache.java +0 −14 Original line number Diff line number Diff line Loading @@ -387,20 +387,6 @@ public class IconCache { } } if (icon != null) { // TODO: handle alpha mask in the view layer Bitmap b = Bitmap.createBitmap(Math.max(icon.getWidth(), 1), Math.max(icon.getHeight(), 1), Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); Paint paint = new Paint(); paint.setAlpha(127); c.drawBitmap(icon, 0, 0, paint); c.setBitmap(null); icon.recycle(); icon = b; } return icon; } Loading src/com/android/launcher3/Launcher.java +11 −0 Original line number Diff line number Diff line Loading @@ -4222,6 +4222,17 @@ public class Launcher extends Activity } } /** * Update the state of a package, typically related to install state. * * Implementation of the method from LauncherModel.Callbacks. */ public void updatePackageState(String pkgName, int state) { if (mWorkspace != null) { mWorkspace.updatePackageState(pkgName, state); } } /** * A package was uninstalled. We take both the super set of packageNames * in addition to specific applications to remove, the reason being that Loading Loading
res/values/integers.xml 0 → 100644 +22 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- /* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ --> <resources> <integer name="promise_icon_alpha">127</integer> </resources> No newline at end of file
res/values/strings.xml +11 −0 Original line number Diff line number Diff line Loading @@ -262,4 +262,15 @@ s --> <string name="wallpaper_button_text">Wallpapers</string> <!-- Text for settings button --> <string name="settings_button_text">Settings</string> <!-- Label on an icon that references an uninstalled package, that is going to be installed at some point. [CHAR_LIMIT=15] --> <string name="package_state_enqueued">Waiting</string> <!-- Label on an icon that references an uninstalled package, that is currently being downloaded. [CHAR_LIMIT=15] --> <string name="package_state_downloading">Downloading</string> <!-- Label on an icon that references an uninstalled package, that is currently being installed. [CHAR_LIMIT=15] --> <string name="package_state_installing">Installing</string> <!-- Label on an icon that references an uninstalled package, for which we have no information about when it might be installed. [CHAR_LIMIT=15] --> <string name="package_state_unknown">Unknown</string> <!-- Label on an icon that references an uninstalled package, for which restore from market has failed. [CHAR_LIMIT=15] --> <string name="package_state_error">Error</string> </resources>
src/com/android/launcher3/BubbleTextView.java +63 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.graphics.Region; import android.graphics.Region.Op; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; import android.view.MotionEvent; import android.widget.TextView; Loading @@ -43,6 +44,10 @@ public class BubbleTextView extends TextView { static final float PADDING_H = 8.0f; static final float PADDING_V = 3.0f; private static final String TAG = "BubbleTextView"; private static final boolean DEBUG = false; private int mPrevAlpha = -1; private HolographicOutlineHelper mOutlineHelper; Loading @@ -64,6 +69,11 @@ public class BubbleTextView extends TextView { private boolean mStayPressed; private CheckLongPressHelper mLongPressHelper; private int mInstallState; private int mState; private CharSequence mDefaultText = ""; public BubbleTextView(Context context) { super(context); Loading Loading @@ -108,11 +118,14 @@ public class BubbleTextView extends TextView { LauncherAppState app = LauncherAppState.getInstance(); DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); setCompoundDrawables(null, Utilities.createIconDrawable(b), null, null); Drawable iconDrawable = Utilities.createIconDrawable(b); setCompoundDrawables(null, iconDrawable, null, null); setCompoundDrawablePadding(grid.iconDrawablePaddingPx); setText(info.title); setTag(info); if (info.isPromise()) { setState(ShortcutInfo.PACKAGE_STATE_UNKNOWN); // TODO: persist this state somewhere } } @Override Loading Loading @@ -392,4 +405,52 @@ public class BubbleTextView extends TextView { mLongPressHelper.cancelLongPress(); } public void setState(int state) { if (mState == ShortcutInfo.PACKAGE_STATE_DEFAULT && mState != state) { mDefaultText = getText(); } mState = state; applyState(); } private void applyState() { int alpha = getResources().getInteger(R.integer.promise_icon_alpha); if (DEBUG) Log.d(TAG, "applying icon state: " + mState); switch(mState) { case ShortcutInfo.PACKAGE_STATE_DEFAULT: super.setText(mDefaultText); alpha = 255; break; case ShortcutInfo.PACKAGE_STATE_ENQUEUED: setText(R.string.package_state_enqueued); break; case ShortcutInfo.PACKAGE_STATE_DOWNLOADING: setText(R.string.package_state_downloading); break; case ShortcutInfo.PACKAGE_STATE_INSTALLING: setText(R.string.package_state_installing); break; case ShortcutInfo.PACKAGE_STATE_ERROR: setText(R.string.package_state_error); break; case ShortcutInfo.PACKAGE_STATE_UNKNOWN: default: setText(R.string.package_state_unknown); break; } if (DEBUG) Log.d(TAG, "setting icon alpha to: " + alpha); Drawable[] drawables = getCompoundDrawables(); for (int i = 0; i < drawables.length; i++) { if (drawables[i] != null) { drawables[i].setAlpha(alpha); } } } }
src/com/android/launcher3/IconCache.java +0 −14 Original line number Diff line number Diff line Loading @@ -387,20 +387,6 @@ public class IconCache { } } if (icon != null) { // TODO: handle alpha mask in the view layer Bitmap b = Bitmap.createBitmap(Math.max(icon.getWidth(), 1), Math.max(icon.getHeight(), 1), Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); Paint paint = new Paint(); paint.setAlpha(127); c.drawBitmap(icon, 0, 0, paint); c.setBitmap(null); icon.recycle(); icon = b; } return icon; } Loading
src/com/android/launcher3/Launcher.java +11 −0 Original line number Diff line number Diff line Loading @@ -4222,6 +4222,17 @@ public class Launcher extends Activity } } /** * Update the state of a package, typically related to install state. * * Implementation of the method from LauncherModel.Callbacks. */ public void updatePackageState(String pkgName, int state) { if (mWorkspace != null) { mWorkspace.updatePackageState(pkgName, state); } } /** * A package was uninstalled. We take both the super set of packageNames * in addition to specific applications to remove, the reason being that Loading