protected void changeWorkspaceGridSize(int x, int y) {
    //        android.util.Log.i("QsLog", "changeWorkspaceGridSize====="
    //                +"==x:"+mSharePrefManager.getWorkspaceCountCellX()
    //                +"==y:"+mSharePrefManager.getWorkspaceCountCellY()
    //                +"==x:"+x
    //                  +"==y:"+y);

    if (x > 0
        && y > 0
        && (x != mSharePrefManager.getWorkspaceCountCellX()
            || y != mSharePrefManager.getWorkspaceCountCellY())) {

      mLauncher.changeWorkspaceGridSize(mSharePrefManager, x, y, mUpdateGridComplete);

      int count = mWorkspaceGridContainer.getChildCount();
      for (int i = 0; i < count; i++) {
        final View child = mWorkspaceGridContainer.getChildAt(i);
        child.setEnabled(false);
      }
    }
  }
  public WorkspaceCustomSettings(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    mLauncher = (Launcher) context;
    mSharePrefManager = mLauncher.getSharedPrefSettingsManager();
  }
  private void initStatus() {
    View view = mAppearanceContainer.findViewWithTag("cycleslide");
    if (view != null && mWorkspace != null) {
      view.setActivated(mWorkspace.isSupportCycleSlidingScreen());
      view.setOnClickListener(this);
      view.setEnabled(true);
    }

    view = mAppearanceContainer.findViewWithTag("appicons");
    if (view != null) {
      view.setOnClickListener(this);
      view.setEnabled(true);
    }

    view = mAppearanceContainer.findViewWithTag("hotseat");
    if (view != null) {
      view.setActivated(mLauncher.isHotseatVisiable());
      view.setOnClickListener(this);
      view.setEnabled(true);
    }

    view = mAppearanceContainer.findViewWithTag("indicator");
    if (view != null && mWorkspace != null) {
      view.setActivated(mWorkspace.isScrollingIndicatorEnabled());
      view.setOnClickListener(this);
      view.setEnabled(true);
    }

    view = mAppearanceContainer.findViewWithTag("label");
    if (view != null) {
      boolean visiable =
          mSharePrefManager.getBoolean(
              ISharedPrefSettingsManager.KEY_WORKSPACE_SHOW_LABEL,
              ResConfigManager.CONFIG_SHOW_WORKSPACE_LABEL,
              true);
      view.setActivated(visiable);
      view.setOnClickListener(this);
      view.setEnabled(true);
    }

    view = mAppearanceContainer.findViewWithTag("grid");
    if (view != null) {
      view.setActivated(true);
      view.setOnClickListener(this);
      // view.setEnabled(true);
      initWorkspaceGridSize(view);
    }

    view = mAppearanceContainer.findViewWithTag("statusbar");
    if (view != null) {
      boolean isFull =
          mSharePrefManager.getBoolean(
              ISharedPrefSettingsManager.KEY_IS_FULLSCREEN,
              ResConfigManager.CONFIG_IS_FULLSCREEN,
              false);
      // android.util.Log.i("QsLog", "initStatus======isfull:"+isFull);
      view.setActivated(!isFull);
      view.setOnClickListener(this);
      view.setEnabled(true);
    }

    view = mAppearanceContainer.findViewWithTag("lock");
    if (view != null) {
      view.setActivated(mWorkspace.isEnableStaticWallpaper());
      view.setOnClickListener(this);
      view.setEnabled(true);
    }

    if (mWorkspaceGridContainer != null) {
      int count = mWorkspaceGridContainer.getChildCount();
      for (int i = 0; i < count; i++) {
        view = mWorkspaceGridContainer.getChildAt(i);
        view.setOnClickListener(mGridContainerClickListener);
        view.setEnabled(true);
      }
    }
  }
  @Override
  public void onClick(View v) {
    // TODO Auto-generated method stub
    String tag = String.valueOf(v.getTag());
    if (tag != null) {
      if (tag.equals("appicons")) {
        mLauncher.showAppIconAndTitleCustomActivity();
        Runnable processIntent =
            new Runnable() {
              public void run() {
                mLauncher.hideCustomSettingsScreen(false);
              }
            };
        super.post(processIntent);
      } else if (tag.equals("cycleslide")) {
        if (mWorkspace != null) {
          boolean enable = !mWorkspace.isSupportCycleSlidingScreen();
          mWorkspace.setSupportCycleSlidingScreen(enable);
          mSharePrefManager.setWorkspaceSupportCycleSliding(enable);
          v.setActivated(enable);
        }

      } else if (tag.equals("hotseat")) {
        boolean enable = mLauncher.isHotseatVisiable();
        if (enable) mLauncher.hideHotseat(false);
        else mLauncher.showHotseat(false);
        mSharePrefManager.setWorkspaceShowHotseatBar(!enable);
        mWorkspace.updateLayoutCustomSettingsChanged(true, null);
        v.setActivated(!enable);
        refreshPreviewView();

      } else if (tag.equals("indicator")) {
        if (mWorkspace != null) {
          boolean enable = !mWorkspace.isScrollingIndicatorEnabled();
          mWorkspace.setScrollingIndicatorEnabled(enable);
          mSharePrefManager.setWorkspaceEnableScreenIndicatorBar(enable);
          v.setActivated(enable);
          mWorkspace.updateLayoutCustomSettingsChanged(true, null);
          refreshPreviewView();
        }
      } else if (tag.equals("label")) {

        boolean visiable =
            mSharePrefManager.getBoolean(
                ISharedPrefSettingsManager.KEY_WORKSPACE_SHOW_LABEL,
                ResConfigManager.CONFIG_SHOW_WORKSPACE_LABEL,
                true);

        mLauncher.setShortcutLableVisiable(!visiable, mUpdateLabelComplete);
        v.setActivated(!visiable);
        v.setEnabled(false);

        //			    mSharePrefManager.setBoolean(ISharedPrefSettingsManager.KEY_WORKSPACE_SHOW_LABEL,
        // !visiable);
        //
        //				refreshPreviewView();
      } else if (tag.equals("grid")) {

        //			    mLauncher.changeWorkspaceGridSize(mUpdateGridComplete);
        // v.setEnabled(false);
        mWorkspaceGridContainer.setVisibility(View.VISIBLE);
        mAppearanceContainer.setVisibility(View.GONE);

      } else if (tag.equals("statusbar")) {
        final boolean isfull =
            mSharePrefManager.getBoolean(ISharedPrefSettingsManager.KEY_IS_FULLSCREEN, false);
        // android.util.Log.i("QsLog", "onClick======isfull:"+isfull);
        mLauncher.setFullscreen(!isfull);
        // android.util.Log.i("QsLog", "onClick===2===isfull:"+isfull);
        v.setActivated(isfull);
        mSharePrefManager.setBoolean(ISharedPrefSettingsManager.KEY_IS_FULLSCREEN, !isfull);
      } else if (tag.equals("lock")) {
        if (mWorkspace != null) {
          boolean enable = !mWorkspace.isEnableStaticWallpaper();
          mWorkspace.setEnableStaticWallpaper(enable);
          mSharePrefManager.setEnableStaticWallpaper(enable);
          v.setActivated(enable);
          mWorkspace.syncWallpaperOffsetWithScroll();
        }
      }
    }
  }