public void testResetTransition() { MockCallBack cb = new MockCallBack(); mTransitionDrawable.setCallback(cb); // reset when there is no transition cb.reset(); mTransitionDrawable.resetTransition(); assertTrue(cb.hasCalledInvalidateDrawable()); // reset when there is a transition in progress makeTransitionInProgress(2000, 1000); cb.reset(); mTransitionDrawable.resetTransition(); assertTrue(cb.hasCalledInvalidateDrawable()); assertTransitionStart(COLOR0); assertTransitionEnd(COLOR0, 2000); // reset when there is a reverse transition in progress makeReverseTransitionInProgress(2000, 1000); cb.reset(); mTransitionDrawable.resetTransition(); assertTrue(cb.hasCalledInvalidateDrawable()); assertTransitionStart(COLOR0); assertTransitionEnd(COLOR0, 2000); }
public void onDragExit(DragObject d) { super.onDragExit(d); if (!d.dragComplete) { mCurrentDrawable.resetTransition(); setTextColor(mOriginalTextColor); } }
private void makeReverseTransitionInProgress(int duration, int delay) { mTransitionDrawable.resetTransition(); mTransitionDrawable.startTransition(2000); assertTransition(COLOR0, COLOR1, 2000); mTransitionDrawable.reverseTransition(duration); assertTransitionStart(COLOR1); assertTransitionInProgress(COLOR1, COLOR0, delay); }
private void stopLightControl() { switch (mCurrentMode) { case R.id.mode_lightbulb: case R.id.mode_viewfinder: // kill any ongoing transition so it's not still finishing when we resume mDrawable.resetTransition(); break; } }
private void makeBadgeVisible() { synchronized (lock) { // show the badge, canceling the "fade out" animation if necessary TransitionDrawable transitionDrawable = (TransitionDrawable) badgeLinearLayout.getBackground(); transitionDrawable.resetTransition(); if (badgeTextView.getAnimation() != null) { badgeTextView.clearAnimation(); } badgeTextView.setVisibility(View.VISIBLE); badgeLinearLayout.setVisibility(View.VISIBLE); } }
@Override public void onDragStart(DragSource source, Object info, int dragAction) { boolean isVisible = true; // Hide this button unless we are dragging something from AllApps if (!isFromAllApps(source)) { isVisible = false; } mActive = isVisible; mDrawable.resetTransition(); setTextColor(mOriginalTextColor); ((ViewGroup) getParent()).setVisibility(isVisible ? View.VISIBLE : View.GONE); }
@Override public void onDragStart(DragSource source, Object info, int dragAction) { boolean isVisible = true; // If we are dragging a widget or shortcut, hide the info target if (!isAllAppsApplication(source, info)) { isVisible = false; } mActive = isVisible; mDrawable.resetTransition(); setTextColor(mOriginalTextColor); ((ViewGroup) getParent()).setVisibility(isVisible ? View.VISIBLE : View.GONE); }
@Override public void onStart() { super.onStart(); if (hasServerChanged) { updateServerState(); } if (isLoggedIn()) logo.startTransition(0); else logo.resetTransition(); tabManager.showTab(); running = true; }
public void onDragStart(DragSource source, Object info, int dragAction) { final ItemInfo item = (ItemInfo) info; if (item != null) { mTrashMode = true; createAnimations(); final int[] location = mLocation; getLocationOnScreen(location); mRegion.set( location[0], location[1], location[0] + mRight - mLeft, location[1] + mBottom - mTop); mDragController.setDeleteRegion(mRegion); mTransition.resetTransition(); startAnimation(mInAnimation); mHandle.startAnimation(mHandleOutAnimation); setVisibility(VISIBLE); } }
@Override public void onDragStart(DragSource source, Object info, int dragAction) { final ItemInfo item = (ItemInfo) info; if (item != null) { mLauncher.switchScreenMode(true); mTrashMode = true; createAnimations(); final int paddingTop = ((ViewGroup) mLauncher.getWindow().getDecorView()).getChildAt(0).getPaddingTop(); final int[] location = mLocation; getLocationOnScreen(location); mRegion.set( location[0], location[1] - paddingTop, location[0] + mRight - mLeft, location[1] + mBottom - mTop - paddingTop); mDragController.setDeleteRegion(mRegion); mTransition.resetTransition(); startAnimation(mInAnimation); // mHandle.startAnimation(mHandleOutAnimation); setVisibility(VISIBLE); } }
@Override public void onDragStart(DragSource source, Object info, int dragAction) { boolean isVisible = true; boolean isUninstall = false; // If we are dragging a widget from AppsCustomize, hide the delete target if (isAllAppsWidget(source, info)) { isVisible = false; } // If we are dragging an application from AppsCustomize, only show the control if we can // delete the app (it was downloaded), and rename the string to "uninstall" in such a case if (isAllAppsApplication(source, info)) { ApplicationInfo appInfo = (ApplicationInfo) info; if ((appInfo.flags & ApplicationInfo.DOWNLOADED_FLAG) != 0) { isUninstall = true; } else { isVisible = false; } } if (isUninstall) { setCompoundDrawablesWithIntrinsicBounds(mUninstallDrawable, null, null, null); } else { setCompoundDrawablesWithIntrinsicBounds(mRemoveDrawable, null, null, null); } mCurrentDrawable = (TransitionDrawable) getCompoundDrawables()[0]; mActive = isVisible; mCurrentDrawable.resetTransition(); setTextColor(mOriginalTextColor); ((ViewGroup) getParent()).setVisibility(isVisible ? View.VISIBLE : View.GONE); if (getText().length() > 0) { setText(isUninstall ? R.string.delete_target_uninstall_label : R.string.delete_target_label); } }
@Override public void onAnimationEnd(Animator animation) { mDetail.setVisibility(View.GONE); mBackground.resetTransition(); mAnimator = null; };
public void onDragStart(View v, DragSource source, Object info, int dragAction) { if (mPosition == -1) { int position = MyLauncherSettingsHelper.getDeletezoneStyle(getContext()); setPosition(position); } if (mPosition == POSITION_NONE) return; final ItemInfo item = (ItemInfo) info; mUninstallPkg = null; if (item != null) { mTrashMode = true; createAnimations(); final int[] location = mLocation; getLocationOnScreen(location); if (mPosition == POSITION_BOTTOM_SHRINK) { mLauncher.getWorkspace().setPadding(0, 0, 0, mStatusBarHeight); mLauncher.setDockPadding(mStatusBarHeight); mLauncher.fullScreenTemporary(true); } else if (mPosition == POSITION_TOP_SHRINK) { mLauncher.getWorkspace().setPadding(0, mStatusBarHeight, 0, 0); mLauncher.fullScreenTemporary(true); if (mLauncher.isScreenLandscape()) { mLauncher.setDockPadding(-mStatusBarHeight); } else { mLauncher.setDockPadding(0); } } mLauncher.getWorkspace().requestLayout(); mRegion.set( location[0], location[1], location[0] + getRight() - getLeft(), location[1] + getBottom() - getTop()); mDragLayer.setDeleteRegion(mRegion); mTransition.resetTransition(); startAnimation(mInAnimation); setVisibility(VISIBLE); // ADW Store app data for uninstall if its an Application // ADW Thanks to irrenhaus@xda & Rogro82@xda :) if (item instanceof ApplicationInfo) { try { final ApplicationInfo appInfo = (ApplicationInfo) item; if (appInfo.iconResource != null) mUninstallPkg = appInfo.iconResource.packageName; else { PackageManager mgr = DeleteZone.this.getContext().getPackageManager(); ResolveInfo res = mgr.resolveActivity(appInfo.intent, 0); mUninstallPkg = res.activityInfo.packageName; } // Dont uninstall ADW ;-) if (this.getClass().getPackage().getName().equals(mUninstallPkg)) mUninstallPkg = null; } catch (Exception e) { Log.w(LOG_TAG, "Could not load shortcut icon: " + item); mUninstallPkg = null; } } else if (item instanceof LauncherAppWidgetInfo) { LauncherAppWidgetInfo appwidget = (LauncherAppWidgetInfo) item; final AppWidgetProviderInfo aw = AppWidgetManager.getInstance(mLauncher).getAppWidgetInfo(appwidget.appWidgetId); if (aw != null) mUninstallPkg = aw.provider.getPackageName(); } } }
@Override public void onDragStart(DragSource source, Object info, int dragAction) { boolean isVisible = true; boolean isUninstall = false; // If we are dragging a widget from AppsCustomize, hide the delete target if (isAllAppsWidget(source, info)) { isVisible = false; } // If we are dragging an application from AppsCustomize, only show the control if we can // delete the app (it was downloaded), and rename the string to "uninstall" in such a case if (isAllAppsApplication(source, info)) { ApplicationInfo appInfo = (ApplicationInfo) info; if ((appInfo.flags & ApplicationInfo.DOWNLOADED_FLAG) != 0) { isUninstall = true; } else { isVisible = false; } } if (isUninstall) { setCompoundDrawablesWithIntrinsicBounds(mUninstallDrawable, null, null, null); } else { setCompoundDrawablesWithIntrinsicBounds(mRemoveDrawable, null, null, null); } mCurrentDrawable = (TransitionDrawable) getCompoundDrawables()[0]; mActive = isVisible; mCurrentDrawable.resetTransition(); setTextColor(mOriginalTextColor); ((ViewGroup) getParent()).setVisibility(isVisible ? View.VISIBLE : View.GONE); if (getText().length() > 0) { setText(isUninstall ? R.string.delete_target_uninstall_label : R.string.delete_target_label); } Resources res = getResources(); if (isUninstall) { setPadding( res.getDimensionPixelOffset(R.dimen.uninstall_padding_left), getPaddingTop(), getPaddingRight(), getPaddingBottom()); } else { setPadding( res.getDimensionPixelOffset(R.dimen.remove_padding_left), getPaddingTop(), getPaddingRight(), getPaddingBottom()); } if (LauncherLog.DEBUG) { LauncherLog.d( DragController.TAG, "DeleteDropTarget onDragStart: isUninstall = " + isUninstall + ",isVisible = " + isVisible + ",info = " + info); } }