Exemplo n.º 1
0
 /** 数据有变化,则清空数据并且重建 */
 void notifyDataSetChanged() {
   // recreate all the children if the data set changes under us. We may
   // want to do this more
   // intelligently (ie just removing the views that should no longer
   // exist)
   mContent.removeAllViewsInLayout();
   bind(mInfo);
 }
Exemplo n.º 2
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);
  }
Exemplo n.º 3
0
  void resetLayout() {
    mContent.removeAllViewsInLayout();

    if (!AppsCustomizePagedView.DISABLE_ALL_APPS) {
      // Add the Apps button
      Context context = getContext();

      LayoutInflater inflater = LayoutInflater.from(context);
      TextView allAppsButton =
          (TextView) inflater.inflate(R.layout.all_apps_button, mContent, false);
      Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon);
      Utilities.resizeIconDrawable(d);
      allAppsButton.setCompoundDrawables(null, d, null, null);

      allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
      if (mLauncher != null) {
        allAppsButton.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
      }
      allAppsButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(android.view.View v) {
              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);
    }
  }