@Override
  public void onResume() {
    super.onResume();

    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT)
      getActivity()
          .getActionBar()
          .setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext));
  }
  /** Applies KitKat specific translucency. */
  private void applyKitKatTranslucency() {
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {

      // Calculate ActionBar and navigation bar height.
      TypedValue tv = new TypedValue();
      int actionBarHeight = 0;
      if (getActivity().getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
        actionBarHeight =
            TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics());
      }

      mListView.setBackgroundColor(0xFFEEEEEE);
      mRootView.setPadding(0, actionBarHeight + mApp.getStatusBarHeight(mContext), 0, 0);
      mListView.setPadding(10, 0, 10, mApp.getNavigationBarHeight(mContext));
      mListView.setClipToPadding(false);

      // Set the window color.
      getActivity()
          .getWindow()
          .setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext));
    }
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mRootView = inflater.inflate(R.layout.fragment_grid_view, container, false);
    mContext = getActivity().getApplicationContext();
    mApp = (Common) mContext;
    mFragment = this;

    // Set the background color and the partial color bleed.
    mRootView.setBackgroundColor(UIElementsHelper.getBackgroundColor(mContext));

    // Grab the fragment. This will determine which data to load into the cursor.
    mFragmentId = getArguments().getInt(Common.FRAGMENT_ID);
    mFragmentTitle = getArguments().getString(MainActivity.FRAGMENT_HEADER);
    mDBColumnsMap = new HashMap<Integer, String>();

    mQuickScroll = (QuickScrollGridView) mRootView.findViewById(R.id.quickscrollgrid);

    // Set the adapter for the outer gridview.
    mGridView = (GridView) mRootView.findViewById(R.id.generalGridView);
    mGridViewContainer =
        (RelativeLayout) mRootView.findViewById(R.id.fragment_grid_view_frontal_layout);
    mGridView.setVerticalScrollBarEnabled(false);

    // Set the number of gridview columns based on the screen density and orientation.
    if (mApp.isPhoneInLandscape() || mApp.isTabletInLandscape()) {
      mGridView.setNumColumns(4);
    } else if (mApp.isPhoneInPortrait()) {
      mGridView.setNumColumns(2);
    } else if (mApp.isTabletInPortrait()) {
      mGridView.setNumColumns(3);
    }

    // KitKat translucent navigation/status bar.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      int topPadding = Common.getStatusBarHeight(mContext);

      // Calculate navigation bar height.
      int navigationBarHeight = 0;
      int resourceId = getResources().getIdentifier("navigation_bar_height", "dimen", "android");
      if (resourceId > 0) {
        navigationBarHeight = getResources().getDimensionPixelSize(resourceId);
      }

      mGridViewContainer.setPadding(0, topPadding, 0, 0);
      mGridView.setClipToPadding(false);
      mGridView.setPadding(0, mGridView.getPaddingTop(), 0, navigationBarHeight);
      mQuickScroll.setPadding(0, 0, 0, navigationBarHeight);
    }

    // Set the empty views.
    mEmptyTextView = (TextView) mRootView.findViewById(R.id.empty_view_text);
    mEmptyTextView.setTypeface(TypefaceHelper.getTypeface(mContext, "Roboto-Light"));
    mEmptyTextView.setPaintFlags(
        mEmptyTextView.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    // Create a set of options to optimize the bitmap memory usage.
    final BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    options.inJustDecodeBounds = false;
    options.inPurgeable = true;

    mHandler.postDelayed(queryRunnable, 250);
    return mRootView;
  }
        @Override
        public void run() {
          TranslateAnimation animation =
              new TranslateAnimation(
                  Animation.RELATIVE_TO_SELF,
                  0.0f,
                  Animation.RELATIVE_TO_SELF,
                  0.0f,
                  Animation.RELATIVE_TO_SELF,
                  2.0f,
                  Animation.RELATIVE_TO_SELF,
                  0.0f);

          animation.setDuration(150);
          animation.setInterpolator(new AccelerateDecelerateInterpolator());

          mGridViewAdapter = new GridViewCardsAdapter(mContext, mFragment, mDBColumnsMap);
          // mGridView.setAdapter(mGridViewAdapter);

          // GridView animation adapter.
          final SwingBottomInAnimationAdapter animationAdapter =
              new SwingBottomInAnimationAdapter(mGridViewAdapter, 100, 150);
          animationAdapter.setShouldAnimate(true);
          animationAdapter.setShouldAnimateFromPosition(0);
          animationAdapter.setAbsListView(mGridView);
          mGridView.setAdapter(animationAdapter);
          mGridView.setOnItemClickListener(onItemClickListener);

          // Init the quick scroll widget.
          mQuickScroll.init(
              QuickScrollGridView.TYPE_INDICATOR_WITH_HANDLE,
              mGridView,
              (GridViewCardsAdapter) mGridViewAdapter,
              QuickScrollGridView.STYLE_HOLO);

          int[] quickScrollColors = UIElementsHelper.getQuickScrollColors(mContext);
          PauseOnScrollHelper scrollHelper =
              new PauseOnScrollHelper(mApp.getPicasso(), null, false, true);

          mQuickScroll.setOnScrollListener(scrollHelper);
          mQuickScroll.setPicassoInstance(mApp.getPicasso());
          mQuickScroll.setHandlebarColor(
              quickScrollColors[0], quickScrollColors[0], quickScrollColors[1]);
          mQuickScroll.setIndicatorColor(
              quickScrollColors[1], quickScrollColors[0], quickScrollColors[2]);
          mQuickScroll.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 48);

          animation.setAnimationListener(
              new AnimationListener() {

                @Override
                public void onAnimationEnd(Animation arg0) {
                  mQuickScroll.setVisibility(View.VISIBLE);
                  // animationAdapter.setShouldAnimate(false);

                }

                @Override
                public void onAnimationRepeat(Animation arg0) {
                  // TODO Auto-generated method stub

                }

                @Override
                public void onAnimationStart(Animation arg0) {
                  mGridView.setVisibility(View.VISIBLE);
                }
              });

          mGridView.startAnimation(animation);
        }