images = returnImageUrlsFromHtml(htmlStr);
58 | String text = returnOnlyText(htmlStr);
59 | if (TextUtils.isEmpty(text) && images.size() == 0) {
60 | return true;
61 | } else {
62 | return false;
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/app/src/main/java/com/leo/copytoutiao/utils/Utils.java:
--------------------------------------------------------------------------------
1 | package com.leo.copytoutiao.utils;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.BitmapFactory;
6 | import android.graphics.Canvas;
7 | import android.graphics.drawable.BitmapDrawable;
8 | import android.graphics.drawable.Drawable;
9 | import android.util.Base64;
10 |
11 | import java.io.ByteArrayOutputStream;
12 |
13 | /**
14 | * Created by ZQiong on 2018/3/22.
15 | */
16 |
17 | public final class Utils {
18 |
19 | private Utils() throws InstantiationException {
20 | throw new InstantiationException("This class is not for instantiation");
21 | }
22 |
23 | public static String toBase64(Bitmap bitmap) {
24 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
25 | bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
26 | byte[] bytes = baos.toByteArray();
27 |
28 | return Base64.encodeToString(bytes, Base64.NO_WRAP);
29 | }
30 |
31 | public static Bitmap toBitmap(Drawable drawable) {
32 | if (drawable instanceof BitmapDrawable) {
33 | return ((BitmapDrawable) drawable).getBitmap();
34 | }
35 |
36 | int width = drawable.getIntrinsicWidth();
37 | width = width > 0 ? width : 1;
38 | int height = drawable.getIntrinsicHeight();
39 | height = height > 0 ? height : 1;
40 |
41 | Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
42 | Canvas canvas = new Canvas(bitmap);
43 | drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
44 | drawable.draw(canvas);
45 |
46 | return bitmap;
47 | }
48 |
49 | public static Bitmap decodeResource(Context context, int resId) {
50 | return BitmapFactory.decodeResource(context.getResources(), resId);
51 | }
52 |
53 | public static long getCurrentTime() {
54 | return System.currentTimeMillis();
55 | }
56 |
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/leo/copytoutiao/utils/popup/PopupController.java:
--------------------------------------------------------------------------------
1 | package com.leo.copytoutiao.utils.popup;
2 |
3 | import android.content.Context;
4 | import android.graphics.drawable.ColorDrawable;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.view.Window;
9 | import android.widget.PopupWindow;
10 |
11 | /**
12 | * Created by MQ on 2017/5/2.
13 | */
14 |
15 | class PopupController {
16 | private int layoutResId;//布局id
17 | Context context;
18 | private PopupWindow popupWindow;
19 | View mPopupView;//弹窗布局View
20 | private View mView;
21 | private Window mWindow;
22 |
23 | PopupController(Context context, PopupWindow popupWindow) {
24 | this.context = context;
25 | this.popupWindow = popupWindow;
26 | }
27 |
28 | public void setView(int layoutResId) {
29 | mView = null;
30 | this.layoutResId = layoutResId;
31 | installContent();
32 | }
33 |
34 | public void setView(View view) {
35 | mView = view;
36 | this.layoutResId = 0;
37 | installContent();
38 | }
39 |
40 | private void installContent() {
41 | if (layoutResId != 0) {
42 | mPopupView = LayoutInflater.from(context).inflate(layoutResId, null);
43 | } else if (mView != null) {
44 | mPopupView = mView;
45 | }
46 | popupWindow.setContentView(mPopupView);
47 | }
48 |
49 | /**
50 | * 设置宽度
51 | *
52 | * @param width 宽
53 | * @param height 高
54 | */
55 | private void setWidthAndHeight(int width, int height) {
56 | if (width == 0 || height == 0) {
57 | //如果没设置宽高,默认是WRAP_CONTENT
58 | popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
59 | popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
60 | } else {
61 | popupWindow.setWidth(width);
62 | popupWindow.setHeight(height);
63 | }
64 | }
65 |
66 |
67 | /**
68 | * 设置动画
69 | */
70 | private void setAnimationStyle(int animationStyle) {
71 | popupWindow.setAnimationStyle(animationStyle);
72 | }
73 |
74 |
75 | /**
76 | * 设置Outside是否可点击
77 | *
78 | * @param touchable 是否可点击
79 | */
80 | private void setOutsideTouchable(boolean touchable) {
81 | popupWindow.setBackgroundDrawable(new ColorDrawable(0x00000000));//设置透明背景
82 | popupWindow.setOutsideTouchable(touchable);//设置outside可点击
83 | popupWindow.setFocusable(touchable);
84 | }
85 |
86 |
87 | static class PopupParams {
88 | public int layoutResId;//布局id
89 | public Context mContext;
90 | public int mWidth, mHeight;//弹窗的宽和高
91 | public boolean isShowAnim;
92 | public int animationStyle;//动画Id
93 | public View mView;
94 | public boolean isTouchable = true;
95 |
96 | public PopupParams(Context mContext) {
97 | this.mContext = mContext;
98 | }
99 |
100 | public void apply(PopupController controller) {
101 | if (mView != null) {
102 | controller.setView(mView);
103 | } else if (layoutResId != 0) {
104 | controller.setView(layoutResId);
105 | } else {
106 | throw new IllegalArgumentException("PopupView's contentView is null");
107 | }
108 | controller.setWidthAndHeight(mWidth, mHeight);
109 | controller.setOutsideTouchable(isTouchable);//设置outside可点击
110 |
111 | if (isShowAnim) {
112 | controller.setAnimationStyle(animationStyle);
113 | }
114 | }
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/translate_pop_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/translate_pop_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/color/text_newapp_publish.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_dotted_line.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_white_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
15 |
16 |
23 |
24 |
30 |
31 |
32 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_show_art.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/newapp_pop_picture.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
12 |
13 |
19 |
20 |
21 |
27 |
28 |
35 |
36 |
37 |
38 |
42 |
43 |
49 |
50 |
51 |
52 |
59 |
60 |
61 |
62 |
66 |
72 |
73 |
74 |
75 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/bold.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xhdpi/bold.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/bold_.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xhdpi/bold_.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/list_ol.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xhdpi/list_ol.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/list_ol_.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xhdpi/list_ol_.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/list_ul.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xhdpi/list_ul.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/list_ul_.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xhdpi/list_ul_.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/picture_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xhdpi/picture_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/underline.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xhdpi/underline.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/underline_.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xhdpi/underline_.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/rich_do.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xxxhdpi/rich_do.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/rich_undo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/app/src/main/res/mipmap-xxxhdpi/rich_undo.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 | #000000
7 | #ffffff
8 |
9 |
10 | #0479CA
11 | #1b1b1b
12 | #f2f2f2
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 高仿今日头条富文本编辑
3 |
4 | \t\t高仿今日头条文章发布富文本,你想要的功能,全都有。
5 | \n
6 | \t\t基于开源框架:richeditor-android实现;感谢开源,开源地址:https://github.com/wasabeef/richeditor-android
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
13 |
14 |
17 |
18 |
19 |
29 |
30 |
31 |
32 |
39 |
40 |
41 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/test/java/com/leo/copytoutiao/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.leo.copytoutiao;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext {
5 | androidx_appcompat_version = "1.1.0"
6 | androidx_core_version = "1.1.0"
7 | androidx_exifinterface_version = "1.1.0-beta01"
8 | androidx_transition_version = "1.2.0-rc01"
9 | constraintlayout_version = "1.1.3"
10 | }
11 |
12 | repositories {
13 | google()
14 | jcenter()
15 |
16 | }
17 | dependencies {
18 | classpath 'com.android.tools.build:gradle:3.5.2'
19 |
20 | // NOTE: Do not place your application dependencies here; they belong
21 | // in the individual module build.gradle files
22 | }
23 | }
24 |
25 | allprojects {
26 | repositories {
27 | google()
28 | jcenter()
29 | maven { url 'https://jitpack.io' }
30 | }
31 | }
32 |
33 | task clean(type: Delete) {
34 | delete rootProject.buildDir
35 | }
36 |
--------------------------------------------------------------------------------
/gif/richEditText1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/gif/richEditText1.gif
--------------------------------------------------------------------------------
/gif/richEditText2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/gif/richEditText2.gif
--------------------------------------------------------------------------------
/gif/richEditText3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/gif/richEditText3.gif
--------------------------------------------------------------------------------
/gif/richEditText4.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/gif/richEditText4.gif
--------------------------------------------------------------------------------
/gif/richEditText5.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/gif/richEditText5.gif
--------------------------------------------------------------------------------
/gif/richEditText6.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/gif/richEditText6.gif
--------------------------------------------------------------------------------
/gif/richEditText7.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/gif/richEditText7.gif
--------------------------------------------------------------------------------
/gif/wx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/gif/wx.png
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Sep 15 11:02:31 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.4.1-all.zip
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/imagepicker/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/imagepicker/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/imagepicker/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | minSdkVersion 15
7 | targetSdkVersion 28
8 | versionCode 1
9 | versionName "1.0"
10 | vectorDrawables.useSupportLibrary = true
11 | }
12 |
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 |
20 | }
21 |
22 | dependencies {
23 | implementation fileTree(dir: 'libs', include: ['*.jar'])
24 | implementation 'com.android.support:appcompat-v7:28.0.0'
25 | testImplementation 'junit:junit:4.12'
26 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
28 | implementation 'com.android.support:recyclerview-v7:28.0.0'
29 | implementation 'com.github.bumptech.glide:glide:4.9.0'
30 | implementation ('com.github.chrisbanes.photoview:library:1.2.4'){
31 | exclude group:'com.android.support'
32 | }
33 | }
34 |
35 | //apply from: '../bintray.gradle'
--------------------------------------------------------------------------------
/imagepicker/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in E:\Android\SDK/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/imagepicker/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
22 |
27 |
31 |
32 |
36 |
37 |
42 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/DataHolder.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker;
2 |
3 | import com.lzy.imagepicker.bean.ImageItem;
4 |
5 | import java.util.HashMap;
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 |
10 | /**
11 | * 新的DataHolder,使用单例和弱引用解决崩溃问题
12 | *
13 | * Author: nanchen
14 | * Email: liushilin520@foxmail.com
15 | * Date: 2017-03-20 07:01
16 | */
17 | public class DataHolder {
18 | public static final String DH_CURRENT_IMAGE_FOLDER_ITEMS = "dh_current_image_folder_items";
19 |
20 | private static DataHolder mInstance;
21 | private Map> data;
22 |
23 | public static DataHolder getInstance() {
24 | if (mInstance == null){
25 | synchronized (DataHolder.class){
26 | if (mInstance == null){
27 | mInstance = new DataHolder();
28 | }
29 | }
30 | }
31 | return mInstance;
32 | }
33 |
34 | private DataHolder() {
35 | data = new HashMap<>();
36 | }
37 |
38 | public void save(String id, List object) {
39 | if (data != null){
40 | data.put(id, object);
41 | }
42 | }
43 |
44 | public Object retrieve(String id) {
45 | if (data == null || mInstance == null){
46 | throw new RuntimeException("你必须先初始化");
47 | }
48 | return data.get(id);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/ImagePickerProvider.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker;
2 |
3 |
4 | import androidx.core.content.FileProvider;
5 |
6 | /**
7 | * 自定义一个Provider,以免和引入的项目的provider冲突
8 | *
9 | * Author: nanchen
10 | * Email: liushilin520@foxmail.com
11 | * Date: 2017-03-17 16:10
12 | */
13 |
14 | public class ImagePickerProvider extends FileProvider {
15 | }
16 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/adapter/ImageFolderAdapter.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker.adapter;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.BaseAdapter;
9 | import android.widget.ImageView;
10 | import android.widget.TextView;
11 |
12 | import com.lzy.imagepicker.ImagePicker;
13 | import com.lzy.imagepicker.R;
14 | import com.lzy.imagepicker.util.Utils;
15 | import com.lzy.imagepicker.bean.ImageFolder;
16 |
17 | import java.util.ArrayList;
18 | import java.util.List;
19 |
20 |
21 | /**
22 | * ================================================
23 | * 作 者:jeasonlzy(廖子尧 Github地址:https://github.com/jeasonlzy0216
24 | * 版 本:1.0
25 | * 创建日期:2016/5/19
26 | * 描 述:
27 | * 修订历史:
28 | * ================================================
29 | */
30 | public class ImageFolderAdapter extends BaseAdapter {
31 |
32 | private ImagePicker imagePicker;
33 | private Activity mActivity;
34 | private LayoutInflater mInflater;
35 | private int mImageSize;
36 | private List imageFolders;
37 | private int lastSelected = 0;
38 |
39 | public ImageFolderAdapter(Activity activity, List folders) {
40 | mActivity = activity;
41 | if (folders != null && folders.size() > 0) imageFolders = folders;
42 | else imageFolders = new ArrayList<>();
43 |
44 | imagePicker = ImagePicker.getInstance();
45 | mImageSize = Utils.getImageItemWidth(mActivity);
46 | mInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
47 | }
48 |
49 | public void refreshData(List folders) {
50 | if (folders != null && folders.size() > 0) imageFolders = folders;
51 | else imageFolders.clear();
52 | notifyDataSetChanged();
53 | }
54 |
55 | @Override
56 | public int getCount() {
57 | return imageFolders.size();
58 | }
59 |
60 | @Override
61 | public ImageFolder getItem(int position) {
62 | return imageFolders.get(position);
63 | }
64 |
65 | @Override
66 | public long getItemId(int position) {
67 | return position;
68 | }
69 |
70 | @Override
71 | public View getView(int position, View convertView, ViewGroup parent) {
72 | ViewHolder holder;
73 | if (convertView == null) {
74 | convertView = mInflater.inflate(R.layout.adapter_folder_list_item, parent, false);
75 | holder = new ViewHolder(convertView);
76 | } else {
77 | holder = (ViewHolder) convertView.getTag();
78 | }
79 |
80 | ImageFolder folder = getItem(position);
81 | holder.folderName.setText(folder.name);
82 | holder.imageCount.setText(mActivity.getString(R.string.ip_folder_image_count, folder.images.size()));
83 | imagePicker.getImageLoader().displayImage(mActivity, folder.cover.path, holder.cover, mImageSize, mImageSize);
84 |
85 | if (lastSelected == position) {
86 | holder.folderCheck.setVisibility(View.VISIBLE);
87 | } else {
88 | holder.folderCheck.setVisibility(View.INVISIBLE);
89 | }
90 |
91 | return convertView;
92 | }
93 |
94 | public void setSelectIndex(int i) {
95 | if (lastSelected == i) {
96 | return;
97 | }
98 | lastSelected = i;
99 | notifyDataSetChanged();
100 | }
101 |
102 | public int getSelectIndex() {
103 | return lastSelected;
104 | }
105 |
106 | private class ViewHolder {
107 | ImageView cover;
108 | TextView folderName;
109 | TextView imageCount;
110 | ImageView folderCheck;
111 |
112 | public ViewHolder(View view) {
113 | cover = (ImageView) view.findViewById(R.id.iv_cover);
114 | folderName = (TextView) view.findViewById(R.id.tv_folder_name);
115 | imageCount = (TextView) view.findViewById(R.id.tv_image_count);
116 | folderCheck = (ImageView) view.findViewById(R.id.iv_folder_check);
117 | view.setTag(this);
118 | }
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/adapter/ImagePageAdapter.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker.adapter;
2 |
3 | import android.app.Activity;
4 | import android.util.DisplayMetrics;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 |
8 | import com.lzy.imagepicker.ImagePicker;
9 | import com.lzy.imagepicker.util.Utils;
10 | import com.lzy.imagepicker.bean.ImageItem;
11 |
12 | import java.util.ArrayList;
13 |
14 | import androidx.viewpager.widget.PagerAdapter;
15 | import uk.co.senab.photoview.PhotoView;
16 | import uk.co.senab.photoview.PhotoViewAttacher;
17 |
18 | /**
19 | * ================================================
20 | * 作 者:jeasonlzy(廖子尧 Github地址:https://github.com/jeasonlzy0216
21 | * 版 本:1.0
22 | * 创建日期:2016/5/19
23 | * 描 述:
24 | * 修订历史:
25 | * ================================================
26 | */
27 | public class ImagePageAdapter extends PagerAdapter {
28 |
29 | private int screenWidth;
30 | private int screenHeight;
31 | private ImagePicker imagePicker;
32 | private ArrayList images = new ArrayList<>();
33 | private Activity mActivity;
34 | public PhotoViewClickListener listener;
35 |
36 | public ImagePageAdapter(Activity activity, ArrayList images) {
37 | this.mActivity = activity;
38 | this.images = images;
39 |
40 | DisplayMetrics dm = Utils.getScreenPix(activity);
41 | screenWidth = dm.widthPixels;
42 | screenHeight = dm.heightPixels;
43 | imagePicker = ImagePicker.getInstance();
44 | }
45 |
46 | public void setData(ArrayList images) {
47 | this.images = images;
48 | }
49 |
50 | public void setPhotoViewClickListener(PhotoViewClickListener listener) {
51 | this.listener = listener;
52 | }
53 |
54 | @Override
55 | public Object instantiateItem(ViewGroup container, int position) {
56 | PhotoView photoView = new PhotoView(mActivity);
57 | ImageItem imageItem = images.get(position);
58 | imagePicker.getImageLoader().displayImagePreview(mActivity, imageItem.path, photoView, screenWidth, screenHeight);
59 | photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
60 | @Override
61 | public void onPhotoTap(View view, float x, float y) {
62 | if (listener != null) listener.OnPhotoTapListener(view, x, y);
63 | }
64 | });
65 | container.addView(photoView);
66 | return photoView;
67 | }
68 |
69 | @Override
70 | public int getCount() {
71 | return images.size();
72 | }
73 |
74 | @Override
75 | public boolean isViewFromObject(View view, Object object) {
76 | return view == object;
77 | }
78 |
79 | @Override
80 | public void destroyItem(ViewGroup container, int position, Object object) {
81 | container.removeView((View) object);
82 | }
83 |
84 | @Override
85 | public int getItemPosition(Object object) {
86 | return POSITION_NONE;
87 | }
88 |
89 | public interface PhotoViewClickListener {
90 | void OnPhotoTapListener(View view, float v, float v1);
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/bean/ImageFolder.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker.bean;
2 |
3 | import java.io.Serializable;
4 | import java.util.ArrayList;
5 | import java.util.List;
6 |
7 | /**
8 | * ================================================
9 | * 作 者:jeasonlzy(廖子尧 Github地址:https://github.com/jeasonlzy0216
10 | * 版 本:1.0
11 | * 创建日期:2016/5/19
12 | * 描 述:图片文件夹
13 | * 修订历史:
14 | * ================================================
15 | */
16 | public class ImageFolder implements Serializable {
17 |
18 | public String name; //当前文件夹的名字
19 | public String path; //当前文件夹的路径
20 | public ImageItem cover; //当前文件夹需要要显示的缩略图,默认为最近的一次图片
21 | public ArrayList images; //当前文件夹下所有图片的集合
22 |
23 | /** 只要文件夹的路径和名字相同,就认为是相同的文件夹 */
24 | @Override
25 | public boolean equals(Object o) {
26 | try {
27 | ImageFolder other = (ImageFolder) o;
28 | return this.path.equalsIgnoreCase(other.path) && this.name.equalsIgnoreCase(other.name);
29 | } catch (ClassCastException e) {
30 | e.printStackTrace();
31 | }
32 | return super.equals(o);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/bean/ImageItem.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker.bean;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import java.io.Serializable;
7 |
8 | /**
9 | * ================================================
10 | * 作 者:jeasonlzy(廖子尧 Github地址:https://github.com/jeasonlzy0216
11 | * 版 本:1.0
12 | * 创建日期:2016/5/19
13 | * 描 述:图片信息
14 | * 修订历史:
15 | * ================================================
16 | */
17 | public class ImageItem implements Serializable, Parcelable {
18 |
19 | public String name; //图片的名字
20 | public String path; //图片的路径
21 | public long size; //图片的大小
22 | public int width; //图片的宽度
23 | public int height; //图片的高度
24 | public String mimeType; //图片的类型
25 | public long addTime; //图片的创建时间
26 |
27 | /** 图片的路径和创建时间相同就认为是同一张图片 */
28 | @Override
29 | public boolean equals(Object o) {
30 | if (o instanceof ImageItem) {
31 | ImageItem item = (ImageItem) o;
32 | return this.path.equalsIgnoreCase(item.path) && this.addTime == item.addTime;
33 | }
34 |
35 | return super.equals(o);
36 | }
37 |
38 |
39 | @Override
40 | public int describeContents() {
41 | return 0;
42 | }
43 |
44 | @Override
45 | public void writeToParcel(Parcel dest, int flags) {
46 | dest.writeString(this.name);
47 | dest.writeString(this.path);
48 | dest.writeLong(this.size);
49 | dest.writeInt(this.width);
50 | dest.writeInt(this.height);
51 | dest.writeString(this.mimeType);
52 | dest.writeLong(this.addTime);
53 | }
54 |
55 | public ImageItem() {
56 | }
57 |
58 | protected ImageItem(Parcel in) {
59 | this.name = in.readString();
60 | this.path = in.readString();
61 | this.size = in.readLong();
62 | this.width = in.readInt();
63 | this.height = in.readInt();
64 | this.mimeType = in.readString();
65 | this.addTime = in.readLong();
66 | }
67 |
68 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
69 | @Override
70 | public ImageItem createFromParcel(Parcel source) {
71 | return new ImageItem(source);
72 | }
73 |
74 | @Override
75 | public ImageItem[] newArray(int size) {
76 | return new ImageItem[size];
77 | }
78 | };
79 | }
80 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/loader/GlideImageLoader.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker.loader;
2 |
3 | import android.app.Activity;
4 | import android.content.ContentValues;
5 | import android.content.Context;
6 | import android.database.Cursor;
7 | import android.net.Uri;
8 | import android.provider.MediaStore;
9 | import android.util.Log;
10 | import android.widget.ImageView;
11 |
12 | import com.bumptech.glide.Glide;
13 | import com.bumptech.glide.load.engine.DiskCacheStrategy;
14 | import com.lzy.imagepicker.R;
15 |
16 | import java.io.File;
17 |
18 | /**
19 | * ================================================
20 | * 作 者:jeasonlzy(廖子尧 Github地址:https://github.com/jeasonlzy0216
21 | * 版 本:1.0
22 | * 创建日期:2016/5/19
23 | * 描 述:
24 | * 修订历史:
25 | * ================================================
26 | */
27 | public class GlideImageLoader implements ImageLoader {
28 |
29 | @Override
30 | public void displayImage(Activity activity, String path, ImageView imageView, int width, int height) {
31 | // Uri.fromFile(new File(path))
32 | Glide.with(activity) //配置上下文
33 | .load(new File(path)) //设置图片路径(fix #8,文件名包含%符号 无法识别和显示)
34 | .error(R.mipmap.default_error) //设置错误图片
35 | .placeholder(R.mipmap.default_error) //设置占位图片
36 | .diskCacheStrategy(DiskCacheStrategy.ALL)//缓存全尺寸
37 | .into(imageView);
38 | }
39 |
40 |
41 | @Override
42 | public void displayImagePreview(Activity activity, String path, ImageView imageView, int width, int height) {
43 | Glide.with(activity) //配置上下文
44 | .load(new File(path)) //设置图片路径(fix #8,文件名包含%符号 无法识别和显示)
45 | .error(R.mipmap.default_error) //设置错误图片
46 | .placeholder(R.mipmap.default_error) //设置占位图片
47 | .diskCacheStrategy(DiskCacheStrategy.ALL)//缓存全尺寸
48 | .into(imageView);
49 | }
50 |
51 | @Override
52 | public void clearMemoryCache() {
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/loader/ImageLoader.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker.loader;
2 |
3 | import android.app.Activity;
4 | import android.widget.ImageView;
5 |
6 | import java.io.Serializable;
7 |
8 | /**
9 | * ================================================
10 | * 作 者:jeasonlzy(廖子尧 Github地址:https://github.com/jeasonlzy0216
11 | * 版 本:1.0
12 | * 创建日期:2016/5/19
13 | * 描 述:ImageLoader抽象类,外部需要实现这个类去加载图片, 尽力减少对第三方库的依赖,所以这么干了
14 | * 修订历史:
15 | * ================================================
16 | */
17 | public interface ImageLoader extends Serializable {
18 |
19 | void displayImage(Activity activity, String path, ImageView imageView, int width, int height);
20 |
21 | void displayImagePreview(Activity activity, String path, ImageView imageView, int width, int height);
22 |
23 | void clearMemoryCache();
24 | }
25 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/ui/ImageBaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker.ui;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.pm.PackageManager;
5 | import android.os.Build;
6 | import android.os.Bundle;
7 | import android.view.Window;
8 | import android.view.WindowManager;
9 | import android.widget.Toast;
10 |
11 | import com.lzy.imagepicker.ImagePicker;
12 | import com.lzy.imagepicker.R;
13 | import com.lzy.imagepicker.view.SystemBarTintManager;
14 |
15 | import androidx.annotation.NonNull;
16 | import androidx.appcompat.app.AppCompatActivity;
17 | import androidx.core.app.ActivityCompat;
18 |
19 | /**
20 | * ================================================
21 | * 作 者:jeasonlzy(廖子尧 Github地址:https://github.com/jeasonlzy0216
22 | * 版 本:1.0
23 | * 创建日期:2016/5/19
24 | * 描 述:
25 | * 修订历史:
26 | * ================================================
27 | */
28 | public class ImageBaseActivity extends AppCompatActivity {
29 |
30 | protected SystemBarTintManager tintManager;
31 |
32 | @Override
33 | protected void onCreate(Bundle savedInstanceState) {
34 | super.onCreate(savedInstanceState);
35 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
36 | setTranslucentStatus(true);
37 | }
38 | tintManager = new SystemBarTintManager(this);
39 | tintManager.setStatusBarTintEnabled(true);
40 | tintManager.setStatusBarTintResource(R.color.ip_color_primary_dark); //设置上方状态栏的颜色
41 | }
42 |
43 | @TargetApi(19)
44 | private void setTranslucentStatus(boolean on) {
45 | Window win = getWindow();
46 | WindowManager.LayoutParams winParams = win.getAttributes();
47 | final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
48 | if (on) {
49 | winParams.flags |= bits;
50 | } else {
51 | winParams.flags &= ~bits;
52 | }
53 | win.setAttributes(winParams);
54 | }
55 |
56 | public boolean checkPermission(@NonNull String permission) {
57 | return ActivityCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_GRANTED;
58 | }
59 |
60 | public void showToast(String toastText) {
61 | Toast.makeText(getApplicationContext(), toastText, Toast.LENGTH_SHORT).show();
62 | }
63 |
64 | @Override
65 | protected void onRestoreInstanceState(Bundle savedInstanceState) {
66 | super.onRestoreInstanceState(savedInstanceState);
67 | ImagePicker.getInstance().restoreInstanceState(savedInstanceState);
68 | }
69 |
70 | @Override
71 | protected void onSaveInstanceState(Bundle outState) {
72 | super.onSaveInstanceState(outState);
73 | ImagePicker.getInstance().saveInstanceState(outState);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/ui/ImagePreviewBaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker.ui;
2 |
3 | import android.os.Build;
4 | import android.os.Bundle;
5 | import android.view.View;
6 | import android.widget.RelativeLayout;
7 | import android.widget.TextView;
8 |
9 | import com.lzy.imagepicker.DataHolder;
10 | import com.lzy.imagepicker.ImagePicker;
11 | import com.lzy.imagepicker.R;
12 | import com.lzy.imagepicker.adapter.ImagePageAdapter;
13 | import com.lzy.imagepicker.bean.ImageItem;
14 | import com.lzy.imagepicker.util.Utils;
15 | import com.lzy.imagepicker.view.ViewPagerFixed;
16 |
17 | import java.util.ArrayList;
18 |
19 | /**
20 | * ================================================
21 | * 作 者:jeasonlzy(廖子尧 Github地址:https://github.com/jeasonlzy0216
22 | * 版 本:1.0
23 | * 创建日期:2016/5/19
24 | * 描 述:
25 | * 修订历史:图片预览的基类
26 | * ================================================
27 | */
28 | public abstract class ImagePreviewBaseActivity extends ImageBaseActivity {
29 |
30 | protected ImagePicker imagePicker;
31 | protected ArrayList mImageItems; //跳转进ImagePreviewFragment的图片文件夹
32 | protected int mCurrentPosition = 0; //跳转进ImagePreviewFragment时的序号,第几个图片
33 | protected TextView mTitleCount; //显示当前图片的位置 例如 5/31
34 | protected ArrayList selectedImages; //所有已经选中的图片
35 | protected View content;
36 | protected View topBar;
37 | protected ViewPagerFixed mViewPager;
38 | protected ImagePageAdapter mAdapter;
39 | protected boolean isFromItems = false;
40 |
41 | @Override
42 | protected void onCreate(Bundle savedInstanceState) {
43 | super.onCreate(savedInstanceState);
44 | setContentView(R.layout.activity_image_preview);
45 |
46 | mCurrentPosition = getIntent().getIntExtra(ImagePicker.EXTRA_SELECTED_IMAGE_POSITION, 0);
47 | isFromItems = getIntent().getBooleanExtra(ImagePicker.EXTRA_FROM_ITEMS, false);
48 |
49 | if (isFromItems) {
50 | // 据说这样会导致大量图片崩溃
51 | mImageItems = (ArrayList) getIntent().getSerializableExtra(ImagePicker.EXTRA_IMAGE_ITEMS);
52 | } else {
53 | // 下面采用弱引用会导致预览崩溃
54 | mImageItems = (ArrayList) DataHolder.getInstance().retrieve(DataHolder.DH_CURRENT_IMAGE_FOLDER_ITEMS);
55 | }
56 |
57 | imagePicker = ImagePicker.getInstance();
58 | selectedImages = imagePicker.getSelectedImages();
59 |
60 | //初始化控件
61 | content = findViewById(R.id.content);
62 |
63 | //因为状态栏透明后,布局整体会上移,所以给头部加上状态栏的margin值,保证头部不会被覆盖
64 | topBar = findViewById(R.id.top_bar);
65 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
66 | RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) topBar.getLayoutParams();
67 | params.topMargin = Utils.getStatusHeight(this);
68 | topBar.setLayoutParams(params);
69 | }
70 | topBar.findViewById(R.id.btn_ok).setVisibility(View.GONE);
71 | topBar.findViewById(R.id.btn_back).setOnClickListener(new View.OnClickListener() {
72 | @Override
73 | public void onClick(View v) {
74 | finish();
75 | }
76 | });
77 |
78 | mTitleCount = (TextView) findViewById(R.id.tv_des);
79 |
80 | mViewPager = (ViewPagerFixed) findViewById(R.id.viewpager);
81 | mAdapter = new ImagePageAdapter(this, mImageItems);
82 | mAdapter.setPhotoViewClickListener(new ImagePageAdapter.PhotoViewClickListener() {
83 | @Override
84 | public void OnPhotoTapListener(View view, float v, float v1) {
85 | onImageSingleTap();
86 | }
87 | });
88 | mViewPager.setAdapter(mAdapter);
89 | mViewPager.setCurrentItem(mCurrentPosition, false);
90 |
91 | //初始化当前页面的状态
92 | mTitleCount.setText(getString(R.string.ip_preview_image_count, mCurrentPosition + 1, mImageItems.size()));
93 | }
94 |
95 | /** 单击时,隐藏头和尾 */
96 | public abstract void onImageSingleTap();
97 |
98 | @Override
99 | protected void onRestoreInstanceState(Bundle savedInstanceState) {
100 | super.onRestoreInstanceState(savedInstanceState);
101 | ImagePicker.getInstance().restoreInstanceState(savedInstanceState);
102 | }
103 |
104 | @Override
105 | protected void onSaveInstanceState(Bundle outState) {
106 | super.onSaveInstanceState(outState);
107 | ImagePicker.getInstance().saveInstanceState(outState);
108 | }
109 | }
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/util/BitmapUtil.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker.util;
2 |
3 | import android.app.Activity;
4 | import android.graphics.Bitmap;
5 | import android.graphics.BitmapFactory;
6 | import android.graphics.Matrix;
7 | import android.media.ExifInterface;
8 | import android.net.Uri;
9 | import android.provider.MediaStore;
10 |
11 | import java.io.File;
12 | import java.io.IOException;
13 |
14 | /**
15 | *
16 | * Bitmap工具类,主要是解决拍照旋转的适配
17 | *
18 | * Author: nanchen
19 | * Email: liushilin520@foxmail.com
20 | * Date: 2017-03-20 13:27
21 | */
22 |
23 | public class BitmapUtil {
24 |
25 | private BitmapUtil() {
26 | throw new UnsupportedOperationException("u can't instantiate me...");
27 | }
28 |
29 | /**
30 | * 获取图片的旋转角度
31 | *
32 | * @param path 图片绝对路径
33 | * @return 图片的旋转角度
34 | */
35 | public static int getBitmapDegree(String path) {
36 | int degree = 0;
37 | try {
38 | // 从指定路径下读取图片,并获取其EXIF信息
39 | ExifInterface exifInterface = new ExifInterface(path);
40 | // 获取图片的旋转信息
41 | int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
42 | switch (orientation) {
43 | case ExifInterface.ORIENTATION_ROTATE_90:
44 | degree = 90;
45 | break;
46 | case ExifInterface.ORIENTATION_ROTATE_180:
47 | degree = 180;
48 | break;
49 | case ExifInterface.ORIENTATION_ROTATE_270:
50 | degree = 270;
51 | break;
52 | }
53 | } catch (IOException e) {
54 | e.printStackTrace();
55 | }
56 | return degree;
57 | }
58 |
59 | /**
60 | * 将图片按照指定的角度进行旋转
61 | *
62 | * @param bitmap 需要旋转的图片
63 | * @param degree 指定的旋转角度
64 | * @return 旋转后的图片
65 | */
66 | public static Bitmap rotateBitmapByDegree(Bitmap bitmap, int degree) {
67 | // 根据旋转角度,生成旋转矩阵
68 | Matrix matrix = new Matrix();
69 | matrix.postRotate(degree);
70 | // 将原始图片按照旋转矩阵进行旋转,并得到新的图片
71 | Bitmap newBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
72 | if (!bitmap.isRecycled()) {
73 | bitmap.recycle();
74 | }
75 | return newBitmap;
76 | }
77 |
78 | /**
79 | * 获取我们需要的整理过旋转角度的Uri
80 | * @param activity 上下文环境
81 | * @param path 路径
82 | * @return 正常的Uri
83 | */
84 | public static Uri getRotatedUri(Activity activity, String path){
85 | int degree = BitmapUtil.getBitmapDegree(path);
86 | if (degree != 0){
87 | Bitmap bitmap = BitmapFactory.decodeFile(path);
88 | Bitmap newBitmap = BitmapUtil.rotateBitmapByDegree(bitmap,degree);
89 | return Uri.parse(MediaStore.Images.Media.insertImage(activity.getContentResolver(),newBitmap,null,null));
90 | }else{
91 | return Uri.fromFile(new File(path));
92 | }
93 | }
94 |
95 | /**
96 | * 将图片按照指定的角度进行旋转
97 | *
98 | * @param path 需要旋转的图片的路径
99 | * @param degree 指定的旋转角度
100 | * @return 旋转后的图片
101 | */
102 | public static Bitmap rotateBitmapByDegree(String path, int degree) {
103 | Bitmap bitmap = BitmapFactory.decodeFile(path);
104 | return rotateBitmapByDegree(bitmap,degree);
105 | }
106 |
107 | }
108 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/util/NavigationBarChangeListener.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker.util;
2 |
3 | import android.app.Activity;
4 | import android.graphics.Rect;
5 | import android.view.View;
6 | import android.view.ViewTreeObserver;
7 |
8 | /**
9 | * Created by z-chu on 2017/9/4
10 | * 用于监听导航栏的显示和隐藏,主要用于适配华为EMUI系统上虚拟导航栏可随时收起和展开的情况
11 | */
12 | public class NavigationBarChangeListener implements ViewTreeObserver.OnGlobalLayoutListener {
13 |
14 | public static final int ORIENTATION_VERTICAL = 1; //监听竖屏模式导航栏的显示和隐藏
15 | public static final int ORIENTATION_HORIZONTAL = 2; //监听横屏模式导航栏的显示和隐藏
16 |
17 | private Rect rect;
18 | private View rootView;
19 | private boolean isShowNavigationBar = false;
20 | private int orientation;
21 | private OnSoftInputStateChangeListener listener;
22 |
23 | public NavigationBarChangeListener(View rootView, int orientation) {
24 | this.rootView = rootView;
25 | this.orientation = orientation;
26 | rect = new Rect();
27 | }
28 |
29 | @Override
30 | public void onGlobalLayout() {
31 | rect.setEmpty();
32 | rootView.getWindowVisibleDisplayFrame(rect);
33 | int heightDiff = 0;
34 | if (orientation == ORIENTATION_VERTICAL) {
35 | heightDiff = rootView.getHeight() - (rect.bottom - rect.top);
36 | } else if (orientation == ORIENTATION_HORIZONTAL) {
37 | heightDiff = rootView.getWidth() - (rect.right - rect.left);
38 | }
39 | int navigationBarHeight = Utils.hasVirtualNavigationBar(rootView.getContext()) ? Utils.getNavigationBarHeight(rootView.getContext()) : 0;
40 | if (heightDiff >= navigationBarHeight && heightDiff < navigationBarHeight * 2) {
41 | if (!isShowNavigationBar && listener != null) {
42 | listener.onNavigationBarShow(orientation, heightDiff);
43 | }
44 | isShowNavigationBar = true;
45 | } else {
46 | if (isShowNavigationBar && listener != null) {
47 | listener.onNavigationBarHide(orientation);
48 | }
49 | isShowNavigationBar = false;
50 | }
51 | }
52 |
53 | public void setListener(OnSoftInputStateChangeListener listener) {
54 | this.listener = listener;
55 | }
56 |
57 | public interface OnSoftInputStateChangeListener {
58 | void onNavigationBarShow(int orientation, int height);
59 |
60 | void onNavigationBarHide(int orientation);
61 | }
62 |
63 | public static NavigationBarChangeListener with(View rootView) {
64 | return with(rootView, ORIENTATION_VERTICAL);
65 | }
66 |
67 | public static NavigationBarChangeListener with(Activity activity) {
68 | return with(activity.findViewById(android.R.id.content), ORIENTATION_VERTICAL);
69 | }
70 |
71 | public static NavigationBarChangeListener with(View rootView, int orientation) {
72 | NavigationBarChangeListener changeListener = new NavigationBarChangeListener(rootView, orientation);
73 | rootView.getViewTreeObserver().addOnGlobalLayoutListener(changeListener);
74 | return changeListener;
75 | }
76 |
77 | public static NavigationBarChangeListener with(Activity activity, int orientation) {
78 | return with(activity.findViewById(android.R.id.content), orientation);
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/util/ProviderUtil.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker.util;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * 用于解决provider冲突的util
7 | *
8 | * Author: nanchen
9 | * Email: liushilin520@foxmail.com
10 | * Date: 2017-03-22 18:55
11 | */
12 |
13 | public class ProviderUtil {
14 |
15 | public static String getFileProviderName(Context context){
16 | return context.getPackageName()+".provider";
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/util/Utils.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker.util;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.os.Build;
6 | import android.os.Environment;
7 | import android.util.DisplayMetrics;
8 | import android.util.TypedValue;
9 | import android.view.Display;
10 | import android.view.KeyCharacterMap;
11 | import android.view.KeyEvent;
12 | import android.view.ViewConfiguration;
13 | import android.view.WindowManager;
14 |
15 | /**
16 | * ================================================
17 | * 作 者:jeasonlzy(廖子尧 Github地址:https://github.com/jeasonlzy0216
18 | * 版 本:1.0
19 | * 创建日期:2016/5/19
20 | * 描 述:
21 | * 修订历史:
22 | * ================================================
23 | */
24 | public class Utils {
25 |
26 | /** 获得状态栏的高度 */
27 | public static int getStatusHeight(Context context) {
28 | int statusHeight = -1;
29 | try {
30 | Class> clazz = Class.forName("com.android.internal.R$dimen");
31 | Object object = clazz.newInstance();
32 | int height = Integer.parseInt(clazz.getField("status_bar_height").get(object).toString());
33 | statusHeight = context.getResources().getDimensionPixelSize(height);
34 | } catch (Exception e) {
35 | e.printStackTrace();
36 | }
37 | return statusHeight;
38 | }
39 |
40 | /** 根据屏幕宽度与密度计算GridView显示的列数, 最少为三列,并获取Item宽度 */
41 | public static int getImageItemWidth(Activity activity) {
42 | int screenWidth = activity.getResources().getDisplayMetrics().widthPixels;
43 | int densityDpi = activity.getResources().getDisplayMetrics().densityDpi;
44 | int cols = screenWidth / densityDpi;
45 | cols = cols < 3 ? 3 : cols;
46 | int columnSpace = (int) (2 * activity.getResources().getDisplayMetrics().density);
47 | return (screenWidth - columnSpace * (cols - 1)) / cols;
48 | }
49 |
50 | /**
51 | * 判断SDCard是否可用
52 | */
53 | public static boolean existSDCard() {
54 | return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
55 | }
56 |
57 | /**
58 | * 获取手机大小(分辨率)
59 | */
60 | public static DisplayMetrics getScreenPix(Activity activity) {
61 | DisplayMetrics displaysMetrics = new DisplayMetrics();
62 | activity.getWindowManager().getDefaultDisplay().getMetrics(displaysMetrics);
63 | return displaysMetrics;
64 | }
65 |
66 | /** dp转px */
67 | public static int dp2px(Context context, float dpVal) {
68 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpVal, context.getResources().getDisplayMetrics());
69 | }
70 |
71 | /**
72 | * 判断手机是否含有虚拟按键 99%
73 | */
74 | public static boolean hasVirtualNavigationBar(Context context) {
75 | boolean hasSoftwareKeys = true;
76 |
77 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
78 | Display d = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
79 |
80 | DisplayMetrics realDisplayMetrics = new DisplayMetrics();
81 | d.getRealMetrics(realDisplayMetrics);
82 |
83 | int realHeight = realDisplayMetrics.heightPixels;
84 | int realWidth = realDisplayMetrics.widthPixels;
85 |
86 | DisplayMetrics displayMetrics = new DisplayMetrics();
87 | d.getMetrics(displayMetrics);
88 |
89 | int displayHeight = displayMetrics.heightPixels;
90 | int displayWidth = displayMetrics.widthPixels;
91 |
92 | hasSoftwareKeys = (realWidth - displayWidth) > 0 || (realHeight - displayHeight) > 0;
93 | } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
94 | boolean hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey();
95 | boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
96 | hasSoftwareKeys = !hasMenuKey && !hasBackKey;
97 | }
98 |
99 | return hasSoftwareKeys;
100 | }
101 |
102 | /**
103 | * 获取导航栏高度,有些没有虚拟导航栏的手机也能获取到,建议先判断是否有虚拟按键
104 | */
105 | public static int getNavigationBarHeight(Context context) {
106 | int resourceId = context.getResources().getIdentifier("navigation_bar_height", "dimen", "android");
107 | return resourceId > 0 ? context.getResources().getDimensionPixelSize(resourceId) : 0;
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/view/GridSpacingItemDecoration.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker.view;
2 |
3 | import android.graphics.Rect;
4 | import android.view.View;
5 |
6 | import androidx.recyclerview.widget.RecyclerView;
7 |
8 | /**
9 | * author : zchu
10 | * date : 2017/8/30
11 | * desc : 为Recyclerview 的GridLayoutManager添加列间距
12 | */
13 |
14 | public class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
15 |
16 | private int spanCount;
17 | private int spacing;
18 | private boolean includeEdge;
19 |
20 | public GridSpacingItemDecoration(int spanCount, int spacing, boolean includeEdge) {
21 | this.spanCount = spanCount;
22 | this.spacing = spacing;
23 | this.includeEdge = includeEdge;
24 | }
25 |
26 | @Override
27 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
28 | int position = parent.getChildAdapterPosition(view); // item position
29 | int column = position % spanCount; // item column
30 |
31 | if (includeEdge) {
32 | outRect.left = spacing - column * spacing / spanCount; // spacing - column * ((1f / spanCount) * spacing)
33 | outRect.right = (column + 1) * spacing / spanCount; // (column + 1) * ((1f / spanCount) * spacing)
34 |
35 | if (position < spanCount) { // top edge
36 | outRect.top = spacing;
37 | }
38 | outRect.bottom = spacing; // item bottom
39 | } else {
40 | outRect.left = column * spacing / spanCount; // column * ((1f / spanCount) * spacing)
41 | outRect.right = spacing - (column + 1) * spacing / spanCount; // spacing - (column + 1) * ((1f / spanCount) * spacing)
42 | if (position >= spanCount) {
43 | outRect.top = spacing; // item top
44 | }
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/view/SuperCheckBox.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker.view;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.SoundEffectConstants;
6 |
7 | import androidx.appcompat.widget.AppCompatCheckBox;
8 |
9 | /**
10 | * ================================================
11 | * 作 者:jeasonlzy(廖子尧 Github地址:https://github.com/jeasonlzy0216
12 | * 版 本:1.0
13 | * 创建日期:2016/5/19
14 | * 描 述:带声音的CheckBox
15 | * 修订历史:
16 | * ================================================
17 | */
18 | public class SuperCheckBox extends AppCompatCheckBox {
19 |
20 | public SuperCheckBox(Context context) {
21 | super(context);
22 | }
23 |
24 | public SuperCheckBox(Context context, AttributeSet attrs) {
25 | super(context, attrs);
26 | }
27 |
28 | public SuperCheckBox(Context context, AttributeSet attrs, int defStyle) {
29 | super(context, attrs, defStyle);
30 | }
31 |
32 | @Override
33 | public boolean performClick() {
34 | final boolean handled = super.performClick();
35 | if (!handled) {
36 | // View only makes a sound effect if the onClickListener was
37 | // called, so we'll need to make one here instead.
38 | playSoundEffect(SoundEffectConstants.CLICK);
39 | }
40 | return handled;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/lzy/imagepicker/view/ViewPagerFixed.java:
--------------------------------------------------------------------------------
1 | package com.lzy.imagepicker.view;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.MotionEvent;
6 |
7 | import androidx.viewpager.widget.ViewPager;
8 |
9 | /**
10 | * ================================================
11 | * 作 者:jeasonlzy(廖子尧 Github地址:https://github.com/jeasonlzy0216
12 | * 版 本:1.0
13 | * 创建日期:2016/5/19
14 | * 描 述:修复图片在ViewPager控件中缩放报错的BUG
15 | * 修订历史:
16 | * ================================================
17 | */
18 | public class ViewPagerFixed extends ViewPager {
19 |
20 | public ViewPagerFixed(Context context) {
21 | super(context);
22 | }
23 |
24 | public ViewPagerFixed(Context context, AttributeSet attrs) {
25 | super(context, attrs);
26 | }
27 |
28 | @Override
29 | public boolean onTouchEvent(MotionEvent ev) {
30 | try {
31 | return super.onTouchEvent(ev);
32 | } catch (IllegalArgumentException ex) {
33 | ex.printStackTrace();
34 | }
35 | return false;
36 | }
37 |
38 | @Override
39 | public boolean onInterceptTouchEvent(MotionEvent ev) {
40 | try {
41 | return super.onInterceptTouchEvent(ev);
42 | } catch (IllegalArgumentException ex) {
43 | ex.printStackTrace();
44 | }
45 | return false;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/anim/fade_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/anim/fade_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/anim/hide_to_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/anim/show_from_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
12 |
13 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/anim/top_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/anim/top_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/drawable-v21/bg_folder_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | -
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/drawable/bg_btn_dis.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/drawable/bg_btn_nor.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/drawable/bg_btn_pre.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/drawable/bg_folder_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/drawable/bg_image_folder.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 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/drawable/ic_arrow_back.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/drawable/ic_cover_shade.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/drawable/ic_default_image.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/drawable/ic_vector_check.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/drawable/ic_vector_delete.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/drawable/selector_back_press.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/drawable/selector_grid_camera_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/drawable/selector_item_checked.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/drawable/selector_top_ok.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/layout/activity_image_crop.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
15 |
16 |
20 |
21 |
39 |
40 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/layout/activity_image_grid.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
12 |
13 |
18 |
19 |
28 |
29 |
35 |
36 |
43 |
44 |
55 |
56 |
64 |
65 |
66 |
67 |
68 |
80 |
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/layout/activity_image_preview.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
13 |
14 |
17 |
18 |
27 |
28 |
31 |
32 |
42 |
43 |
56 |
57 |
58 |
63 |
64 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/layout/adapter_camera_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
20 |
21 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/layout/adapter_folder_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
24 |
25 |
26 |
27 |
33 |
34 |
41 |
42 |
50 |
51 |
52 |
59 |
60 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/layout/adapter_image_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
18 |
19 |
25 |
26 |
37 |
38 |
47 |
48 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/layout/include_top_bar.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
25 |
26 |
37 |
38 |
54 |
55 |
65 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/layout/pop_folder.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
22 |
30 |
31 |
32 |
37 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/mipmap-xxhdpi/checkbox_checked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/imagepicker/src/main/res/mipmap-xxhdpi/checkbox_checked.png
--------------------------------------------------------------------------------
/imagepicker/src/main/res/mipmap-xxhdpi/checkbox_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/imagepicker/src/main/res/mipmap-xxhdpi/checkbox_normal.png
--------------------------------------------------------------------------------
/imagepicker/src/main/res/mipmap-xxhdpi/default_error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/imagepicker/src/main/res/mipmap-xxhdpi/default_error.png
--------------------------------------------------------------------------------
/imagepicker/src/main/res/mipmap-xxhdpi/grid_camera.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/imagepicker/src/main/res/mipmap-xxhdpi/grid_camera.png
--------------------------------------------------------------------------------
/imagepicker/src/main/res/mipmap-xxhdpi/text_indicator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/imagepicker/src/main/res/mipmap-xxhdpi/text_indicator.png
--------------------------------------------------------------------------------
/imagepicker/src/main/res/values-v19/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #323336
4 | #393A3F
5 | #303135
6 | #ec2f3335
7 | #ffe0e0e0
8 | #353535
9 | #1AAD19
10 | #66ffffff
11 | #ffffff
12 | #000
13 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 所有图片
3 | 共%1$d张
4 | %1$d/%2$d
5 | 最多选择%1$d张图片
6 | 完成
7 | 完成(%1$d/%2$d)
8 | 预览
9 | 预览(%1$d)
10 | 图片裁剪
11 | 原图
12 | 原图(%1$s)
13 |
14 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
13 |
14 |
15 |
18 |
19 |
25 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/xml/provider_paths.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/screenMatch.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/screenMatch.properties
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':imagepicker', ':ucrop'
2 | rootProject.name='RichEditTextCopyToutiao'
3 |
--------------------------------------------------------------------------------
/ucrop/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/ucrop/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 28
5 | buildToolsVersion '28.0.3'
6 |
7 | defaultConfig {
8 | minSdkVersion 14
9 | targetSdkVersion 28
10 | versionCode 26
11 | versionName "2.2.5-native"
12 |
13 | vectorDrawables.useSupportLibrary = true
14 | }
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 | compileOptions {
22 | sourceCompatibility JavaVersion.VERSION_1_7
23 | targetCompatibility JavaVersion.VERSION_1_7
24 | }
25 | lintOptions {
26 | abortOnError false
27 | }
28 |
29 | resourcePrefix 'ucrop_'
30 |
31 | sourceSets.main {
32 | jni.srcDirs = []
33 | }
34 |
35 | }
36 |
37 | dependencies {
38 | implementation "androidx.appcompat:appcompat:${androidx_appcompat_version}"
39 | implementation "androidx.exifinterface:exifinterface:${androidx_exifinterface_version}"
40 | implementation "androidx.transition:transition:${androidx_transition_version}"
41 | implementation "com.squareup.okhttp3:okhttp:3.12.1"
42 | //沉浸式状态栏
43 | implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
44 | }
45 |
--------------------------------------------------------------------------------
/ucrop/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_NAME=uCrop
2 | POM_ARTIFACT_ID=ucrop
3 | POM_PACKAGING=aar
--------------------------------------------------------------------------------
/ucrop/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/oleksii/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/ucrop/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
12 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/ucrop/src/main/java/com/yalantis/ucrop/ImagePickerLeoProvider.java:
--------------------------------------------------------------------------------
1 | package com.yalantis.ucrop;
2 |
3 |
4 | import androidx.core.content.FileProvider;
5 |
6 | /**
7 | * 自定义一个Provider,以免和引入的项目的provider冲突
8 | *
9 | * Author: nanchen
10 | * Email: liushilin520@foxmail.com
11 | * Date: 2017-03-17 16:10
12 | */
13 |
14 | public class ImagePickerLeoProvider extends FileProvider {
15 | }
16 |
--------------------------------------------------------------------------------
/ucrop/src/main/java/com/yalantis/ucrop/UCropFragmentCallback.java:
--------------------------------------------------------------------------------
1 | package com.yalantis.ucrop;
2 |
3 | public interface UCropFragmentCallback {
4 |
5 | /**
6 | * Return loader status
7 | * @param showLoader
8 | */
9 | void loadingProgress(boolean showLoader);
10 |
11 | /**
12 | * Return cropping result or error
13 | * @param result
14 | */
15 | void onCropFinish(UCropFragment.UCropResult result);
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/ucrop/src/main/java/com/yalantis/ucrop/callback/BitmapCropCallback.java:
--------------------------------------------------------------------------------
1 | package com.yalantis.ucrop.callback;
2 |
3 | import android.net.Uri;
4 |
5 | import androidx.annotation.NonNull;
6 |
7 | public interface BitmapCropCallback {
8 |
9 | void onBitmapCropped(@NonNull String outPath, int offsetX, int offsetY, int imageWidth, int imageHeight);
10 |
11 | void onCropFailure(@NonNull Throwable t);
12 |
13 | }
--------------------------------------------------------------------------------
/ucrop/src/main/java/com/yalantis/ucrop/callback/BitmapLoadCallback.java:
--------------------------------------------------------------------------------
1 | package com.yalantis.ucrop.callback;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | import com.yalantis.ucrop.model.ExifInfo;
6 |
7 | import androidx.annotation.NonNull;
8 | import androidx.annotation.Nullable;
9 |
10 | public interface BitmapLoadCallback {
11 |
12 | void onBitmapLoaded(@NonNull Bitmap bitmap, @NonNull ExifInfo exifInfo, @NonNull String imageInputPath, @Nullable String imageOutputPath);
13 |
14 | void onFailure(@NonNull Exception bitmapWorkerException);
15 |
16 | }
--------------------------------------------------------------------------------
/ucrop/src/main/java/com/yalantis/ucrop/callback/CropBoundsChangeListener.java:
--------------------------------------------------------------------------------
1 | package com.yalantis.ucrop.callback;
2 |
3 | /**
4 | * Interface for crop bound change notifying.
5 | */
6 | public interface CropBoundsChangeListener {
7 |
8 | void onCropAspectRatioChanged(float cropRatio);
9 |
10 | }
--------------------------------------------------------------------------------
/ucrop/src/main/java/com/yalantis/ucrop/callback/OverlayViewChangeListener.java:
--------------------------------------------------------------------------------
1 | package com.yalantis.ucrop.callback;
2 |
3 | import android.graphics.RectF;
4 |
5 | /**
6 | * Created by Oleksii Shliama.
7 | */
8 | public interface OverlayViewChangeListener {
9 |
10 | void onCropRectUpdated(RectF cropRect);
11 |
12 | }
--------------------------------------------------------------------------------
/ucrop/src/main/java/com/yalantis/ucrop/model/AspectRatio.java:
--------------------------------------------------------------------------------
1 | package com.yalantis.ucrop.model;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import androidx.annotation.Nullable;
7 |
8 | /**
9 | * Created by Oleksii Shliama [https://github.com/shliama] on 6/24/16.
10 | */
11 | public class AspectRatio implements Parcelable {
12 |
13 | @Nullable
14 | private final String mAspectRatioTitle;
15 | private final float mAspectRatioX;
16 | private final float mAspectRatioY;
17 |
18 | public AspectRatio(@Nullable String aspectRatioTitle, float aspectRatioX, float aspectRatioY) {
19 | mAspectRatioTitle = aspectRatioTitle;
20 | mAspectRatioX = aspectRatioX;
21 | mAspectRatioY = aspectRatioY;
22 | }
23 |
24 | protected AspectRatio(Parcel in) {
25 | mAspectRatioTitle = in.readString();
26 | mAspectRatioX = in.readFloat();
27 | mAspectRatioY = in.readFloat();
28 | }
29 |
30 | @Override
31 | public void writeToParcel(Parcel dest, int flags) {
32 | dest.writeString(mAspectRatioTitle);
33 | dest.writeFloat(mAspectRatioX);
34 | dest.writeFloat(mAspectRatioY);
35 | }
36 |
37 | @Override
38 | public int describeContents() {
39 | return 0;
40 | }
41 |
42 | public static final Creator CREATOR = new Creator() {
43 | @Override
44 | public AspectRatio createFromParcel(Parcel in) {
45 | return new AspectRatio(in);
46 | }
47 |
48 | @Override
49 | public AspectRatio[] newArray(int size) {
50 | return new AspectRatio[size];
51 | }
52 | };
53 |
54 | @Nullable
55 | public String getAspectRatioTitle() {
56 | return mAspectRatioTitle;
57 | }
58 |
59 | public float getAspectRatioX() {
60 | return mAspectRatioX;
61 | }
62 |
63 | public float getAspectRatioY() {
64 | return mAspectRatioY;
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/ucrop/src/main/java/com/yalantis/ucrop/model/CropParameters.java:
--------------------------------------------------------------------------------
1 | package com.yalantis.ucrop.model;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | /**
6 | * Created by Oleksii Shliama [https://github.com/shliama] on 6/21/16.
7 | */
8 | public class CropParameters {
9 |
10 | private int mMaxResultImageSizeX, mMaxResultImageSizeY;
11 |
12 | private Bitmap.CompressFormat mCompressFormat;
13 | private int mCompressQuality;
14 | private String mImageInputPath, mImageOutputPath;
15 | private ExifInfo mExifInfo;
16 |
17 |
18 | public CropParameters(int maxResultImageSizeX, int maxResultImageSizeY,
19 | Bitmap.CompressFormat compressFormat, int compressQuality,
20 | String imageInputPath, String imageOutputPath, ExifInfo exifInfo) {
21 | mMaxResultImageSizeX = maxResultImageSizeX;
22 | mMaxResultImageSizeY = maxResultImageSizeY;
23 | mCompressFormat = compressFormat;
24 | mCompressQuality = compressQuality;
25 | mImageInputPath = imageInputPath;
26 | mImageOutputPath = imageOutputPath;
27 | mExifInfo = exifInfo;
28 | }
29 |
30 | public int getMaxResultImageSizeX() {
31 | return mMaxResultImageSizeX;
32 | }
33 |
34 | public int getMaxResultImageSizeY() {
35 | return mMaxResultImageSizeY;
36 | }
37 |
38 | public Bitmap.CompressFormat getCompressFormat() {
39 | return mCompressFormat;
40 | }
41 |
42 | public int getCompressQuality() {
43 | return mCompressQuality;
44 | }
45 |
46 | public String getImageInputPath() {
47 | return mImageInputPath;
48 | }
49 |
50 | public String getImageOutputPath() {
51 | return mImageOutputPath;
52 | }
53 |
54 | public ExifInfo getExifInfo() {
55 | return mExifInfo;
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/ucrop/src/main/java/com/yalantis/ucrop/model/ExifInfo.java:
--------------------------------------------------------------------------------
1 | package com.yalantis.ucrop.model;
2 |
3 | /**
4 | * Created by Oleksii Shliama [https://github.com/shliama] on 6/21/16.
5 | */
6 | public class ExifInfo {
7 |
8 | private int mExifOrientation;
9 | private int mExifDegrees;
10 | private int mExifTranslation;
11 |
12 | public ExifInfo(int exifOrientation, int exifDegrees, int exifTranslation) {
13 | mExifOrientation = exifOrientation;
14 | mExifDegrees = exifDegrees;
15 | mExifTranslation = exifTranslation;
16 | }
17 |
18 | public int getExifOrientation() {
19 | return mExifOrientation;
20 | }
21 |
22 | public int getExifDegrees() {
23 | return mExifDegrees;
24 | }
25 |
26 | public int getExifTranslation() {
27 | return mExifTranslation;
28 | }
29 |
30 | public void setExifOrientation(int exifOrientation) {
31 | mExifOrientation = exifOrientation;
32 | }
33 |
34 | public void setExifDegrees(int exifDegrees) {
35 | mExifDegrees = exifDegrees;
36 | }
37 |
38 | public void setExifTranslation(int exifTranslation) {
39 | mExifTranslation = exifTranslation;
40 | }
41 |
42 | @Override
43 | public boolean equals(Object o) {
44 | if (this == o) return true;
45 | if (o == null || getClass() != o.getClass()) return false;
46 |
47 | ExifInfo exifInfo = (ExifInfo) o;
48 |
49 | if (mExifOrientation != exifInfo.mExifOrientation) return false;
50 | if (mExifDegrees != exifInfo.mExifDegrees) return false;
51 | return mExifTranslation == exifInfo.mExifTranslation;
52 |
53 | }
54 |
55 | @Override
56 | public int hashCode() {
57 | int result = mExifOrientation;
58 | result = 31 * result + mExifDegrees;
59 | result = 31 * result + mExifTranslation;
60 | return result;
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/ucrop/src/main/java/com/yalantis/ucrop/model/ImageState.java:
--------------------------------------------------------------------------------
1 | package com.yalantis.ucrop.model;
2 |
3 | import android.graphics.RectF;
4 |
5 | /**
6 | * Created by Oleksii Shliama [https://github.com/shliama] on 6/21/16.
7 | */
8 | public class ImageState {
9 |
10 | private RectF mCropRect;
11 | private RectF mCurrentImageRect;
12 |
13 | private float mCurrentScale, mCurrentAngle;
14 |
15 | public ImageState(RectF cropRect, RectF currentImageRect, float currentScale, float currentAngle) {
16 | mCropRect = cropRect;
17 | mCurrentImageRect = currentImageRect;
18 | mCurrentScale = currentScale;
19 | mCurrentAngle = currentAngle;
20 | }
21 |
22 | public RectF getCropRect() {
23 | return mCropRect;
24 | }
25 |
26 | public RectF getCurrentImageRect() {
27 | return mCurrentImageRect;
28 | }
29 |
30 | public float getCurrentScale() {
31 | return mCurrentScale;
32 | }
33 |
34 | public float getCurrentAngle() {
35 | return mCurrentAngle;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/ucrop/src/main/java/com/yalantis/ucrop/util/CubicEasing.java:
--------------------------------------------------------------------------------
1 | package com.yalantis.ucrop.util;
2 |
3 | public final class CubicEasing {
4 |
5 | public static float easeOut(float time, float start, float end, float duration) {
6 | return end * ((time = time / duration - 1.0f) * time * time + 1.0f) + start;
7 | }
8 |
9 | public static float easeIn(float time, float start, float end, float duration) {
10 | return end * (time /= duration) * time * time + start;
11 | }
12 |
13 | public static float easeInOut(float time, float start, float end, float duration) {
14 | return (time /= duration / 2.0f) < 1.0f ? end / 2.0f * time * time * time + start : end / 2.0f * ((time -= 2.0f) * time * time + 2.0f) + start;
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/ucrop/src/main/java/com/yalantis/ucrop/util/FastBitmapDrawable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.yalantis.ucrop.util;
17 |
18 | import android.graphics.Bitmap;
19 | import android.graphics.Canvas;
20 | import android.graphics.ColorFilter;
21 | import android.graphics.Paint;
22 | import android.graphics.PixelFormat;
23 | import android.graphics.drawable.Drawable;
24 |
25 | public class FastBitmapDrawable extends Drawable {
26 |
27 | private final Paint mPaint = new Paint(Paint.FILTER_BITMAP_FLAG);
28 |
29 | private Bitmap mBitmap;
30 | private int mAlpha;
31 | private int mWidth, mHeight;
32 |
33 | public FastBitmapDrawable(Bitmap b) {
34 | mAlpha = 255;
35 | setBitmap(b);
36 | }
37 |
38 | @Override
39 | public void draw(Canvas canvas) {
40 | if (mBitmap != null && !mBitmap.isRecycled()) {
41 | canvas.drawBitmap(mBitmap, null, getBounds(), mPaint);
42 | }
43 | }
44 |
45 | @Override
46 | public void setColorFilter(ColorFilter cf) {
47 | mPaint.setColorFilter(cf);
48 | }
49 |
50 | @Override
51 | public int getOpacity() {
52 | return PixelFormat.TRANSLUCENT;
53 | }
54 |
55 | public void setFilterBitmap(boolean filterBitmap) {
56 | mPaint.setFilterBitmap(filterBitmap);
57 | }
58 |
59 | public int getAlpha() {
60 | return mAlpha;
61 | }
62 |
63 | @Override
64 | public void setAlpha(int alpha) {
65 | mAlpha = alpha;
66 | mPaint.setAlpha(alpha);
67 | }
68 |
69 | @Override
70 | public int getIntrinsicWidth() {
71 | return mWidth;
72 | }
73 |
74 | @Override
75 | public int getIntrinsicHeight() {
76 | return mHeight;
77 | }
78 |
79 | @Override
80 | public int getMinimumWidth() {
81 | return mWidth;
82 | }
83 |
84 | @Override
85 | public int getMinimumHeight() {
86 | return mHeight;
87 | }
88 |
89 | public Bitmap getBitmap() {
90 | return mBitmap;
91 | }
92 |
93 | public void setBitmap(Bitmap b) {
94 | mBitmap = b;
95 | if (b != null) {
96 | mWidth = mBitmap.getWidth();
97 | mHeight = mBitmap.getHeight();
98 | } else {
99 | mWidth = mHeight = 0;
100 | }
101 | }
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/ucrop/src/main/java/com/yalantis/ucrop/util/RectUtils.java:
--------------------------------------------------------------------------------
1 | package com.yalantis.ucrop.util;
2 |
3 | import android.graphics.RectF;
4 |
5 | public class RectUtils {
6 |
7 | /**
8 | * Gets a float array of the 2D coordinates representing a rectangles
9 | * corners.
10 | * The order of the corners in the float array is:
11 | * 0------->1
12 | * ^ |
13 | * | |
14 | * | v
15 | * 3<-------2
16 | *
17 | * @param r the rectangle to get the corners of
18 | * @return the float array of corners (8 floats)
19 | */
20 | public static float[] getCornersFromRect(RectF r) {
21 | return new float[]{
22 | r.left, r.top,
23 | r.right, r.top,
24 | r.right, r.bottom,
25 | r.left, r.bottom
26 | };
27 | }
28 |
29 | /**
30 | * Gets a float array of two lengths representing a rectangles width and height
31 | * The order of the corners in the input float array is:
32 | * 0------->1
33 | * ^ |
34 | * | |
35 | * | v
36 | * 3<-------2
37 | *
38 | * @param corners the float array of corners (8 floats)
39 | * @return the float array of width and height (2 floats)
40 | */
41 | public static float[] getRectSidesFromCorners(float[] corners) {
42 | return new float[]{(float) Math.sqrt(Math.pow(corners[0] - corners[2], 2) + Math.pow(corners[1] - corners[3], 2)),
43 | (float) Math.sqrt(Math.pow(corners[2] - corners[4], 2) + Math.pow(corners[3] - corners[5], 2))};
44 | }
45 |
46 | public static float[] getCenterFromRect(RectF r) {
47 | return new float[]{r.centerX(), r.centerY()};
48 | }
49 |
50 | /**
51 | * Takes an array of 2D coordinates representing corners and returns the
52 | * smallest rectangle containing those coordinates.
53 | *
54 | * @param array array of 2D coordinates
55 | * @return smallest rectangle containing coordinates
56 | */
57 | public static RectF trapToRect(float[] array) {
58 | RectF r = new RectF(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY,
59 | Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY);
60 | for (int i = 1; i < array.length; i += 2) {
61 | float x = Math.round(array[i - 1] * 10) / 10.f;
62 | float y = Math.round(array[i] * 10) / 10.f;
63 | r.left = (x < r.left) ? x : r.left;
64 | r.top = (y < r.top) ? y : r.top;
65 | r.right = (x > r.right) ? x : r.right;
66 | r.bottom = (y > r.bottom) ? y : r.bottom;
67 | }
68 | r.sort();
69 | return r;
70 | }
71 |
72 | }
--------------------------------------------------------------------------------
/ucrop/src/main/java/com/yalantis/ucrop/util/RotationGestureDetector.java:
--------------------------------------------------------------------------------
1 | package com.yalantis.ucrop.util;
2 |
3 | import android.view.MotionEvent;
4 |
5 | import androidx.annotation.NonNull;
6 |
7 | public class RotationGestureDetector {
8 |
9 | private static final int INVALID_POINTER_INDEX = -1;
10 |
11 | private float fX, fY, sX, sY;
12 |
13 | private int mPointerIndex1, mPointerIndex2;
14 | private float mAngle;
15 | private boolean mIsFirstTouch;
16 |
17 | private OnRotationGestureListener mListener;
18 |
19 | public RotationGestureDetector(OnRotationGestureListener listener) {
20 | mListener = listener;
21 | mPointerIndex1 = INVALID_POINTER_INDEX;
22 | mPointerIndex2 = INVALID_POINTER_INDEX;
23 | }
24 |
25 | public float getAngle() {
26 | return mAngle;
27 | }
28 |
29 | public boolean onTouchEvent(@NonNull MotionEvent event) {
30 | switch (event.getActionMasked()) {
31 | case MotionEvent.ACTION_DOWN:
32 | sX = event.getX();
33 | sY = event.getY();
34 | mPointerIndex1 = event.findPointerIndex(event.getPointerId(0));
35 | mAngle = 0;
36 | mIsFirstTouch = true;
37 | break;
38 | case MotionEvent.ACTION_POINTER_DOWN:
39 | fX = event.getX();
40 | fY = event.getY();
41 | mPointerIndex2 = event.findPointerIndex(event.getPointerId(event.getActionIndex()));
42 | mAngle = 0;
43 | mIsFirstTouch = true;
44 | break;
45 | case MotionEvent.ACTION_MOVE:
46 | if (mPointerIndex1 != INVALID_POINTER_INDEX && mPointerIndex2 != INVALID_POINTER_INDEX && event.getPointerCount() > mPointerIndex2) {
47 | float nfX, nfY, nsX, nsY;
48 |
49 | nsX = event.getX(mPointerIndex1);
50 | nsY = event.getY(mPointerIndex1);
51 | nfX = event.getX(mPointerIndex2);
52 | nfY = event.getY(mPointerIndex2);
53 |
54 | if (mIsFirstTouch) {
55 | mAngle = 0;
56 | mIsFirstTouch = false;
57 | } else {
58 | calculateAngleBetweenLines(fX, fY, sX, sY, nfX, nfY, nsX, nsY);
59 | }
60 |
61 | if (mListener != null) {
62 | mListener.onRotation(this);
63 | }
64 | fX = nfX;
65 | fY = nfY;
66 | sX = nsX;
67 | sY = nsY;
68 | }
69 | break;
70 | case MotionEvent.ACTION_UP:
71 | mPointerIndex1 = INVALID_POINTER_INDEX;
72 | break;
73 | case MotionEvent.ACTION_POINTER_UP:
74 | mPointerIndex2 = INVALID_POINTER_INDEX;
75 | break;
76 | }
77 | return true;
78 | }
79 |
80 | private float calculateAngleBetweenLines(float fx1, float fy1, float fx2, float fy2,
81 | float sx1, float sy1, float sx2, float sy2) {
82 | return calculateAngleDelta(
83 | (float) Math.toDegrees((float) Math.atan2((fy1 - fy2), (fx1 - fx2))),
84 | (float) Math.toDegrees((float) Math.atan2((sy1 - sy2), (sx1 - sx2))));
85 | }
86 |
87 | private float calculateAngleDelta(float angleFrom, float angleTo) {
88 | mAngle = angleTo % 360.0f - angleFrom % 360.0f;
89 |
90 | if (mAngle < -180.0f) {
91 | mAngle += 360.0f;
92 | } else if (mAngle > 180.0f) {
93 | mAngle -= 360.0f;
94 | }
95 |
96 | return mAngle;
97 | }
98 |
99 | public static class SimpleOnRotationGestureListener implements OnRotationGestureListener {
100 |
101 | @Override
102 | public boolean onRotation(RotationGestureDetector rotationDetector) {
103 | return false;
104 | }
105 | }
106 |
107 | public interface OnRotationGestureListener {
108 |
109 | boolean onRotation(RotationGestureDetector rotationDetector);
110 | }
111 |
112 | }
--------------------------------------------------------------------------------
/ucrop/src/main/java/com/yalantis/ucrop/util/SelectedStateListDrawable.java:
--------------------------------------------------------------------------------
1 | package com.yalantis.ucrop.util;
2 |
3 | import android.graphics.PorterDuff;
4 | import android.graphics.drawable.Drawable;
5 | import android.graphics.drawable.StateListDrawable;
6 |
7 | /**
8 | * Hack class to properly support state drawable back to Android 1.6
9 | */
10 | public class SelectedStateListDrawable extends StateListDrawable {
11 |
12 | private int mSelectionColor;
13 |
14 | public SelectedStateListDrawable(Drawable drawable, int selectionColor) {
15 | super();
16 | this.mSelectionColor = selectionColor;
17 | addState(new int[]{android.R.attr.state_selected}, drawable);
18 | addState(new int[]{}, drawable);
19 | }
20 |
21 | @Override
22 | protected boolean onStateChange(int[] states) {
23 | boolean isStatePressedInArray = false;
24 | for (int state : states) {
25 | if (state == android.R.attr.state_selected) {
26 | isStatePressedInArray = true;
27 | }
28 | }
29 | if (isStatePressedInArray) {
30 | super.setColorFilter(mSelectionColor, PorterDuff.Mode.SRC_ATOP);
31 | } else {
32 | super.clearColorFilter();
33 | }
34 | return super.onStateChange(states);
35 | }
36 |
37 | @Override
38 | public boolean isStateful() {
39 | return true;
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/ucrop/src/main/java/com/yalantis/ucrop/view/UCropView.java:
--------------------------------------------------------------------------------
1 | package com.yalantis.ucrop.view;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.RectF;
6 | import android.util.AttributeSet;
7 | import android.view.LayoutInflater;
8 | import android.widget.FrameLayout;
9 |
10 | import com.yalantis.ucrop.R;
11 | import com.yalantis.ucrop.callback.CropBoundsChangeListener;
12 | import com.yalantis.ucrop.callback.OverlayViewChangeListener;
13 |
14 | import androidx.annotation.NonNull;
15 |
16 | public class UCropView extends FrameLayout {
17 |
18 | private GestureCropImageView mGestureCropImageView;
19 | private final OverlayView mViewOverlay;
20 |
21 | public UCropView(Context context, AttributeSet attrs) {
22 | this(context, attrs, 0);
23 | }
24 |
25 | public UCropView(Context context, AttributeSet attrs, int defStyleAttr) {
26 | super(context, attrs, defStyleAttr);
27 |
28 | LayoutInflater.from(context).inflate(R.layout.ucrop_view, this, true);
29 | mGestureCropImageView = findViewById(R.id.image_view_crop);
30 | mViewOverlay = findViewById(R.id.view_overlay);
31 |
32 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ucrop_UCropView);
33 | mViewOverlay.processStyledAttributes(a);
34 | mGestureCropImageView.processStyledAttributes(a);
35 | a.recycle();
36 |
37 |
38 | setListenersToViews();
39 | }
40 |
41 | private void setListenersToViews() {
42 | mGestureCropImageView.setCropBoundsChangeListener(new CropBoundsChangeListener() {
43 | @Override
44 | public void onCropAspectRatioChanged(float cropRatio) {
45 | mViewOverlay.setTargetAspectRatio(cropRatio);
46 | }
47 | });
48 | mViewOverlay.setOverlayViewChangeListener(new OverlayViewChangeListener() {
49 | @Override
50 | public void onCropRectUpdated(RectF cropRect) {
51 | mGestureCropImageView.setCropRect(cropRect);
52 | }
53 | });
54 | }
55 |
56 | @Override
57 | public boolean shouldDelayChildPressedState() {
58 | return false;
59 | }
60 |
61 | @NonNull
62 | public GestureCropImageView getCropImageView() {
63 | return mGestureCropImageView;
64 | }
65 |
66 | @NonNull
67 | public OverlayView getOverlayView() {
68 | return mViewOverlay;
69 | }
70 |
71 | /**
72 | * Method for reset state for UCropImageView such as rotation, scale, translation.
73 | * Be careful: this method recreate UCropImageView instance and reattach it to layout.
74 | */
75 | public void resetCropImageView() {
76 | removeView(mGestureCropImageView);
77 | mGestureCropImageView = new GestureCropImageView(getContext());
78 | setListenersToViews();
79 | mGestureCropImageView.setCropRect(getOverlayView().getCropViewRect());
80 | addView(mGestureCropImageView, 0);
81 | }
82 | }
--------------------------------------------------------------------------------
/ucrop/src/main/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | include $(CLEAR_VARS)
4 |
5 | LOCAL_MODULE := ucrop
6 | LOCAL_SRC_FILES := uCrop.cpp
7 |
8 | LOCAL_LDLIBS := -landroid -llog -lz
9 | LOCAL_STATIC_LIBRARIES := libpng libjpeg_static
10 |
11 | include $(BUILD_SHARED_LIBRARY)
12 |
13 | $(call import-module,libpng)
14 | $(call import-module,libjpeg)
--------------------------------------------------------------------------------
/ucrop/src/main/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_STL := gnustl_static
2 | APP_ABI := armeabi armeabi-v7a x86 x86_64 arm64-v8a
3 | APP_CPPFLAGS += -frtti
4 | APP_CPPFLAGS += -fexceptions
5 | APP_CPPFLAGS += -DANDROID
6 | APP_PLATFORM := android-14
--------------------------------------------------------------------------------
/ucrop/src/main/jni/com_yalantis_ucrop_task_BitmapCropTask.h:
--------------------------------------------------------------------------------
1 | /* DO NOT EDIT THIS FILE - it is machine generated */
2 | #include
3 | /* Header for class com_yalantis_ucrop_task_BitmapCropTask */
4 |
5 | #ifndef _Included_com_yalantis_ucrop_task_BitmapCropTask
6 | #define _Included_com_yalantis_ucrop_task_BitmapCropTask
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | /*
12 | * Class: com_yalantis_ucrop_task_BitmapCropTask
13 | * Method: cropCImg
14 | * Signature: (Ljava/lang/String;Ljava/lang/String;IIIIF)Z
15 | */
16 | JNIEXPORT jboolean JNICALL Java_com_yalantis_ucrop_task_BitmapCropTask_cropCImg
17 | (JNIEnv *, jobject, jstring, jstring, jint, jint, jint, jint, jfloat, jfloat, jint, jint, jint, jint);
18 |
19 | #ifdef __cplusplus
20 | }
21 | #endif
22 | #endif
23 |
--------------------------------------------------------------------------------
/ucrop/src/main/jni/uCrop.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Oleksii Shliama on 3/13/16.
3 | //
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include "com_yalantis_ucrop_task_BitmapCropTask.h"
10 |
11 | using namespace std;
12 |
13 | #define cimg_display 0
14 | #define cimg_use_jpeg
15 | #define cimg_use_png
16 | #define cimg_use_openmp
17 |
18 | #include "CImg.h"
19 |
20 | using namespace cimg_library;
21 |
22 | #define LOG_TAG "uCrop JNI"
23 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
24 | #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
25 |
26 | #define SAVE_FORMAT_JPEG 0
27 | #define SAVE_FORMAT_PNG 1
28 |
29 | JNIEXPORT jboolean JNICALL Java_com_yalantis_ucrop_task_BitmapCropTask_cropCImg
30 | (JNIEnv *env, jobject obj,
31 | jstring pathSource, jstring pathResult,
32 | jint left, jint top, jint width, jint height, jfloat angle, jfloat resizeScale,
33 | jint format, jint quality,
34 | jint exifDegrees, jint exifTranslation) {
35 |
36 | LOGD("Crop image with CImg");
37 |
38 | const char *file_source_path = env->GetStringUTFChars(pathSource, 0);
39 | const char *file_result_path = env->GetStringUTFChars(pathResult, 0);
40 |
41 | try {
42 | CImg img(file_source_path);
43 | const int
44 | x0 = left, y0 = top,
45 | x1 = left + width - 1, y1 = top + height - 1;
46 |
47 | /*
48 | LOGD("left %d\ntop: %d", left, top);
49 | LOGD("width %d\nheight: %d", width, height);
50 | LOGD("angle %f\nresizeScale: %f", angle, resizeScale);
51 | LOGD("image size pre: %d x %d", img.width(), img.height());
52 | LOGD("exifDegrees: %d \nexifTranslation: %d", exifDegrees, exifTranslation);
53 | */
54 |
55 | // Handle exif. However it is slow, maybe calculate warp field according to exif rotation/translation.
56 | if (exifDegrees != 0) {
57 | img.rotate(exifDegrees);
58 | }
59 | if (exifTranslation != 1) {
60 | img.mirror("x");
61 | }
62 |
63 | const int
64 | size_x = img.width() * resizeScale, size_y = img.height() * resizeScale,
65 | size_z = -100, size_c = -100, interpolation_type = 1;
66 |
67 | const unsigned int boundary_conditions = 0;
68 | const float
69 | centering_x = 0, centering_y = 0, centering_z = 0, centering_c = 0;
70 | if (resizeScale != 1) {
71 | img.resize(size_x, size_y, size_z, size_c, interpolation_type, boundary_conditions, centering_x, centering_y, centering_z, centering_c);
72 | }
73 |
74 | // Create warp field.
75 | CImg warp(cimg::abs(x1 - x0 + 1), cimg::abs(y1 - y0 + 1), 1, 2);
76 |
77 | const float
78 | rad = angle * cimg::PI/180,
79 | ca = std::cos(rad), sa = std::sin(rad),
80 | ux = cimg::abs(img.width() * ca), uy = cimg::abs(img.width() * sa),
81 | vx = cimg::abs(img.height() * sa), vy = cimg::abs(img.height() * ca),
82 | w2 = 0.5f * img.width(), h2 = 0.5f * img.height(),
83 | dw2 = 0.5f * (ux + vx), dh2 = 0.5f * (uy + vy);
84 |
85 | cimg_forXY(warp, x, y) {
86 | const float
87 | u = x + x0 - dw2, v = y + y0 - dh2;
88 |
89 | warp(x, y, 0) = w2 + u*ca + v*sa;
90 | warp(x, y, 1) = h2 - u*sa + v*ca;
91 | }
92 |
93 | img = img.get_warp(warp, 0, 1, 2);
94 |
95 | if (format == SAVE_FORMAT_JPEG) {
96 | img.save_jpeg(file_result_path, quality);
97 | } else if (format == SAVE_FORMAT_PNG) {
98 | img.save_png(file_result_path, 0);
99 | } else {
100 | img.save(file_result_path);
101 | }
102 |
103 | ~img;
104 | env->ReleaseStringUTFChars(pathSource, file_source_path);
105 | env->ReleaseStringUTFChars(pathResult, file_result_path);
106 |
107 | return true;
108 |
109 | } catch (CImgInstanceException e) {
110 | env->ThrowNew(env->FindClass("java/lang/OutOfMemoryError"), e.what());
111 | } catch (CImgIOException e) {
112 | env->ThrowNew(env->FindClass("java/io/IOException"), e.what());
113 | }
114 |
115 | return false;
116 | }
--------------------------------------------------------------------------------
/ucrop/src/main/jniLibs/arm64-v8a/libucrop.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/jniLibs/arm64-v8a/libucrop.so
--------------------------------------------------------------------------------
/ucrop/src/main/jniLibs/armeabi-v7a/libucrop.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/jniLibs/armeabi-v7a/libucrop.so
--------------------------------------------------------------------------------
/ucrop/src/main/jniLibs/armeabi/libucrop.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/jniLibs/armeabi/libucrop.so
--------------------------------------------------------------------------------
/ucrop/src/main/jniLibs/x86/libucrop.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/jniLibs/x86/libucrop.so
--------------------------------------------------------------------------------
/ucrop/src/main/jniLibs/x86_64/libucrop.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/jniLibs/x86_64/libucrop.so
--------------------------------------------------------------------------------
/ucrop/src/main/res/anim/ucrop_loader_circle_path.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
19 |
20 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/anim/ucrop_loader_circle_scale.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
19 |
20 |
27 |
28 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/color/text_color_tab.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/color/ucrop_scale_text_view_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable-hdpi/ucrop_ic_angle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/res/drawable-hdpi/ucrop_ic_angle.png
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable-hdpi/ucrop_ic_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/res/drawable-hdpi/ucrop_ic_done.png
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable-ldpi/ucrop_ic_angle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/res/drawable-ldpi/ucrop_ic_angle.png
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable-ldpi/ucrop_ic_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/res/drawable-ldpi/ucrop_ic_done.png
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable-mdpi/ucrop_ic_angle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/res/drawable-mdpi/ucrop_ic_angle.png
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable-mdpi/ucrop_ic_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/res/drawable-mdpi/ucrop_ic_done.png
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable-xhdpi/ucrop_ic_angle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/res/drawable-xhdpi/ucrop_ic_angle.png
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable-xhdpi/ucrop_ic_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/res/drawable-xhdpi/ucrop_ic_done.png
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable-xhdpi/wangze1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/res/drawable-xhdpi/wangze1.png
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable-xxhdpi/ucrop_ic_angle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/res/drawable-xxhdpi/ucrop_ic_angle.png
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable-xxhdpi/ucrop_ic_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/res/drawable-xxhdpi/ucrop_ic_done.png
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable-xxxhdpi/ucrop_ic_angle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/res/drawable-xxxhdpi/ucrop_ic_angle.png
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable-xxxhdpi/ucrop_ic_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lihangleo2/RichEditTextCopyToutiao/ebc998665ded4b8b5ceb07f2521b4e2607164c20/ucrop/src/main/res/drawable-xxxhdpi/ucrop_ic_done.png
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/selector_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/shape_false.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
12 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/shape_true.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_crop.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_ic_crop.xml:
--------------------------------------------------------------------------------
1 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_ic_crop_unselected.xml:
--------------------------------------------------------------------------------
1 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_ic_cross.xml:
--------------------------------------------------------------------------------
1 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_ic_next.xml:
--------------------------------------------------------------------------------
1 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_ic_reset.xml:
--------------------------------------------------------------------------------
1 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_ic_rotate.xml:
--------------------------------------------------------------------------------
1 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_ic_rotate_unselected.xml:
--------------------------------------------------------------------------------
1 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_ic_scale.xml:
--------------------------------------------------------------------------------
1 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_ic_scale_unselected.xml:
--------------------------------------------------------------------------------
1 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_rotate.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_scale.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_shadow_upside.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_vector_ic_crop.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_vector_loader.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_vector_loader_animated.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/drawable/ucrop_wrapper_controls_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/layout/ucrop_aspect_ratio.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/layout/ucrop_controls.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
19 |
20 |
26 |
27 |
30 |
31 |
34 |
35 |
36 |
37 |
43 |
44 |
53 |
54 |
57 |
58 |
64 |
65 |
69 |
70 |
71 |
72 |
75 |
76 |
80 |
81 |
85 |
86 |
87 |
88 |
91 |
92 |
96 |
97 |
101 |
102 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/layout/ucrop_fragment_photobox.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
15 |
16 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/layout/ucrop_layout_rotate_wheel.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
25 |
26 |
31 |
32 |
35 |
36 |
37 |
38 |
45 |
46 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/layout/ucrop_layout_scale_wheel.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
19 |
20 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/layout/ucrop_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
13 |
14 |
19 |
20 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/menu/ucrop_menu_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values-de/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Foto editieren
4 | Original
5 | Zuschneiden
6 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values-es/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Original
4 | Editar Foto
5 |
6 | Cortar
7 |
8 | Rotar
9 | Escalar
10 | Cortar
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values-fi/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Muokkaa kuvaa
4 | Rajaa
5 | Sekä sisäänmeno- että ulostulo-Urit täytyy olla määritettyinä
6 |
7 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values-fr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Original
3 | Modifier la photo
4 | Recadrer
5 |
6 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values-it/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Originale
3 | Modifica foto
4 | Taglia
5 |
6 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values-ja/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | オリジナル
4 | 画像編集
5 |
6 | 切り抜き
7 |
8 | 拡大
9 | 回転
10 | 比率
11 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values-ko/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 사진 편집
4 | 원본
5 | 확인
6 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values-nl/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Origineel
3 | Foto bewerken
4 | Bijsnijden
5 |
6 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values-pt-br:
--------------------------------------------------------------------------------
1 |
2 |
3 | Original
4 | Editar Foto
5 |
6 | Cortar
7 |
8 | Uri de entrada e saída deve ser especificado
9 | Portanto, substitua o recurso de cores (ucrop_color_toolbar_widget) no seu aplicativo para fazê-lo funcionar em dispositivos pré-L
10 | Girar
11 | Tamanho
12 | Cortar
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values-sk/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Pôvodná
4 | Upraviť fotografiu
5 | Orezať
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values-zh-rTW/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 原始比例
4 | 裁切
5 |
6 | 裁切
7 |
8 | 必須指定輸入以及輸出的 Uri
9 | 在你的 App 內覆寫顏色資源檔 (ucrop_color_toolbar_widget) 使 5.0 以前裝置正常運作
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values-zh/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 原始比例
4 | 裁剪
5 |
6 | 裁剪
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values/attrs.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 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | #000
6 | #FF6300
7 | #20242F
8 | #B3BECE
9 | #FFF
10 |
11 |
12 | @color/ucrop_color_white
13 | #f5f5f5
14 | @color/ucrop_color_black
15 | @color/ucrop_color_black
16 | @color/ucrop_color_white
17 | @color/ucrop_color_blaze_orange
18 | @color/ucrop_color_heather
19 | @color/ucrop_color_blaze_orange
20 | @color/ucrop_color_ebony_clay
21 | @color/ucrop_color_blaze_orange
22 | @color/ucrop_color_ebony_clay
23 | @color/ucrop_color_ebony_clay
24 | @color/ucrop_color_blaze_orange
25 | @color/ucrop_color_ebony_clay
26 | @color/ucrop_color_black
27 |
28 |
29 | #80ffffff
30 | #ffffff
31 | #8c000000
32 | #4f212121
33 |
34 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 8dp
6 | 20dp
7 | 2dp
8 | 4dp
9 | 10dp
10 | 64dp
11 | 72dp
12 | 3dp
13 | 13sp
14 | 11sp
15 | 10dp
16 | 4dp
17 | 50dp
18 | 40dp
19 | 30dp
20 |
21 |
22 | 200dp
23 | 1dp
24 | 1dp
25 | 30dp
26 | 100dp
27 | 10dp
28 |
29 |
30 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values/public.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Original
4 | Edit Photo
5 |
6 | Crop
7 |
8 | Both input and output Uri must be specified
9 | Therefore, override color resource (ucrop_color_toolbar_widget) in your app to make it work on pre-L devices
10 | Rotate
11 | Scale
12 | Crop
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
21 |
22 |
28 |
29 |
36 |
37 |
46 |
47 |
56 |
57 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/values/values.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 1500
4 |
--------------------------------------------------------------------------------
/ucrop/src/main/res/xml/file_provider_paths.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
--------------------------------------------------------------------------------