Skip to content

Commit 3011e0b

Browse files
committedJul 21, 2018
add test
1 parent 26c1a92 commit 3011e0b

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed
 

‎.idea/caches/build_file_checksums.ser

0 Bytes
Binary file not shown.

‎app/src/main/AndroidManifest.xml

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
</activity>
2424
<activity android:name=".CaptureConfigActivity">
2525
</activity>
26+
<activity android:name=".service.ServiceCaptureActivity"/>
27+
28+
<service android:name=".service.ScreenCaptureService"/>
2629
</application>
2730

2831
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.hd.screen.capture.service;
2+
3+
import android.app.Service;
4+
import android.content.Intent;
5+
import android.os.Handler;
6+
import android.os.IBinder;
7+
import android.support.annotation.Nullable;
8+
9+
10+
/**
11+
* Created by hd on 2018/7/21 .
12+
* 演示通过service 来实现调用录制
13+
*/
14+
public class ScreenCaptureService extends Service {
15+
16+
@Override
17+
public void onCreate() {
18+
super.onCreate();
19+
20+
new Handler().postDelayed(() -> {
21+
Intent i = new Intent(this,ServiceCaptureActivity.class);
22+
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
23+
startActivity(i);
24+
}, 3000);
25+
}
26+
27+
@Nullable
28+
@Override
29+
public IBinder onBind(Intent intent) {
30+
return null;
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.hd.screen.capture.service;
2+
3+
import android.graphics.drawable.ColorDrawable;
4+
import android.os.Bundle;
5+
import android.support.annotation.Nullable;
6+
import android.support.v7.app.AppCompatActivity;
7+
import android.view.Window;
8+
9+
10+
/**
11+
* Created by hd on 2018/7/21 .
12+
* {@link com.hd.screen.capture.MainActivity}
13+
*/
14+
public class ServiceCaptureActivity extends AppCompatActivity {
15+
16+
@Override
17+
protected void onCreate(@Nullable Bundle savedInstanceState) {
18+
super.onCreate(savedInstanceState);
19+
//设置透明
20+
requestWindowFeature(Window.FEATURE_NO_TITLE);
21+
getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
22+
getWindow().setDimAmount(0f);
23+
}
24+
25+
// ... start or stop
26+
}

0 commit comments

Comments
 (0)
Please sign in to comment.