//package com.example.hdllinphonesdkdemo; // //import android.content.Context; //import android.graphics.Bitmap; //import android.text.TextUtils; //import android.util.Log; //import android.widget.Toast; // //import java.io.File; //import java.io.FileNotFoundException; //import java.io.FileOutputStream; //import java.io.IOException; // ///** // * Created by jlchen on 2021/8/17. // */ //public class HDLUtils { // private static final String TAG = "HDLLinphoneKit"; // // public static void save(Context context, Bitmap bmp){ // if (bmp != null) { // try { //// mAudioPlayUtil.playAudioFile(AudioPlayUtil.CAPTURE_SOUND); // // final String strCaptureFile = context.getCapturesFolder() + "/" + System.currentTimeMillis() + ".jpg"; // Log.e(TAG, "captured picture file path is " + strCaptureFile); // // if (TextUtils.isEmpty(strCaptureFile)) { // bmp.recycle(); // bmp = null; // return; // } // saveCapturePictrue(strCaptureFile, bmp); // // // MediaScanner mMediaScanner = new MediaScanner(EZRealPlayActivity.this); // mMediaScanner.scanFile(strCaptureFile, "jpg"); // runOnUiThread(new Runnable() { // @Override // public void run() { // Toast.makeText(context, "抓图成功", Toast.LENGTH_SHORT).show(); // } // }); // } catch (InnerException e) { // e.printStackTrace(); // } finally { // if (bmp != null) { // bmp.recycle(); // bmp = null; // return; // } // } // } else { //// showToast("抓图失败, 检查是否开启了硬件解码"); // } // } // // public static void saveCapturePictrue(String filePath, Bitmap bitmap) throws InnerException { // if (TextUtils.isEmpty(filePath)){ // Log.d("HDL","saveCapturePictrue file is null"); // return; // } // File filepath = new File(filePath); // File parent = filepath.getParentFile(); // if (parent == null || !parent.exists() || parent.isFile()) { // parent.mkdirs(); // } // FileOutputStream out = null; // try { // // 保存原图 // if (!TextUtils.isEmpty(filePath)) { // out = new FileOutputStream(filepath); // bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out); // //out.write(tempBuf, 0, size); // out.flush(); // out.close(); // out = null; // } // // // } catch (FileNotFoundException e) { //// throw new InnerException(e.getLocalizedMessage()); // e.printStackTrace(); // } catch (IOException e) { //// throw new InnerException(e.getLocalizedMessage()); // e.printStackTrace(); // } finally { // if (out != null) { // try { // out.close(); // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // } // } // } // //}