am 9ee14249: am 07130d40: Merge remote-tracking branch \'goog/ub-now-lunchbox\' into lunchbox-release

* commit '9ee142497e1272697393867be0bccddd758aef35':
  Implement spring-loading of folders when dragging over.
  Do updateWorkspaceScreenOrder inside a single transaction.
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
This commit is contained in:
Juan Silveira
2014-03-20 15:55:06 +00:00
committed by Android Git Automerger
8 changed files with 176 additions and 68 deletions
+2 -2
View File
@@ -52,9 +52,9 @@
<string name="all_apps_button_label" msgid="9110807029020582876">"ແອັບຯ"</string> <string name="all_apps_button_label" msgid="9110807029020582876">"ແອັບຯ"</string>
<string name="all_apps_home_button_label" msgid="252062713717058851">"ໜ້າຫຼັກ"</string> <string name="all_apps_home_button_label" msgid="252062713717058851">"ໜ້າຫຼັກ"</string>
<string name="delete_zone_label_workspace" msgid="4009607676751398685">"ລຶບ"</string> <string name="delete_zone_label_workspace" msgid="4009607676751398685">"ລຶບ"</string>
<string name="delete_zone_label_all_apps" msgid="8083826390278958980">"ຖອນການຕິດຕັ້ງ"</string> <string name="delete_zone_label_all_apps" msgid="8083826390278958980">"ຖອນການຕິດຕັ້ງ"</string>
<string name="delete_target_label" msgid="1822697352535677073">"ລຶບ"</string> <string name="delete_target_label" msgid="1822697352535677073">"ລຶບ"</string>
<string name="delete_target_uninstall_label" msgid="5100785476250872595">"ຖອນການຕິດຕັ້ງ"</string> <string name="delete_target_uninstall_label" msgid="5100785476250872595">"ຖອນການຕິດຕັ້ງ"</string>
<string name="info_target_label" msgid="8053346143994679532">"ຂໍ້ມູນແອັບຯ"</string> <string name="info_target_label" msgid="8053346143994679532">"ຂໍ້ມູນແອັບຯ"</string>
<string name="accessibility_search_button" msgid="1628520399424565142">"ຊອກຫາ"</string> <string name="accessibility_search_button" msgid="1628520399424565142">"ຊອກຫາ"</string>
<string name="accessibility_voice_search_button" msgid="4637324840434406584">"ຊອກຫາດ້ວຍສຽງ"</string> <string name="accessibility_voice_search_button" msgid="4637324840434406584">"ຊອກຫາດ້ວຍສຽງ"</string>
@@ -817,7 +817,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
*/ */
private void endDragging(View target, boolean isFlingToDelete, boolean success) { private void endDragging(View target, boolean isFlingToDelete, boolean success) {
if (isFlingToDelete || !success || (target != mLauncher.getWorkspace() && if (isFlingToDelete || !success || (target != mLauncher.getWorkspace() &&
!(target instanceof DeleteDropTarget))) { !(target instanceof DeleteDropTarget) && !(target instanceof Folder))) {
// Exit spring loaded mode if we have not successfully dropped or have not handled the // Exit spring loaded mode if we have not successfully dropped or have not handled the
// drop in Workspace // drop in Workspace
mLauncher.getWorkspace().removeExtraEmptyScreen(true, new Runnable() { mLauncher.getWorkspace().removeExtraEmptyScreen(true, new Runnable() {
+15 -20
View File
@@ -65,8 +65,6 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
private boolean mHoverPointClosesFolder = false; private boolean mHoverPointClosesFolder = false;
private Rect mHitRect = new Rect(); private Rect mHitRect = new Rect();
private int mWorkspaceIndex = -1;
private int mQsbIndex = -1;
public static final int ANIMATION_END_DISAPPEAR = 0; public static final int ANIMATION_END_DISAPPEAR = 0;
public static final int ANIMATION_END_FADE_OUT = 1; public static final int ANIMATION_END_FADE_OUT = 1;
public static final int ANIMATION_END_REMAIN_VISIBLE = 2; public static final int ANIMATION_END_REMAIN_VISIBLE = 2;
@@ -75,6 +73,8 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
private final Rect mInsets = new Rect(); private final Rect mInsets = new Rect();
private int mDragViewIndex;
/** /**
* Used to create a new DragLayer from XML. * Used to create a new DragLayer from XML.
* *
@@ -771,31 +771,26 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
} }
private void updateChildIndices() { private void updateChildIndices() {
if (mLauncher != null) { mDragViewIndex = -1;
mWorkspaceIndex = indexOfChild(mLauncher.getWorkspace()); int childCount = getChildCount();
mQsbIndex = indexOfChild(mLauncher.getSearchBar()); for (int i = 0; i < childCount; i++) {
if (getChildAt(i) instanceof DragView) {
mDragViewIndex = i;
}
} }
} }
@Override @Override
protected int getChildDrawingOrder(int childCount, int i) { protected int getChildDrawingOrder(int childCount, int i) {
// TODO: We have turned off this custom drawing order because it now effects touch if (mDragViewIndex == -1) {
// dispatch order. We need to sort that issue out and then decide how to go about this. return i;
if (true || LauncherAppState.isScreenLandscape(getContext()) || } else if (i == mDragViewIndex) {
mWorkspaceIndex == -1 || mQsbIndex == -1 || return getChildCount()-1;
mLauncher.getWorkspace().isDrawingBackgroundGradient()) { } else if (i < mDragViewIndex) {
return i; return i;
}
// This ensures that the workspace is drawn above the hotseat and qsb,
// except when the workspace is drawing a background gradient, in which
// case we want the workspace to stay behind these elements.
if (i == mQsbIndex) {
return mWorkspaceIndex;
} else if (i == mWorkspaceIndex) {
return mQsbIndex;
} else { } else {
return i; // i > mDragViewIndex
return i-1;
} }
} }
+100 -41
View File
@@ -24,7 +24,6 @@ import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.PointF; import android.graphics.PointF;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.v4.widget.AutoScrollHelper; import android.support.v4.widget.AutoScrollHelper;
import android.text.InputType; import android.text.InputType;
@@ -70,6 +69,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
static final int STATE_ANIMATING = 1; static final int STATE_ANIMATING = 1;
static final int STATE_OPEN = 2; static final int STATE_OPEN = 2;
private static final int CLOSE_FOLDER_DELAY_MS = 150;
private int mExpandDuration; private int mExpandDuration;
protected CellLayout mContent; protected CellLayout mContent;
private ScrollView mScrollView; private ScrollView mScrollView;
@@ -85,10 +86,10 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
private int mMaxCountY; private int mMaxCountY;
private int mMaxNumItems; private int mMaxNumItems;
private ArrayList<View> mItemsInReadingOrder = new ArrayList<View>(); private ArrayList<View> mItemsInReadingOrder = new ArrayList<View>();
private Drawable mIconDrawable;
boolean mItemsInvalidated = false; boolean mItemsInvalidated = false;
private ShortcutInfo mCurrentDragInfo; private ShortcutInfo mCurrentDragInfo;
private View mCurrentDragView; private View mCurrentDragView;
private boolean mIsExternalDrag;
boolean mSuppressOnAdd = false; boolean mSuppressOnAdd = false;
private int[] mTargetCell = new int[2]; private int[] mTargetCell = new int[2];
private int[] mPreviousTargetCell = new int[2]; private int[] mPreviousTargetCell = new int[2];
@@ -242,7 +243,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mLauncher.getWorkspace().onDragStartedWithItem(v); mLauncher.getWorkspace().onDragStartedWithItem(v);
mLauncher.getWorkspace().beginDragShared(v, this); mLauncher.getWorkspace().beginDragShared(v, this);
mIconDrawable = ((TextView) v).getCompoundDrawables()[1];
mCurrentDragInfo = item; mCurrentDragInfo = item;
mEmptyCell[0] = item.cellX; mEmptyCell[0] = item.cellX;
@@ -303,10 +303,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
return mFolderName; return mFolderName;
} }
public Drawable getDragDrawable() {
return mIconDrawable;
}
/** /**
* We need to handle touch events to prevent them from falling through to the workspace below. * We need to handle touch events to prevent them from falling through to the workspace below.
*/ */
@@ -381,7 +377,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
int count = 0; int count = 0;
for (int i = 0; i < children.size(); i++) { for (int i = 0; i < children.size(); i++) {
ShortcutInfo child = (ShortcutInfo) children.get(i); ShortcutInfo child = (ShortcutInfo) children.get(i);
if (!createAndAddShortcut(child)) { if (createAndAddShortcut(child) == null) {
overflow.add(child); overflow.add(child);
} else { } else {
count++; count++;
@@ -466,11 +462,15 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
mState = STATE_OPEN; mState = STATE_OPEN;
setLayerType(LAYER_TYPE_NONE, null); setLayerType(LAYER_TYPE_NONE, null);
Cling cling = mLauncher.getLauncherClings().showFoldersCling();
if (cling != null) { // Only show cling if we are not in the middle of a drag - this would be quite jarring.
cling.bringScrimToFront(); if (!mDragController.isDragging()) {
bringToFront(); Cling cling = mLauncher.getLauncherClings().showFoldersCling();
cling.bringToFront(); if (cling != null) {
cling.bringScrimToFront();
bringToFront();
cling.bringToFront();
}
} }
setFocusOnFirstChild(); setFocusOnFirstChild();
} }
@@ -478,6 +478,23 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
oa.setDuration(mExpandDuration); oa.setDuration(mExpandDuration);
setLayerType(LAYER_TYPE_HARDWARE, null); setLayerType(LAYER_TYPE_HARDWARE, null);
oa.start(); oa.start();
// Make sure the folder picks up the last drag move even if the finger doesn't move.
if (mDragController.isDragging()) {
mDragController.forceTouchMove();
}
}
public void beginExternalDrag(ShortcutInfo item) {
setupContentForNumItems(getItemCount() + 1);
findAndSetEmptyCells(item);
mCurrentDragInfo = item;
mEmptyCell[0] = item.cellX;
mEmptyCell[1] = item.cellY;
mIsExternalDrag = true;
mDragInProgress = true;
} }
private void sendCustomAccessibilityEvent(int type, String text) { private void sendCustomAccessibilityEvent(int type, String text) {
@@ -544,7 +561,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
} }
} }
protected boolean createAndAddShortcut(ShortcutInfo item) { protected View createAndAddShortcut(ShortcutInfo item) {
final BubbleTextView textView = final BubbleTextView textView =
(BubbleTextView) mInflater.inflate(R.layout.application, this, false); (BubbleTextView) mInflater.inflate(R.layout.application, this, false);
textView.setCompoundDrawables(null, textView.setCompoundDrawables(null,
@@ -565,7 +582,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
// This shouldn't happen, log it. // This shouldn't happen, log it.
Log.e(TAG, "Folder order not properly persisted during bind"); Log.e(TAG, "Folder order not properly persisted during bind");
if (!findAndSetEmptyCells(item)) { if (!findAndSetEmptyCells(item)) {
return false; return null;
} }
} }
@@ -574,7 +591,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
boolean insert = false; boolean insert = false;
textView.setOnKeyListener(new FolderKeyEventListener()); textView.setOnKeyListener(new FolderKeyEventListener());
mContent.addViewToCellLayout(textView, insert ? 0 : -1, (int)item.id, lp, true); mContent.addViewToCellLayout(textView, insert ? 0 : -1, (int)item.id, lp, true);
return true; return textView;
} }
public void onDragEnter(DragObject d) { public void onDragEnter(DragObject d) {
@@ -723,6 +740,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mCurrentDragView = null; mCurrentDragView = null;
mSuppressOnAdd = false; mSuppressOnAdd = false;
mRearrangeOnClose = true; mRearrangeOnClose = true;
mIsExternalDrag = false;
} }
public void onDragExit(DragObject d) { public void onDragExit(DragObject d) {
@@ -756,7 +774,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
success && (!beingCalledAfterUninstall || mUninstallSuccessful); success && (!beingCalledAfterUninstall || mUninstallSuccessful);
if (successfulDrop) { if (successfulDrop) {
if (mDeleteFolderOnDropCompleted && !mItemAddedBackToSelfViaIcon) { if (mDeleteFolderOnDropCompleted && !mItemAddedBackToSelfViaIcon && target != this) {
replaceFolderWithFinalItem(); replaceFolderWithFinalItem();
} }
} else { } else {
@@ -1152,34 +1170,75 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
} }
public void onDrop(DragObject d) { public void onDrop(DragObject d) {
ShortcutInfo item; Runnable cleanUpRunnable = null;
if (d.dragInfo instanceof AppInfo) {
// Came from all apps -- make a copy // If we are coming from All Apps space, we need to remove the extra empty screen (which is
item = ((AppInfo) d.dragInfo).makeShortcut(); // normally done in Workspace#onDropExternal, as well zoom back in and close the folder.
item.spanX = 1; if (d.dragSource != mLauncher.getWorkspace() && !(d.dragSource instanceof Folder)) {
item.spanY = 1; cleanUpRunnable = new Runnable() {
} else { @Override
item = (ShortcutInfo) d.dragInfo; public void run() {
mLauncher.getWorkspace().removeExtraEmptyScreen(false, new Runnable() {
@Override
public void run() {
mLauncher.closeFolder();
mLauncher.exitSpringLoadedDragModeDelayed(true,
Launcher.EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT_FOLDER_CLOSE,
null);
}
}, CLOSE_FOLDER_DELAY_MS, false);
}
};
} }
// Dragged from self onto self, currently this is the only path possible, however
// we keep this as a distinct code path. View currentDragView;
if (item == mCurrentDragInfo) { ShortcutInfo si = mCurrentDragInfo;
ShortcutInfo si = (ShortcutInfo) mCurrentDragView.getTag(); if (mIsExternalDrag) {
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) mCurrentDragView.getLayoutParams(); si.cellX = mEmptyCell[0];
si.cellY = mEmptyCell[1];
currentDragView = createAndAddShortcut(si);
} else {
currentDragView = mCurrentDragView;
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) currentDragView.getLayoutParams();
si.cellX = lp.cellX = mEmptyCell[0]; si.cellX = lp.cellX = mEmptyCell[0];
si.cellX = lp.cellY = mEmptyCell[1]; si.cellX = lp.cellY = mEmptyCell[1];
mContent.addViewToCellLayout(mCurrentDragView, -1, (int)item.id, lp, true); mContent.addViewToCellLayout(currentDragView, -1, (int) si.id, lp, true);
if (d.dragView.hasDrawn()) {
mLauncher.getDragLayer().animateViewIntoPosition(d.dragView, mCurrentDragView);
} else {
d.deferDragViewCleanupPostAnimation = false;
mCurrentDragView.setVisibility(VISIBLE);
}
mItemsInvalidated = true;
setupContentDimensions(getItemCount());
mSuppressOnAdd = true;
} }
mInfo.add(item);
if (d.dragView.hasDrawn()) {
// Temporarily reset the scale such that the animation target gets calculated correctly.
float scaleX = getScaleX();
float scaleY = getScaleY();
setScaleX(1.0f);
setScaleY(1.0f);
mLauncher.getDragLayer().animateViewIntoPosition(d.dragView, currentDragView,
cleanUpRunnable, null);
setScaleX(scaleX);
setScaleY(scaleY);
} else {
d.deferDragViewCleanupPostAnimation = false;
currentDragView.setVisibility(VISIBLE);
}
mItemsInvalidated = true;
setupContentDimensions(getItemCount());
// Actually move the item in the database if it was an external drag.
if (mIsExternalDrag) {
LauncherModel.addOrMoveItemInDatabase(
mLauncher, si, mInfo.id, 0, si.cellX, si.cellY);
// We only need to update the locations if it doesn't get handled in #onDropCompleted.
if (d.dragSource != this) {
updateItemLocationsInDatabaseBatch();
}
mIsExternalDrag = false;
}
// Temporarily suppress the listener, as we did all the work already here.
mSuppressOnAdd = true;
mInfo.add(si);
mSuppressOnAdd = false;
} }
// This is used so the item doesn't immediately appear in the folder when added. In one case // This is used so the item doesn't immediately appear in the folder when added. In one case
+31
View File
@@ -75,10 +75,16 @@ public class FolderIcon extends FrameLayout implements FolderListener {
// Flag as to whether or not to draw an outer ring. Currently none is designed. // Flag as to whether or not to draw an outer ring. Currently none is designed.
public static final boolean HAS_OUTER_RING = true; public static final boolean HAS_OUTER_RING = true;
// Flag whether the folder should open itself when an item is dragged over is enabled.
public static final boolean SPRING_LOADING_ENABLED = true;
// The degree to which the item in the back of the stack is scaled [0...1] // The degree to which the item in the back of the stack is scaled [0...1]
// (0 means it's not scaled at all, 1 means it's scaled to nothing) // (0 means it's not scaled at all, 1 means it's scaled to nothing)
private static final float PERSPECTIVE_SCALE_FACTOR = 0.35f; private static final float PERSPECTIVE_SCALE_FACTOR = 0.35f;
// Delay when drag enters until the folder opens, in miliseconds.
private static final int ON_OPEN_DELAY = 800;
public static Drawable sSharedFolderLeaveBehind = null; public static Drawable sSharedFolderLeaveBehind = null;
private ImageView mPreviewBackground; private ImageView mPreviewBackground;
@@ -103,6 +109,9 @@ public class FolderIcon extends FrameLayout implements FolderListener {
private PreviewItemDrawingParams mAnimParams = new PreviewItemDrawingParams(0, 0, 0, 0); private PreviewItemDrawingParams mAnimParams = new PreviewItemDrawingParams(0, 0, 0, 0);
private ArrayList<ShortcutInfo> mHiddenItems = new ArrayList<ShortcutInfo>(); private ArrayList<ShortcutInfo> mHiddenItems = new ArrayList<ShortcutInfo>();
private Alarm mOpenAlarm = new Alarm();
private ItemInfo mDragInfo;
public FolderIcon(Context context, AttributeSet attrs) { public FolderIcon(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
init(); init();
@@ -331,11 +340,32 @@ public class FolderIcon extends FrameLayout implements FolderListener {
mFolderRingAnimator.setCellLayout(layout); mFolderRingAnimator.setCellLayout(layout);
mFolderRingAnimator.animateToAcceptState(); mFolderRingAnimator.animateToAcceptState();
layout.showFolderAccept(mFolderRingAnimator); layout.showFolderAccept(mFolderRingAnimator);
mOpenAlarm.setOnAlarmListener(mOnOpenListener);
if (SPRING_LOADING_ENABLED) {
mOpenAlarm.setAlarm(ON_OPEN_DELAY);
}
mDragInfo = (ItemInfo) dragInfo;
} }
public void onDragOver(Object dragInfo) { public void onDragOver(Object dragInfo) {
} }
OnAlarmListener mOnOpenListener = new OnAlarmListener() {
public void onAlarm(Alarm alarm) {
ShortcutInfo item;
if (mDragInfo instanceof AppInfo) {
// Came from all apps -- make a copy.
item = ((AppInfo) mDragInfo).makeShortcut();
item.spanX = 1;
item.spanY = 1;
} else {
item = (ShortcutInfo) mDragInfo;
}
mFolder.beginExternalDrag(item);
mLauncher.openFolder(FolderIcon.this);
}
};
public void performCreateAnimation(final ShortcutInfo destInfo, final View destView, public void performCreateAnimation(final ShortcutInfo destInfo, final View destView,
final ShortcutInfo srcInfo, final DragView srcView, Rect dstRect, final ShortcutInfo srcInfo, final DragView srcView, Rect dstRect,
float scaleRelativeToDragLayer, Runnable postAnimationRunnable) { float scaleRelativeToDragLayer, Runnable postAnimationRunnable) {
@@ -371,6 +401,7 @@ public class FolderIcon extends FrameLayout implements FolderListener {
public void onDragExit() { public void onDragExit() {
mFolderRingAnimator.animateToNaturalState(); mFolderRingAnimator.animateToNaturalState();
mOpenAlarm.cancelAlarm();
} }
private void onDrop(final ShortcutInfo item, DragView animateView, Rect finalRect, private void onDrop(final ShortcutInfo item, DragView animateView, Rect finalRect,
+1
View File
@@ -210,6 +210,7 @@ public class Launcher extends Activity
static final int APPWIDGET_HOST_ID = 1024; static final int APPWIDGET_HOST_ID = 1024;
public static final int EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT = 300; public static final int EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT = 300;
public static final int EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT_FOLDER_CLOSE = 400;
private static final int ON_ACTIVITY_RESULT_ANIMATION_DELAY = 500; private static final int ON_ACTIVITY_RESULT_ANIMATION_DELAY = 500;
private static final Object sLock = new Object(); private static final Object sLock = new Object();
+9 -4
View File
@@ -995,18 +995,23 @@ public class LauncherModel extends BroadcastReceiver {
Runnable r = new Runnable() { Runnable r = new Runnable() {
@Override @Override
public void run() { public void run() {
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
// Clear the table // Clear the table
cr.delete(uri, null, null); ops.add(ContentProviderOperation.newDelete(uri).build());
int count = screensCopy.size(); int count = screensCopy.size();
ContentValues[] values = new ContentValues[count];
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
ContentValues v = new ContentValues(); ContentValues v = new ContentValues();
long screenId = screensCopy.get(i); long screenId = screensCopy.get(i);
v.put(LauncherSettings.WorkspaceScreens._ID, screenId); v.put(LauncherSettings.WorkspaceScreens._ID, screenId);
v.put(LauncherSettings.WorkspaceScreens.SCREEN_RANK, i); v.put(LauncherSettings.WorkspaceScreens.SCREEN_RANK, i);
values[i] = v; ops.add(ContentProviderOperation.newInsert(uri).withValues(v).build());
}
try {
cr.applyBatch(LauncherProvider.AUTHORITY, ops);
} catch (Exception ex) {
throw new RuntimeException(ex);
} }
cr.bulkInsert(uri, values);
synchronized (sBgLock) { synchronized (sBgLock) {
sBgWorkspaceScreens.clear(); sBgWorkspaceScreens.clear();
@@ -22,11 +22,14 @@ import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo; import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.ContentProvider; import android.content.ContentProvider;
import android.content.ContentProviderOperation;
import android.content.ContentProviderResult;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.ContentUris; import android.content.ContentUris;
import android.content.ContentValues; import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.OperationApplicationException;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
@@ -193,6 +196,20 @@ public class LauncherProvider extends ContentProvider {
return values.length; return values.length;
} }
@Override
public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations)
throws OperationApplicationException {
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
db.beginTransaction();
try {
ContentProviderResult[] result = super.applyBatch(operations);
db.setTransactionSuccessful();
return result;
} finally {
db.endTransaction();
}
}
@Override @Override
public int delete(Uri uri, String selection, String[] selectionArgs) { public int delete(Uri uri, String selection, String[] selectionArgs) {
SqlArguments args = new SqlArguments(uri, selection, selectionArgs); SqlArguments args = new SqlArguments(uri, selection, selectionArgs);