├── library
├── consumer-rules.pro
├── src
│ └── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── u2tzjtne
│ │ └── globalgray
│ │ ├── GlobalGray.java
│ │ └── ObservableArrayList.java
├── proguard-rules.pro
├── build.gradle
└── .gitignore
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── sample
├── src
│ └── main
│ │ ├── res
│ │ ├── values
│ │ │ ├── strings.xml
│ │ │ ├── colors.xml
│ │ │ └── styles.xml
│ │ ├── drawable
│ │ │ ├── img_covid.jpg
│ │ │ └── ic_launcher_background.xml
│ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ ├── layout
│ │ │ └── activity_main.xml
│ │ └── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ ├── java
│ │ └── com
│ │ │ └── u2tzjtne
│ │ │ └── globalgray
│ │ │ └── sample
│ │ │ ├── App.java
│ │ │ ├── util
│ │ │ ├── SPUtils.java
│ │ │ └── AppUtils.java
│ │ │ └── MainActivity.java
│ │ └── AndroidManifest.xml
├── build.gradle
├── proguard-rules.pro
└── .gitignore
├── .idea
├── compiler.xml
└── jarRepositories.xml
├── README.md
├── gradle.properties
├── gradlew.bat
├── .gitignore
└── gradlew
/library/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name='GlobalGray'
2 | include ':sample'
3 | include ':library'
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/U2tzJTNE/GlobalGray/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/sample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | GlobalGray
3 |
4 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/img_covid.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/U2tzJTNE/GlobalGray/HEAD/sample/src/main/res/drawable/img_covid.jpg
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/U2tzJTNE/GlobalGray/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/U2tzJTNE/GlobalGray/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/U2tzJTNE/GlobalGray/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/U2tzJTNE/GlobalGray/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/U2tzJTNE/GlobalGray/HEAD/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/U2tzJTNE/GlobalGray/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/U2tzJTNE/GlobalGray/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/U2tzJTNE/GlobalGray/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/U2tzJTNE/GlobalGray/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/U2tzJTNE/GlobalGray/HEAD/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #6200EE
4 | #3700B3
5 | #03DAC5
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 08 13:13:15 CST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
7 |
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/u2tzjtne/globalgray/sample/App.java:
--------------------------------------------------------------------------------
1 | package com.u2tzjtne.globalgray.sample;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 |
6 | import com.u2tzjtne.globalgray.GlobalGray;
7 | import com.u2tzjtne.globalgray.sample.util.SPUtils;
8 |
9 | /**
10 | * @author u2tzjtne
11 | */
12 | public class App extends Application {
13 | private static Context context;
14 |
15 | @Override
16 | public void onCreate() {
17 | super.onCreate();
18 | context = getApplicationContext();
19 | GlobalGray.enable(SPUtils.getBoolean("enable_gray", false));
20 | }
21 |
22 | public static Context getContext() {
23 | return context;
24 | }
25 | }
--------------------------------------------------------------------------------
/sample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 29
5 | buildToolsVersion "29.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.u2tzjtne.globalgray.sample"
9 | minSdkVersion 19
10 | targetSdkVersion 29
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 |
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 |
22 | }
23 |
24 | dependencies {
25 | implementation 'androidx.appcompat:appcompat:1.3.1'
26 | implementation project(path: ':library')
27 | }
28 |
--------------------------------------------------------------------------------
/library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/sample/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/sample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | id 'maven-publish'
4 | }
5 |
6 | android {
7 | compileSdkVersion 29
8 | buildToolsVersion "29.0.3"
9 |
10 | defaultConfig {
11 | minSdkVersion 19
12 | targetSdkVersion 29
13 | versionCode 1
14 | versionName "1.0"
15 | consumerProguardFiles 'consumer-rules.pro'
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 |
25 | }
26 |
27 | afterEvaluate {
28 | publishing {
29 | publications {
30 | release(MavenPublication) {
31 | from components.release
32 | groupId = 'com.u2tzjtne'
33 | artifactId = 'globalgray'
34 | version = '1.0'
35 | }
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # GlobalGray
2 |
3 | [](https://jitpack.io/#U2tzJTNE/GlobalGray)
4 |
5 | 一个可以让应用全局变灰的库。
6 |
7 | ## Demo
8 |
9 | 
10 |
11 | ## 依赖
12 |
13 | 在你项目的build.gradle文件中添加jitpack的仓库
14 |
15 | ```groovy
16 | allprojects {
17 | repositories {
18 | ...
19 | maven { url 'https://jitpack.io' }
20 | }
21 | }
22 | ```
23 |
24 | 然后在你要使用的模块中添加如下依赖:
25 |
26 | ```groovy
27 | dependencies {
28 | implementation 'com.github.U2tzJTNE:GlobalGray:1.0'
29 | }
30 | ```
31 |
32 | ## 代码示例
33 |
34 | Application的onCreate中调用:
35 |
36 | ```java
37 | GlobalGray.enable(true);
38 | ```
39 |
40 | ## 已知存在的问题
41 |
42 | 1. 开启了View的硬件加速,可能会存在兼容性问题
43 | 2. 对于SurfaceView和Textureview以及其子类无效
44 |
45 | 对于问题1笔者在项目中暂未遇到问题,如果读者朋友们在项目中遇到兼容性问题,欢迎留言;
46 |
47 | 对于问题2其原因是因为这两个组件内部有独立的绘图表面(Surface),笔者目前未想到好的解决方案,如果有思路欢迎一块交流。
48 |
49 | ## 博客地址
50 |
51 | https://juejin.cn/post/6892277675012915207
52 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 |
21 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
16 |
17 |
18 |
24 |
25 |
31 |
32 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/u2tzjtne/globalgray/sample/util/SPUtils.java:
--------------------------------------------------------------------------------
1 | package com.u2tzjtne.globalgray.sample.util;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 |
6 | import com.u2tzjtne.globalgray.sample.App;
7 |
8 | /**
9 | *
10 | * @author u2tzjtne
11 | * @date 2017/10/9
12 | *
13 | * SharedPreferences工具类
14 | */
15 | public class SPUtils {
16 |
17 | private static SharedPreferences sp = App.getContext()
18 | .getSharedPreferences("APP_DATA", Context.MODE_PRIVATE);
19 | private static SharedPreferences.Editor edit = sp.edit();
20 |
21 | public static void putBoolean(String key, boolean value) {
22 | edit.putBoolean(key, value);
23 | edit.apply();
24 | }
25 |
26 | public static boolean getBoolean(String key, boolean defValue) {
27 | return sp.getBoolean(key, defValue);
28 | }
29 |
30 | public static void putInt(String key, int value) {
31 | edit.putInt(key, value);
32 | edit.apply();
33 | }
34 |
35 | public static int getInt(String key, int defValue) {
36 | return sp.getInt(key, defValue);
37 | }
38 |
39 | public static void putString(String key, String value) {
40 | edit.putString(key, value);
41 | edit.apply();
42 | }
43 |
44 | public static String getString(String key, String defValue) {
45 | return sp.getString(key, defValue);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/u2tzjtne/globalgray/sample/util/AppUtils.java:
--------------------------------------------------------------------------------
1 | package com.u2tzjtne.globalgray.sample.util;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.content.pm.PackageManager;
6 | import android.content.pm.ResolveInfo;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author u2tzjtne
12 | * @date 2020/4/16
13 | * Email u2tzjtne@gmail.com
14 | */
15 | public class AppUtils {
16 | public static void restartApp(Context context) {
17 | Intent intent = new Intent(Intent.ACTION_MAIN);
18 | intent.addCategory(Intent.CATEGORY_LAUNCHER);
19 | intent.setClassName(context.getPackageName(),
20 | getLauncherActivity(context, context.getPackageName()));
21 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
22 | | Intent.FLAG_ACTIVITY_CLEAR_TOP
23 | | Intent.FLAG_ACTIVITY_CLEAR_TASK);
24 | context.startActivity(intent);
25 | android.os.Process.killProcess(android.os.Process.myPid());
26 | System.exit(0);
27 | }
28 |
29 | public static String getLauncherActivity(Context context, String pkg) {
30 | Intent intent = new Intent(Intent.ACTION_MAIN, null);
31 | intent.addCategory(Intent.CATEGORY_LAUNCHER);
32 | intent.setPackage(pkg);
33 | PackageManager pm = context.getPackageManager();
34 | List info = pm.queryIntentActivities(intent, 0);
35 | return info.get(0).activityInfo.name;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/library/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | ### Android template
16 | # Built application files
17 | *.apk
18 | *.ap_
19 | *.aab
20 |
21 | # Files for the ART/Dalvik VM
22 | *.dex
23 |
24 | # Java class files
25 | *.class
26 |
27 | # Generated files
28 | bin/
29 | gen/
30 | out/
31 | release/
32 |
33 | # Gradle files
34 | .gradle/
35 | build/
36 |
37 | # Local configuration file (sdk path, etc)
38 | local.properties
39 |
40 | # Proguard folder generated by Eclipse
41 | proguard/
42 |
43 | # Log Files
44 | *.log
45 |
46 | # Android Studio Navigation editor temp files
47 | .navigation/
48 |
49 | # Android Studio captures folder
50 | captures/
51 |
52 | # IntelliJ
53 | *.iml
54 | .idea/workspace.xml
55 | .idea/tasks.xml
56 | .idea/gradle.xml
57 | .idea/assetWizardSettings.xml
58 | .idea/dictionaries
59 | .idea/libraries
60 | # Android Studio 3 in .gitignore file.
61 | .idea/caches
62 | .idea/modules.xml
63 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you
64 | .idea/navEditor.xml
65 |
66 | # Keystore files
67 | # Uncomment the following lines if you do not want to check your keystore files in.
68 | #*.jks
69 | #*.keystore
70 |
71 | # External native build folder generated in Android Studio 2.2 and later
72 | .externalNativeBuild
73 |
74 | # Google Services (e.g. APIs or Firebase)
75 | # google-services.json
76 |
77 | # Freeline
78 | freeline.py
79 | freeline/
80 | freeline_project_description.json
81 |
82 | # fastlane
83 | fastlane/report.xml
84 | fastlane/Preview.html
85 | fastlane/screenshots
86 | fastlane/test_output
87 | fastlane/readme.md
88 |
89 | # Version control
90 | vcs.xml
91 |
92 | # lint
93 | lint/intermediates/
94 | lint/generated/
95 | lint/outputs/
96 | lint/tmp/
97 | # lint/reports/
98 |
99 |
--------------------------------------------------------------------------------
/sample/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | ### Android template
16 | # Built application files
17 | *.apk
18 | *.ap_
19 | *.aab
20 |
21 | # Files for the ART/Dalvik VM
22 | *.dex
23 |
24 | # Java class files
25 | *.class
26 |
27 | # Generated files
28 | bin/
29 | gen/
30 | out/
31 | release/
32 |
33 | # Gradle files
34 | .gradle/
35 | build/
36 |
37 | # Local configuration file (sdk path, etc)
38 | local.properties
39 |
40 | # Proguard folder generated by Eclipse
41 | proguard/
42 |
43 | # Log Files
44 | *.log
45 |
46 | # Android Studio Navigation editor temp files
47 | .navigation/
48 |
49 | # Android Studio captures folder
50 | captures/
51 |
52 | # IntelliJ
53 | *.iml
54 | .idea/workspace.xml
55 | .idea/tasks.xml
56 | .idea/gradle.xml
57 | .idea/assetWizardSettings.xml
58 | .idea/dictionaries
59 | .idea/libraries
60 | # Android Studio 3 in .gitignore file.
61 | .idea/caches
62 | .idea/modules.xml
63 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you
64 | .idea/navEditor.xml
65 |
66 | # Keystore files
67 | # Uncomment the following lines if you do not want to check your keystore files in.
68 | #*.jks
69 | #*.keystore
70 |
71 | # External native build folder generated in Android Studio 2.2 and later
72 | .externalNativeBuild
73 |
74 | # Google Services (e.g. APIs or Firebase)
75 | # google-services.json
76 |
77 | # Freeline
78 | freeline.py
79 | freeline/
80 | freeline_project_description.json
81 |
82 | # fastlane
83 | fastlane/report.xml
84 | fastlane/Preview.html
85 | fastlane/screenshots
86 | fastlane/test_output
87 | fastlane/readme.md
88 |
89 | # Version control
90 | vcs.xml
91 |
92 | # lint
93 | lint/intermediates/
94 | lint/generated/
95 | lint/outputs/
96 | lint/tmp/
97 | # lint/reports/
98 |
99 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/sample/src/main/java/com/u2tzjtne/globalgray/sample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.u2tzjtne.globalgray.sample;
2 |
3 | import androidx.appcompat.app.AlertDialog;
4 | import androidx.appcompat.app.AppCompatActivity;
5 | import androidx.appcompat.widget.SwitchCompat;
6 |
7 | import android.content.DialogInterface;
8 | import android.os.Bundle;
9 | import android.os.Handler;
10 | import android.view.View;
11 | import android.widget.Button;
12 | import android.widget.CompoundButton;
13 |
14 | import com.u2tzjtne.globalgray.sample.util.AppUtils;
15 | import com.u2tzjtne.globalgray.sample.util.SPUtils;
16 |
17 | /**
18 | * @author u2tzjtne
19 | * Date 2020/4/16
20 | * Email u2tzjtne@gmail.com
21 | */
22 | public class MainActivity extends AppCompatActivity {
23 |
24 | private SwitchCompat mSwitchCompat;
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | setContentView(R.layout.activity_main);
30 | initView();
31 | }
32 |
33 | private void initView() {
34 | mSwitchCompat = findViewById(R.id.sw_enable_gray);
35 | Button mBtnShowDialog = findViewById(R.id.btn_show_dialog);
36 |
37 | mBtnShowDialog.setOnClickListener(new View.OnClickListener() {
38 | @Override
39 | public void onClick(View view) {
40 | showDialog();
41 | }
42 | });
43 |
44 | mSwitchCompat.setChecked(SPUtils.getBoolean("enable_gray", false));
45 |
46 | mSwitchCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
47 | @Override
48 | public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
49 | SPUtils.putBoolean("enable_gray", mSwitchCompat.isChecked());
50 | //需要延迟启动,否则可能还没有写入SP应用进程就被杀死了
51 | new Handler().postDelayed(new Runnable() {
52 | @Override
53 | public void run() {
54 | AppUtils.restartApp(MainActivity.this);
55 | }
56 | }, 300);
57 | }
58 | });
59 | }
60 |
61 | private void showDialog() {
62 | AlertDialog.Builder builder = new AlertDialog.Builder(this);
63 | builder.setTitle(R.string.app_name)
64 | .setIcon(R.mipmap.ic_launcher)
65 | .setMessage("this is a dialog!")
66 | .setNegativeButton("ok", new DialogInterface.OnClickListener() {
67 | @Override
68 | public void onClick(DialogInterface dialogInterface, int i) {
69 |
70 | }
71 | })
72 | .setCancelable(true)
73 | .show();
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/library/src/main/java/com/u2tzjtne/globalgray/GlobalGray.java:
--------------------------------------------------------------------------------
1 | package com.u2tzjtne.globalgray;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.graphics.ColorMatrix;
5 | import android.graphics.ColorMatrixColorFilter;
6 | import android.graphics.Paint;
7 | import android.view.View;
8 |
9 | import java.lang.reflect.Field;
10 | import java.util.ArrayList;
11 |
12 | /**
13 | * @author u2tzjtne
14 | */
15 | public class GlobalGray {
16 | /**
17 | * @param enable 是否开启全局灰色调
18 | */
19 | public static void enable(boolean enable) {
20 | if (!enable) {
21 | return;
22 | }
23 | try {
24 | //灰色调Paint
25 | final Paint mPaint = new Paint();
26 | ColorMatrix mColorMatrix = new ColorMatrix();
27 | mColorMatrix.setSaturation(0);
28 | mPaint.setColorFilter(new ColorMatrixColorFilter(mColorMatrix));
29 |
30 | //反射获取windowManagerGlobal
31 | @SuppressLint("PrivateApi")
32 | Class> windowManagerGlobal = Class.forName("android.view.WindowManagerGlobal");
33 | @SuppressLint("DiscouragedPrivateApi")
34 | java.lang.reflect.Method getInstanceMethod = windowManagerGlobal.getDeclaredMethod("getInstance");
35 | getInstanceMethod.setAccessible(true);
36 | Object windowManagerGlobalInstance = getInstanceMethod.invoke(windowManagerGlobal);
37 |
38 | //反射获取mViews
39 | Field mViewsField = windowManagerGlobal.getDeclaredField("mViews");
40 | mViewsField.setAccessible(true);
41 | Object mViewsObject = mViewsField.get(windowManagerGlobalInstance);
42 |
43 | //创建具有数据感知能力的ObservableArrayList
44 | ObservableArrayList observerArrayList = new ObservableArrayList<>();
45 | observerArrayList.addOnListChangedListener(new ObservableArrayList.OnListChangeListener() {
46 | @Override
47 | public void onChange(ArrayList list, int index, int count) {
48 |
49 | }
50 |
51 | @Override
52 | public void onAdd(ArrayList list, int start, int count) {
53 | View view = (View) list.get(start);
54 | if (view != null) {
55 | view.setLayerType(View.LAYER_TYPE_HARDWARE, mPaint);
56 | }
57 | }
58 |
59 | @Override
60 | public void onRemove(ArrayList list, int start, int count) {
61 |
62 | }
63 | });
64 | //将原有的数据添加到新创建的list
65 | observerArrayList.addAll((ArrayList) mViewsObject);
66 | //替换掉原有的mViews
67 | mViewsField.set(windowManagerGlobalInstance, observerArrayList);
68 | } catch (Exception e) {
69 | e.printStackTrace();
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/library/src/main/java/com/u2tzjtne/globalgray/ObservableArrayList.java:
--------------------------------------------------------------------------------
1 | package com.u2tzjtne.globalgray;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collection;
5 | import java.util.List;
6 |
7 | /**
8 | * 具有数据感知能力的ArrayList实现
9 | *
10 | * @author u2tzjtne
11 | * @date 2020/4/8
12 | */
13 | public class ObservableArrayList extends ArrayList {
14 | private List mListeners = new ArrayList<>();
15 |
16 | public void addOnListChangedListener(OnListChangeListener listener) {
17 | if (mListeners != null) {
18 | mListeners.add(listener);
19 | }
20 | }
21 |
22 | public void removeOnListChangedListener(OnListChangeListener listener) {
23 | if (mListeners != null) {
24 | mListeners.remove(listener);
25 | }
26 | }
27 |
28 | @Override
29 | public boolean add(T object) {
30 | super.add(object);
31 | notifyAdd(size() - 1, 1);
32 | return true;
33 | }
34 |
35 | @Override
36 | public void add(int index, T object) {
37 | super.add(index, object);
38 | notifyAdd(index, 1);
39 | }
40 |
41 | @Override
42 | public boolean addAll(Collection extends T> collection) {
43 | int oldSize = size();
44 | boolean added = super.addAll(collection);
45 | if (added) {
46 | notifyAdd(oldSize, size() - oldSize);
47 | }
48 | return added;
49 | }
50 |
51 |
52 | @Override
53 | public void clear() {
54 | int oldSize = size();
55 | super.clear();
56 | if (oldSize != 0) {
57 | notifyRemove(0, oldSize);
58 | }
59 | }
60 |
61 | @Override
62 | public T remove(int index) {
63 | T val = super.remove(index);
64 | notifyRemove(index, 1);
65 | return val;
66 | }
67 |
68 | @Override
69 | public boolean remove(Object object) {
70 | int index = indexOf(object);
71 | if (index >= 0) {
72 | remove(index);
73 | return true;
74 | } else {
75 | return false;
76 | }
77 | }
78 |
79 | @Override
80 | public T set(int index, T object) {
81 | T val = super.set(index, object);
82 | if (mListeners != null) {
83 | for (OnListChangeListener listener : mListeners) {
84 | listener.onChange(this, index, 1);
85 | }
86 | }
87 | return val;
88 | }
89 |
90 | @Override
91 | protected void removeRange(int fromIndex, int toIndex) {
92 | super.removeRange(fromIndex, toIndex);
93 | notifyRemove(fromIndex, toIndex - fromIndex);
94 | }
95 |
96 | private void notifyAdd(int start, int count) {
97 | if (mListeners != null) {
98 | for (OnListChangeListener listener : mListeners) {
99 | listener.onAdd(this, start, count);
100 | }
101 | }
102 | }
103 |
104 | private void notifyRemove(int start, int count) {
105 | if (mListeners != null) {
106 | for (OnListChangeListener listener : mListeners) {
107 | listener.onRemove(this, start, count);
108 | }
109 | }
110 | }
111 |
112 | public interface OnListChangeListener {
113 |
114 | void onChange(ArrayList list, int index, int count);
115 |
116 | void onAdd(ArrayList list, int start, int count);
117 |
118 | void onRemove(ArrayList list, int start, int count);
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | ### Android template
16 | # Built application files
17 | *.apk
18 | *.ap_
19 | *.aab
20 |
21 | # Files for the ART/Dalvik VM
22 | *.dex
23 |
24 | # Java class files
25 | *.class
26 |
27 | # Generated files
28 | bin/
29 | gen/
30 | out/
31 | release/
32 |
33 | # Gradle files
34 | .gradle/
35 | build/
36 |
37 | # Local configuration file (sdk path, etc)
38 | local.properties
39 |
40 | # Proguard folder generated by Eclipse
41 | proguard/
42 |
43 | # Log Files
44 | *.log
45 |
46 | # Android Studio Navigation editor temp files
47 | .navigation/
48 |
49 | # Android Studio captures folder
50 | captures/
51 |
52 | # IntelliJ
53 | *.iml
54 | .idea/workspace.xml
55 | .idea/tasks.xml
56 | .idea/gradle.xml
57 | .idea/assetWizardSettings.xml
58 | .idea/dictionaries
59 | .idea/libraries
60 | # Android Studio 3 in .gitignore file.
61 | .idea/caches
62 | .idea/modules.xml
63 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you
64 | .idea/navEditor.xml
65 |
66 | # Keystore files
67 | # Uncomment the following lines if you do not want to check your keystore files in.
68 | #*.jks
69 | #*.keystore
70 |
71 | # External native build folder generated in Android Studio 2.2 and later
72 | .externalNativeBuild
73 |
74 | # Google Services (e.g. APIs or Firebase)
75 | # google-services.json
76 |
77 | # Freeline
78 | freeline.py
79 | freeline/
80 | freeline_project_description.json
81 |
82 | # fastlane
83 | fastlane/report.xml
84 | fastlane/Preview.html
85 | fastlane/screenshots
86 | fastlane/test_output
87 | fastlane/readme.md
88 |
89 | # Version control
90 | vcs.xml
91 |
92 | # lint
93 | lint/intermediates/
94 | lint/generated/
95 | lint/outputs/
96 | lint/tmp/
97 | # lint/reports/
98 |
99 | ### Android template
100 | # Built application files
101 | *.apk
102 | *.aar
103 | *.ap_
104 | *.aab
105 |
106 | # Files for the ART/Dalvik VM
107 | *.dex
108 |
109 | # Java class files
110 | *.class
111 |
112 | # Generated files
113 | bin/
114 | gen/
115 | out/
116 | # Uncomment the following line in case you need and you don't have the release build type files in your app
117 | # release/
118 |
119 | # Gradle files
120 | .gradle/
121 | build/
122 |
123 | # Local configuration file (sdk path, etc)
124 | local.properties
125 |
126 | # Proguard folder generated by Eclipse
127 | proguard/
128 |
129 | # Log Files
130 | *.log
131 |
132 | # Android Studio Navigation editor temp files
133 | .navigation/
134 |
135 | # Android Studio captures folder
136 | captures/
137 |
138 | # IntelliJ
139 | *.iml
140 | .idea/workspace.xml
141 | .idea/tasks.xml
142 | .idea/gradle.xml
143 | .idea/assetWizardSettings.xml
144 | .idea/dictionaries
145 | .idea/libraries
146 | # Android Studio 3 in .gitignore file.
147 | .idea/caches
148 | .idea/modules.xml
149 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you
150 | .idea/navEditor.xml
151 |
152 | # Keystore files
153 | # Uncomment the following lines if you do not want to check your keystore files in.
154 | #*.jks
155 | #*.keystore
156 |
157 | # External native build folder generated in Android Studio 2.2 and later
158 | .externalNativeBuild
159 | .cxx/
160 |
161 | # Google Services (e.g. APIs or Firebase)
162 | # google-services.json
163 |
164 | # Freeline
165 | freeline.py
166 | freeline/
167 | freeline_project_description.json
168 |
169 | # fastlane
170 | fastlane/report.xml
171 | fastlane/Preview.html
172 | fastlane/screenshots
173 | fastlane/test_output
174 | fastlane/readme.md
175 |
176 | # Version control
177 | vcs.xml
178 |
179 | # lint
180 | lint/intermediates/
181 | lint/generated/
182 | lint/outputs/
183 | lint/tmp/
184 | # lint/reports/
185 |
186 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------