コード例 #1
0
  @SuppressWarnings("deprecation")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AbsoluteLayout layout = new AbsoluteLayout(this);
    Map<Integer, ZView> zMap = new TreeMap<Integer, ZView>();

    TextView z1 = new TextView(this);
    z1.setBackgroundColor(Color.parseColor("red"));
    AbsoluteLayout.LayoutParams lpz1 = new AbsoluteLayout.LayoutParams(500, 500, 300, 300);
    ZView z1View = new ZView(z1, lpz1);
    zMap.put(2, z1View);

    TextView z2 = new TextView(this);
    z2.setBackgroundColor(Color.parseColor("green"));
    AbsoluteLayout.LayoutParams lpz2 = new AbsoluteLayout.LayoutParams(300, 300, 400, 100);
    ZView z2View = new ZView(z2, lpz2);
    zMap.put(5, z2View);

    TextView z0 = new TextView(this);
    z0.setBackgroundColor(Color.parseColor("blue"));
    AbsoluteLayout.LayoutParams lpz0 = new AbsoluteLayout.LayoutParams(500, 500, 0, 0);
    ZView z0View = new ZView(z0, lpz0);
    zMap.put(9, z0View);

    for (Integer s : zMap.keySet()) {
      layout.addView(zMap.get(s).getView(), zMap.get(s).getParams());
    }
    setContentView(layout);
  }
コード例 #2
0
  public void startAnimation() {
    if (item == null) {
      return;
    }

    foregroundImage = new ImageView(context);
    if (item.getForeground().getColor() != null) {
      foregroundImage.setBackgroundColor(Color.parseColor(item.getForeground().getColor()));
    }

    if (item.getForeground().getImage() != null) {
      try {
        FileInputStream fileInputStream =
            new FileInputStream(
                Environment.getExternalStorageDirectory() + File.separator + "1.png");
        Bitmap bitmap = BitmapFactory.decodeStream(fileInputStream);
        foregroundImage.setImageBitmap(bitmap);
      } catch (IOException e) {
        Log.e(TAG, e.getMessage(), e);
      }
    }

    AbsoluteLayout.LayoutParams foregroundParams =
        new AbsoluteLayout.LayoutParams(
            item.getGeometry().getWidth(), item.getGeometry().getHeight(),
            item.getGeometry().getLeft(), item.getGeometry().getTop());
    foregroundImage.setLayoutParams(foregroundParams);
    layout.addView(foregroundImage);

    backgroundImage = new ImageView(context);
    if (item.getBackground().getColor() != null) {
      backgroundImage.setBackgroundColor(Color.parseColor(item.getBackground().getColor()));
    }

    if (item.getBackground().getImage() != null) {
      try {
        FileInputStream fileInputStream =
            new FileInputStream(
                Environment.getExternalStorageDirectory() + File.separator + "1.png");
        Bitmap bitmap = BitmapFactory.decodeStream(fileInputStream);
        backgroundImage.setImageBitmap(bitmap);
      } catch (IOException e) {
        Log.e(TAG, e.getMessage(), e);
      }
    }

    AbsoluteLayout.LayoutParams backgroundParams =
        new AbsoluteLayout.LayoutParams(
            item.getGeometry().getWidth(), item.getGeometry().getHeight(),
            item.getGeometry().getLeft(), item.getGeometry().getTop());
    backgroundImage.setLayoutParams(backgroundParams);

    AlphaAnimation animation = new AlphaAnimation(0f, 1.0f);
    animation.setDuration(item.getDuration() * 1000);
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.REVERSE);
    backgroundImage.startAnimation(animation);
    layout.addView(backgroundImage);
  }
コード例 #3
0
 @Override
 protected void onLayout(boolean arg1, int arg2, int arg3, int arg4, int arg5) {
   if (!testjnOverride("onLayout")) {
     super.onLayout(arg1, arg2, arg3, arg4, arg5);
     return;
   } else super.onLayout(arg1, arg2, arg3, arg4, arg5);
   jInterface.Jnido(
       this,
       jchildidx + "onLayout_" + jlocale + "_",
       new java.lang.Object[] {arg1, arg2, arg3, arg4, arg5});
 }
