@Override
    public View getView(final int position, View convertView, ViewGroup parent) {
      View view = convertView;
      if (view == null) {
        LayoutInflater inflater =
            (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = inflater.inflate(R.layout.content_list_item, null);
      }
      TextView titleTextView = (TextView) view.findViewById(R.id.list_item_title);
      TextView stateTextView = (TextView) view.findViewById(R.id.list_item_state);
      TextView downTextView = (TextView) view.findViewById(R.id.list_item_downbar);
      Button downloadButton = (Button) view.findViewById(R.id.list_item_download_button);
      Button uploadButton = (Button) view.findViewById(R.id.list_item_upload_button);

      LocationInfo info = mInfoList.get(position);
      String titleText = info.title;
      String stateText = "";

      if (titleText.length() > 30) titleText = titleText.substring(0, 28) + "...";

      synchronized (mLoaderMap) {
        if (mLoaderMap.containsKey(info.title)) {
          LoaderState loader = mLoaderMap.get(info.title);
          if (loader.state < 100) stateText = String.format(Locale.ENGLISH, "%d%%", loader.state);
          else if (loader.state == 100) stateText = String.format(Locale.ENGLISH, "Done!");
          else stateText = String.format(Locale.ENGLISH, "Failed!");
        }
      }

      if (info.localVersion < 0) titleText += " (?)";
      else {
        if (info.localModified)
          titleText += String.format(Locale.ENGLISH, " (v. %d+)", info.localVersion);
        else titleText += String.format(Locale.ENGLISH, " (v. %d)", info.localVersion);
      }

      String mapFile = NavigineApp.Settings.getString("map_file", "");
      if (mapFile.equals(info.archiveFile)) {
        titleTextView.setTypeface(null, Typeface.BOLD);
        view.setBackgroundColor(Color.parseColor("#590E0E"));
      } else {
        titleTextView.setTypeface(null, Typeface.NORMAL);
        view.setBackgroundColor(Color.BLACK);
      }

      titleTextView.setText(titleText);
      stateTextView.setText(stateText);

      if (info.localModified) {
        downloadButton.setVisibility(View.GONE);
        uploadButton.setVisibility(View.VISIBLE);
        downTextView.setText("Version is modified. Upload?");
      } else if (info.serverVersion > info.localVersion) {
        downloadButton.setVisibility(View.VISIBLE);
        uploadButton.setVisibility(View.GONE);
        String downText =
            String.format(Locale.ENGLISH, "Version available: %d", info.serverVersion);
        downTextView.setText(downText);
      } else {
        downloadButton.setVisibility(View.INVISIBLE);
        uploadButton.setVisibility(View.GONE);
        downTextView.setText("Version is up to date");
      }

      downloadButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              startDownload(position);
            }
          });

      uploadButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              startUpload(position);
            }
          });

      return view;
    }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.quran_page_layout, container, false);
    view.setBackgroundDrawable((mPageNumber % 2 == 0 ? mLeftGradient : mRightGradient));
    int lineImageId = R.drawable.dark_line;
    int leftBorderImageId = R.drawable.border_left;
    int rightBorderImageId = R.drawable.border_right;

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());

    Resources res = getResources();
    if (!prefs.getBoolean(Constants.PREF_USE_NEW_BACKGROUND, true)) {
      view.setBackgroundColor(res.getColor(R.color.page_background));
    }

    boolean nightMode = false;
    if (prefs.getBoolean(Constants.PREF_NIGHT_MODE, false)) {
      leftBorderImageId = R.drawable.night_left_border;
      rightBorderImageId = R.drawable.night_right_border;
      lineImageId = R.drawable.light_line;
      view.setBackgroundColor(Color.BLACK);
      nightMode = true;
    }

    ImageView leftBorder = (ImageView) view.findViewById(R.id.left_border);
    ImageView rightBorder = (ImageView) view.findViewById(R.id.right_border);
    if (mPageNumber % 2 == 0) {
      rightBorder.setVisibility(View.GONE);
      leftBorder.setBackgroundResource(leftBorderImageId);
    } else {
      rightBorder.setVisibility(View.VISIBLE);
      rightBorder.setBackgroundResource(rightBorderImageId);
      leftBorder.setBackgroundResource(lineImageId);
    }

    mImageView = (HighlightingImageView) view.findViewById(R.id.page_image);
    mImageView.setNightMode(nightMode);

    mScrollView = (ScrollView) view.findViewById(R.id.page_scroller);

    final GestureDetector gestureDetector = new GestureDetector(new PageGestureDetector());
    OnTouchListener gestureListener =
        new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            return gestureDetector.onTouchEvent(event);
          }
        };
    mImageView.setOnTouchListener(gestureListener);
    mImageView.setClickable(true);
    mImageView.setLongClickable(true);

    mOverlayText = prefs.getBoolean(Constants.PREF_OVERLAY_PAGE_INFO, true);

    if (mCoordinateData != null) {
      mImageView.setCoordinateData(mCoordinateData);
    }

    if (mPageBoundsRect != null) {
      mImageView.setPageBounds(mPageBoundsRect);
      if (mOverlayText) {
        mImageView.setOverlayText(mPageNumber, true);
      }
    }

    return view;
  }
  public void initTest(String vt) {
    eh = new TestDefaultHandler.EventHandlerTestDTH(this);
    vs = vsm.addVirtualSpace("src");
    cam = vs.addCamera();
    List<Camera> cameras = new ArrayList<Camera>();
    cameras.add(cam);
    cam.setZoomFloor(-90);
    testView = vsm.addFrameView(cameras, "Test", vt, 800, 600, true);
    testView.setBackgroundColor(Color.LIGHT_GRAY);
    testView.setListener(eh);
    final Glyph circle = new VCircle(100, 0, 0, 40, Color.WHITE);
    cam.setAltitude(50);
    vs.addGlyph(circle);
    vsm.repaint();

    AnimationManager am = vsm.getAnimationManager();

    for (int i = 0; i < 4; ++i) {
      Animation anim =
          am.getAnimationFactory()
              .createAnimation(
                  3000,
                  1.0,
                  Animation.RepeatBehavior.LOOP,
                  circle,
                  Animation.Dimension.POSITION,
                  new DefaultTimingHandler() {
                    public void timingEvent(
                        float fraction, Object subject, Animation.Dimension dim) {
                      Glyph g = (Glyph) subject;
                      g.moveTo(100 - (double) 600 * fraction, 0);
                    }
                  },
                  new SplineInterpolator(0.7f, 0.1f, 0.3f, 0.9f));
      am.startAnimation(anim, false);
    }

    Animation anim =
        am.getAnimationFactory()
            .createAnimation(
                8000,
                1.0,
                Animation.RepeatBehavior.LOOP,
                circle,
                Animation.Dimension.FILLCOLOR,
                new DefaultTimingHandler() {
                  public void timingEvent(float fraction, Object subject, Animation.Dimension dim) {
                    Glyph g = (Glyph) subject;
                    g.setColor(new Color(0, 0, Float.valueOf(255 * fraction).intValue()));
                  }
                });
    am.startAnimation(anim, false);

    Animation animSize =
        am.getAnimationFactory()
            .createAnimation(
                4000,
                1.0,
                Animation.RepeatBehavior.LOOP,
                circle,
                Animation.Dimension.SIZE,
                new DefaultTimingHandler() {
                  public void timingEvent(float fraction, Object subject, Animation.Dimension dim) {
                    Glyph g = (Glyph) subject;
                    g.sizeTo(40 + 60 * fraction);
                  }
                });
    am.startAnimation(animSize, false);
  }