@Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    // Get the individual components
    mDropTargetBar = findViewById(R.id.drag_target_bar);
    mInfoDropTarget = (ButtonDropTarget) mDropTargetBar.findViewById(R.id.info_target_text);
    mDeleteDropTarget = (ButtonDropTarget) mDropTargetBar.findViewById(R.id.delete_target_text);

    mInfoDropTarget.setSearchDropTargetBar(this);
    mDeleteDropTarget.setSearchDropTargetBar(this);

    mEnableDropDownDropTargets =
        getResources().getBoolean(R.bool.config_useDropTargetDownTransition);

    // Create the various fade animations
    if (mEnableDropDownDropTargets) {
      LauncherAppState app = LauncherAppState.getInstance();
      DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
      mBarHeight = grid.searchBarSpaceHeightPx;
      mDropTargetBar.setTranslationY(-mBarHeight);
      mDropTargetBarAnim =
          LauncherAnimUtils.ofFloat(mDropTargetBar, "translationY", -mBarHeight, 0f);

    } else {
      mDropTargetBar.setAlpha(0f);
      mDropTargetBarAnim = LauncherAnimUtils.ofFloat(mDropTargetBar, "alpha", 0f, 1f);
    }
    setupAnimation(mDropTargetBarAnim, mDropTargetBar);
  }
 public void enableAccessibleDrag(boolean enable) {
   if (mQSBSearchBar != null) {
     mQSBSearchBar.setVisibility(enable ? View.GONE : View.VISIBLE);
   }
   mInfoDropTarget.enableAccessibleDrag(enable);
   mDeleteDropTarget.enableAccessibleDrag(enable);
   mUninstallDropTarget.enableAccessibleDrag(enable);
 }
  public void setup(Launcher launcher, DragController dragController) {
    dragController.addDragListener(this);
    dragController.setFlingToDeleteDropTarget(mDeleteDropTarget);

    dragController.addDragListener(mInfoDropTarget);
    dragController.addDragListener(mDeleteDropTarget);
    dragController.addDragListener(mUninstallDropTarget);

    dragController.addDropTarget(mInfoDropTarget);
    dragController.addDropTarget(mDeleteDropTarget);
    dragController.addDropTarget(mUninstallDropTarget);

    mInfoDropTarget.setLauncher(launcher);
    mDeleteDropTarget.setLauncher(launcher);
    mUninstallDropTarget.setLauncher(launcher);
  }
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    // Get the drawable
    mOriginalTextColor = getTextColors();

    // Get the hover color
    Resources r = getResources();
    mHoverColor = r.getColor(R.color.delete_target_hover_tint);
    mHoverPaint.setColorFilter(new PorterDuffColorFilter(mHoverColor, PorterDuff.Mode.SRC_ATOP));
    mUninstallDrawable = (TransitionDrawable) r.getDrawable(R.drawable.uninstall_target_selector);
    mRemoveDrawable = (TransitionDrawable) r.getDrawable(R.drawable.remove_target_selector);

    mRemoveDrawable.setCrossFadeEnabled(true);
    mUninstallDrawable.setCrossFadeEnabled(true);

    // The current drawable is set to either the remove drawable or the uninstall drawable
    // and is initially set to the remove drawable, as set in the layout xml.
    mCurrentDrawable = (TransitionDrawable) getCompoundDrawables()[0];

    // Remove the text in the Phone UI in landscape
    int orientation = getResources().getConfiguration().orientation;
    if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
      if (!LauncherApplication.isScreenLarge()) {
        setText("");
      }
    }
  }
 public void setup(Launcher launcher, DragController dragController) {
   dragController.addDragListener(this);
   dragController.addDragListener(mInfoDropTarget);
   dragController.addDragListener(mDeleteDropTarget);
   dragController.addDropTarget(mInfoDropTarget);
   dragController.addDropTarget(mDeleteDropTarget);
   dragController.setFlingToDeleteDropTarget(mDeleteDropTarget);
   mInfoDropTarget.setLauncher(launcher);
   mDeleteDropTarget.setLauncher(launcher);
   mQSBSearchBar = launcher.getQsbBar();
   if (mEnableDropDownDropTargets) {
     mQSBSearchBarAnim = LauncherAnimUtils.ofFloat(mQSBSearchBar, "translationY", 0, -mBarHeight);
   } else {
     mQSBSearchBarAnim = LauncherAnimUtils.ofFloat(mQSBSearchBar, "alpha", 1f, 0f);
   }
   setupAnimation(mQSBSearchBarAnim, mQSBSearchBar);
 }