コード例 #4
0
 @Override
 protected void onMeasure(int arg1, int arg2) {
   if (!testjnOverride("onMeasure")) {
     super.onMeasure(arg1, arg2);
     return;
   }
   jInterface.Jnido(
       this, jchildidx + "onMeasure_" + jlocale + "_", new java.lang.Object[] {arg1, arg2});
 }
コード例 #5
0
  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);

    if (mSizeChangedListener != null) {
      if (LOCAL_LOGV) {
        Log.v(TAG, "new size=" + w + "x" + h);
      }
      mSizeChangedListener.onSizeChanged(w, h - AUDIO_INFO_HEIGHT);
    }
  }
コード例 #6
0
  private void moveView(View v, float pitch, float roll) {
    float top = v.getTop();
    if (v.getBottom() + v.getHeight() - pitch < metrics.heightPixels && v.getTop() - pitch > 0) {
      top = v.getTop() - pitch;
    }
    float left = v.getLeft();
    if (v.getLeft() - roll > 0 && v.getRight() - roll - 1 < metrics.widthPixels) {
      left = v.getLeft() - roll;
    }
    float width = v.getWidth();
    float height = v.getHeight();

    AbsoluteLayout.LayoutParams lp =
        new AbsoluteLayout.LayoutParams((int) width, (int) height, (int) left, (int) top);
    //	        lp.x = touchX - mRegistrationX;
    //	        lp.y = touchY - mRegistrationY;

    absLayout.updateViewLayout(v, lp);
  }
コード例 #7
0
 public void disableCameraView() {
   mainLayout.removeView(cameraView);
 }
コード例 #8
0
 public void enableCameraView() {
   // Some phones (eg. nexus S) need at least a 8x16 preview size
   mainLayout.addView(cameraView, new AbsoluteLayout.LayoutParams(8, 16, 0, 0));
 }
