-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/hd/screen/capture/service/ScreenCaptureService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.hd.screen.capture.service; | ||
|
||
import android.app.Service; | ||
import android.content.Intent; | ||
import android.os.Handler; | ||
import android.os.IBinder; | ||
import android.support.annotation.Nullable; | ||
|
||
|
||
/** | ||
* Created by hd on 2018/7/21 . | ||
* 演示通过service 来实现调用录制 | ||
*/ | ||
public class ScreenCaptureService extends Service { | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
|
||
new Handler().postDelayed(() -> { | ||
Intent i = new Intent(this,ServiceCaptureActivity.class); | ||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
startActivity(i); | ||
}, 3000); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public IBinder onBind(Intent intent) { | ||
return null; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
app/src/main/java/com/hd/screen/capture/service/ServiceCaptureActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.hd.screen.capture.service; | ||
|
||
import android.graphics.drawable.ColorDrawable; | ||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.Window; | ||
|
||
|
||
/** | ||
* Created by hd on 2018/7/21 . | ||
* {@link com.hd.screen.capture.MainActivity} | ||
*/ | ||
public class ServiceCaptureActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
//设置透明 | ||
requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); | ||
getWindow().setDimAmount(0f); | ||
} | ||
|
||
// ... start or stop | ||
} |