Skip to content

Commit

Permalink
添加 屏幕截图
Browse files Browse the repository at this point in the history
  • Loading branch information
MJLblabla committed Sep 27, 2021
1 parent 72d9690 commit 72e7ded
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib_sreenshot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ android {
dependencies {

implementation 'androidx.appcompat:appcompat:1.3.1'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ private ScreenShotPlugin() {


private ServiceConnection serviceConnection;
public void startMediaRecorder(final FragmentActivity activity, OnScreenShotListener callback) {
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public void startMediaRecorder(final FragmentActivity activity, final OnScreenShotListener callback) {
MediaProjectionManager mediaProjectionManager = (MediaProjectionManager) activity.getSystemService(Context.MEDIA_PROJECTION_SERVICE);
// 此处宽高需要获取屏幕完整宽高,否则截屏图片会有白/黑边
final DisplayMetrics displayMetrics = new DisplayMetrics();
Expand Down

0 comments on commit 72e7ded

Please sign in to comment.