コード例 #9
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    mAppContext = this;
    mMainHandler = new Handler();

    if (!sTryCatchAttached) {
      sTryCatchAttached = true;
      mMainHandler.post(
          new Runnable() {
            public void run() {
              try {
                Looper.loop();
              } catch (Exception e) {
                Log.e(LOG_FILE_NAME, "top level exception", e);
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw);
                e.printStackTrace(pw);
                pw.flush();
                GeckoAppShell.reportJavaCrash(sw.toString());
              }
              // resetting this is kinda pointless, but oh well
              sTryCatchAttached = false;
            }
          });
    }

    SharedPreferences settings = getPreferences(Activity.MODE_PRIVATE);
    String localeCode = settings.getString(getPackageName() + ".locale", "");
    if (localeCode != null && localeCode.length() > 0) GeckoAppShell.setSelectedLocale(localeCode);

    Log.i(LOG_FILE_NAME, "create");
    super.onCreate(savedInstanceState);

    if (sGREDir == null) sGREDir = new File(this.getApplicationInfo().dataDir);

    getWindow()
        .setFlags(
            mFullscreen ? WindowManager.LayoutParams.FLAG_FULLSCREEN : 0,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

    if (cameraView == null) {
      cameraView = new SurfaceView(this);
      cameraView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    }

    if (surfaceView == null) surfaceView = new GeckoSurfaceView(this);
    else mainLayout.removeAllViews();

    mainLayout = new AbsoluteLayout(this);
    mainLayout.addView(
        surfaceView,
        new AbsoluteLayout.LayoutParams(
            AbsoluteLayout.LayoutParams.MATCH_PARENT, // level 8
            AbsoluteLayout.LayoutParams.MATCH_PARENT,
            0,
            0));

    setContentView(
        mainLayout,
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

    mConnectivityFilter = new IntentFilter();
    mConnectivityFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    mConnectivityReceiver = new GeckoConnectivityReceiver();

    IntentFilter batteryFilter = new IntentFilter();
    batteryFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
    mBatteryReceiver = new GeckoBatteryManager();
    registerReceiver(mBatteryReceiver, batteryFilter);

    if (SmsManager.getInstance() != null) {
      SmsManager.getInstance().start();
    }

    GeckoNetworkManager.getInstance().init();

    if (!checkAndSetLaunchState(LaunchState.PreLaunch, LaunchState.Launching)) return;

    checkAndLaunchUpdate();
    mLibLoadThread =
        new Thread(
            new Runnable() {
              public void run() {
                // At some point while loading the gecko libs our default locale gets set
                // so just save it to locale here and reset it as default after the join
                Locale locale = Locale.getDefault();
                GeckoAppShell.loadGeckoLibs(getApplication().getPackageResourcePath());
                Locale.setDefault(locale);
                Resources res = getBaseContext().getResources();
                Configuration config = res.getConfiguration();
                config.locale = locale;
                res.updateConfiguration(config, res.getDisplayMetrics());
              }
            });
    mLibLoadThread.start();
  }
コード例 #10
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    m_context = MainActivity.this;

    m_btnSelectImage = (Button) findViewById(R.id.btn_image);
    m_btnTakePhoto = (Button) findViewById(R.id.btn_photo);
    m_ivImage = (ImageView) findViewById(R.id.ivCardView);
    m_absolutelayout = (AbsoluteLayout) findViewById(R.id.relative1);
    m_llTopLayout = (LinearLayout) findViewById(R.id.llBottomLayout);
    m_arrSignObjects = new ArrayList<ViewsVo>();

    // Set the layout parameters to the Absolute layout for adding images.
    RelativeLayout.LayoutParams rl_pr =
        new LayoutParams(
            RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT);
    rl_pr.addRule(RelativeLayout.ABOVE, R.id.llBottomLayout);
    rl_pr.addRule(RelativeLayout.BELOW, R.id.layout_title);

    m_absolutelayout.setLayoutParams(rl_pr);

    m_screen = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
    m_DisplayWidth = m_screen.getWidth();
    m_AddedViewsHeightText = m_llTopLayout.getHeight();

    // Get the absoulte layout height according to the device screen density
    // to set the layout.
    m_vtoTree = m_absolutelayout.getViewTreeObserver();
    m_vtoTree.addOnGlobalLayoutListener(
        new OnGlobalLayoutListener() {

          @Override
          public void onGlobalLayout() {

            m_absHeight = m_absolutelayout.getHeight();
            m_absolutelayout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
          }
        });

    m_dialog = new Dialog(this, R.style.Dialog);
    m_dialog.setCancelable(true);

    m_btnSelectImage.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            //                Intent i = new Intent(
            //                        Intent.ACTION_PICK,
            //
            // android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
            //                startActivityForResult(i, 0);

            m_bitmap = null;

            Uri selectedImages = resIdToUri(m_context, R.drawable.mario);

            System.err.println("Image Path =====>" + selectedImages.getPath());
            m_bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.mario);
            getImageLayout(m_bitmap);
          }
        });

    m_btnTakePhoto.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            // Launch camera
            // create new Intent
            intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

            fileUri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO); // create a file to save the video
            intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name
            intent.putExtra(MediaStore.EXTRA_MEDIA_TITLE, fileUri.toString());
            intent.putExtra(
                MediaStore.EXTRA_VIDEO_QUALITY, 1); // set the video image quality to high

            // start the Video Capture Intent
            startActivityForResult(intent, CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE);
          }
        });
  }