Пример #6
0
  public void onDragExit(DragObject d) {
    super.onDragExit(d);

    if (!d.dragComplete) {
      // mDrawable.resetTransition();
      setTextColor(mOriginalTextColor);
    }
  }
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    // Get the individual components
    mDropTargetBar = findViewById(R.id.drag_target_bar);
    mInfoDropTarget = (ButtonDropTarget) mDropTargetBar.findViewById(R.id.info_target_text);
    mDeleteDropTarget = (ButtonDropTarget) mDropTargetBar.findViewById(R.id.delete_target_text);
    mUninstallDropTarget =
        (ButtonDropTarget) mDropTargetBar.findViewById(R.id.uninstall_target_text);

    mInfoDropTarget.setSearchDropTargetBar(this);
    mDeleteDropTarget.setSearchDropTargetBar(this);
    mUninstallDropTarget.setSearchDropTargetBar(this);

    // Create the various fade animations
    mDropTargetBar.setAlpha(0f);
    mShowDropTargetBarAnim = LauncherAnimUtils.ofFloat(mDropTargetBar, "alpha", 0f, 1f);
    setupAnimation(mShowDropTargetBarAnim, mDropTargetBar);
  }
Пример #8
0
  public void onDragEnter(DragObject d) {
    super.onDragEnter(d);

    if (mUninstall) {
      mHandler.removeCallbacks(mShowUninstaller);
      mHandler.postDelayed(mShowUninstaller, 1000);
    }

    setCompoundDrawablesWithIntrinsicBounds(mRemoveActiveDrawable, null, null, null);
    mCurrentDrawable = getCompoundDrawables()[0];
    setTextColor(mHoverColor);
  }
Пример #9
0
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    mOriginalTextColor = getTextColors();

    // Get the hover color
    Resources r = getResources();
    mHoverColor = r.getColor(R.color.info_target_hover_tint);
    // mDrawable = (TransitionDrawable) getCurrentDrawable();
    // mDrawable.setCrossFadeEnabled(true);

    // Remove the text in the Phone UI in landscape
    int orientation = getResources().getConfiguration().orientation;
    if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
      if (!LauncherApplication.isScreenLarge()) {
        setText("");
      }
    }
  }
Пример #10
0
  public void onDragExit(DragObject d) {
    super.onDragExit(d);

    mHandler.removeCallbacks(mShowUninstaller);

    if (!d.dragComplete) {
      mMode = MODE_DELETE;

      if (getText().length() > 0) {
        if (isAllAppsItem(d.dragSource, d.dragInfo)) {
          setText(R.string.cancel_target_label);
        } else {
          setText(R.string.delete_target_label);
        }
      }

      setCompoundDrawablesWithIntrinsicBounds(mRemoveNormalDrawable, null, null, null);
      mCurrentDrawable = getCompoundDrawables()[0];
      setTextColor(mOriginalTextColor);
    }
  }
Пример #11
0
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    // Get the drawable
    mOriginalTextColor = getTextColors();

    // Get the hover color
    Resources r = getResources();
    mHoverColor = r.getColor(R.color.delete_target_hover_tint);
    mHoverPaint.setColorFilter(new PorterDuffColorFilter(mHoverColor, PorterDuff.Mode.SRC_ATOP));
    mUninstallActiveDrawable = r.getDrawable(R.drawable.ic_launcher_trashcan_active_holo);
    mRemoveActiveDrawable = r.getDrawable(R.drawable.ic_launcher_clear_active_holo);
    mRemoveNormalDrawable = r.getDrawable(R.drawable.ic_launcher_clear_normal_holo);

    // Remove the text in the Phone UI in landscape
    int orientation = getResources().getConfiguration().orientation;
    if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
      if (!LauncherApplication.isScreenLarge()) {
        setText("");
      }
    }
  }
Пример #12
0
  public void onDragEnter(DragObject d) {
    super.onDragEnter(d);

    // mDrawable.startTransition(mTransitionDuration);
    setTextColor(mHoverColor);
  }
Пример #13
0
 @Override
 public void onDragEnd() {
   super.onDragEnd();
   mActive = false;
 }