Repository: BruceWind/AndroidScreenShot_SysApi
Branch: master
Commit: df470b7e92db
Files: 32
Total size: 34.6 KB
Directory structure:
gitextract_ryiq_r0s/
├── .github/
│ └── workflows/
│ └── android.yml
├── .gitignore
├── README.md
├── app/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ ├── androidTest/
│ │ └── java/
│ │ └── com/
│ │ └── androidyuan/
│ │ └── androidscreenshot_sysapi/
│ │ └── ApplicationTest.java
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── androidyuan/
│ │ │ └── androidscreenshot_sysapi/
│ │ │ └── ExampleActivity.java
│ │ └── res/
│ │ ├── layout/
│ │ │ └── activity_main.xml
│ │ ├── values/
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── values-w820dp/
│ │ └── dimens.xml
│ └── test/
│ └── java/
│ └── com/
│ └── androidyuan/
│ └── androidscreenshot_sysapi/
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle/
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── libshot/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ ├── androidTest/
│ │ └── java/
│ │ └── com/
│ │ └── androidyuan/
│ │ └── lib/
│ │ └── ApplicationTest.java
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── androidyuan/
│ │ │ └── lib/
│ │ │ └── screenshot/
│ │ │ ├── ScreenShotActivity.java
│ │ │ └── Shooter.java
│ │ └── res/
│ │ └── values/
│ │ └── strings.xml
│ └── test/
│ └── java/
│ └── com/
│ └── androidyuan/
│ └── lib/
│ └── ExampleUnitTest.java
└── settings.gradle
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/android.yml
================================================
# if gitlab action running occur a error such as 'No toolchains found in the NDK toolchains folder
# for ABI with prefix: mips64el-linux-android', might you need to change 'distributionUrl' of gradle zip and 'classpath'.
name: Build & Publish Debug APK
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Make Gradle executable
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Build Debug APK
run: ./gradlew assembleDebug
# - name: Releasing using Hub
# uses: ShaunLWM/action-release-debugapk@master # this value is not any user,it is a pedestal,
# env:
# GITHUB_TOKEN: ${{ secrets.TOKEN }}
# APP_FOLDER: app
# RELEASE_TITLE: New Build
================================================
FILE: .gitignore
================================================
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
### Android template
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Android Studio Navigation editor temp files
.navigation/
# Android Studio captures folder
captures/
# Intellij
*.iml
.idea/workspace.xml
.idea/
# Keystore files
*.jks
================================================
FILE: README.md
================================================
# AndroidScreenShot_SysApi
这是一个例子,以非常优雅的方案实现屏幕截图。 实现原理为 利用android 5.0 之后的录屏API获取一帧画面,来实现截屏。
## Special Features
1. 打破老旧的截屏方案,不能截状态栏的问题。
2. 截图其他app.
## Usage
**使用Shotter**
请查阅代码 onClickReqPermission()
**使用ScreenShotActivity**
请查阅代码 onClickShot(),该方法可以截图其他app
### 更多拓展:
> 因为ScreenShotActivity是一个透明并隐藏的activity,玩法有很多:
a. 截图桌面;
b. 对其他app进行截图:你自己试着调整shotter的delay时间为3秒,然后start截图,再切换到其他app里,等toast截图成功。
================================================
FILE: app/.gitignore
================================================
/build
================================================
FILE: app/build.gradle
================================================
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.androidyuan.androidscreenshot_sysapi"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug{
minifyEnabled false
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':libshot')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.0.1'
}
================================================
FILE: app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/wei/文档/tools/android-sdk-linux/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
================================================
FILE: app/src/androidTest/java/com/androidyuan/androidscreenshot_sysapi/ApplicationTest.java
================================================
package com.androidyuan.androidscreenshot_sysapi;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
================================================
FILE: app/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.androidyuan.androidscreenshot_sysapi">
<!--it is necessary-->
<uses-sdk tools:overrideLibrary="com.androidyuan.lib"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
tools:overrideLibrary="com.androidyuan.lib"
android:theme="@style/AppTheme">
<activity android:name=".ExampleActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
================================================
FILE: app/src/main/java/com/androidyuan/androidscreenshot_sysapi/ExampleActivity.java
================================================
package com.androidyuan.androidscreenshot_sysapi;
import android.content.Intent;
import android.media.projection.MediaProjectionManager;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;
import com.androidyuan.lib.screenshot.ScreenShotActivity;
import com.androidyuan.lib.screenshot.Shooter;
/**
* This class is a demo to show you how to use Shooter.
*/
public class ExampleActivity extends AppCompatActivity {
private static final int REQ_CODE_PER = 0x2304;
private static final int REQ_CODE_ACT = 0x2305;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
/**
* This is an example for using Shooter.
* This method will request permission and take screenshot on this Activity.
*/
public void onClickReqPermission(View view) {
if (Build.VERSION.SDK_INT >= 21) {
startActivityForResult(createScreenCaptureIntent(), REQ_CODE_PER);
}
}
/**
* using {@see ScreenShotActivity} to take screenshot on current Activity directly.
* If you press home it will take screenshot on another app.
* @param view
*/
public void onClickShot(View view) {
startActivityForResult(ScreenShotActivity.createIntent(this, null,0), REQ_CODE_ACT);
toast("Press home key,open another app.");//if you want to take screenshot on another app.
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private Intent createScreenCaptureIntent() {
//Here using media_projection instead of Context.MEDIA_PROJECTION_SERVICE to make it successfully build on low api.
return ((MediaProjectionManager) getSystemService("media_projection")).createScreenCaptureIntent();
}
private String getSavedPath() {
return getExternalFilesDir("screenshot").getAbsoluteFile() + "/"
+ SystemClock.currentThreadTimeMillis() + ".png";
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQ_CODE_ACT: {
if (resultCode == RESULT_OK && data != null) {
toast("Screenshot saved at " + data.getData().toString());
}
else{
toast("You got wrong.");
}
}
break;
case REQ_CODE_PER: {
if (resultCode == RESULT_OK && data != null) {
Shooter shooter = new Shooter(ExampleActivity.this, resultCode, data);
shooter.startScreenShot(getSavedPath(), new Shooter.OnShotListener() {
@Override
public void onFinish(String path) {
//here is done status.
toast("Screenshot saved at " + path);
}
@Override
public void onError() {
toast("You got wrong.");
}
}
);
} else if (resultCode == RESULT_CANCELED) {
//user canceled.
} else {
}
}
}
}
private void toast(String str) {
Toast.makeText(ExampleActivity.this, str, Toast.LENGTH_LONG).show();
}
private void goBackground() {
Intent startMain = new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(startMain);
}
}
================================================
FILE: app/src/main/res/layout/activity_main.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context="com.androidyuan.androidscreenshot_sysapi.ExampleActivity">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClickReqPermission"
android:text="Using Shooter class" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClickShot"
android:text="Using Activity"/>
</LinearLayout>
================================================
FILE: app/src/main/res/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
================================================
FILE: app/src/main/res/values/dimens.xml
================================================
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
================================================
FILE: app/src/main/res/values/strings.xml
================================================
<resources>
<string name="app_name">AndroidScreenShot_SysApi</string>
</resources>
================================================
FILE: app/src/main/res/values/styles.xml
================================================
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
================================================
FILE: app/src/main/res/values-w820dp/dimens.xml
================================================
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
================================================
FILE: app/src/test/java/com/androidyuan/androidscreenshot_sysapi/ExampleUnitTest.java
================================================
package com.androidyuan.androidscreenshot_sysapi;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
================================================
FILE: build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
maven { url "https://jitpack.io" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
maven { url "https://jitpack.io" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
================================================
FILE: gradle/wrapper/gradle-wrapper.properties
================================================
#Thu Aug 10 14:12:44 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
================================================
FILE: gradle.properties
================================================
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
================================================
FILE: gradlew
================================================
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
================================================
FILE: gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
================================================
FILE: libshot/.gitignore
================================================
/build
================================================
FILE: libshot/build.gradle
================================================
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
minSdkVersion 21
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.4.0'
}
================================================
FILE: libshot/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/wei/文档/tools/android-sdk-linux/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
================================================
FILE: libshot/src/androidTest/java/com/androidyuan/lib/ApplicationTest.java
================================================
package com.androidyuan.lib;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
================================================
FILE: libshot/src/main/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.androidyuan.lib">
<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true">
<activity
android:name="com.androidyuan.lib.screenshot.ScreenShotActivity"
android:exported="true"
android:launchMode="singleTask"
android:theme="@android:style/Theme.Dialog">
<intent-filter>
<action android:name="androidyuan.shooter"></action>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
================================================
FILE: libshot/src/main/java/com/androidyuan/lib/screenshot/ScreenShotActivity.java
================================================
package com.androidyuan.lib.screenshot;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.media.projection.MediaProjectionManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.Window;
/**
* Created by wei on 16-9-18.
* <p>
* There is totally transparent activity,only has a record permission dialog.
* If you want to screenshot on other applications,might you need to use this activity to take screenshot.
*/
public class ScreenShotActivity extends Activity {
public static final String KEY_PATH = "path";
public static final String KEY_DELAY = "delay_time";
public static final int REQUEST_MEDIA_PROJECTION = 0x2304;
public static final String ACTION_SHOTER = "androidyuan.shooter";
private String savedPath;
private long delay;
@Override
protected void onCreate(Bundle savedInstanceState) {
// setTheme(android.R.style.Theme_Dialog);//this line cause a problem, activity background wasn't transparent but black.
super.onCreate(savedInstanceState);
//here is a transparent activity,and previous activity will not be called Activity#onPause().
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
getWindow().setDimAmount(0f);
savedPath = getIntent().getStringExtra(KEY_PATH);
delay = getIntent().getLongExtra(KEY_DELAY,0);
requestScreenShotPermission();
}
public static Intent createIntent(Context context, String path,long delay) {
Intent intent = new Intent(context, ScreenShotActivity.class);
intent.putExtra(KEY_PATH, path);
intent.putExtra(KEY_DELAY, delay);
return intent;
}
public void requestScreenShotPermission() {
if (Build.VERSION.SDK_INT >= 21) {
startActivityForResult(createScreenCaptureIntent(), REQUEST_MEDIA_PROJECTION);
}
}
private Intent createScreenCaptureIntent() {
//here used media_projection instead of Context.MEDIA_PROJECTION_SERVICE to make it successfully build on low api.
return ((MediaProjectionManager) getSystemService("media_projection")).createScreenCaptureIntent();
}
protected void onActivityResult(int requestCode, final int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQUEST_MEDIA_PROJECTION: {
if (resultCode == RESULT_OK && data != null) {
getWindow().getDecorView().postDelayed(new Runnable() {
@Override
public void run() {
Shooter shooter = new Shooter(ScreenShotActivity.this, resultCode, data);
shooter.startScreenShot(savedPath, new Shooter.OnShotListener() {
@Override
public void onFinish(String path) {
Intent intent = new Intent();
intent.setData(Uri.parse(path));
setResult(RESULT_OK, intent);
finish(); // don't forget finish activity
}
@Override
public void onError() {
setResult(RESULT_CANCELED);
finish();
}
});
}
},delay);
} else if (resultCode == RESULT_CANCELED) {
setResult(RESULT_CANCELED);
finish();
} else {
setResult(RESULT_CANCELED);
finish();
}
}
}
}
}
================================================
FILE: libshot/src/main/java/com/androidyuan/lib/screenshot/Shooter.java
================================================
package com.androidyuan.lib.screenshot;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.PixelFormat;
import android.hardware.display.DisplayManager;
import android.hardware.display.VirtualDisplay;
import android.media.Image;
import android.media.ImageReader;
import android.media.projection.MediaProjection;
import android.media.projection.MediaProjectionManager;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Handler;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.ref.SoftReference;
import java.nio.ByteBuffer;
/**
* Created by wei on 16-12-1.
* <p>
* Remind:
* Run this class after you got record permission.
*/
public class Shooter {
public static boolean hasPermission;
private final SoftReference<Context> mRefContext;
private ImageReader mImageReader;
private MediaProjection mMediaProjection;
private VirtualDisplay mVirtualDisplay;
private String mLocalUrl = "";
private OnShotListener mOnShotListener;
private int mHeight;
private int mWidth;
//using a default path.
private String getSavedPath() {
if (TextUtils.isEmpty(mLocalUrl)) {
mLocalUrl = getContext().getExternalFilesDir("screenshot").getAbsoluteFile() + "/"
+ SystemClock.currentThreadTimeMillis() + ".png";
}
return mLocalUrl;
}
public Shooter(Context context, int reqCode, Intent data) {
this.mRefContext = new SoftReference<>(context);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mMediaProjection = getMediaProjectionManager().getMediaProjection(reqCode, data);
WindowManager window = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display mDisplay = window.getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
mDisplay.getRealMetrics(metrics);
mWidth = metrics.widthPixels;//size.x;
mHeight = metrics.heightPixels;//size.y;
mImageReader = ImageReader.newInstance(
mWidth,
mHeight,
PixelFormat.RGBA_8888,//this is necessary to equal buffer format in #copyPixelsFromBuffer.
1);
}
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void virtualDisplay() {
mVirtualDisplay = mMediaProjection.createVirtualDisplay(
"screen-mirror",
mWidth,
mHeight,
Resources.getSystem().getDisplayMetrics().densityDpi,
DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
mImageReader.getSurface(), null, null
);
}
/**
* @param onShotListener
* @param savedPath
*/
public void startScreenShot(String savedPath, OnShotListener onShotListener) {
mLocalUrl = savedPath;
startScreenShot(onShotListener);
}
/**
* This method will using {@link #getSavedPath} to save.
* @param onShotListener
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
public void startScreenShot(OnShotListener onShotListener) {
hasPermission = true;
mOnShotListener = onShotListener;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
virtualDisplay();
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Image image = mImageReader.acquireLatestImage();
new SaveTask().doInBackground(image);
}
},
800);
//this is a delay due to that record screen permission dialog has not dismissed on some devices cause take dialog graphic in screenshot
//.@see<a href="https://github.com/weizongwei5/AndroidScreenShot_SysApi/issues/4">issues</a>
}
}
public class SaveTask extends AsyncTask<Image, Void, Bitmap> {
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
protected Bitmap doInBackground(Image... params) {
if (params == null || params.length < 1 || params[0] == null) {
return null;
}
Image image = params[0];
int width = image.getWidth();
int height = image.getHeight();
final Image.Plane[] planes = image.getPlanes();
final ByteBuffer buffer = planes[0].getBuffer();
//每个像素的间距
int pixelStride = planes[0].getPixelStride();
//总的间距
int rowStride = planes[0].getRowStride();
int rowPadding = rowStride - pixelStride * width;
Bitmap bitmap = Bitmap.createBitmap(width + rowPadding / pixelStride, height,
Bitmap.Config.ARGB_8888);//even though ARGB8888 will consume more memory,it has better compatibility on device.
bitmap.copyPixelsFromBuffer(buffer);
bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height);
image.close();
File fileImage = null;
if (bitmap != null) {
try {
fileImage = new File(getSavedPath());
if (!fileImage.exists()) {
fileImage.createNewFile();
}
FileOutputStream out = new FileOutputStream(fileImage);
if (out != null) {
bitmap.compress(Bitmap.CompressFormat.PNG, 90, out);
out.flush();
out.close();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
if (mOnShotListener != null) mOnShotListener.onError();
release();
return null;
} catch (IOException e) {
e.printStackTrace();
if (mOnShotListener != null) mOnShotListener.onError();
release();
return null;
}
}
if (bitmap != null && !bitmap.isRecycled()) {
bitmap.recycle();
}
if (mVirtualDisplay != null) {
mVirtualDisplay.release();
}
if (mMediaProjection != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mMediaProjection.stop();
}
}
if (mOnShotListener != null) {
mOnShotListener.onFinish(getSavedPath());
}
return null;
}
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
protected void onPostExecute(Bitmap bitmap) {
super.onPostExecute(bitmap);
}
}
public void release(){
if (mVirtualDisplay != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
mVirtualDisplay.release();
}
}
if (mMediaProjection != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mMediaProjection.stop();
}
}
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private MediaProjectionManager getMediaProjectionManager() {
return (MediaProjectionManager) getContext().getSystemService(
Context.MEDIA_PROJECTION_SERVICE);
}
private Context getContext() {
return mRefContext.get();
}
public interface OnShotListener {
void onFinish(String path);
void onError();
}
}
================================================
FILE: libshot/src/main/res/values/strings.xml
================================================
<resources>
<string name="app_name">lib</string>
</resources>
================================================
FILE: libshot/src/test/java/com/androidyuan/lib/ExampleUnitTest.java
================================================
package com.androidyuan.lib;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
================================================
FILE: settings.gradle
================================================
include ':app', ':libshot'
gitextract_ryiq_r0s/ ├── .github/ │ └── workflows/ │ └── android.yml ├── .gitignore ├── README.md ├── app/ │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ ├── androidTest/ │ │ └── java/ │ │ └── com/ │ │ └── androidyuan/ │ │ └── androidscreenshot_sysapi/ │ │ └── ApplicationTest.java │ ├── main/ │ │ ├── AndroidManifest.xml │ │ ├── java/ │ │ │ └── com/ │ │ │ └── androidyuan/ │ │ │ └── androidscreenshot_sysapi/ │ │ │ └── ExampleActivity.java │ │ └── res/ │ │ ├── layout/ │ │ │ └── activity_main.xml │ │ ├── values/ │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── values-w820dp/ │ │ └── dimens.xml │ └── test/ │ └── java/ │ └── com/ │ └── androidyuan/ │ └── androidscreenshot_sysapi/ │ └── ExampleUnitTest.java ├── build.gradle ├── gradle/ │ └── wrapper/ │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── gradlew ├── gradlew.bat ├── libshot/ │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ ├── androidTest/ │ │ └── java/ │ │ └── com/ │ │ └── androidyuan/ │ │ └── lib/ │ │ └── ApplicationTest.java │ ├── main/ │ │ ├── AndroidManifest.xml │ │ ├── java/ │ │ │ └── com/ │ │ │ └── androidyuan/ │ │ │ └── lib/ │ │ │ └── screenshot/ │ │ │ ├── ScreenShotActivity.java │ │ │ └── Shooter.java │ │ └── res/ │ │ └── values/ │ │ └── strings.xml │ └── test/ │ └── java/ │ └── com/ │ └── androidyuan/ │ └── lib/ │ └── ExampleUnitTest.java └── settings.gradle
SYMBOL INDEX (38 symbols across 7 files)
FILE: app/src/androidTest/java/com/androidyuan/androidscreenshot_sysapi/ApplicationTest.java
class ApplicationTest (line 9) | public class ApplicationTest extends ApplicationTestCase<Application> {
method ApplicationTest (line 10) | public ApplicationTest() {
FILE: app/src/main/java/com/androidyuan/androidscreenshot_sysapi/ExampleActivity.java
class ExampleActivity (line 19) | public class ExampleActivity extends AppCompatActivity {
method onCreate (line 24) | @Override
method onClickReqPermission (line 34) | public void onClickReqPermission(View view) {
method onClickShot (line 45) | public void onClickShot(View view) {
method createScreenCaptureIntent (line 51) | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
method getSavedPath (line 57) | private String getSavedPath() {
method onActivityResult (line 62) | protected void onActivityResult(int requestCode, int resultCode, Inten...
method toast (line 101) | private void toast(String str) {
method goBackground (line 105) | private void goBackground() {
FILE: app/src/test/java/com/androidyuan/androidscreenshot_sysapi/ExampleUnitTest.java
class ExampleUnitTest (line 10) | public class ExampleUnitTest {
method addition_isCorrect (line 11) | @Test
FILE: libshot/src/androidTest/java/com/androidyuan/lib/ApplicationTest.java
class ApplicationTest (line 9) | public class ApplicationTest extends ApplicationTestCase<Application> {
method ApplicationTest (line 10) | public ApplicationTest() {
FILE: libshot/src/main/java/com/androidyuan/lib/screenshot/ScreenShotActivity.java
class ScreenShotActivity (line 20) | public class ScreenShotActivity extends Activity {
method onCreate (line 31) | @Override
method createIntent (line 46) | public static Intent createIntent(Context context, String path,long de...
method requestScreenShotPermission (line 54) | public void requestScreenShotPermission() {
method createScreenCaptureIntent (line 60) | private Intent createScreenCaptureIntent() {
method onActivityResult (line 66) | protected void onActivityResult(int requestCode, final int resultCode,...
FILE: libshot/src/main/java/com/androidyuan/lib/screenshot/Shooter.java
class Shooter (line 37) | public class Shooter {
method getSavedPath (line 54) | private String getSavedPath() {
method Shooter (line 63) | public Shooter(Context context, int reqCode, Intent data) {
method virtualDisplay (line 86) | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
method startScreenShot (line 104) | public void startScreenShot(String savedPath, OnShotListener onShotLis...
method startScreenShot (line 114) | @TargetApi(Build.VERSION_CODES.KITKAT)
class SaveTask (line 137) | public class SaveTask extends AsyncTask<Image, Void, Bitmap> {
method doInBackground (line 139) | @TargetApi(Build.VERSION_CODES.KITKAT)
method onPostExecute (line 211) | @TargetApi(Build.VERSION_CODES.KITKAT)
method release (line 218) | public void release(){
method getMediaProjectionManager (line 232) | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
method getContext (line 239) | private Context getContext() {
type OnShotListener (line 243) | public interface OnShotListener {
method onFinish (line 244) | void onFinish(String path);
method onError (line 245) | void onError();
FILE: libshot/src/test/java/com/androidyuan/lib/ExampleUnitTest.java
class ExampleUnitTest (line 10) | public class ExampleUnitTest {
method addition_isCorrect (line 11) | @Test
Condensed preview — 32 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (39K chars).
[
{
"path": ".github/workflows/android.yml",
"chars": 910,
"preview": "# if gitlab action running occur a error such as 'No toolchains found in the NDK toolchains folder\n# for ABI with prefix"
},
{
"path": ".gitignore",
"chars": 591,
"preview": "*.iml\n.gradle\n/local.properties\n/.idea/workspace.xml\n/.idea/libraries\n.DS_Store\n/build\n/captures\n### Android template\n# "
},
{
"path": "README.md",
"chars": 443,
"preview": "# AndroidScreenShot_SysApi\n这是一个例子,以非常优雅的方案实现屏幕截图。 实现原理为 利用android 5.0 之后的录屏API获取一帧画面,来实现截屏。\n\n## Special Features\n\n 1. 打破"
},
{
"path": "app/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "app/build.gradle",
"chars": 783,
"preview": "apply plugin: 'com.android.application'\n\nandroid {\n compileSdkVersion 25\n buildToolsVersion '25.0.0'\n\n defaultC"
},
{
"path": "app/proguard-rules.pro",
"chars": 667,
"preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /h"
},
{
"path": "app/src/androidTest/java/com/androidyuan/androidscreenshot_sysapi/ApplicationTest.java",
"chars": 371,
"preview": "package com.androidyuan.androidscreenshot_sysapi;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCa"
},
{
"path": "app/src/main/AndroidManifest.xml",
"chars": 875,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:to"
},
{
"path": "app/src/main/java/com/androidyuan/androidscreenshot_sysapi/ExampleActivity.java",
"chars": 3993,
"preview": "package com.androidyuan.androidscreenshot_sysapi;\n\nimport android.content.Intent;\nimport android.media.projection.MediaP"
},
{
"path": "app/src/main/res/layout/activity_main.xml",
"chars": 993,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "app/src/main/res/values/colors.xml",
"chars": 208,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <color name=\"colorPrimary\">#3F51B5</color>\n <color name=\"color"
},
{
"path": "app/src/main/res/values/dimens.xml",
"chars": 211,
"preview": "<resources>\n <!-- Default screen margins, per the Android Design guidelines. -->\n <dimen name=\"activity_horizontal"
},
{
"path": "app/src/main/res/values/strings.xml",
"chars": 87,
"preview": "<resources>\n <string name=\"app_name\">AndroidScreenShot_SysApi</string>\n</resources>\n"
},
{
"path": "app/src/main/res/values/styles.xml",
"chars": 383,
"preview": "<resources>\n\n <!-- Base application theme. -->\n <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar"
},
{
"path": "app/src/main/res/values-w820dp/dimens.xml",
"chars": 358,
"preview": "<resources>\n <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n (such as s"
},
{
"path": "app/src/test/java/com/androidyuan/androidscreenshot_sysapi/ExampleUnitTest.java",
"chars": 333,
"preview": "package com.androidyuan.androidscreenshot_sysapi;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * To "
},
{
"path": "build.gradle",
"chars": 739,
"preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n r"
},
{
"path": "gradle/wrapper/gradle-wrapper.properties",
"chars": 230,
"preview": "#Thu Aug 10 14:12:44 CST 2017\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_"
},
{
"path": "gradle.properties",
"chars": 855,
"preview": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will o"
},
{
"path": "gradlew",
"chars": 4971,
"preview": "#!/usr/bin/env bash\n\n##############################################################################\n##\n## Gradle start "
},
{
"path": "gradlew.bat",
"chars": 2314,
"preview": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem "
},
{
"path": "libshot/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "libshot/build.gradle",
"chars": 622,
"preview": "apply plugin: 'com.android.library'\n\nandroid {\n compileSdkVersion 25\n buildToolsVersion '25.0.0'\n\n defaultConfi"
},
{
"path": "libshot/proguard-rules.pro",
"chars": 667,
"preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /h"
},
{
"path": "libshot/src/androidTest/java/com/androidyuan/lib/ApplicationTest.java",
"chars": 350,
"preview": "package com.androidyuan.lib;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * <a href=\""
},
{
"path": "libshot/src/main/AndroidManifest.xml",
"chars": 771,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:tools=\"http://schemas.android.com/tools\"\n"
},
{
"path": "libshot/src/main/java/com/androidyuan/lib/screenshot/ScreenShotActivity.java",
"chars": 4068,
"preview": "package com.androidyuan.lib.screenshot;\n\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.co"
},
{
"path": "libshot/src/main/java/com/androidyuan/lib/screenshot/Shooter.java",
"chars": 8189,
"preview": "package com.androidyuan.lib.screenshot;\n\nimport android.annotation.TargetApi;\nimport android.content.Context;\nimport and"
},
{
"path": "libshot/src/main/res/values/strings.xml",
"chars": 66,
"preview": "<resources>\n <string name=\"app_name\">lib</string>\n</resources>\n"
},
{
"path": "libshot/src/test/java/com/androidyuan/lib/ExampleUnitTest.java",
"chars": 312,
"preview": "package com.androidyuan.lib;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * To work on unit tests, s"
},
{
"path": "settings.gradle",
"chars": 27,
"preview": "include ':app', ':libshot'\n"
}
]
// ... and 1 more files (download for full content)
About this extraction
This page contains the full source code of the BruceWind/AndroidScreenShot_SysApi GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 32 files (34.6 KB), approximately 9.4k tokens, and a symbol index with 38 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.