コード例 #11
0
  /**
   * Method to add the image by setting and creating the views dynamically with delete and zoom
   * option.
   */
  @SuppressWarnings("deprecation")
  private void getImageLayout(Bitmap p_bitmap) {
    ViewsVo m_signVo;
    // Check for images count .Set the count for limiting the number of images to add on screen.
    if (m_ImageCount < 1) {
      m_viewsAddedHeightEmotions = m_viewsAddedHeightEmotions + 90;
      m_ImageCount++;
    } /*
       * else { Toast.makeText(m_context, "No enough space for images.",
       * Toast.LENGTH_LONG).show(); }
       */
    m_btnSDeleteImage = new Button(m_context);
    m_btnZoom = new Button(m_context);
    m_ivtmpImage = new ImageView(m_context);

    setViewsHeightDynamically();
    // System.err.println("Height of Layout------" + m_absHeight);
    m_btnSDeleteImage.setLayoutParams(m_layoutparamsDelete);
    m_btnSDeleteImage.setBackgroundDrawable(getResources().getDrawable(R.drawable.ic_deletered));
    m_btnSDeleteImage.setId(0);
    m_btnSDeleteImage.setOnClickListener(new ImageDeleteListener());

    m_btnZoom.setLayoutParams(m_layoutParamsEdit);
    m_btnZoom.setBackgroundDrawable(getResources().getDrawable(R.drawable.right_arrow));
    m_btnZoom.setId(0);

    m_absTextlayout = new AbsoluteLayout(m_context);
    m_absZoomlayout = new AbsoluteLayout(m_context);
    m_ivtmpImage.setImageBitmap(Bitmap.createScaledBitmap(p_bitmap, 400, 180, true));
    m_absTextlayout.setLayoutParams(
        new AbsoluteLayout.LayoutParams(
            AbsoluteLayout.LayoutParams.WRAP_CONTENT,
            AbsoluteLayout.LayoutParams.WRAP_CONTENT,
            0,
            0));
    m_absZoomlayout.setLayoutParams(
        new AbsoluteLayout.LayoutParams(
            AbsoluteLayout.LayoutParams.WRAP_CONTENT,
            AbsoluteLayout.LayoutParams.WRAP_CONTENT,
            0,
            0));

    if (m_absHeight >= 900) m_ivtmpImage.setLayoutParams(new FrameLayout.LayoutParams(400, 200));
    else m_ivtmpImage.setLayoutParams(new FrameLayout.LayoutParams(80, 80));

    m_ivtmpImage.setBackgroundColor(Color.TRANSPARENT);
    m_absTextlayout.addView(m_btnSDeleteImage);
    if (m_absHeight >= 900) m_absZoomlayout.setPadding(0, 0, 0, 0);
    else m_absZoomlayout.setPadding(0, 0, 0, 0);

    m_absZoomlayout.setBackgroundResource(R.drawable.dashedbordersmall);
    m_absZoomlayout.addView(m_ivtmpImage);

    m_absTextlayout.addView(m_absZoomlayout);
    m_absTextlayout.addView(m_btnZoom);
    m_absTextlayout.setDrawingCacheEnabled(true);
    m_absTextlayout.setClickable(true);
    m_absTextlayout.setId(0);
    m_ivtmpImage.setId(0);

    m_vtoTree = m_absTextlayout.getViewTreeObserver();
    m_vtoTree.addOnGlobalLayoutListener(
        new OnGlobalLayoutListener() {

          @Override
          public void onGlobalLayout() {
            m_absTextlayout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
          }
        });

    /**
     * Add all the views into arraylist which are added into the screen for further to perform
     * deletion of each views.
     */
    m_signVo = new ViewsVo();
    m_arrSignObjects.add(0, m_signVo);
    m_absolutelayout.addView(m_absTextlayout);

    // Image touch listener to move image onTouch event on screen.
    m_touchImagListener =
        new OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {

            switch (event.getAction() & MotionEvent.ACTION_MASK) {
              case MotionEvent.ACTION_DOWN:
                m_oldX = event.getX();
                m_oldY = event.getY();
                break;
              case MotionEvent.ACTION_UP:

              case MotionEvent.ACTION_POINTER_UP:
                break;

              case MotionEvent.ACTION_MOVE:
                m_dX = event.getX() - m_oldX;
                m_dY = event.getY() - m_oldY;

                m_posX = m_prevX + m_dX;
                m_posY = m_prevY + m_dY;

                if (m_posX > 0
                    && m_posY > 0
                    && (m_posX + v.getWidth()) < m_absolutelayout.getWidth()
                    && (m_posY + v.getHeight()) < m_absolutelayout.getHeight()) {
                  v.setLayoutParams(
                      new AbsoluteLayout.LayoutParams(
                          v.getMeasuredWidth(), v.getMeasuredHeight(), (int) m_posX, (int) m_posY));

                  m_prevX = m_posX;
                  m_prevY = m_posY;
                }
                break;
            }
            return false;
          }
        };

    // Listener for the arrow ontouch of arrow ZoomIn and ZoomOut the image.
    m_strecthArrowListener =
        new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {

            View view;
            // RemoveBorders();
            view = v;
            v.setClickable(true);
            v.setDrawingCacheEnabled(true);
            AbsoluteLayout m_absLayout = null;
            switch (event.getAction() & MotionEvent.ACTION_MASK) {
              case MotionEvent.ACTION_DOWN:
                m_oldX = event.getX();
                m_oldY = event.getY();
                break;
              case MotionEvent.ACTION_UP:

              case MotionEvent.ACTION_POINTER_UP:
                break;

              case MotionEvent.ACTION_MOVE:
                m_newX = event.getX();
                m_newY = event.getY();

                float newDist = m_newX - m_oldX;
                if (m_newX > m_oldX && m_newY > m_oldY) {
                  if (newDist > 0.0f) {
                    m_scale = 1;
                    m_absLayout = (AbsoluteLayout) v.getParent();
                    int m_hightOfImage =
                        (int)
                            (m_scale
                                + (((ImageView)
                                        ((AbsoluteLayout) m_absLayout.getChildAt(1)).getChildAt(0))
                                    .getHeight()));
                    int m_widthOfImage =
                        (int)
                            (m_scale
                                + (((ImageView)
                                        ((AbsoluteLayout) m_absLayout.getChildAt(1)).getChildAt(0))
                                    .getWidth()));
                    m_widthDelete =
                        (int)
                            (m_scale + ((((AbsoluteLayout) m_absLayout.getChildAt(1))).getWidth()));
                    m_heightDelete =
                        (int)
                            (m_scale
                                + ((((AbsoluteLayout) m_absLayout.getChildAt(1)).getHeight())));
                    if (m_absLayout.getBottom() <= (m_ivImage.getBottom())
                        && m_absLayout.getRight() <= (m_DisplayWidth)) {
                      m_layoutparams =
                          new AbsoluteLayout.LayoutParams(m_widthOfImage, m_hightOfImage, 0, 0);
                      ((ImageView) ((AbsoluteLayout) m_absLayout.getChildAt(1)).getChildAt(0))
                          .setLayoutParams(m_layoutparams);

                      m_layoutparams =
                          new AbsoluteLayout.LayoutParams(
                              AbsoluteLayout.LayoutParams.WRAP_CONTENT,
                              AbsoluteLayout.LayoutParams.WRAP_CONTENT,
                              m_absLayout.getLeft(),
                              m_absLayout.getTop());
                      m_absLayout.setLayoutParams(m_layoutparams);
                      ((Button) m_absLayout.getChildAt(0))
                          .setLayoutParams(
                              new AbsoluteLayout.LayoutParams(
                                  m_deleteEditHeightwidth,
                                  m_deleteEditHeightwidth,
                                  m_widthDelete,
                                  0));
                      ((Button) m_absLayout.getChildAt(2))
                          .setLayoutParams(
                              new AbsoluteLayout.LayoutParams(
                                  m_deleteEditHeightwidth,
                                  m_deleteEditHeightwidth,
                                  m_widthDelete,
                                  m_heightDelete));

                      m_hightOfImage =
                          (int)
                              (m_scale
                                  + (((AbsoluteLayout) m_absLayout.getChildAt(1)).getHeight()));
                      m_widthOfImage =
                          (int)
                              (m_scale + (((AbsoluteLayout) m_absLayout.getChildAt(1)).getWidth()));
                      m_layoutparams =
                          new AbsoluteLayout.LayoutParams(
                              m_widthOfImage,
                              m_hightOfImage,
                              ((AbsoluteLayout) m_absLayout.getChildAt(1)).getLeft(),
                              ((AbsoluteLayout) m_absLayout.getChildAt(1)).getTop());
                      ((AbsoluteLayout) m_absLayout.getChildAt(1)).setLayoutParams(m_layoutparams);
                    }
                  }
                }
                if (m_newX < m_oldX && m_newY < m_oldY) {
                  m_absLayout = (AbsoluteLayout) view.getParent();

                  int m_hightOfImage =
                      (int)
                          (((ImageView) ((AbsoluteLayout) m_absLayout.getChildAt(1)).getChildAt(0))
                                  .getHeight()
                              - m_scale);
                  int m_widthOfImage =
                      (int)
                          (((ImageView) ((AbsoluteLayout) m_absLayout.getChildAt(1)).getChildAt(0))
                                  .getWidth()
                              - m_scale);

                  m_widthDelete =
                      (int) (((AbsoluteLayout) m_absLayout.getChildAt(1)).getWidth() - m_scale);
                  m_layoutparams =
                      new AbsoluteLayout.LayoutParams(m_widthOfImage, m_hightOfImage, 0, 0);
                  ((ImageView) ((AbsoluteLayout) m_absLayout.getChildAt(1)).getChildAt(0))
                      .setLayoutParams(m_layoutparams);

                  m_layoutparams =
                      new AbsoluteLayout.LayoutParams(
                          AbsoluteLayout.LayoutParams.WRAP_CONTENT,
                          AbsoluteLayout.LayoutParams.WRAP_CONTENT,
                          m_absLayout.getLeft(),
                          m_absLayout.getTop());
                  m_absLayout.setLayoutParams(m_layoutparams);

                  ((Button) m_absLayout.getChildAt(0))
                      .setLayoutParams(
                          new AbsoluteLayout.LayoutParams(
                              m_deleteEditHeightwidth, m_deleteEditHeightwidth, m_widthDelete, 0));
                  ((Button) m_absLayout.getChildAt(2))
                      .setLayoutParams(
                          new AbsoluteLayout.LayoutParams(
                              m_deleteEditHeightwidth,
                              m_deleteEditHeightwidth,
                              m_widthDelete,
                              m_widthDelete));

                  m_hightOfImage =
                      (int) ((((AbsoluteLayout) m_absLayout.getChildAt(1)).getHeight()) - m_scale);
                  m_widthOfImage =
                      (int) ((((AbsoluteLayout) m_absLayout.getChildAt(1)).getWidth()) - m_scale);
                  m_layoutparams =
                      new AbsoluteLayout.LayoutParams(
                          m_widthOfImage,
                          m_hightOfImage,
                          ((AbsoluteLayout) m_absLayout.getChildAt(1)).getLeft(),
                          ((AbsoluteLayout) m_absLayout.getChildAt(1)).getTop());
                  ((AbsoluteLayout) m_absLayout.getChildAt(1)).setLayoutParams(m_layoutparams);
                }

                break;
            }

            return false;
          }
        };
    m_absTextlayout.setOnTouchListener(m_touchImagListener);
    m_btnZoom.setOnTouchListener(m_strecthArrowListener);
  }
コード例 #12
0
  private View initViewItem(ViewHolder viewHolder) {

    DisplayMetrics displayMetrics = ViewUtils.getScreenResolution(mContext.getActivity());

    View mainView = new AbsoluteLayout(mContext.getActivity());

    AbsListView.LayoutParams as_params =
        new AbsListView.LayoutParams(
            ((int) (displayMetrics.widthPixels * (689.0f / 1920f))),
            (int) (displayMetrics.heightPixels * (334.0 / 1200.0f)));

    mainView.setLayoutParams(as_params);

    viewHolder = new ViewHolder();

    viewHolder.iv_avatar = new ImageView(mContext.getActivity());
    viewHolder.iv_avatar_bg = new ImageView(mContext.getActivity());
    viewHolder.cb_infomation_bg = new CheckBox(mContext.getActivity());
    viewHolder.tv_singer = new TextView(mContext.getActivity());
    viewHolder.tv_position = new TextView(mContext.getActivity());
    viewHolder.tv_title = new TextView(mContext.getActivity());
    viewHolder.cb_delete = new CheckBox(mContext.getActivity());
    viewHolder.cb_first = new CheckBox(mContext.getActivity());
    viewHolder.cb_preview = new CheckBox(mContext.getActivity());
    viewHolder.cb_delete.setButtonDrawable(R.drawable.blank_button);
    viewHolder.cb_first.setButtonDrawable(R.drawable.blank_button);
    viewHolder.cb_preview.setButtonDrawable(R.drawable.blank_button);

    AbsoluteLayout.LayoutParams al_params =
        new AbsoluteLayout.LayoutParams(
            (int) (displayMetrics.widthPixels * (304.0f / 1920.0f)),
            ((int) (displayMetrics.heightPixels * (304.0f / 1200.0f))),
            0,
            (int) (displayMetrics.heightPixels * (15.0f / 1920.0f)));

    viewHolder.iv_avatar_bg.setLayoutParams(al_params);
    viewHolder.iv_avatar_bg.setImageResource(R.drawable.song_list_pic_bg);

    al_params =
        new AbsoluteLayout.LayoutParams(
            (int) (displayMetrics.widthPixels * (195.0f / 1920.0f)),
            ((int) (displayMetrics.heightPixels * (195.0f / 1200.0f))),
            (int) (displayMetrics.widthPixels * (53.0f / 1920.0f)),
            (int) (displayMetrics.heightPixels * (47.0 / 1200.0f)));
    viewHolder.iv_avatar.setLayoutParams(al_params);
    new SyncCommonLoadImage()
        .loadImage(
            "http://wenwen.soso.com/p/20120131/20120131191714-1979069020.jpg",
            viewHolder.iv_avatar);

    al_params =
        new AbsoluteLayout.LayoutParams(
            (int) (displayMetrics.widthPixels * (454.0f / 1920.0f)),
            ((int) (displayMetrics.heightPixels * (334.0f / 1200.0f))),
            (int) (displayMetrics.widthPixels * (200.0f / 1920.0f)),
            -(int) (displayMetrics.heightPixels * (7.0 / 1200.0f)));

    AbsoluteLayout ab_infomation = new AbsoluteLayout(mContext.getActivity());
    ab_infomation.setLayoutParams(al_params);
    al_params =
        new AbsoluteLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 0, 0);

    viewHolder.cb_infomation_bg.setLayoutParams(al_params);
    viewHolder.cb_infomation_bg.setBackground(
        mContext.getActivity().getResources().getDrawable(R.drawable.btn_song_list_information_bg));
    viewHolder.cb_infomation_bg.setButtonDrawable(R.drawable.blank_button);

    al_params =
        new AbsoluteLayout.LayoutParams(
            (int) (displayMetrics.widthPixels * (120.0f / 1920.0f)),
            (int) (displayMetrics.widthPixels * (120.0f / 1920.0f)),
            (int) (displayMetrics.widthPixels * (82.0f / 1920.0f)),
            (int) (displayMetrics.heightPixels * (62.0f / 1200)));
    viewHolder.tv_title.setLayoutParams(al_params);
    viewHolder.tv_title.setTextSize(CONSTANT_LARGE_FONT_SIZE);
    viewHolder.tv_title.setTextColor(Color.WHITE);
    viewHolder.tv_title.setText("バクチ・ダンサー");
    viewHolder.tv_title.setSingleLine();

    al_params =
        new AbsoluteLayout.LayoutParams(
            (int) (displayMetrics.widthPixels * (120.0f / 1920.0f)),
            (int) (displayMetrics.widthPixels * (120.0f / 1920.0f)),
            (int) (displayMetrics.widthPixels * (82.0f / 1920.0f)),
            (int) (displayMetrics.heightPixels * (108.0f / 1200)));
    viewHolder.tv_singer.setLayoutParams(al_params);
    viewHolder.tv_singer.setTextSize(CONSTANT_SMALL_FONT_SIZE);
    viewHolder.tv_singer.setTextColor(Color.WHITE);
    viewHolder.tv_singer.setAlpha(0.5f);
    viewHolder.tv_singer.setText("DOES");
    viewHolder.tv_singer.setSingleLine();

    al_params =
        new AbsoluteLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT,
            0,
            (int) (displayMetrics.heightPixels * (62.0f / 1200)));
    viewHolder.tv_position.setLayoutParams(al_params);
    viewHolder.tv_position.setGravity(Gravity.RIGHT);
    viewHolder.tv_position.setPadding(
        0, 0, (int) (displayMetrics.widthPixels * (82.0f / 1920.0f)), 0);
    viewHolder.tv_position.setTextSize(CONSTANT_LARGE_FONT_SIZE);
    viewHolder.tv_position.setTextColor(Color.WHITE);
    viewHolder.tv_position.setText("(约6)");
    viewHolder.tv_position.setSingleLine();

    al_params =
        new AbsoluteLayout.LayoutParams(
            (int) (displayMetrics.widthPixels * 0.044),
            (int) (displayMetrics.heightPixels * 0.1),
            (int) (displayMetrics.widthPixels * (67.0f / 1920.0f))
            // 0
            ,
            (int) (displayMetrics.heightPixels * (136.0f / 1200.0f)));
    viewHolder.cb_first.setBackgroundResource(R.drawable.btn_song_list_priority);
    viewHolder.cb_first.setLayoutParams(al_params);

    al_params =
        new AbsoluteLayout.LayoutParams(
            (int) (displayMetrics.widthPixels * 0.044),
            (int) (displayMetrics.heightPixels * 0.1),
            (int) (displayMetrics.widthPixels * (182.0f / 1920.0f))
            // (int) (displayMetrics.widthPixels * (297.0f / 1920.0f))
            ,
            (int) (displayMetrics.heightPixels * (136.0f / 1200.0f)));
    viewHolder.cb_preview.setBackgroundResource(R.drawable.btn_song_list_preview);
    viewHolder.cb_preview.setLayoutParams(al_params);

    al_params =
        new AbsoluteLayout.LayoutParams(
            (int) (displayMetrics.widthPixels * 0.044),
            (int) (displayMetrics.heightPixels * 0.1),
            (int) (displayMetrics.widthPixels * (297.0f / 1920.0f))
            // 0
            ,
            (int) (displayMetrics.heightPixels * (136.0f / 1200.0f)));

    viewHolder.cb_delete.setBackgroundResource(R.drawable.btn_song_list_delete);
    viewHolder.cb_delete.setLayoutParams(al_params);

    ab_infomation.addView(viewHolder.cb_infomation_bg);
    ab_infomation.addView(viewHolder.tv_title);
    ab_infomation.addView(viewHolder.tv_singer);
    ab_infomation.addView(viewHolder.tv_position);
    ab_infomation.addView(viewHolder.cb_delete);
    ab_infomation.addView(viewHolder.cb_first);
    ab_infomation.addView(viewHolder.cb_preview);

    ((AbsoluteLayout) mainView).addView(viewHolder.iv_avatar_bg);
    ((AbsoluteLayout) mainView).addView(viewHolder.iv_avatar);
    ((AbsoluteLayout) mainView).addView(ab_infomation);

    // set listener
    viewHolder.cb_delete.setOnClickListener(new PreViewClickListener());

    return mainView;
  }