@Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout containing a title and body text.
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.estadistica_view, container, false);

    int idEstadistica = this.mPageNumber;

    // Titulo y descripcion de estadistica
    TextView tituloEstadistica = (TextView) rootView.findViewById(R.id.TxtTituloEstadistica);
    TextView descEstadistica = (TextView) rootView.findViewById(R.id.TxtDescEstadistica);

    tituloEstadistica.setText(RelacionEstadisticas.getRelacion().get(idEstadistica).getTitulo());
    descEstadistica.setText(RelacionEstadisticas.getRelacion().get(idEstadistica).getDescripcion());

    rootView.addView(
        new EstadisticaViewLayout(Utilidades.getAppContext())
            .getView(RelacionEstadisticas.getRelacion().get(idEstadistica)));
    // }
    // catch (Exception e)
    // {
    //	Toast.makeText(Utilidades.getAppContext(), "error: " + e.getLocalizedMessage(),
    // Toast.LENGTH_LONG).show();
    //	Log.e("ERROR", e.getLocalizedMessage());
    // }
    // Set the title view to show the page number.
    /*((TextView) rootView.findViewById(android.R.id.text1)).setText(
    getString(R.string.title_template_step, mPageNumber + 1));*/

    return rootView;
  }
    @Override
    public View getChildView(
        int groupPosition,
        int childPosition,
        boolean isLastChild,
        View convertView,
        ViewGroup parent) {
      ViewGroup item;

      if (convertView != null && convertView.getId() == R.id.child_item) {
        // We can reuse the view
        item = (ViewGroup) convertView;
      } else {
        // We create a new View
        item = (ViewGroup) inflater.inflate(R.layout.child_item_layout, parent, false);
      }

      ChildClass child = (ChildClass) getChild(groupPosition, childPosition);

      TextView nameView = (TextView) item.findViewById(R.id.child_name);
      nameView.setText(child.getName());

      TextView sizeView = (TextView) item.findViewById(R.id.child_text);
      sizeView.setText(child.getText());

      return item;
    }
  /** @Method: openPopupwin @Description: popupwindow�����ü���Ӧ */
  private void openPopupwin() {

    LayoutInflater mLayoutInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
    ViewGroup menuView = (ViewGroup) mLayoutInflater.inflate(R.layout.gridview_popx, null, true);
    menuGrid = (GridView) menuView.findViewById(R.id.popgridview);
    menuGrid.setAdapter(getMenuAdapter(menu_name_array, menu_image_array));
    // menuGrid������
    menuGrid.requestFocus();

    // ����popupwindow���������Ϣ
    menuGrid.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            menuPopupWindow.dismiss();
            if (arg2 == 0) { // �ϴ�
              albumPopupwin();
            } else if (arg2 == 1) // �༭
            {
              Intent intent = new Intent(LocalImageView.this, PictureEditActivity.class);
              intent.putExtra("photopath", photoPath);
              startActivity(intent);
            } else if (arg2 == 2) // ɾ��
            {
              sureToDelete();
            }
          }
        });

    // ���㵽��gridview�ϣ�������Ҫ����˴��ļ����¼����������ֲ���Ӧ�����¼������
    menuGrid.setOnKeyListener(
        new OnKeyListener() {
          @Override
          public boolean onKey(View v, int keyCode, KeyEvent event) {
            switch (keyCode) {
              case KeyEvent.KEYCODE_MENU:
                if (menuPopupWindow != null && menuPopupWindow.isShowing()) {
                  menuPopupWindow.dismiss();
                }
                break;
            }
            System.out.println("menuGridfdsfdsfdfd");
            return true;
          }
        });

    // ��ʾpopupwindow
    menuPopupWindow =
        new PopupWindow(menuView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, true);
    menuPopupWindow.setBackgroundDrawable(new BitmapDrawable());
    menuPopupWindow.setAnimationStyle(R.style.PopupAnimation);
    menuPopupWindow.showAtLocation(
        findViewById(R.id.filpperparent), Gravity.BOTTOM | Gravity.BOTTOM, 0, 0);
    menuPopupWindow.update();
  }
    @Override
    public View getGroupView(
        int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
      ViewGroup item;

      if (convertView != null && convertView.getId() == R.id.group_item) {
        // We can reuse the View
        item = (ViewGroup) convertView;
      } else {
        // We create a new View
        item = (ViewGroup) inflater.inflate(R.layout.group_item_layout, parent, false);
      }

      GroupClass group = (GroupClass) getGroup(groupPosition);

      TextView nameView = (TextView) item.findViewById(R.id.group_name);
      nameView.setText(group.getName());

      TextView sizeView = (TextView) item.findViewById(R.id.group_size);
      sizeView.setText("" + group.getChildren().size());

      return item;
    }
	public void setDrawerContentView(int layout_id) {
		
		LayoutInflater inflater = LayoutInflater.from(this);
		rightSideAppScreenView = inflater.inflate(layout_id, null);
		mAttachedViewID = rightSideAppScreenView.getId();
		
		mHeaderRelativeLayout = (RelativeLayout)rightSideAppScreenView.findViewById(R.id.navigation_header);
		
		mTitleTextView = (TextView)mHeaderRelativeLayout.findViewById(R.id.tv_header_title);
		mSubtitleTextView = (TextView)mHeaderRelativeLayout.findViewById(R.id.tv_header_subtitle);
		mHeaderImageView = (ImageView)mHeaderRelativeLayout.findViewById(R.id.iv_header_icon);
		
		mTimeTrackerTextView = (TextView) mHeaderRelativeLayout.findViewById(R.id.menu_header_time_tracker);
		mTimerLayout = (LinearLayout)mHeaderRelativeLayout.findViewById(R.id.timer_layout);
		
		mSubtitleTextView.setOnClickListener(this);
		mTimeTrackerTextView.setOnClickListener(this);
		mTimerLayout.setOnClickListener(this);

		ViewGroup tabBar = (ViewGroup) rightSideAppScreenView.findViewById(mAttachedViewID);

		btnSlide = (ImageButton) tabBar.findViewById(R.id.bt_slider);
		btnSlide.setVisibility(View.VISIBLE);

		mSliderClickListener = new ClickListenerForScrolling(mSliderView, leftSideListView, menuOut);
		btnSlide.setOnClickListener(mSliderClickListener);
		
		mHomeBtnLayout = (LinearLayout)mHeaderRelativeLayout.findViewById(R.id.home_layout);
		if(mHomeBtnLayout!= null)
		{
			mHomeBtnLayout.setOnClickListener(mSliderClickListener);
		}

		View[] children = new View[] { leftSideListView, rightSideAppScreenView };

		int scrollToViewIdx = 1;

		mSliderView.initViews(children, scrollToViewIdx, new SizeCallbackForMenu(btnSlide));
		
		setSubTitle(AppConfig.getAppConfigInstance(this).getUserName());
	     setTitle(getResources().getString(R.string.app_title));
		
		displayHeaderMenuBar();
		//If learn mode is active, the titlebar color must be changed.
		if (AppConfig.getAppConfigInstance(this).getDeviceSynched())
			mPresenter.checkLearnMode(this, rightSideAppScreenView,
					mSubtitleTextView);
	}
  @SuppressLint("ResourceAsColor")
  @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
  @Override
  public boolean onTouch(final View view, MotionEvent event) {
    if (mViewWidth < 2) {
      mViewWidth = mListView.getWidth();
      smallWidth = mViewWidth / 7;
      textwidth2 = mViewWidth / 3;
      textwidth = textwidth2;
      //            原版
      //            largewidth	=	textwidth+textwidth2;
      //           自己修改
      largewidth = textwidth;
    }

    int tempwidth = 0;
    if (SwipeType == 1) tempwidth = smallWidth;
    else tempwidth = textwidth2 / 2;

    switch (event.getActionMasked()) {
      case MotionEvent.ACTION_DOWN:
        {
          if (mPaused) {
            return false;
          }
          Rect rect = new Rect();
          int childCount = mListView.getChildCount();
          int[] listViewCoords = new int[2];
          mListView.getLocationOnScreen(listViewCoords);
          int x = (int) event.getRawX() - listViewCoords[0];
          int y = (int) event.getRawY() - listViewCoords[1];
          ViewGroup child;
          for (int i = 0; i < childCount; i++) {
            child = (ViewGroup) mListView.getChildAt(i);
            child.getHitRect(rect);
            if (rect.contains(x, y)) {
              mDownView_parent = child;
              mDownView = (ViewGroup) child.findViewById(R.id.list_display_view_container);
              if (mDownView_parent.getChildCount() == 1) {
                textheight = mDownView_parent.getHeight();
                if (SwipeType == Dismiss) {
                  HalfColor = singleColor;
                  //                                HalfDrawable	=
                  //	activity.getResources().getDrawable(R.drawable.content_discard);
                }
                SetBackGroundforList();
              }

              if (old_mDownView != null && mDownView != old_mDownView) {
                ResetListItem(old_mDownView);
                old_mDownView = null;
                return false;
              }
              break;
            }
          }

          if (mDownView != null) {
            mDownX = event.getRawX();
            mDownY = event.getRawY();
            mDownPosition = mListView.getPositionForView(mDownView);
            mVelocityTracker = VelocityTracker.obtain();
            mVelocityTracker.addMovement(event);
          } else {
            mDownView = null;
          }

          // mSwipeDetected              =   false;
          temp_position = mListView.pointToPosition((int) event.getX(), (int) event.getY());
          view.onTouchEvent(event);
          return true;
        }

      case MotionEvent.ACTION_UP:
        {
          if (mVelocityTracker == null) {
            break;
          }
          float deltaX = event.getRawX() - mDownX;
          // 在OnItemClick事件中判断如果Deltax!=0则表示不是点击事件
          DeltaX = deltaX;
          mVelocityTracker.addMovement(event);
          mVelocityTracker.computeCurrentVelocity(1000); // 1000 by defaut but
          float velocityX = mVelocityTracker.getXVelocity(); // it was too much
          float absVelocityX = Math.abs(velocityX);
          float absVelocityY = Math.abs(mVelocityTracker.getYVelocity());
          boolean swipe = false;
          boolean swipeRight = false;

          if (Math.abs(deltaX) > tempwidth) {
            swipe = true;
            swipeRight = deltaX > 0;

          } else if (mMinFlingVelocity <= absVelocityX
              && absVelocityX <= mMaxFlingVelocity
              && absVelocityY < absVelocityX) {
            // dismiss only if flinging in the same direction as dragging
            swipe = (velocityX < 0) == (deltaX < 0);
            swipeRight = mVelocityTracker.getXVelocity() > 0;
          }
          if (deltaX < 0 && swipe) {
            mListView.setDrawSelectorOnTop(false);
            // && Math.abs(DeltaY)<30
            if (swipe && !swipeRight && deltaX <= -tempwidth && Math.abs(DeltaY) < 100) {
              FullSwipeTrigger();
            } else if (deltaX >= -textwidth && SwipeType == Double) {
              ResetListItem(mDownView);
            } else {
              ResetListItem(mDownView);
            }
          } else if (deltaX != 0) {
            ResetListItem(mDownView);
          }

          mVelocityTracker.recycle();
          mVelocityTracker = null;
          mDownX = 0;
          mDownView = null;
          mDownPosition = ListView.INVALID_POSITION;
          mSwiping = false;
          break;
        }

        // 根据手势滑动方向滑出滑入

      case MotionEvent.ACTION_MOVE:
        {
          float deltaX = event.getRawX() - mDownX;
          float deltaY = event.getRawY() - mDownY;
          DeltaY = deltaY;
          if (mVelocityTracker == null || mPaused || deltaX > 0) {
            break;
          }

          mVelocityTracker.addMovement(event);

          // && Math.abs(deltaY)<30
          if (Math.abs(deltaX) > (mSlop * 5) && Math.abs(deltaY) < 50) {
            mSwiping = true;
            mListView.requestDisallowInterceptTouchEvent(true);

            // Cancel ListView's touch (un-highlighting the item)
            MotionEvent cancelEvent = MotionEvent.obtain(event);
            cancelEvent.setAction(
                MotionEvent.ACTION_CANCEL
                    | (event.getActionIndex() << MotionEvent.ACTION_POINTER_INDEX_SHIFT));
            mListView.onTouchEvent(cancelEvent);
            cancelEvent.recycle();
          } else if (Math.abs(deltaY) > 50) {
            mSwiping = false;
            //                     ResetListItem(mDownView);
          }
          System.out.println(
              "<<<<<<<<<" + deltaY + "<<<<<<" + deltaX + "<<<<" + mSwiping + "<<<<<" + mSlop * 10);
          if (mSwiping && deltaX < 0) {
            int width;
            //                     if(SwipeType==1){
            width = textwidth2;
            //                     }
            //                     else{
            //                         width	=	largewidth;
            //                     }

            if (-deltaX < width) {

              mDownView.setTranslationX(deltaX);
              return false;
            }
            return false;
          } else if (mSwiping) {
            ResetListItem(mDownView);
          }
          break;
        }
    }
    return false;
  }
  /** @Method: albumPopupwin @Description: menuPopupwindow�����ü���Ӧ */
  private void albumPopupwin() {

    ListView popList;
    ImageView popImage;
    SimpleAdapter adapter;
    List<Map<String, Object>> foldersList = new ArrayList<Map<String, Object>>();

    LayoutInflater mLayoutInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
    ViewGroup menuView = (ViewGroup) mLayoutInflater.inflate(R.layout.listview_pop, null, true);
    popList = (ListView) menuView.findViewById(R.id.poplistview);
    popImage = (ImageView) menuView.findViewById(R.id.poplistviewimage);
    // popwindow �ı���
    popImage.setImageDrawable(getResources().getDrawable(R.drawable.pop_titleimg));

    // ��������ʽ
    adapter =
        new SimpleAdapter(
            this,
            foldersList,
            R.layout.smallinsidelistview,
            new String[] {"albumName", "picnum", "img"},
            new int[] {R.id.smalluserName, R.id.smallipInfo, R.id.smalluserImg});
    popList.setAdapter(adapter);

    foldersList.clear();

    for (int i = 1; i < albumArray.length; i += 2) {
      HashMap<String, Object> map = new HashMap<String, Object>();
      map.put("albumName", albumArray[i]);
      map.put("picnum", albumArray[i + 1] + "��");
      map.put("img", R.drawable.folder);
      foldersList.add(map);
      adapter.notifyDataSetChanged();
    }

    popList.requestFocus();
    popList.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            Log.d("debug", albumArray.length + "");
            choosedAlbum = albumArray[arg2 * 2 + 1];
            uploadThread = new Thread(uploadRunnable); // ����һ�����߳�
            uploadThread.start();
            albumPopupWindow.dismiss(); // ���ѡ���
            showProgress(); // �����
          }
        });
    popList.setOnKeyListener(
        new OnKeyListener() { // ���㵽��gridview�ϣ�������Ҫ����˴��ļ����¼����������ֲ���Ӧ�����¼������
          @Override
          public boolean onKey(View v, int keyCode, KeyEvent event) {
            switch (keyCode) {
              case KeyEvent.KEYCODE_MENU:
                if (albumPopupWindow != null && albumPopupWindow.isShowing()) {
                  albumPopupWindow.dismiss();
                }
                break;
            }
            System.out.println("menuGridfdsfdsfdfd");
            return true;
          }
        });

    int poplength = (albumArray.length - 1) * 53 + 65;
    Log.d("10", albumArray.length + "");
    if (poplength > 595) poplength = 595;
    albumPopupWindow = new PopupWindow(menuView, 300, poplength, true);
    albumPopupWindow.setBackgroundDrawable(new BitmapDrawable());
    albumPopupWindow.setAnimationStyle(R.style.PopupAnimation);
    albumPopupWindow.showAtLocation(findViewById(R.id.filpperparent), Gravity.CENTER, 0, 0);
    albumPopupWindow.update();
  }