@Override
 public void onResume() {
   mMapView.onResume();
   super.onResume();
   UmengclickAgentWrapper.onResume(this);
   CmmobiClickAgentWrapper.onResume(this);
 }
  @Override
  protected void modifyMainAttach() {
    if (isDiaryMontaged) {
      String inputFile = mainAudioPath;
      long currentTime = TimeHelper.getInstance().now();
      String voiceID = String.valueOf(currentTime);
      String RECORD_FILE_DIR =
          Constant.SD_STORAGE_ROOT
              + "/"
              + ActiveAccount.getInstance(this).getLookLookID()
              + "/audio";
      String outputFile =
          Environment.getExternalStorageDirectory()
              + RECORD_FILE_DIR
              + "/"
              + voiceID
              + "/"
              + voiceID
              + ".mp4";

      File dstFile = new File(outputFile);
      if (!dstFile.getParentFile().exists()) {
        dstFile.getParentFile().mkdirs();
      }
      editAttachPath = outputFile;
      montageAudio(voiceID, inputFile, outputFile); // 1s
    }

    if (mEffects.getEffectsCount() > 0) {
      try {

        String infilename = "";
        if (editAttachPath != null) {
          infilename = editAttachPath;
        } else {
          infilename = mainAudioPath;
        }
        Log.d(TAG, "infilename = " + infilename);
        EffectTransCodeUtil transCode =
            new EffectTransCodeUtil(
                handler, mEffects, infilename, this, EffectTransCodeUtil.MAIN_AUDIO);
        transCode.start("audio");
        threadsSignal = new CountDownLatch(1);
        threadsSignal.await();

        if (effectAudioPath != null) {
          if (editAttachPath != null) {
            EditMediaDetailActivity.delFile(editAttachPath);
          }
          editAttachPath = effectAudioPath;
        }

        Log.d(TAG, "editAttachPath = " + editAttachPath + " effectAudioPath = " + effectAudioPath);
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }
 @Override
 protected void onPause() {
   // TODO Auto-generated method stub
   mMapView.onPause();
   super.onPause();
   UmengclickAgentWrapper.onPause(this);
   CmmobiClickAgentWrapper.onPause(this);
 }
 @Override
 public void onStop() {
   if (shortRecMediaPlayer.isPlaying()) {
     tackView.stopAudio(shortRecMediaPlayer);
   }
   if (mMediaPlayer.isPlaying()) {
     mMediaPlayer.pause();
     ivPlay.setImageResource(R.drawable.btn_edit_audio_play);
   }
   super.onStop();
   CmmobiClickAgentWrapper.onStop(this);
 }
 private void montageAudio(String videoID, String inputFile, String outputFile) {
   XMp4Box mMp4Box = new XMp4Box();
   if (isSelectedDelete) {
     String RECORD_FILE_DIR =
         Constant.SD_STORAGE_ROOT
             + "/"
             + ActiveAccount.getInstance(this).getLookLookID()
             + "/audio";
     String outputFile1 =
         Environment.getExternalStorageDirectory()
             + RECORD_FILE_DIR
             + "/"
             + videoID
             + "/"
             + "temp1.mp4";
     int ret1 = mMp4Box.splitFile(inputFile, outputFile1, 0, montageStartTime);
     String outputFile2 =
         Environment.getExternalStorageDirectory()
             + RECORD_FILE_DIR
             + "/"
             + videoID
             + "/"
             + "temp2.mp4";
     float videoDuration = (float) (montageFragment.totalTime);
     int ret2 = mMp4Box.splitFile(inputFile, outputFile2, montageEndTime, videoDuration);
     Log.d(TAG, "ret1 = " + ret1 + " ret2 = " + ret2);
     mMp4Box.appendOpen(outputFile);
     if (ret1 == 0) {
       mMp4Box.appendFile(outputFile1);
       EditMediaDetailActivity.delFile(outputFile1);
     }
     if (ret2 == 0) {
       mMp4Box.appendFile(outputFile2);
       EditMediaDetailActivity.delFile(outputFile2);
     }
     mMp4Box.appendClose();
   } else {
     mMp4Box.splitFile(inputFile, outputFile, montageStartTime, montageEndTime); // 1s
   }
 }
  @Override
  protected void onDestroy() {
    // TODO Auto-generated method stub
    try {
      if (mMediaPlayer != null) {
        mMediaPlayer.release();
        mMediaPlayer = null;
        isPlayerNeedToPlay = false;
        isPlayerPrepared = false;
      }

      if (shortRecMediaPlayer != null) {
        shortRecMediaPlayer.release();
        shortRecMediaPlayer = null;
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    mMapView.destroy();
    super.onDestroy();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_voice_detail);

    detailMainFragment = new EditVoiceDetailMainFragment();
    tagFragment = new EditMediaTagFragment();
    posFragment = new EditMediaPositionFragment();
    soundFragment = new EditMediaBeautifySoundFragment();
    textFragment = new EditMediaTextInputFragment();
    mainFragment = new EditVoiceMainFragment();
    montageFragment = new EditVoiceMontageFragment();
    soundtrackFragment = new EditMediaSoundtrackFragment();

    fm = getSupportFragmentManager();

    ivBack = (ImageView) findViewById(R.id.iv_back);
    ivDone = (ImageView) findViewById(R.id.iv_edit_done);
    ivBack.setOnClickListener(this);
    ivDone.setOnClickListener(this);

    myLocInfo = MyLocationInfo.getInstance(this);
    myLoc = myLocInfo.getLocation();

    initView(this);

    mMapView = (MyMapView) findViewById(R.id.bmv_activity_edit_voice_detail_position);
    mMapView.setVisibility(View.GONE);
    myPositionLayout = (MyPositionLayout) findViewById(R.id.rl_activity_edit_media_my_position);
    myPositionLayout.setVisibility(View.GONE);
    myPositionLayout.setWillNotDraw(false);
    myPositionTv = (TextView) findViewById(R.id.tv_edit_media_myposition);
    myPositionTv.setVisibility(View.GONE);

    mainLayout = (RelativeLayout) findViewById(R.id.rl_activity_edit_voice_main);
    mainLayout.setOnClickListener(this);
    detailMainLayout = (LinearLayout) findViewById(R.id.ll_activity_edit_voice_detail_main);
    thumbView = (ImageView) findViewById(R.id.iv_edit_voice_thumbnails);
    thumbView.setOnClickListener(this);
    //		recPlayerView = (ImageView) findViewById(R.id.iv_edit_long_rec_player);
    //		recPlayerView.setOnClickListener(this);

    diaryUUID = getIntent().getStringExtra(DiaryDetailActivity.INTENT_ACTION_DIARY_UUID);
    diaryString = getIntent().getStringExtra(DiaryDetailActivity.INTENT_ACTION_DIARY_STRING);

    initAttachs();

    tvAudioDuration = (TextView) findViewById(R.id.tv_edit_voice_duration);
    if (mainAudioDuration != null) {
      tvAudioDuration.setText(
          EditVoiceMainFragment.convertTimeFormartMS("0")
              + "/"
              + EditVoiceMainFragment.convertTimeFormartMS(mainAudioDuration));
    }

    loadAudioData();

    ivPlay = (ImageView) findViewById(R.id.iv_edit_voice_play);
    ivPlay.setOnClickListener(this);

    playProcess = (SeekBar) findViewById(R.id.sk_edit_voice_seekbar);
    playProcess.setMax(100);
    playProcess.setProgress(0);
    seekBarBg = (ImageView) findViewById(R.id.v_seekbar_background);
    ViewTreeObserver vto2 = seekBarBg.getViewTreeObserver();
    vto2.addOnGlobalLayoutListener(
        new OnGlobalLayoutListener() {

          @Override
          public void onGlobalLayout() {
            // TODO Auto-generated method stub
            seekBarLength = seekBarBg.getMeasuredWidth();
          }
        });

    llXiaLa = (LinearLayout) findViewById(R.id.ll_edit_diary_style);
    llXiaLa.setOnClickListener(this);
    diaryEditStyle = (TextView) findViewById(R.id.tv_edit_name);
    inflater = LayoutInflater.from(this);
    rlTitleBar = findViewById(R.id.rl_title);

    handler = new Handler(this);

    if (mainAudioPath == null) {
      thumbView.setVisibility(View.INVISIBLE);
      thumbView.setClickable(false);
    }
    goToPage(FRAGMENT_DETAIL_MAIN_VIEW, false);
    getWindow()
        .setSoftInputMode(
            WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN
                | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

    overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
  }