wxr
2023-07-31 27cb19320ed4ac5552c17a263d0887a7cb88edc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//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";
//                HDLLog.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();
//                }
//            }
//        }
//    }
//
//}