Beispiel #1
0
 public void setTextVisible(boolean visible) {
   if (visible) {
     mFolderName.setVisibility(VISIBLE);
   } else {
     mFolderName.setVisibility(INVISIBLE);
   }
 }
  private void setFolderIcon(Object dragInfo) {

    if (mIsFolderIconMode) {
      return;
    }

    if (dragInfo instanceof UserFolderInfo) {
      // it is a foler icon return
      return;
    }
    final ShortcutInfo info = (ShortcutInfo) getTag();
    if (info.container >= 0) {
      // i am in a folder return
      return;
    }
    final Bitmap mFolderIcon = info.getIcon(mLauncher.getIconCache());
    mContent.setCompoundDrawablesWithIntrinsicBounds(
        null,
        new FastBitmapDrawable(
            Utilities.makeGridFolderIcons(new Bitmap[] {mFolderIcon}, getContext())),
        null,
        null);
    showUninstallBtn(false);

    mIsFolderIconMode = true;
  }
 @Override
 protected void drawableStateChanged() {
   Drawable d = mContent.getCompoundDrawables()[1];
   if (d != null && d.isStateful()) {
     d.setState(getDrawableState());
   }
   super.drawableStateChanged();
 }
Beispiel #4
0
  void resetLayout() {
    mContent.removeAllViewsInLayout();

    // Add the Apps button
    Context context = getContext();
    LayoutInflater inflater = LayoutInflater.from(context);
    BubbleTextView allAppsButton =
        (BubbleTextView) inflater.inflate(R.layout.application_allapps, mContent, false);
    allAppsButton.setCompoundDrawablesWithIntrinsicBounds(
        null, context.getResources().getDrawable(R.drawable.all_apps_button_icon), null, null);
    allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
    allAppsButton.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            if (mLauncher != null
                && (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
              mLauncher.onTouchDownAllAppsButton(v);
            }
            return false;
          }
        });

    allAppsButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(android.view.View v) {
            if (LauncherLog.DEBUG) {
              LauncherLog.d(TAG, "Click on all apps view on hotseat: mLauncher = " + mLauncher);
            }
            if (mLauncher != null) {
              mLauncher.onClickAllAppsButton(v);
            }
          }
        });

    // Note: We do this to ensure that the hotseat is always laid out in the orientation of
    // the hotseat in order regardless of which orientation they were added
    int x = getCellXFromOrder(mAllAppsButtonRank);
    int y = getCellYFromOrder(mAllAppsButtonRank);
    CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x, y, 1, 1);
    lp.canReorder = false;
    mContent.addViewToCellLayout(allAppsButton, -1, 0, lp, true);
  }
 public boolean onTouchEvent(MotionEvent event) {
   switch (event.getAction()) {
     case MotionEvent.ACTION_DOWN:
       // if (getAnimation() != null) {
       // ItemInfo info = (ItemInfo) getTag();
       // if (info.container > 0) {
       // // this view is in a folder.
       // Folder folder = mLauncher.getOpenIphoneFolder();
       // if (folder != null) {
       // folder.startDrag(this);
       // return true;
       // }
       // } else {
       // CellLayout.CellInfo cellInfo = (CellLayout.CellInfo) ((View)
       // getParent())
       // .getTag();
       // if (cellInfo == null) {
       // Log.d(TAG, "cellinfo is null");
       // return true;
       // }
       // final View parent = (View) getParent().getParent();
       // if (parent instanceof Workspace) {
       // ((Workspace) parent).startDrag(cellInfo);
       // return true;
       // }
       // }
       // }
       mContent.setIphonePressed(true);
       break;
     case MotionEvent.ACTION_MOVE:
       break;
     case MotionEvent.ACTION_UP:
     case MotionEvent.ACTION_CANCEL:
       mContent.setIphonePressed(false);
       break;
     default:
       break;
   }
   return super.onTouchEvent(event);
 }
  private void setOrilIcon(Object dragInfo) {
    if (!mIsFolderIconMode) {
      return;
    }
    if (dragInfo instanceof UserFolderInfo) {
      // it is a foler icon return
      return;
    }
    final ShortcutInfo info = (ShortcutInfo) getTag();
    if (info.container >= 0) {
      // i am in a folder return
      return;
    }
    final Bitmap mFolderIcon = info.getIcon(mLauncher.getIconCache());
    mContent.setIphoneIcon(mFolderIcon);
    if (AnimManager.getInstance().isAnim()) showUninstallBtn(true);

    mIsFolderIconMode = false;
  }
  protected View createAndAddShortcut(ShortcutInfo item) {
    final BubbleTextView textView =
        (BubbleTextView) mInflater.inflate(R.layout.folder_application, this, false);
    textView.applyFromShortcutInfo(item, mIconCache, false);

    int color =
        SettingsProvider.getInt(
            getContext(),
            SettingsProvider.FOLDER_ICON_TEXT_COLOR,
            getResources().getColor(R.color.folder_items_text_color));
    textView.setTextColor(color);

    textView.setOnClickListener(this);
    textView.setOnLongClickListener(this);
    textView.setOnFocusChangeListener(mFocusIndicatorHandler);

    // We need to check here to verify that the given item's location isn't already occupied
    // by another item.
    if (mContent.getChildAt(item.cellX, item.cellY) != null
        || item.cellX < 0
        || item.cellY < 0
        || item.cellX >= mContent.getCountX()
        || item.cellY >= mContent.getCountY()) {
      // This shouldn't happen, log it.
      Log.e(TAG, "Folder order not properly persisted during bind");
      if (!findAndSetEmptyCells(item)) {
        return null;
      }
    }

    CellLayout.LayoutParams lp =
        new CellLayout.LayoutParams(item.cellX, item.cellY, item.spanX, item.spanY);
    boolean insert = false;
    textView.setOnKeyListener(new FolderKeyEventListener());
    mContent.addViewToCellLayout(textView, insert ? 0 : -1, (int) item.id, lp, true);
    return textView;
  }
Beispiel #8
0
 public void onTitleChanged(CharSequence title) {
   mFolderName.setText(title.toString());
   setContentDescription(String.format(mContext.getString(R.string.folder_name_format), title));
 }
Beispiel #9
0
 public boolean getTextVisible() {
   return mFolderName.getVisibility() == VISIBLE;
 }
 public void setText(CharSequence c) {
   mContent.setText(c);
 }
 public void setIphoneIcon(Bitmap icon) {
   mContent.setIphoneIcon(icon);
 }
 public void setReflectionEffect(boolean has) {
   mContent.setReflectionEffect(has);
 }