Merge in Android 4.4
This commit is contained in:
@@ -62,8 +62,8 @@
|
||||
android:id="@+id/focused_hotseat_app_bubble"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|right"
|
||||
android:layout_marginRight="25dp"
|
||||
android:layout_gravity="bottom|left"
|
||||
android:layout_marginLeft="25dp"
|
||||
android:layout_marginBottom="90dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
@@ -90,8 +90,8 @@
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginRight="80dp"
|
||||
android:layout_gravity="left"
|
||||
android:layout_marginLeft="78dp"
|
||||
android:src="@drawable/cling_arrow_down" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
@@ -101,7 +101,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_gravity="bottom|left"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_gravity="bottom|right"
|
||||
android:onClick="dismissWorkspaceCling" />
|
||||
</com.android.launcher3.Cling>
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
<string name="first_run_cling_search_bar_hint" msgid="5909062802402452582"></string>
|
||||
<string name="first_run_cling_create_screens_hint" msgid="6950729526680114157">"Unda skrini zaidi za programu na folda"</string>
|
||||
<string name="workspace_cling_title" msgid="5626202359865825661">"Panga nafasi yako"</string>
|
||||
<string name="workspace_cling_move_item" msgid="528201129978005352">"Gusa na ushikile mandharinyuma ili udhibiti mandhari, wijeti, na mipangilio."</string>
|
||||
<string name="workspace_cling_move_item" msgid="528201129978005352">"Gusa na ushikilie mandharinyuma ili udhibiti mandhari, wijeti, na mipangilio."</string>
|
||||
<string name="all_apps_cling_title" msgid="34929250753095858">"Chagua programu kadhaa"</string>
|
||||
<string name="all_apps_cling_add_item" msgid="400866858451850784">"Ili kuongeza programu kwenye Skrini yako Kuu, iguse na uishikilie."</string>
|
||||
<string name="folder_cling_title" msgid="3894908818693254164">"Folda hii hapa"</string>
|
||||
|
||||
@@ -53,6 +53,8 @@
|
||||
<!-- Workspace -->
|
||||
<style name="Theme" parent="android:Theme.Holo.Wallpaper.NoTitleBar">
|
||||
<item name="android:windowActionModeOverlay">true</item>
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
<item name="android:windowTranslucentNavigation">true</item>
|
||||
</style>
|
||||
|
||||
<style name="TabIndicator.AppsCustomize">
|
||||
|
||||
@@ -109,9 +109,8 @@ public class BubbleTextView extends TextView {
|
||||
LauncherAppState app = LauncherAppState.getInstance();
|
||||
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
|
||||
|
||||
setCompoundDrawablesWithIntrinsicBounds(null,
|
||||
new FastBitmapDrawable(b),
|
||||
null, null);
|
||||
setCompoundDrawables(null,
|
||||
Utilities.createIconDrawable(b), null, null);
|
||||
setCompoundDrawablePadding((int) ((grid.folderIconSizePx - grid.iconSizePx) / 2f));
|
||||
setText(info.title);
|
||||
setTag(info);
|
||||
|
||||
@@ -532,8 +532,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
||||
protected boolean createAndAddShortcut(ShortcutInfo item) {
|
||||
final BubbleTextView textView =
|
||||
(BubbleTextView) mInflater.inflate(R.layout.application, this, false);
|
||||
textView.setCompoundDrawablesWithIntrinsicBounds(null,
|
||||
new FastBitmapDrawable(item.getIcon(mIconCache)), null, null);
|
||||
textView.setCompoundDrawables(null,
|
||||
Utilities.createIconDrawable(item.getIcon(mIconCache)), null, null);
|
||||
textView.setText(item.title);
|
||||
textView.setTag(item);
|
||||
textView.setTextColor(getResources().getColor(R.color.folder_items_text_color));
|
||||
|
||||
@@ -98,6 +98,7 @@ public class FolderIcon extends LinearLayout implements FolderListener {
|
||||
private int mPreviewOffsetY;
|
||||
private float mMaxPerspectiveShift;
|
||||
boolean mAnimating = false;
|
||||
private Rect mOldBounds = new Rect();
|
||||
|
||||
private PreviewItemDrawingParams mParams = new PreviewItemDrawingParams(0, 0, 0, 0);
|
||||
private PreviewItemDrawingParams mAnimParams = new PreviewItemDrawingParams(0, 0, 0, 0);
|
||||
@@ -534,6 +535,7 @@ public class FolderIcon extends LinearLayout implements FolderListener {
|
||||
Drawable d = params.drawable;
|
||||
|
||||
if (d != null) {
|
||||
mOldBounds.set(d.getBounds());
|
||||
d.setBounds(0, 0, mIntrinsicIconSize, mIntrinsicIconSize);
|
||||
d.setFilterBitmap(true);
|
||||
d.setColorFilter(Color.argb(params.overlayAlpha, 255, 255, 255),
|
||||
@@ -541,6 +543,7 @@ public class FolderIcon extends LinearLayout implements FolderListener {
|
||||
d.draw(canvas);
|
||||
d.clearColorFilter();
|
||||
d.setFilterBitmap(false);
|
||||
d.setBounds(mOldBounds);
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public class Hotseat extends FrameLayout {
|
||||
TextView allAppsButton = (TextView)
|
||||
inflater.inflate(R.layout.all_apps_button, mContent, false);
|
||||
Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon);
|
||||
d.setBounds(0, 0, Utilities.sIconTextureWidth, Utilities.sIconTextureHeight);
|
||||
Utilities.resizeIconDrawable(d);
|
||||
allAppsButton.setCompoundDrawables(null, d, null, null);
|
||||
|
||||
allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
|
||||
|
||||
@@ -29,6 +29,8 @@ import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* Cache of application icons. Icons can be made from any thread.
|
||||
@@ -146,6 +148,21 @@ public class IconCache {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty out the cache that aren't of the correct grid size
|
||||
*/
|
||||
public void flushInvalidIcons(DeviceProfile grid) {
|
||||
synchronized (mCache) {
|
||||
Iterator<Entry<ComponentName, CacheEntry>> it = mCache.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
final CacheEntry e = it.next().getValue();
|
||||
if (e.icon.getWidth() != grid.iconSizePx || e.icon.getHeight() != grid.iconSizePx) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill in "application" with the icon and label for "info."
|
||||
*/
|
||||
|
||||
@@ -36,6 +36,9 @@ import java.util.Set;
|
||||
import org.json.*;
|
||||
|
||||
public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "InstallShortcutReceiver";
|
||||
private static final boolean DBG = false;
|
||||
|
||||
public static final String ACTION_INSTALL_SHORTCUT =
|
||||
"com.android.launcher.action.INSTALL_SHORTCUT";
|
||||
|
||||
@@ -94,10 +97,11 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
}
|
||||
json = json.endObject();
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
if (DBG) Log.d(TAG, "Adding to APPS_PENDING_INSTALL: " + json);
|
||||
addToStringSet(sharedPrefs, editor, APPS_PENDING_INSTALL, json.toString());
|
||||
editor.commit();
|
||||
} catch (org.json.JSONException e) {
|
||||
Log.d("InstallShortcutReceiver", "Exception when adding shortcut: " + e);
|
||||
Log.d(TAG, "Exception when adding shortcut: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,9 +110,15 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
ArrayList<String> packageNames) {
|
||||
synchronized(sLock) {
|
||||
Set<String> strings = sharedPrefs.getStringSet(APPS_PENDING_INSTALL, null);
|
||||
if (DBG) {
|
||||
Log.d(TAG, "APPS_PENDING_INSTALL: " + strings
|
||||
+ ", removing packages: " + packageNames);
|
||||
}
|
||||
if (strings != null) {
|
||||
Set<String> newStrings = new HashSet<String>(strings);
|
||||
for (String json : newStrings) {
|
||||
Iterator<String> newStringsIter = newStrings.iterator();
|
||||
while (newStringsIter.hasNext()) {
|
||||
String json = newStringsIter.next();
|
||||
try {
|
||||
JSONObject object = (JSONObject) new JSONTokener(json).nextValue();
|
||||
Intent launchIntent = Intent.parseUri(object.getString(LAUNCH_INTENT_KEY), 0);
|
||||
@@ -117,12 +127,12 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
pn = launchIntent.getComponent().getPackageName();
|
||||
}
|
||||
if (packageNames.contains(pn)) {
|
||||
newStrings.remove(json);
|
||||
newStringsIter.remove();
|
||||
}
|
||||
} catch (org.json.JSONException e) {
|
||||
Log.d("InstallShortcutReceiver", "Exception reading shortcut to remove: " + e);
|
||||
Log.d(TAG, "Exception reading shortcut to remove: " + e);
|
||||
} catch (java.net.URISyntaxException e) {
|
||||
Log.d("InstallShortcutReceiver", "Exception reading shortcut to remove: " + e);
|
||||
Log.d(TAG, "Exception reading shortcut to remove: " + e);
|
||||
}
|
||||
}
|
||||
sharedPrefs.edit().putStringSet(APPS_PENDING_INSTALL,
|
||||
@@ -135,6 +145,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
SharedPreferences sharedPrefs) {
|
||||
synchronized(sLock) {
|
||||
Set<String> strings = sharedPrefs.getStringSet(APPS_PENDING_INSTALL, null);
|
||||
if (DBG) Log.d(TAG, "Getting and clearing APPS_PENDING_INSTALL: " + strings);
|
||||
if (strings == null) {
|
||||
return new ArrayList<PendingInstallShortcutInfo>();
|
||||
}
|
||||
@@ -167,11 +178,9 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
new PendingInstallShortcutInfo(data, name, launchIntent);
|
||||
infos.add(info);
|
||||
} catch (org.json.JSONException e) {
|
||||
Log.d("InstallShortcutReceiver",
|
||||
"Exception reading shortcut to add: " + e);
|
||||
Log.d(TAG, "Exception reading shortcut to add: " + e);
|
||||
} catch (java.net.URISyntaxException e) {
|
||||
Log.d("InstallShortcutReceiver",
|
||||
"Exception reading shortcut to add: " + e);
|
||||
Log.d(TAG, "Exception reading shortcut to add: " + e);
|
||||
}
|
||||
}
|
||||
sharedPrefs.edit().putStringSet(APPS_PENDING_INSTALL, new HashSet<String>()).commit();
|
||||
@@ -203,6 +212,8 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DBG) Log.d(TAG, "Got INSTALL_SHORTCUT: " + data.toUri(0));
|
||||
|
||||
Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
|
||||
if (intent == null) {
|
||||
return;
|
||||
|
||||
@@ -402,6 +402,7 @@ public class Launcher extends Activity
|
||||
Context.MODE_PRIVATE);
|
||||
mModel = app.setLauncher(this);
|
||||
mIconCache = app.getIconCache();
|
||||
mIconCache.flushInvalidIcons(grid);
|
||||
mDragController = new DragController(this);
|
||||
mInflater = getLayoutInflater();
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ public class LauncherAnimUtils {
|
||||
static HashSet<Animator> sAnimators = new HashSet<Animator>();
|
||||
static Animator.AnimatorListener sEndAnimListener = new Animator.AnimatorListener() {
|
||||
public void onAnimationStart(Animator animation) {
|
||||
sAnimators.add(animation);
|
||||
}
|
||||
|
||||
public void onAnimationRepeat(Animator animation) {
|
||||
@@ -45,7 +46,6 @@ public class LauncherAnimUtils {
|
||||
};
|
||||
|
||||
public static void cancelOnDestroyActivity(Animator a) {
|
||||
sAnimators.add(a);
|
||||
a.addListener(sEndAnimListener);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,8 @@ public class PagedViewIcon extends TextView {
|
||||
PagedViewIcon.PressedCallback cb) {
|
||||
mIcon = info.iconBitmap;
|
||||
mPressedCallback = cb;
|
||||
setCompoundDrawablesWithIntrinsicBounds(null, new FastBitmapDrawable(mIcon), null, null);
|
||||
setCompoundDrawables(null, Utilities.createIconDrawable(mIcon),
|
||||
null, null);
|
||||
setText(info.title);
|
||||
setTag(info);
|
||||
}
|
||||
|
||||
@@ -138,7 +138,8 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D
|
||||
* Shows and hides the search bar.
|
||||
*/
|
||||
public void showSearchBar(boolean animated) {
|
||||
if (!mIsSearchBarHidden) return;
|
||||
boolean needToCancelOngoingAnimation = mQSBSearchBarAnim.isRunning() && !animated;
|
||||
if (!mIsSearchBarHidden && !needToCancelOngoingAnimation) return;
|
||||
if (animated) {
|
||||
prepareStartAnimation(mQSBSearchBar);
|
||||
mQSBSearchBarAnim.reverse();
|
||||
@@ -153,7 +154,8 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D
|
||||
mIsSearchBarHidden = false;
|
||||
}
|
||||
public void hideSearchBar(boolean animated) {
|
||||
if (mIsSearchBarHidden) return;
|
||||
boolean needToCancelOngoingAnimation = mQSBSearchBarAnim.isRunning() && !animated;
|
||||
if (mIsSearchBarHidden && !needToCancelOngoingAnimation) return;
|
||||
if (animated) {
|
||||
prepareStartAnimation(mQSBSearchBar);
|
||||
mQSBSearchBarAnim.start();
|
||||
|
||||
@@ -65,6 +65,23 @@ final class Utilities {
|
||||
static int sColors[] = { 0xffff0000, 0xff00ff00, 0xff0000ff };
|
||||
static int sColorIndex = 0;
|
||||
|
||||
/**
|
||||
* Returns a FastBitmapDrawable with the icon, accurately sized.
|
||||
*/
|
||||
static Drawable createIconDrawable(Bitmap icon) {
|
||||
FastBitmapDrawable d = new FastBitmapDrawable(icon);
|
||||
d.setFilterBitmap(true);
|
||||
resizeIconDrawable(d);
|
||||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes an icon drawable to the correct icon size.
|
||||
*/
|
||||
static void resizeIconDrawable(Drawable icon) {
|
||||
icon.setBounds(0, 0, sIconTextureWidth, sIconTextureHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a bitmap suitable for the all apps view. Used to convert pre-ICS
|
||||
* icon bitmaps that are stored in the database (which were 74x74 pixels at hdpi size)
|
||||
|
||||
@@ -87,9 +87,15 @@ public class WallpaperCropActivity extends Activity {
|
||||
|
||||
mCropView = (CropView) findViewById(R.id.cropView);
|
||||
|
||||
Intent cropIntent = this.getIntent();
|
||||
Intent cropIntent = getIntent();
|
||||
final Uri imageUri = cropIntent.getData();
|
||||
|
||||
if (imageUri == null) {
|
||||
Log.e(LOGTAG, "No URI passed in intent, exiting WallpaperCropActivity");
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
int rotation = getRotationFromExif(this, imageUri);
|
||||
mCropView.setTileSource(new BitmapRegionTileSource(this, imageUri, 1024, rotation), null);
|
||||
mCropView.setTouchEnabled(true);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.launcher3;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.LayoutTransition;
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
@@ -54,6 +55,7 @@ import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.FrameLayout;
|
||||
@@ -215,12 +217,21 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
|
||||
if (mAnim != null) {
|
||||
mAnim.cancel();
|
||||
}
|
||||
if (mWallpaperStrip.getTranslationY() == 0) {
|
||||
if (mWallpaperStrip.getAlpha() == 1f) {
|
||||
mIgnoreNextTap = true;
|
||||
}
|
||||
mAnim = new LauncherViewPropertyAnimator(mWallpaperStrip);
|
||||
mAnim.translationY(mWallpaperStrip.getHeight()).alpha(0f)
|
||||
.setInterpolator(new DecelerateInterpolator(0.75f));
|
||||
mAnim.alpha(0f)
|
||||
.setDuration(150)
|
||||
.addListener(new Animator.AnimatorListener() {
|
||||
public void onAnimationStart(Animator animator) { }
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
mWallpaperStrip.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
public void onAnimationCancel(Animator animator) { }
|
||||
public void onAnimationRepeat(Animator animator) { }
|
||||
});
|
||||
mAnim.setInterpolator(new AccelerateInterpolator(0.75f));
|
||||
mAnim.start();
|
||||
}
|
||||
@Override
|
||||
@@ -235,9 +246,11 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
|
||||
if (mAnim != null) {
|
||||
mAnim.cancel();
|
||||
}
|
||||
mWallpaperStrip.setVisibility(View.VISIBLE);
|
||||
mAnim = new LauncherViewPropertyAnimator(mWallpaperStrip);
|
||||
mAnim.translationY(0f).alpha(1f)
|
||||
.setInterpolator(new DecelerateInterpolator(0.75f));
|
||||
mAnim.alpha(1f)
|
||||
.setDuration(150)
|
||||
.setInterpolator(new DecelerateInterpolator(0.75f));
|
||||
mAnim.start();
|
||||
}
|
||||
}
|
||||
@@ -489,9 +502,9 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mWallpaperStrip = findViewById(R.id.wallpaper_strip);
|
||||
if (mWallpaperStrip.getTranslationY() > 0f) {
|
||||
mWallpaperStrip.setTranslationY(0f);
|
||||
if (mWallpaperStrip.getAlpha() < 1f) {
|
||||
mWallpaperStrip.setAlpha(1f);
|
||||
mWallpaperStrip.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1446,6 +1446,12 @@ public class Workspace extends SmoothPagedView
|
||||
}
|
||||
|
||||
if (Float.compare(progress, mLastCustomContentScrollProgress) == 0) return;
|
||||
|
||||
CellLayout cc = mWorkspaceScreens.get(CUSTOM_CONTENT_SCREEN_ID);
|
||||
if (progress > 0 && cc.getVisibility() != VISIBLE && !isSmall()) {
|
||||
cc.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
mLastCustomContentScrollProgress = progress;
|
||||
|
||||
setBackgroundAlpha(progress * 0.8f);
|
||||
@@ -3046,7 +3052,9 @@ public class Workspace extends SmoothPagedView
|
||||
private void cleanupFolderCreation() {
|
||||
if (mDragFolderRingAnimator != null) {
|
||||
mDragFolderRingAnimator.animateToNaturalState();
|
||||
mDragFolderRingAnimator = null;
|
||||
}
|
||||
mFolderCreationAlarm.setOnAlarmListener(null);
|
||||
mFolderCreationAlarm.cancelAlarm();
|
||||
}
|
||||
|
||||
@@ -3390,9 +3398,11 @@ public class Workspace extends SmoothPagedView
|
||||
}
|
||||
|
||||
public void onAlarm(Alarm alarm) {
|
||||
if (mDragFolderRingAnimator == null) {
|
||||
mDragFolderRingAnimator = new FolderRingAnimator(mLauncher, null);
|
||||
if (mDragFolderRingAnimator != null) {
|
||||
// This shouldn't happen ever, but just in case, make sure we clean up the mess.
|
||||
mDragFolderRingAnimator.animateToNaturalState();
|
||||
}
|
||||
mDragFolderRingAnimator = new FolderRingAnimator(mLauncher, null);
|
||||
mDragFolderRingAnimator.setCell(cellX, cellY);
|
||||
mDragFolderRingAnimator.setCellLayout(layout);
|
||||
mDragFolderRingAnimator.animateToAcceptState();
|
||||
@@ -4077,6 +4087,7 @@ public class Workspace extends SmoothPagedView
|
||||
}
|
||||
}
|
||||
mRestoredPages.clear();
|
||||
mSavedStates = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user