-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathHanryReceiver.java
More file actions
59 lines (51 loc) · 2.17 KB
/
HanryReceiver.java
File metadata and controls
59 lines (51 loc) · 2.17 KB
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
package com.fei435;
import com.fei435.Constant;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
public class HanryReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
Log.i("ScreenCapture Intent", "onReceive intent = " + intent.getAction());
if (Constant.ACTION_TAKE_PICTURE_DONE.equals(intent.getAction()))
{
Bundle bundle = intent.getExtras();
if (bundle != null)
{
int res = bundle.getInt(Constant.EXTRA_RES);
String text = bundle.getString(Constant.EXTRA_PATH);
Log.i("Intent", "onReceive intent, res= " + res + " path=" + text);
switch (res) {
case Constant.CAM_RES_OK:
Toast.makeText(context, "成功保存照片:" + text, Toast.LENGTH_LONG).show();
break;
case Constant.CAM_RES_FAIL_BITMAP_ERROR:
case Constant.CAM_RES_FAIL_FILE_NAME_ERROR:
case Constant.CAM_RES_FAIL_FILE_WRITE_ERROR:
case Constant.CAM_RES_FAIL_NO_SPACE_LEFT:
case Constant.CAM_RES_FAIL_UNKNOW:
Toast.makeText(context, "保存照片失败:Error = " + res, Toast.LENGTH_LONG).show();
break;
default:
break;
}
}
}
else if (Constant.ACTION_RECORDING_START.equals(intent.getAction()) ||
Constant.ACTION_RECORDING_STOP.equals(intent.getAction()) ){
Log.i("ScreenCapture Intent", "onReceive intent = " + intent.getAction());
Bundle bundle = intent.getExtras();
if (bundle != null){
int res = bundle.getInt(Constant.EXTRA_RES);
String text = bundle.getString(Constant.EXTRA_PATH);
Log.i("ScreenCapture Intent", "onReceive intent, res= " + res + " path=" + text);
Toast.makeText(context, text, Toast.LENGTH_LONG).show();
}
}
}
}