├── .gitignore
├── .idea
├── encodings.xml
├── gradle.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── jniLibs
│ └── armeabi
│ │ └── libapp.so
├── libs
│ └── javassist.jar
├── proguard-rules.pro
├── ruyao.jks
├── src
│ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── gjson
│ │ │ └── androidtools
│ │ │ └── ApplicationTest.java
│ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── assets
│ │ │ ├── lottie_zan.json
│ │ │ ├── scheme.html
│ │ │ └── zd
│ │ │ │ └── img_0.png
│ │ ├── groovy
│ │ │ └── com
│ │ │ │ └── gjson
│ │ │ │ └── injecttransform
│ │ │ │ ├── InjectByJavassit.groovy
│ │ │ │ ├── InjectTransform.groovy
│ │ │ │ └── TransformPlugin.groovy
│ │ ├── java
│ │ │ ├── com
│ │ │ │ └── gjson
│ │ │ │ │ └── androidtools
│ │ │ │ │ ├── MyApplication.java
│ │ │ │ │ ├── activity
│ │ │ │ │ ├── BaseActivity.java
│ │ │ │ │ ├── BezierActivity.java
│ │ │ │ │ ├── CouponActivity.java
│ │ │ │ │ ├── ImageMakeActivity.java
│ │ │ │ │ ├── KrJsoUpActivity.java
│ │ │ │ │ ├── LoadingSampleActivity.java
│ │ │ │ │ ├── LottieActivity.java
│ │ │ │ │ └── MainActivity.java
│ │ │ │ │ ├── adapter
│ │ │ │ │ └── CouponListAdapter.java
│ │ │ │ │ ├── autocheckpermisson
│ │ │ │ │ ├── EasyPermissions.java
│ │ │ │ │ ├── PermissionActivity.java
│ │ │ │ │ └── StatusBarCompat.java
│ │ │ │ │ ├── commonview
│ │ │ │ │ ├── AutoListView.java
│ │ │ │ │ ├── AutoScrollBanner.java
│ │ │ │ │ ├── AutoScrollViewPager.java
│ │ │ │ │ ├── BezierView.java
│ │ │ │ │ ├── CouponView.java
│ │ │ │ │ ├── CustomDurationScroller.java
│ │ │ │ │ ├── VerticalAutoScrollView.java
│ │ │ │ │ ├── XYTranlateImageView.java
│ │ │ │ │ ├── autoscrollimageview
│ │ │ │ │ │ ├── AutoScrollImageViewBitmapLoader.java
│ │ │ │ │ │ └── AutoscrollImageView.java
│ │ │ │ │ ├── loadingview
│ │ │ │ │ │ ├── Indicator.java
│ │ │ │ │ │ ├── LoadingIndicatorView.java
│ │ │ │ │ │ └── indicators
│ │ │ │ │ │ │ ├── BallBeatIndicator.java
│ │ │ │ │ │ │ ├── BallClipRotateIndicator.java
│ │ │ │ │ │ │ ├── BallClipRotateMultipleIndicator.java
│ │ │ │ │ │ │ ├── BallClipRotatePulseIndicator.java
│ │ │ │ │ │ │ ├── BallGridBeatIndicator.java
│ │ │ │ │ │ │ ├── BallGridPulseIndicator.java
│ │ │ │ │ │ │ ├── BallPulseIndicator.java
│ │ │ │ │ │ │ ├── BallPulseRiseIndicator.java
│ │ │ │ │ │ │ ├── BallPulseSyncIndicator.java
│ │ │ │ │ │ │ ├── BallRotateIndicator.java
│ │ │ │ │ │ │ ├── BallScaleIndicator.java
│ │ │ │ │ │ │ ├── BallScaleMultipleIndicator.java
│ │ │ │ │ │ │ ├── BallScaleRippleIndicator.java
│ │ │ │ │ │ │ ├── BallScaleRippleMultipleIndicator.java
│ │ │ │ │ │ │ ├── BallSpinFadeLoaderIndicator.java
│ │ │ │ │ │ │ ├── BallTrianglePathIndicator.java
│ │ │ │ │ │ │ ├── BallZigZagDeflectIndicator.java
│ │ │ │ │ │ │ ├── BallZigZagIndicator.java
│ │ │ │ │ │ │ ├── CubeTransitionIndicator.java
│ │ │ │ │ │ │ ├── LineScaleIndicator.java
│ │ │ │ │ │ │ ├── LineScalePartyIndicator.java
│ │ │ │ │ │ │ ├── LineScalePulseOutIndicator.java
│ │ │ │ │ │ │ ├── LineScalePulseOutRapidIndicator.java
│ │ │ │ │ │ │ ├── LineSpinFadeLoaderIndicator.java
│ │ │ │ │ │ │ ├── PacmanIndicator.java
│ │ │ │ │ │ │ ├── SemiCircleSpinIndicator.java
│ │ │ │ │ │ │ ├── SquareSpinIndicator.java
│ │ │ │ │ │ │ └── TriangleSkewSpinIndicator.java
│ │ │ │ │ └── rainview
│ │ │ │ │ │ ├── BaseView.java
│ │ │ │ │ │ ├── RainItem.java
│ │ │ │ │ │ └── RainView.java
│ │ │ │ │ ├── db
│ │ │ │ │ └── SQLiteUtils.java
│ │ │ │ │ ├── entity
│ │ │ │ │ └── AdInfo.java
│ │ │ │ │ ├── fragment
│ │ │ │ │ └── PayDetailFragment.java
│ │ │ │ │ ├── rxjavaoretrofit
│ │ │ │ │ ├── bean
│ │ │ │ │ │ └── WeatherBean.java
│ │ │ │ │ ├── config
│ │ │ │ │ │ └── HttpServerConfig.java
│ │ │ │ │ ├── model
│ │ │ │ │ │ ├── callback
│ │ │ │ │ │ │ └── OnWeatherCallback.java
│ │ │ │ │ │ ├── impl
│ │ │ │ │ │ │ ├── WeatherNetModelImpl.java
│ │ │ │ │ │ │ └── WeatherRxJavaModelImpl.java
│ │ │ │ │ │ └── interfaces
│ │ │ │ │ │ │ └── IWeatherModel.java
│ │ │ │ │ ├── presenter
│ │ │ │ │ │ ├── impl
│ │ │ │ │ │ │ └── WeatherPresenterImpl.java
│ │ │ │ │ │ └── interfaces
│ │ │ │ │ │ │ └── IWeatherPresenter.java
│ │ │ │ │ ├── retrofitApi
│ │ │ │ │ │ ├── IWeatherService.java
│ │ │ │ │ │ └── RetrofitManager.java
│ │ │ │ │ └── view
│ │ │ │ │ │ ├── activities
│ │ │ │ │ │ └── WeatherActivity.java
│ │ │ │ │ │ └── interfaces
│ │ │ │ │ │ └── IWeatherView.java
│ │ │ │ │ └── utils
│ │ │ │ │ ├── AnimationUtils.java
│ │ │ │ │ ├── AppUtil.java
│ │ │ │ │ ├── Constant.java
│ │ │ │ │ ├── DensityUtil.java
│ │ │ │ │ ├── EncodeUtil.java
│ │ │ │ │ ├── GjsonJni.java
│ │ │ │ │ ├── GsonFactory.java
│ │ │ │ │ ├── LogUtil.java
│ │ │ │ │ ├── ScreenUtil.java
│ │ │ │ │ ├── StringUtil.java
│ │ │ │ │ └── ToastManager.java
│ │ │ └── test
│ │ │ │ └── BaseTest.java
│ │ ├── res
│ │ │ ├── anim
│ │ │ │ ├── push_bottom_in.xml
│ │ │ │ ├── push_bottom_out.xml
│ │ │ │ ├── slide_left_to_left.xml
│ │ │ │ ├── slide_left_to_left_in.xml
│ │ │ │ ├── slide_left_to_right.xml
│ │ │ │ └── slide_right_to_left.xml
│ │ │ ├── drawable
│ │ │ │ ├── btn_click.xml
│ │ │ │ ├── btn_shape_normal.xml
│ │ │ │ ├── btn_shape_press.xml
│ │ │ │ ├── selector_in.xml
│ │ │ │ └── toast_frame.9.png
│ │ │ ├── layout
│ │ │ │ ├── activity_bezier.xml
│ │ │ │ ├── activity_coupon.xml
│ │ │ │ ├── activity_imagemake.xml
│ │ │ │ ├── activity_loadingview_sample.xml
│ │ │ │ ├── activity_lottie.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── activity_weather.xml
│ │ │ │ ├── common_view_toast.xml
│ │ │ │ ├── fragment_pay_detail.xml
│ │ │ │ ├── item_couponview.xml
│ │ │ │ ├── item_indicator.xml
│ │ │ │ └── item_view.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ico_app.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_close.png
│ │ │ │ ├── ic_doubt.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_open.png
│ │ │ │ ├── ic_pay_banlance_able.png
│ │ │ │ └── ico_app.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── cart.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_xt_ayxx.png
│ │ │ │ ├── ic_xt_cjjb.png
│ │ │ │ ├── ic_xt_fczn.png
│ │ │ │ ├── ic_xt_fy.png
│ │ │ │ ├── ic_xt_jhpt.png
│ │ │ │ ├── ic_xt_mrtx_small.png
│ │ │ │ ├── ic_xt_sjzx.png
│ │ │ │ ├── ic_xt_whtx.png
│ │ │ │ ├── ic_xt_ysdk.png
│ │ │ │ ├── ico_app.png
│ │ │ │ ├── icon_tv.png
│ │ │ │ ├── img_horn_small.png
│ │ │ │ ├── just_experience_one.jpeg
│ │ │ │ ├── just_experience_two.jpg
│ │ │ │ ├── toast_frame.9.png
│ │ │ │ ├── toast_icon_fail.png
│ │ │ │ ├── toast_icon_normal.png
│ │ │ │ └── toast_icon_prompt.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── bg1.jpg
│ │ │ │ ├── bg2.jpg
│ │ │ │ ├── bg3.jpg
│ │ │ │ ├── bg4.jpg
│ │ │ │ ├── bg_srcolling_image.png
│ │ │ │ ├── earth.jpg
│ │ │ │ ├── house2.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ico_app.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ico_app.png
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ └── values
│ │ │ │ ├── arrays.xml
│ │ │ │ ├── attrs.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── gradle-plugins
│ │ │ └── com.gjson.customplugin.transform.properties
│ └── test
│ │ └── java
│ │ └── com
│ │ └── gjson
│ │ └── androidtools
│ │ └── ExampleUnitTest.java
└── transform.gradle
├── build.gradle
├── gif
├── five.gif
├── four.gif
├── loadingview.gif
├── main.gif
├── one.gif
├── three.gif
└── two.gif
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── iOS.md
├── imagepicker
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── gjson
│ │ └── androidtools
│ │ └── library
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── gjson
│ │ │ └── androidtools
│ │ │ └── library
│ │ │ ├── ImagePickerProvider.java
│ │ │ └── imagepicker
│ │ │ ├── DataHolder.java
│ │ │ ├── ImageDataSource.java
│ │ │ ├── ImagePicker.java
│ │ │ ├── ImagePickerProvider.java
│ │ │ ├── adapter
│ │ │ ├── ImageFolderAdapter.java
│ │ │ ├── ImagePageAdapter.java
│ │ │ └── ImageRecyclerAdapter.java
│ │ │ ├── bean
│ │ │ ├── ImageFolder.java
│ │ │ └── ImageItem.java
│ │ │ ├── loader
│ │ │ └── ImageLoader.java
│ │ │ ├── ui
│ │ │ ├── ImageBaseActivity.java
│ │ │ ├── ImageCropActivity.java
│ │ │ ├── ImageGridActivity.java
│ │ │ ├── ImagePreviewActivity.java
│ │ │ ├── ImagePreviewBaseActivity.java
│ │ │ └── ImagePreviewDelActivity.java
│ │ │ ├── util
│ │ │ ├── BitmapUtil.java
│ │ │ ├── NavigationBarChangeListener.java
│ │ │ ├── ProviderUtil.java
│ │ │ └── Utils.java
│ │ │ └── view
│ │ │ ├── CropImageView.java
│ │ │ ├── FolderPopUpWindow.java
│ │ │ ├── GridSpacingItemDecoration.java
│ │ │ ├── SuperCheckBox.java
│ │ │ ├── SystemBarTintManager.java
│ │ │ └── ViewPagerFixed.java
│ └── res
│ │ ├── anim
│ │ ├── fade_in.xml
│ │ ├── fade_out.xml
│ │ ├── hide_to_bottom.xml
│ │ ├── show_from_bottom.xml
│ │ ├── top_in.xml
│ │ └── top_out.xml
│ │ ├── drawable-v21
│ │ └── bg_folder_item.xml
│ │ ├── drawable
│ │ ├── bg_btn_dis.xml
│ │ ├── bg_btn_nor.xml
│ │ ├── bg_btn_pre.xml
│ │ ├── bg_folder_item.xml
│ │ ├── bg_image_folder.xml
│ │ ├── ic_arrow_back.xml
│ │ ├── ic_cover_shade.xml
│ │ ├── ic_default_image.xml
│ │ ├── ic_vector_check.xml
│ │ ├── ic_vector_delete.xml
│ │ ├── selector_back_press.xml
│ │ ├── selector_grid_camera_bg.xml
│ │ ├── selector_item_checked.xml
│ │ └── selector_top_ok.xml
│ │ ├── layout
│ │ ├── activity_image_crop.xml
│ │ ├── activity_image_grid.xml
│ │ ├── activity_image_preview.xml
│ │ ├── adapter_camera_item.xml
│ │ ├── adapter_folder_list_item.xml
│ │ ├── adapter_image_list_item.xml
│ │ ├── include_top_bar.xml
│ │ └── pop_folder.xml
│ │ ├── mipmap-xxhdpi
│ │ ├── checkbox_checked.png
│ │ ├── checkbox_normal.png
│ │ ├── grid_camera.png
│ │ └── text_indicator.png
│ │ ├── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ │ └── xml
│ │ └── provider_paths.xml
│ └── test
│ └── java
│ └── com
│ └── gjson
│ └── androidtools
│ └── library
│ └── ExampleUnitTest.java
├── settings.gradle
└── test.html
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea
5 | /.idea/workspace.xml
6 | /.idea/libraries
7 | .DS_Store
8 | /build
9 | /captures
10 |
11 | /.idea
12 | .idea
13 | /.idea/vcs.xml
14 | /.gitignore
15 | /app/gradle.properties
16 | AndroidTools_v1.1.0.apk
17 | libs/
18 | src/main/assets/
19 | src/main/java/com/gjson/androidtools/Interface/
20 | src/main/java/com/qihoo360/
21 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AndroidTools
2 | this is android tools for view autoscroll view and coupon view ;for RXJava Retrofit MVP etc;
3 | Pay attention to progress Android Plugin Transform API Dev
4 |
5 | * Gradle Plugin Transform API 实战
6 |
7 | * 轻松搞定 Android M 动态权限检测;
8 |
9 | * 上下自动滚动,实例如京东、淘宝、一号店等 Android app里的上下滚动动态;
10 |
11 | * 自定义的优惠券view、淘宝支付动效;
12 |
13 | * RXJava Retrofit MVP实战;
14 |
15 | * 添加购物车动效;
16 |
17 | * 使用三阶贝塞尔曲线模拟运动路径。一个模拟贝塞尔曲线的网站,可以在线模拟出想要的曲线 http://myst729.github.io/bezier-curve/
18 |
19 | * 开发过程中常用的工具类 AppUtil DensityUtil EncodeUtil ScreenUtil StringUtil EncryptUtil
20 |
21 | * 无限重复、自动滚动的ImageView;
22 |
23 | * 加载中的样式 LoadingView;支持circular progressbar
24 |
25 |
26 |
27 | # 效果图
28 |
29 | 
30 |
31 | * 上下自动滚动,实例如京东、淘宝、一号店等 Android app里的上下滚动动态;
32 |
33 | 
34 |
35 |
36 |
37 |
38 |
39 | * 添加购物车动效;
40 |
41 | 
42 |
43 |
44 |
45 |
46 |
47 | * 自定义的优惠券view,以及支付宝支付动效;
48 |
49 | 
50 |
51 |
52 |
53 |
54 |
55 | * RXJava Retrofit MVP实战
56 |
57 | 
58 |
59 |
60 |
61 |
62 |
63 | * 三阶贝塞尔曲线动效
64 |
65 | 
66 |
67 |
68 | * 加载中的样式的 LoadingView
69 |
70 | 
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /gradle.properties
3 |
--------------------------------------------------------------------------------
/app/jniLibs/armeabi/libapp.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/jniLibs/armeabi/libapp.so
--------------------------------------------------------------------------------
/app/libs/javassist.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/libs/javassist.jar
--------------------------------------------------------------------------------
/app/ruyao.jks:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/ruyao.jks
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/gjson/androidtools/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/assets/scheme.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
22 |
23 |
24 | wechat pay
25 |
26 | alipay
27 |
28 | 课程详情页
29 |
30 | 课程列表页
31 |
32 | 网页调试
33 |
34 |
35 |
36 |
37 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/assets/zd/img_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/assets/zd/img_0.png
--------------------------------------------------------------------------------
/app/src/main/groovy/com/gjson/injecttransform/InjectByJavassit.groovy:
--------------------------------------------------------------------------------
1 | package com.gjson.groovy.injecttransform
2 |
3 | import javassist.ClassPool
4 | import javassist.CtClass
5 | import javassist.CtMethod
6 | import org.gradle.api.Project
7 |
8 | /**
9 | * 借助 Javassit 操作 Class 文件
10 | */
11 | class InjectByJavassit {
12 |
13 | private static final ClassPool sClassPool = ClassPool.getDefault()
14 |
15 | /**
16 | * 插入一段Toast代码
17 | * @param path
18 | * @param project
19 | */
20 | static void injectToast(String path, Project project) {
21 | // 加入当前路径
22 | sClassPool.appendClassPath(path)
23 | // project.android.bootClasspath 加入android.jar,不然找不到android相关的所有类
24 | sClassPool.appendClassPath(project.android.bootClasspath[0].toString())
25 | // 引入android.os.Bundle包,因为onCreate方法参数有Bundle
26 | sClassPool.importPackage('android.os.Bundle')
27 |
28 | File dir = new File(path)
29 | if (dir.isDirectory()) {
30 | // 遍历文件夹
31 | dir.eachFileRecurse { File file ->
32 | String filePath = file.absolutePath
33 | println("filePath: $filePath")
34 |
35 | if (file.name == 'MainActivity.class') {
36 | // 获取Class
37 | // 这里的MainActivity就在app模块里
38 | CtClass ctClass = sClassPool.getCtClass('com.gjson.androidtools.activity.MainActivity')
39 | println("ctClass: $ctClass")
40 |
41 | // 解冻
42 | if (ctClass.isFrozen()) {
43 | ctClass.defrost()
44 | }
45 |
46 | // 获取Method
47 | CtMethod ctMethod = ctClass.getDeclaredMethod('onCreate')
48 | println("ctMethod: $ctMethod")
49 |
50 | String toastStr = """ android.widget.Toast.makeText(this,"我是被插入的Toast代码~!!",android.widget.Toast.LENGTH_SHORT).show();
51 | """
52 |
53 | // 方法尾插入
54 | ctMethod.insertAfter(toastStr)
55 | ctClass.writeFile(path)
56 | ctClass.detach() //释放
57 | }
58 | }
59 | }
60 | }
61 |
62 | }
--------------------------------------------------------------------------------
/app/src/main/groovy/com/gjson/injecttransform/TransformPlugin.groovy:
--------------------------------------------------------------------------------
1 | package com.gjson.groovy.injecttransform
2 | import com.android.build.gradle.AppExtension
3 | import org.gradle.api.Plugin
4 | import org.gradle.api.Project
5 |
6 | /**
7 | * 定义插件,加入Transform
8 | */
9 | class TransformPlugin implements Plugin {
10 |
11 | @Override
12 | void apply(Project project) {
13 |
14 | // 获取Android扩展
15 | def android = project.extensions.getByType(AppExtension)
16 | // 注册Transform,其实就是添加了Task
17 | android.registerTransform(new InjectTransform(project))
18 |
19 | // 这里只是随便定义一个Task而已,和Transform无关
20 | project.task('JustTask') {
21 | doLast {
22 | println('InjectTransform task')
23 | }
24 | }
25 |
26 | }
27 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/MyApplication.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools;
2 |
3 | import android.app.Application;
4 | import com.gjson.androidtools.utils.Constant;
5 | //import com.qihoo360.replugin.RePluginApplication;
6 | //import com.taobao.hotfix.HotFixManager;
7 | import com.taobao.hotfix.HotFixManager;
8 | import com.taobao.hotfix.PatchLoadStatusListener;
9 | import com.taobao.hotfix.util.PatchStatusCode;
10 |
11 | /**
12 | * Created by gjson on 16/11/9.
13 | * Name MyApplication
14 | * Version 1.0
15 | */
16 | public class MyApplication extends Application {
17 |
18 | @Override
19 | public void onCreate() {
20 | super.onCreate();
21 |
22 | initHotfix();
23 | }
24 |
25 | // TODO: 11/05/16 初始化hotfix
26 | private void initHotfix() {
27 |
28 | HotFixManager.getInstance().initialize(this, BuildConfig.VERSION_NAME, Constant.ALIBAICHUAN_HOTFIX_APP_ID, true, new PatchLoadStatusListener() {
29 | @Override
30 | public void onload(int mode, int code, String info, int handlePatchVersion) {
31 |
32 | // 补丁加载回调通知
33 | if (code == PatchStatusCode.CODE_SUCCESS_LOAD) {
34 | // 表明补丁加载成功
35 |
36 | } else if (code == PatchStatusCode.CODE_ERROR_NEEDRESTART) {
37 | // 表明新补丁生效需要重启. 业务方可自行实现逻辑, 提示用户或者强制重启, 可以监听应用进入后台事件, 然后应用自杀
38 | killProcess();
39 |
40 | } else {
41 | // 其它信息
42 |
43 | }
44 |
45 | }
46 | });
47 | HotFixManager.getInstance().queryNewHotPatch();
48 | }
49 |
50 | /**
51 | * 杀死当前进程
52 | */
53 | private void killProcess() {
54 | android.os.Process.killProcess(android.os.Process.myPid());
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/activity/BezierActivity.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.activity;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.gjson.androidtools.R;
6 | import com.gjson.androidtools.commonview.BezierView;
7 | import com.gjson.androidtools.utils.LogUtil;
8 | import com.gjson.androidtools.utils.ScreenUtil;
9 |
10 | import org.jsoup.Jsoup;
11 | import org.jsoup.nodes.Document;
12 | import org.jsoup.select.Elements;
13 |
14 | import java.io.IOException;
15 |
16 | /**
17 | * Created by gjson on 16/9/6.
18 | * Name BezierActivity
19 | * Version 1.0
20 | */
21 | public class BezierActivity extends BaseActivity {
22 |
23 | private BezierView mBezierView;
24 |
25 | private Document document;
26 |
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 |
31 | }
32 |
33 | @Override
34 | protected int getLayoutId() {
35 | return R.layout.activity_bezier;
36 | }
37 |
38 | @Override
39 | protected void setupView() {
40 |
41 | mBezierView = getView(R.id.bezier_view);
42 | }
43 |
44 | @Override
45 | protected void initializedData() {
46 |
47 | mBezierView.setDefaultResourceImgList();
48 |
49 | mBezierView.startAnimation(ScreenUtil.getScreenWidth(mContext), ScreenUtil.getScreenHeight(mContext), 1000);
50 |
51 | new Thread(new Runnable() {
52 | @Override
53 | public void run() {
54 | JsoUpFrom36Kr();
55 | }
56 | }).start();
57 | }
58 |
59 |
60 | private void JsoUpFrom36Kr() {
61 | try {
62 | document = Jsoup.connect("http://www.36kr.com/").timeout(8000).get();
63 | Elements elements = document.select("ul.J_navList");
64 | Elements lis = elements.select("li");
65 | for (int i = 0; i < lis.size(); i++) {
66 |
67 | // if (i < 5) continue;
68 |
69 | String intro = lis.get(i).select("s.undefined mark h5_mark").text();
70 |
71 | LogUtil.e("title", intro + "\\n");
72 |
73 | }
74 | } catch (IOException e) {
75 | e.printStackTrace();
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/activity/CouponActivity.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.activity;
2 |
3 | import android.os.Bundle;
4 | import android.view.View;
5 | import android.widget.AdapterView;
6 | import android.widget.ImageView;
7 | import android.widget.ListView;
8 | import android.widget.RelativeLayout;
9 |
10 | import com.gjson.androidtools.R;
11 | import com.gjson.androidtools.adapter.CouponListAdapter;
12 | import com.gjson.androidtools.fragment.PayDetailFragment;
13 | import com.gjson.androidtools.utils.AnimationUtils;
14 |
15 | /**
16 | * Created by gjson on 16/7/26.
17 | * Name CouponActivity
18 | * Version 1.0
19 | */
20 | public class CouponActivity extends BaseActivity implements AdapterView.OnItemClickListener {
21 |
22 | private RelativeLayout mRootRel;
23 | private ImageView mCartImg;
24 | private ListView mCouponLv;
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 |
30 | }
31 |
32 | @Override
33 | protected int getLayoutId() {
34 | return R.layout.activity_coupon;
35 | }
36 |
37 | @Override
38 | protected void setupView() {
39 | mRootRel = getView(R.id.root_rl);
40 | mCouponLv = getView(R.id.coupon_lv);
41 | mCartImg = getView(R.id.cart_img);
42 |
43 | }
44 |
45 | @Override
46 | protected void initializedData() {
47 | mCouponLv.setAdapter(new CouponListAdapter(mContext, this));
48 | mCouponLv.setOnItemClickListener(this);
49 | }
50 |
51 | @Override
52 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
53 | switch (view.getId()) {
54 | case R.id.horn_img:
55 | // CouponListAdapter.ViewHolder viewHolder = new CouponListAdapter.ViewHolder();
56 | // viewHolder = (CouponListAdapter.ViewHolder) view.getTag();
57 | AnimationUtils.AddToShopingCart((ImageView) view, mCartImg, mContext, mRootRel, 1);
58 | break;
59 | default:
60 | PayDetailFragment payDetailFragment = new PayDetailFragment();
61 | // getSupportFragmentManager().beginTransaction().replace();
62 | payDetailFragment.show(getFragmentManager(), "payDetailFragment");
63 | break;
64 | }
65 |
66 |
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/activity/KrJsoUpActivity.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.activity;
2 |
3 | import com.gjson.androidtools.utils.LogUtil;
4 |
5 | import org.jsoup.Jsoup;
6 | import org.jsoup.nodes.Document;
7 | import org.jsoup.select.Elements;
8 |
9 | import java.io.IOException;
10 |
11 | /**
12 | * Created by gjson on 2017/7/5.
13 | * Name KrJsoUpActivity
14 | * Version 1.0
15 | */
16 |
17 | public class KrJsoUpActivity extends BaseActivity {
18 |
19 | private Document document;
20 |
21 |
22 | @Override
23 | protected int getLayoutId() {
24 | return 0;
25 | }
26 |
27 | @Override
28 | protected void setupView() {
29 |
30 | }
31 |
32 | @Override
33 | protected void initializedData() {
34 |
35 | }
36 |
37 |
38 | private void JsoUpFrom36Kr() {
39 | try {
40 | document = Jsoup.connect("http://36kr.com/").timeout(8000).get();
41 | Elements elements = document.select("ul.feed_ul");
42 | Elements lis = elements.select("li");
43 | for (int i = 0; i < lis.size(); i++) {
44 |
45 | if (i<5)continue;
46 |
47 | String intro=lis.get(i).select("div.intro").text();
48 |
49 | LogUtil.e("intro",intro);
50 |
51 | }
52 | } catch (IOException e) {
53 | e.printStackTrace();
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/activity/LoadingSampleActivity.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.activity;
2 |
3 | import android.support.v7.widget.GridLayoutManager;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import com.gjson.androidtools.R;
8 | import com.gjson.androidtools.commonview.loadingview.LoadingIndicatorView;
9 |
10 | /**
11 | * @Author Created by gjson on 2018/12/29.
12 | */
13 | public class LoadingSampleActivity extends BaseActivity {
14 | private RecyclerView mRecycler;
15 |
16 | @Override protected int getLayoutId() {
17 | return R.layout.activity_loadingview_sample;
18 | }
19 |
20 | @Override protected void setupView() {
21 |
22 | }
23 |
24 | @Override protected void initializedData() {
25 |
26 | mRecycler = (RecyclerView) findViewById(R.id.recycler);
27 |
28 | GridLayoutManager layoutManager = new GridLayoutManager(this, 4);
29 | mRecycler.setLayoutManager(layoutManager);
30 | mRecycler.setAdapter(new RecyclerView.Adapter() {
31 | @Override public IndicatorHolder onCreateViewHolder(ViewGroup parent, int viewType) {
32 | View itemView = getLayoutInflater().inflate(R.layout.item_indicator, parent, false);
33 | return new IndicatorHolder(itemView);
34 | }
35 |
36 | @Override public void onBindViewHolder(IndicatorHolder holder, final int position) {
37 | holder.indicatorView.setIndicator(INDICATORS[position]);
38 | holder.itemLayout.setOnClickListener(new View.OnClickListener() {
39 | @Override public void onClick(View v) {
40 | //Intent intent = new Intent(LoadingSampleActivity.this, IndicatorActivity.class);
41 | //intent.putExtra("indicator", INDICATORS[position]);
42 | //startActivity(intent);
43 | }
44 | });
45 | }
46 |
47 | @Override public int getItemCount() {
48 | return INDICATORS.length;
49 | }
50 | });
51 | }
52 |
53 | final static class IndicatorHolder extends RecyclerView.ViewHolder {
54 |
55 | public LoadingIndicatorView indicatorView;
56 | public View itemLayout;
57 |
58 | public IndicatorHolder(View itemView) {
59 | super(itemView);
60 | itemLayout = itemView.findViewById(R.id.itemLayout);
61 | indicatorView = (LoadingIndicatorView) itemView.findViewById(R.id.indicator);
62 | }
63 | }
64 |
65 | private static final String[] INDICATORS = new String[] {
66 | "BallPulseIndicator", "BallGridPulseIndicator", "BallClipRotateIndicator",
67 | "BallClipRotatePulseIndicator", "SquareSpinIndicator", "BallClipRotateMultipleIndicator",
68 | "BallPulseRiseIndicator", "BallRotateIndicator", "CubeTransitionIndicator",
69 | "BallZigZagIndicator", "BallZigZagDeflectIndicator", "BallTrianglePathIndicator",
70 | "BallScaleIndicator", "LineScaleIndicator", "LineScalePartyIndicator",
71 | "BallScaleMultipleIndicator", "BallPulseSyncIndicator", "BallBeatIndicator",
72 | "LineScalePulseOutIndicator", "LineScalePulseOutRapidIndicator", "BallScaleRippleIndicator",
73 | "BallScaleRippleMultipleIndicator", "BallSpinFadeLoaderIndicator",
74 | "LineSpinFadeLoaderIndicator", "TriangleSkewSpinIndicator", "PacmanIndicator",
75 | "BallGridBeatIndicator", "SemiCircleSpinIndicator", "com.wang.avi.sample.MyCustomIndicator"
76 | };
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/activity/LottieActivity.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.activity;
2 |
3 | import android.os.Bundle;
4 | import android.view.View;
5 | import android.widget.Button;
6 | import android.widget.TextView;
7 | import com.airbnb.lottie.LottieAnimationView;
8 | import com.gjson.androidtools.R;
9 | import com.gjson.androidtools.adapter.CouponListAdapter;
10 |
11 | /**
12 | * Created by gjson on 2020-02-19.
13 | * Name LottieActivity
14 | * Version 1.0
15 | */
16 | public class LottieActivity extends BaseActivity implements View.OnClickListener {
17 |
18 | Button lottieBtn;
19 | LottieAnimationView likeAnimationView;
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | }
25 |
26 | @Override
27 | protected int getLayoutId() {
28 | return R.layout.activity_lottie;
29 | }
30 |
31 | @Override
32 | protected void setupView() {
33 |
34 | lottieBtn = (Button) findViewById(R.id.btn_lottie);
35 | likeAnimationView = (LottieAnimationView) findViewById(R.id.animation_view);
36 |
37 | likeAnimationView.setImageAssetsFolder("zd/");
38 | likeAnimationView.setAnimation("lottie_zan.json");
39 | //likeAnimationView.loop(true);
40 |
41 | }
42 |
43 | @Override
44 | protected void initializedData() {
45 |
46 | lottieBtn.setOnClickListener(this);
47 | }
48 |
49 | @Override
50 | public void onClick(View view) {
51 | switch (view.getId()) {
52 |
53 | case R.id.btn_lottie:
54 | likeAnimationView.playAnimation();
55 | break;
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/adapter/CouponListAdapter.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.adapter;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.AdapterView;
8 | import android.widget.BaseAdapter;
9 | import android.widget.ImageView;
10 | import android.widget.TextView;
11 |
12 | import com.gjson.androidtools.R;
13 |
14 |
15 | /**
16 | * Created by gjson on 16/7/26.
17 | * Name CouponListAdapter
18 | * Version 1.0
19 | */
20 | public class CouponListAdapter extends BaseAdapter {
21 | private LayoutInflater mInflater;
22 | private Context mContext;
23 | private AdapterView.OnItemClickListener mOnitemClicklis;
24 |
25 | public CouponListAdapter(Context context, AdapterView.OnItemClickListener itemClickListener) {
26 |
27 | mContext = context;
28 | mInflater = LayoutInflater.from(mContext);
29 | this.mOnitemClicklis = itemClickListener;
30 | }
31 |
32 | @Override
33 | public int getCount() {
34 | return 10;
35 | }
36 |
37 | @Override
38 | public Object getItem(int position) {
39 | return null;
40 | }
41 |
42 | @Override
43 | public long getItemId(int position) {
44 | return position;
45 | }
46 |
47 | @Override
48 | public View getView(final int position, View convertView, final ViewGroup parent) {
49 | final ViewHolder viewHolder;
50 | if (convertView == null) {
51 | convertView = mInflater.inflate(R.layout.item_couponview, null);
52 | viewHolder = new ViewHolder();
53 | viewHolder.img = (ImageView) convertView.findViewById(R.id.horn_img);
54 | convertView.setTag(viewHolder);
55 | } else {
56 |
57 | viewHolder = (ViewHolder) convertView.getTag();
58 |
59 | }
60 | // viewHolder.img.setTag(viewHolder);
61 | viewHolder.img.setOnClickListener(new View.OnClickListener() {
62 | @Override
63 | public void onClick(View v) {
64 | mOnitemClicklis.onItemClick(null, v, position, 0);
65 | }
66 | });
67 | return convertView;
68 | }
69 |
70 | public static class ViewHolder {
71 | public TextView tv;
72 | public ImageView img;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/autocheckpermisson/PermissionActivity.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.autocheckpermisson;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.graphics.Color;
6 | import android.os.Bundle;
7 | import android.support.annotation.NonNull;
8 |
9 | import com.gjson.androidtools.R;
10 |
11 | import java.util.List;
12 |
13 |
14 | /**
15 | * Created by gjson on 16/7/26.
16 | * Name PermissionActivity
17 | * Version 1.0
18 | */
19 | public class PermissionActivity extends Activity implements
20 | EasyPermissions.PermissionCallbacks {
21 |
22 | protected static final int RC_PERM = 123;
23 |
24 | protected static int reSting = R.string.ask_again;//默认提示语句
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | }
30 |
31 | public void initStatusBar(String strColor) {
32 | StatusBarCompat.setStatusBarColor(this, Color.parseColor(strColor));
33 | StatusBarCompat.translucentStatusBar(this);
34 | }
35 |
36 | /**
37 | * 权限回调接口
38 | */
39 | private CheckPermListener mListener;
40 |
41 | public interface CheckPermListener {
42 | //权限通过后的回调方法
43 | void superPermission();
44 | }
45 |
46 | public void checkPermission(CheckPermListener listener, int resString, String... mPerms) {
47 | mListener = listener;
48 | if (EasyPermissions.hasPermissions(this, mPerms)) {
49 | if (mListener != null)
50 | mListener.superPermission();
51 | } else {
52 | EasyPermissions.requestPermissions(this, getString(resString),
53 | RC_PERM, mPerms);
54 | }
55 | }
56 |
57 | /**
58 | * 用户权限处理,
59 | * 如果全部获取, 则直接过.
60 | * 如果权限缺失, 则提示Dialog.
61 | *
62 | * @param requestCode 请求码
63 | * @param permissions 权限
64 | * @param grantResults 结果
65 | */
66 | @Override
67 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
68 | super.onRequestPermissionsResult(requestCode, permissions, grantResults);
69 |
70 | EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
71 | }
72 |
73 | @Override
74 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
75 | super.onActivityResult(requestCode, resultCode, data);
76 |
77 | if (requestCode == EasyPermissions.SETTINGS_REQ_CODE) {
78 | //设置返回
79 | }
80 | }
81 |
82 |
83 | @Override
84 | public void onPermissionsGranted(int requestCode, List perms) {
85 | //同意了某些权限可能不是全部
86 | }
87 |
88 | @Override
89 | public void onPermissionsAllGranted() {
90 | if (mListener != null)
91 | mListener.superPermission();//同意了全部权限的回调
92 | }
93 |
94 | @Override
95 | public void onPermissionsDenied(int requestCode, List perms) {
96 |
97 | EasyPermissions.checkDeniedPermissionsNeverAskAgain(this,
98 | getString(R.string.perm_tip),
99 | R.string.setting, R.string.cancel, null, perms);
100 | }
101 |
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/AutoListView.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.ListView;
6 |
7 | /**
8 | * Created by gjson on 2018/11/18.
9 | * Name AutoListView
10 | * Version 1.0
11 | */
12 | public class AutoListView extends ListView{
13 |
14 |
15 | public AutoListView(Context context) {
16 | super(context);
17 | }
18 |
19 | public AutoListView(Context context, AttributeSet attrs) {
20 | super(context, attrs);
21 | }
22 |
23 | public AutoListView(Context context, AttributeSet attrs, int defStyleAttr) {
24 | super(context, attrs, defStyleAttr);
25 | }
26 |
27 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
28 |
29 | int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
30 |
31 | MeasureSpec.AT_MOST);
32 |
33 | super.onMeasure(widthMeasureSpec, expandSpec);
34 |
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/CouponView.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.graphics.Paint;
7 | import android.util.AttributeSet;
8 | import android.widget.LinearLayout;
9 |
10 | /**
11 | * Created by gjson on 16/7/26.
12 | * Name CouponView
13 | * Version 1.0
14 | */
15 | public class CouponView extends LinearLayout {
16 |
17 | private Paint mPaint;
18 | /**
19 | * 圆间距
20 | */
21 | private float gap = 8;
22 | /**
23 | * 半径
24 | */
25 | private float radius = 10;
26 | /**
27 | * 圆数量
28 | */
29 | private int circleNum;
30 |
31 | private float remain;
32 |
33 |
34 | public CouponView(Context context) {
35 | super(context);
36 | }
37 |
38 | public CouponView(Context context, AttributeSet attrs) {
39 | super(context, attrs);
40 | mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
41 | mPaint.setDither(true);
42 | mPaint.setColor(Color.WHITE);
43 | mPaint.setStyle(Paint.Style.FILL);
44 | }
45 |
46 | @Override
47 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
48 | super.onSizeChanged(w, h, oldw, oldh);
49 | if (remain == 0) {
50 | //计算不整除的剩余部分
51 | remain = (int) (w - gap) % (2 * radius + gap);
52 | }
53 | circleNum = (int) ((w - gap) / (2 * radius + gap));
54 | }
55 |
56 |
57 | public CouponView(Context context, AttributeSet attrs, int defStyleAttr) {
58 | super(context, attrs, defStyleAttr);
59 | }
60 |
61 |
62 | @Override
63 | protected void onDraw(Canvas canvas) {
64 | super.onDraw(canvas);
65 | for (int i = 0; i < circleNum; i++) {
66 | float x = gap + radius + remain / 2 + ((gap + radius * 2) * i);
67 | canvas.drawCircle(x, 0, radius, mPaint);
68 | canvas.drawCircle(x, getHeight(), radius, mPaint);
69 | }
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/CustomDurationScroller.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview;
2 |
3 | import android.content.Context;
4 | import android.view.animation.Interpolator;
5 | import android.widget.Scroller;
6 |
7 | /**
8 | * @Author Created by gjson (zhuangyalei@lianjia.com) on 2018/11/8.
9 | * @Copyright (c) 2018, Lianjia Group All Rights Reserved.
10 | */
11 | public class CustomDurationScroller extends Scroller {
12 |
13 | private double scrollFactor = 1;
14 |
15 | public CustomDurationScroller(Context context) {
16 | super(context);
17 | }
18 |
19 | public CustomDurationScroller(Context context, Interpolator interpolator) {
20 | super(context, interpolator);
21 | }
22 |
23 | /**
24 | * not exist in android 2.3
25 | *
26 | * @param context
27 | * @param interpolator
28 | * @param flywheel
29 | */
30 | // @SuppressLint("NewApi")
31 | // public CustomDurationScroller(Context context, Interpolator interpolator, boolean flywheel){
32 | // super(context, interpolator, flywheel);
33 | // }
34 |
35 | /**
36 | * Set the factor by which the duration will change
37 | */
38 | public void setScrollDurationFactor(double scrollFactor) {
39 | this.scrollFactor = scrollFactor;
40 | }
41 |
42 | @Override
43 | public void startScroll(int startX, int startY, int dx, int dy, int duration) {
44 | super.startScroll(startX, startY, dx, dy, (int)(duration * scrollFactor));
45 | }
46 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/autoscrollimageview/AutoScrollImageViewBitmapLoader.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.autoscrollimageview;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 |
6 | /**
7 | * Created by gjson on 2018/3/27.
8 | * Name AutoScrollImageViewBitmapLoader
9 | * Version 1.0
10 | */
11 |
12 | public interface AutoScrollImageViewBitmapLoader {
13 |
14 | Bitmap loadBitmap(Context context, int resourceId);
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/BallBeatIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import com.gjson.androidtools.commonview.loadingview.Indicator;
7 | import java.util.ArrayList;
8 |
9 | /**
10 | * @Author Created by gjson on 2018/12/29.
11 | */
12 | public class BallBeatIndicator extends Indicator {
13 |
14 | public static final float SCALE=1.0f;
15 |
16 | public static final int ALPHA=255;
17 |
18 | private float[] scaleFloats=new float[]{SCALE,
19 | SCALE,
20 | SCALE};
21 |
22 | int[] alphas=new int[]{ALPHA,
23 | ALPHA,
24 | ALPHA,};
25 |
26 | @Override
27 | public void draw(Canvas canvas, Paint paint) {
28 | float circleSpacing=4;
29 | float radius=(getWidth()-circleSpacing*2)/6;
30 | float x = getWidth()/ 2-(radius*2+circleSpacing);
31 | float y=getHeight() / 2;
32 | for (int i = 0; i < 3; i++) {
33 | canvas.save();
34 | float translateX=x+(radius*2)*i+circleSpacing*i;
35 | canvas.translate(translateX, y);
36 | canvas.scale(scaleFloats[i], scaleFloats[i]);
37 | paint.setAlpha(alphas[i]);
38 | canvas.drawCircle(0, 0, radius, paint);
39 | canvas.restore();
40 | }
41 | }
42 |
43 | @Override
44 | public ArrayList onCreateAnimators() {
45 | ArrayList animators=new ArrayList<>();
46 | int[] delays=new int[]{350,0,350};
47 | for (int i = 0; i < 3; i++) {
48 | final int index=i;
49 | ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.75f,1);
50 | scaleAnim.setDuration(700);
51 | scaleAnim.setRepeatCount(-1);
52 | scaleAnim.setStartDelay(delays[i]);
53 | addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() {
54 | @Override
55 | public void onAnimationUpdate(ValueAnimator animation) {
56 | scaleFloats[index] = (float) animation.getAnimatedValue();
57 | postInvalidate();
58 | }
59 | });
60 |
61 | ValueAnimator alphaAnim=ValueAnimator.ofInt(255,51,255);
62 | alphaAnim.setDuration(700);
63 | alphaAnim.setRepeatCount(-1);
64 | alphaAnim.setStartDelay(delays[i]);
65 | addUpdateListener(alphaAnim,new ValueAnimator.AnimatorUpdateListener() {
66 | @Override
67 | public void onAnimationUpdate(ValueAnimator animation) {
68 | alphas[index] = (int) animation.getAnimatedValue();
69 | postInvalidate();
70 | }
71 | });
72 | animators.add(scaleAnim);
73 | animators.add(alphaAnim);
74 | }
75 | return animators;
76 | }
77 |
78 |
79 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/BallClipRotateIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import android.graphics.RectF;
7 | import com.gjson.androidtools.commonview.loadingview.Indicator;
8 | import java.util.ArrayList;
9 |
10 | /**
11 | * @Author Created by gjson on 2018/12/29.
12 | */
13 | public class BallClipRotateIndicator extends Indicator {
14 |
15 | float scaleFloat=1,degrees;
16 |
17 | @Override
18 | public void draw(Canvas canvas, Paint paint) {
19 | paint.setStyle(Paint.Style.STROKE);
20 | paint.setStrokeWidth(3);
21 |
22 | float circleSpacing=12;
23 | float x = (getWidth()) / 2;
24 | float y=(getHeight()) / 2;
25 | canvas.translate(x, y);
26 | canvas.scale(scaleFloat, scaleFloat);
27 | canvas.rotate(degrees);
28 | RectF rectF=new RectF(-x+circleSpacing,-y+circleSpacing,0+x-circleSpacing,0+y-circleSpacing);
29 | canvas.drawArc(rectF, -45, 270, false, paint);
30 | }
31 |
32 | @Override
33 | public ArrayList onCreateAnimators() {
34 | ArrayList animators=new ArrayList<>();
35 | ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.6f,0.5f,1);
36 | scaleAnim.setDuration(750);
37 | scaleAnim.setRepeatCount(-1);
38 | addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() {
39 | @Override
40 | public void onAnimationUpdate(ValueAnimator animation) {
41 | scaleFloat = (float) animation.getAnimatedValue();
42 | postInvalidate();
43 | }
44 | });
45 | ValueAnimator rotateAnim=ValueAnimator.ofFloat(0,180,360);
46 | rotateAnim.setDuration(750);
47 | rotateAnim.setRepeatCount(-1);
48 | addUpdateListener(rotateAnim,new ValueAnimator.AnimatorUpdateListener() {
49 | @Override
50 | public void onAnimationUpdate(ValueAnimator animation) {
51 | degrees = (float) animation.getAnimatedValue();
52 | postInvalidate();
53 | }
54 | });
55 | animators.add(scaleAnim);
56 | animators.add(rotateAnim);
57 | return animators;
58 | }
59 |
60 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/BallClipRotateMultipleIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import android.graphics.RectF;
7 | import com.gjson.androidtools.commonview.loadingview.Indicator;
8 | import java.util.ArrayList;
9 |
10 | /**
11 | * @Author Created by gjson on 2018/12/29.
12 | */
13 | public class BallClipRotateMultipleIndicator extends Indicator {
14 |
15 | float scaleFloat=1,degrees;
16 |
17 |
18 | @Override
19 | public void draw(Canvas canvas, Paint paint) {
20 | paint.setStrokeWidth(3);
21 | paint.setStyle(Paint.Style.STROKE);
22 |
23 | float circleSpacing=12;
24 | float x=getWidth()/2;
25 | float y=getHeight()/2;
26 |
27 | canvas.save();
28 |
29 | canvas.translate(x, y);
30 | canvas.scale(scaleFloat, scaleFloat);
31 | canvas.rotate(degrees);
32 |
33 | //draw two big arc
34 | float[] bStartAngles=new float[]{135,-45};
35 | for (int i = 0; i < 2; i++) {
36 | RectF rectF=new RectF(-x+circleSpacing,-y+circleSpacing,x-circleSpacing,y-circleSpacing);
37 | canvas.drawArc(rectF, bStartAngles[i], 90, false, paint);
38 | }
39 |
40 | canvas.restore();
41 | canvas.translate(x, y);
42 | canvas.scale(scaleFloat, scaleFloat);
43 | canvas.rotate(-degrees);
44 | //draw two small arc
45 | float[] sStartAngles=new float[]{225,45};
46 | for (int i = 0; i < 2; i++) {
47 | RectF rectF=new RectF(-x/1.8f+circleSpacing,-y/1.8f+circleSpacing,x/1.8f-circleSpacing,y/1.8f-circleSpacing);
48 | canvas.drawArc(rectF, sStartAngles[i], 90, false, paint);
49 | }
50 | }
51 |
52 | @Override
53 | public ArrayList onCreateAnimators() {
54 | ArrayList animators=new ArrayList<>();
55 | ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.6f,1);
56 | scaleAnim.setDuration(1000);
57 | scaleAnim.setRepeatCount(-1);
58 | addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() {
59 | @Override
60 | public void onAnimationUpdate(ValueAnimator animation) {
61 | scaleFloat = (float) animation.getAnimatedValue();
62 | postInvalidate();
63 | }
64 | });
65 |
66 | ValueAnimator rotateAnim=ValueAnimator.ofFloat(0, 180,360);
67 | rotateAnim.setDuration(1000);
68 | rotateAnim.setRepeatCount(-1);
69 | addUpdateListener(rotateAnim,new ValueAnimator.AnimatorUpdateListener() {
70 | @Override
71 | public void onAnimationUpdate(ValueAnimator animation) {
72 | degrees = (float) animation.getAnimatedValue();
73 | postInvalidate();
74 | }
75 | });
76 | animators.add(scaleAnim);
77 | animators.add(rotateAnim);
78 | return animators;
79 | }
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/BallClipRotatePulseIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import android.graphics.RectF;
7 | import com.gjson.androidtools.commonview.loadingview.Indicator;
8 | import java.util.ArrayList;
9 |
10 | /**
11 | * @Author Created by gjson on 2018/12/29.
12 | */
13 | public class BallClipRotatePulseIndicator extends Indicator {
14 |
15 | float scaleFloat1,scaleFloat2,degrees;
16 |
17 |
18 | @Override
19 | public void draw(Canvas canvas, Paint paint) {
20 | float circleSpacing=12;
21 | float x=getWidth()/2;
22 | float y=getHeight()/2;
23 |
24 | //draw fill circle
25 | canvas.save();
26 | canvas.translate(x, y);
27 | canvas.scale(scaleFloat1, scaleFloat1);
28 | paint.setStyle(Paint.Style.FILL);
29 | canvas.drawCircle(0, 0, x / 2.5f, paint);
30 |
31 | canvas.restore();
32 |
33 | canvas.translate(x, y);
34 | canvas.scale(scaleFloat2, scaleFloat2);
35 | canvas.rotate(degrees);
36 |
37 | paint.setStrokeWidth(3);
38 | paint.setStyle(Paint.Style.STROKE);
39 |
40 | //draw two arc
41 | float[] startAngles=new float[]{225,45};
42 | for (int i = 0; i < 2; i++) {
43 | RectF rectF=new RectF(-x+circleSpacing,-y+circleSpacing,x-circleSpacing,y-circleSpacing);
44 | canvas.drawArc(rectF, startAngles[i], 90, false, paint);
45 | }
46 | }
47 |
48 | @Override
49 | public ArrayList onCreateAnimators() {
50 | ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.3f,1);
51 | scaleAnim.setDuration(1000);
52 | scaleAnim.setRepeatCount(-1);
53 | addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() {
54 | @Override
55 | public void onAnimationUpdate(ValueAnimator animation) {
56 | scaleFloat1 = (float) animation.getAnimatedValue();
57 | postInvalidate();
58 | }
59 | });
60 |
61 | ValueAnimator scaleAnim2=ValueAnimator.ofFloat(1,0.6f,1);
62 | scaleAnim2.setDuration(1000);
63 | scaleAnim2.setRepeatCount(-1);
64 | addUpdateListener(scaleAnim2,new ValueAnimator.AnimatorUpdateListener() {
65 | @Override
66 | public void onAnimationUpdate(ValueAnimator animation) {
67 | scaleFloat2 = (float) animation.getAnimatedValue();
68 | postInvalidate();
69 | }
70 | });
71 |
72 | ValueAnimator rotateAnim=ValueAnimator.ofFloat(0, 180,360);
73 | rotateAnim.setDuration(1000);
74 | rotateAnim.setRepeatCount(-1);
75 | addUpdateListener(rotateAnim,new ValueAnimator.AnimatorUpdateListener() {
76 | @Override
77 | public void onAnimationUpdate(ValueAnimator animation) {
78 | degrees = (float) animation.getAnimatedValue();
79 | postInvalidate();
80 | }
81 | });
82 | ArrayList animators=new ArrayList<>();
83 | animators.add(scaleAnim);
84 | animators.add(scaleAnim2);
85 | animators.add(rotateAnim);
86 | return animators;
87 | }
88 |
89 |
90 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/BallGridBeatIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import com.gjson.androidtools.commonview.loadingview.Indicator;
7 | import java.util.ArrayList;
8 |
9 | /**
10 | * @Author Created by gjson on 2018/12/29.
11 | */
12 | public class BallGridBeatIndicator extends Indicator {
13 |
14 | public static final int ALPHA=255;
15 |
16 | int[] alphas=new int[]{ALPHA,
17 | ALPHA,
18 | ALPHA,
19 | ALPHA,
20 | ALPHA,
21 | ALPHA,
22 | ALPHA,
23 | ALPHA,
24 | ALPHA};
25 |
26 | @Override
27 | public void draw(Canvas canvas, Paint paint) {
28 | float circleSpacing=4;
29 | float radius=(getWidth()-circleSpacing*4)/6;
30 | float x = getWidth()/ 2-(radius*2+circleSpacing);
31 | float y = getWidth()/ 2-(radius*2+circleSpacing);
32 |
33 | for (int i = 0; i < 3; i++) {
34 | for (int j = 0; j < 3; j++) {
35 | canvas.save();
36 | float translateX=x+(radius*2)*j+circleSpacing*j;
37 | float translateY=y+(radius*2)*i+circleSpacing*i;
38 | canvas.translate(translateX, translateY);
39 | paint.setAlpha(alphas[3 * i + j]);
40 | canvas.drawCircle(0, 0, radius, paint);
41 | canvas.restore();
42 | }
43 | }
44 | }
45 |
46 | @Override
47 | public ArrayList onCreateAnimators() {
48 | ArrayList animators=new ArrayList<>();
49 |
50 | int[] durations={960, 930, 1190, 1130, 1340, 940, 1200, 820, 1190};
51 | int[] delays= {360, 400, 680, 410, 710, -150, -120, 10, 320};
52 |
53 | for (int i = 0; i < 9; i++) {
54 | final int index=i;
55 | ValueAnimator alphaAnim=ValueAnimator.ofInt(255, 168,255);
56 | alphaAnim.setDuration(durations[i]);
57 | alphaAnim.setRepeatCount(-1);
58 | alphaAnim.setStartDelay(delays[i]);
59 | addUpdateListener(alphaAnim,new ValueAnimator.AnimatorUpdateListener() {
60 | @Override
61 | public void onAnimationUpdate(ValueAnimator animation) {
62 | alphas[index] = (int) animation.getAnimatedValue();
63 | postInvalidate();
64 | }
65 | });
66 | animators.add(alphaAnim);
67 | }
68 | return animators;
69 | }
70 |
71 |
72 |
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/BallPulseIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import com.gjson.androidtools.commonview.loadingview.Indicator;
7 | import java.util.ArrayList;
8 |
9 | /**
10 | * Created by GJSON on 2015/10/16.
11 | */
12 | public class BallPulseIndicator extends Indicator {
13 |
14 | public static final float SCALE=1.0f;
15 |
16 | //scale x ,y
17 | private float[] scaleFloats=new float[]{SCALE,
18 | SCALE,
19 | SCALE};
20 |
21 |
22 |
23 | @Override
24 | public void draw(Canvas canvas, Paint paint) {
25 | float circleSpacing=4;
26 | float radius=(Math.min(getWidth(),getHeight())-circleSpacing*2)/6;
27 | float x = getWidth()/ 2-(radius*2+circleSpacing);
28 | float y=getHeight() / 2;
29 | for (int i = 0; i < 3; i++) {
30 | canvas.save();
31 | float translateX=x+(radius*2)*i+circleSpacing*i;
32 | canvas.translate(translateX, y);
33 | canvas.scale(scaleFloats[i], scaleFloats[i]);
34 | canvas.drawCircle(0, 0, radius, paint);
35 | canvas.restore();
36 | }
37 | }
38 |
39 | @Override
40 | public ArrayList onCreateAnimators() {
41 | ArrayList animators=new ArrayList<>();
42 | int[] delays=new int[]{120,240,360};
43 | for (int i = 0; i < 3; i++) {
44 | final int index=i;
45 |
46 | ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.3f,1);
47 |
48 | scaleAnim.setDuration(750);
49 | scaleAnim.setRepeatCount(-1);
50 | scaleAnim.setStartDelay(delays[i]);
51 |
52 | addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() {
53 | @Override
54 | public void onAnimationUpdate(ValueAnimator animation) {
55 | scaleFloats[index] = (float) animation.getAnimatedValue();
56 | postInvalidate();
57 | }
58 | });
59 | animators.add(scaleAnim);
60 | }
61 | return animators;
62 | }
63 |
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/BallPulseRiseIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Camera;
5 | import android.graphics.Canvas;
6 | import android.graphics.Matrix;
7 | import android.graphics.Paint;
8 | import android.view.animation.LinearInterpolator;
9 | import com.gjson.androidtools.commonview.loadingview.Indicator;
10 | import java.util.ArrayList;
11 |
12 | /**
13 | * Created by GJSON on 2015/10/17.
14 | */
15 | public class BallPulseRiseIndicator extends Indicator {
16 |
17 | private Camera mCamera;
18 | private Matrix mMatrix;
19 |
20 | private float degress;
21 |
22 | public BallPulseRiseIndicator(){
23 | mCamera=new Camera();
24 | mMatrix=new Matrix();
25 | }
26 |
27 | @Override
28 | public void draw(Canvas canvas, Paint paint) {
29 |
30 | mMatrix.reset();
31 | mCamera.save();
32 | mCamera.rotateX(degress);
33 | mCamera.getMatrix(mMatrix);
34 | mCamera.restore();
35 |
36 | mMatrix.preTranslate(-centerX(), -centerY());
37 | mMatrix.postTranslate(centerX(), centerY());
38 | canvas.concat(mMatrix);
39 |
40 | float radius=getWidth()/10;
41 | canvas.drawCircle(getWidth()/4,radius*2,radius,paint);
42 | canvas.drawCircle(getWidth()*3/4,radius*2,radius,paint);
43 |
44 | canvas.drawCircle(radius,getHeight()-2*radius,radius,paint);
45 | canvas.drawCircle(getWidth()/2,getHeight()-2*radius,radius,paint);
46 | canvas.drawCircle(getWidth()-radius,getHeight()-2*radius,radius,paint);
47 | }
48 |
49 | @Override
50 | public ArrayList onCreateAnimators() {
51 | ArrayList animators=new ArrayList<>();
52 | ValueAnimator animator=ValueAnimator.ofFloat(0,360);
53 | addUpdateListener(animator,new ValueAnimator.AnimatorUpdateListener() {
54 | @Override
55 | public void onAnimationUpdate(ValueAnimator animation) {
56 | degress = (float) animation.getAnimatedValue();
57 | postInvalidate();
58 | }
59 | });
60 | animator.setInterpolator(new LinearInterpolator());
61 | animator.setRepeatCount(-1);
62 | animator.setDuration(1500);
63 | animators.add(animator);
64 | return animators;
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/BallPulseSyncIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import com.gjson.androidtools.commonview.loadingview.Indicator;
7 | import java.util.ArrayList;
8 |
9 | /**
10 | * Created by GJSON on 2015/10/19.
11 | */
12 | public class BallPulseSyncIndicator extends Indicator {
13 |
14 | float[] translateYFloats=new float[3];
15 |
16 | @Override
17 | public void draw(Canvas canvas, Paint paint) {
18 | float circleSpacing=4;
19 | float radius=(getWidth()-circleSpacing*2)/6;
20 | float x = getWidth()/ 2-(radius*2+circleSpacing);
21 | for (int i = 0; i < 3; i++) {
22 | canvas.save();
23 | float translateX=x+(radius*2)*i+circleSpacing*i;
24 | canvas.translate(translateX, translateYFloats[i]);
25 | canvas.drawCircle(0, 0, radius, paint);
26 | canvas.restore();
27 | }
28 | }
29 |
30 | @Override
31 | public ArrayList onCreateAnimators() {
32 | ArrayList animators=new ArrayList<>();
33 | float circleSpacing=4;
34 | float radius=(getWidth()-circleSpacing*2)/6;
35 | int[] delays=new int[]{70,140,210};
36 | for (int i = 0; i < 3; i++) {
37 | final int index=i;
38 | ValueAnimator scaleAnim=ValueAnimator.ofFloat(getHeight()/2,getHeight()/2-radius*2,getHeight()/2);
39 | scaleAnim.setDuration(600);
40 | scaleAnim.setRepeatCount(-1);
41 | scaleAnim.setStartDelay(delays[i]);
42 | addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() {
43 | @Override
44 | public void onAnimationUpdate(ValueAnimator animation) {
45 | translateYFloats[index] = (float) animation.getAnimatedValue();
46 | postInvalidate();
47 | }
48 | });
49 | animators.add(scaleAnim);
50 | }
51 | return animators;
52 | }
53 |
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/BallRotateIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Canvas;
5 | import android.graphics.Matrix;
6 | import android.graphics.Paint;
7 | import com.gjson.androidtools.commonview.loadingview.Indicator;
8 | import java.util.ArrayList;
9 |
10 | /**
11 | * Created by GJSON on 2015/10/17.
12 | */
13 | public class BallRotateIndicator extends Indicator {
14 |
15 | float scaleFloat=0.5f;
16 |
17 | float degress;
18 |
19 | private Matrix mMatrix;
20 |
21 | public BallRotateIndicator(){
22 | mMatrix=new Matrix();
23 | }
24 |
25 | @Override
26 | public void draw(Canvas canvas, Paint paint) {
27 | float radius=getWidth()/10;
28 | float x = getWidth()/ 2;
29 | float y=getHeight()/2;
30 |
31 | /*mMatrix.preTranslate(-centerX(), -centerY());
32 | mMatrix.preRotate(degress,centerX(),centerY());
33 | mMatrix.postTranslate(centerX(), centerY());
34 | canvas.concat(mMatrix);*/
35 |
36 | canvas.rotate(degress,centerX(),centerY());
37 |
38 | canvas.save();
39 | canvas.translate(x - radius * 2 - radius, y);
40 | canvas.scale(scaleFloat, scaleFloat);
41 | canvas.drawCircle(0, 0, radius, paint);
42 | canvas.restore();
43 |
44 | canvas.save();
45 | canvas.translate(x, y);
46 | canvas.scale(scaleFloat, scaleFloat);
47 | canvas.drawCircle(0, 0, radius, paint);
48 | canvas.restore();
49 |
50 | canvas.save();
51 | canvas.translate(x + radius * 2 + radius, y);
52 | canvas.scale(scaleFloat, scaleFloat);
53 | canvas.drawCircle(0,0,radius, paint);
54 | canvas.restore();
55 | }
56 |
57 | @Override
58 | public ArrayList onCreateAnimators() {
59 | ArrayList animators=new ArrayList<>();
60 | ValueAnimator scaleAnim=ValueAnimator.ofFloat(0.5f,1,0.5f);
61 | scaleAnim.setDuration(1000);
62 | scaleAnim.setRepeatCount(-1);
63 | addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() {
64 | @Override
65 | public void onAnimationUpdate(ValueAnimator animation) {
66 | scaleFloat = (float) animation.getAnimatedValue();
67 | postInvalidate();
68 | }
69 | });
70 |
71 | ValueAnimator rotateAnim=ValueAnimator.ofFloat(0,180,360);
72 | addUpdateListener(rotateAnim,new ValueAnimator.AnimatorUpdateListener() {
73 | @Override
74 | public void onAnimationUpdate(ValueAnimator animation) {
75 | degress = (float) animation.getAnimatedValue();
76 | postInvalidate();
77 | }
78 | });
79 | rotateAnim.setDuration(1000);
80 | rotateAnim.setRepeatCount(-1);
81 |
82 | animators.add(scaleAnim);
83 | animators.add(rotateAnim);
84 | return animators;
85 | }
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/BallScaleIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import android.view.animation.LinearInterpolator;
7 | import com.gjson.androidtools.commonview.loadingview.Indicator;
8 | import java.util.ArrayList;
9 |
10 | /**
11 | * Created by GJSON on 2015/10/19.
12 | */
13 | public class BallScaleIndicator extends Indicator {
14 |
15 | float scale=1;
16 | int alpha=255;
17 |
18 | @Override
19 | public void draw(Canvas canvas, Paint paint) {
20 | float circleSpacing=4;
21 | paint.setAlpha(alpha);
22 | canvas.scale(scale,scale,getWidth()/2,getHeight()/2);
23 | paint.setAlpha(alpha);
24 | canvas.drawCircle(getWidth()/2,getHeight()/2,getWidth()/2-circleSpacing,paint);
25 | }
26 |
27 | @Override
28 | public ArrayList onCreateAnimators() {
29 | ArrayList animators=new ArrayList<>();
30 | ValueAnimator scaleAnim=ValueAnimator.ofFloat(0,1);
31 | scaleAnim.setInterpolator(new LinearInterpolator());
32 | scaleAnim.setDuration(1000);
33 | scaleAnim.setRepeatCount(-1);
34 | addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() {
35 | @Override
36 | public void onAnimationUpdate(ValueAnimator animation) {
37 | scale = (float) animation.getAnimatedValue();
38 | postInvalidate();
39 | }
40 | });
41 |
42 | ValueAnimator alphaAnim=ValueAnimator.ofInt(255, 0);
43 | alphaAnim.setInterpolator(new LinearInterpolator());
44 | alphaAnim.setDuration(1000);
45 | alphaAnim.setRepeatCount(-1);
46 | addUpdateListener(alphaAnim,new ValueAnimator.AnimatorUpdateListener() {
47 | @Override
48 | public void onAnimationUpdate(ValueAnimator animation) {
49 | alpha = (int) animation.getAnimatedValue();
50 | postInvalidate();
51 | }
52 | });
53 | animators.add(scaleAnim);
54 | animators.add(alphaAnim);
55 | return animators;
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/BallScaleMultipleIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import android.view.animation.LinearInterpolator;
7 | import com.gjson.androidtools.commonview.loadingview.Indicator;
8 | import java.util.ArrayList;
9 |
10 | /**
11 | * Created by GJSON on 2015/10/19.
12 | */
13 | public class BallScaleMultipleIndicator extends Indicator {
14 |
15 | float[] scaleFloats=new float[]{1,1,1};
16 | int[] alphaInts=new int[]{255,255,255};
17 |
18 | @Override
19 | public void draw(Canvas canvas, Paint paint) {
20 | float circleSpacing=4;
21 | for (int i = 0; i < 3; i++) {
22 | paint.setAlpha(alphaInts[i]);
23 | canvas.scale(scaleFloats[i],scaleFloats[i],getWidth()/2,getHeight()/2);
24 | canvas.drawCircle(getWidth()/2,getHeight()/2,getWidth()/2-circleSpacing,paint);
25 | }
26 | }
27 |
28 | @Override
29 | public ArrayList onCreateAnimators() {
30 | ArrayList animators=new ArrayList<>();
31 | long[] delays=new long[]{0, 200, 400};
32 | for (int i = 0; i < 3; i++) {
33 | final int index=i;
34 | ValueAnimator scaleAnim=ValueAnimator.ofFloat(0,1);
35 | scaleAnim.setInterpolator(new LinearInterpolator());
36 | scaleAnim.setDuration(1000);
37 | scaleAnim.setRepeatCount(-1);
38 | addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() {
39 | @Override
40 | public void onAnimationUpdate(ValueAnimator animation) {
41 | scaleFloats[index] = (float) animation.getAnimatedValue();
42 | postInvalidate();
43 | }
44 | });
45 | scaleAnim.setStartDelay(delays[i]);
46 |
47 | ValueAnimator alphaAnim=ValueAnimator.ofInt(255,0);
48 | alphaAnim.setInterpolator(new LinearInterpolator());
49 | alphaAnim.setDuration(1000);
50 | alphaAnim.setRepeatCount(-1);
51 | addUpdateListener(alphaAnim,new ValueAnimator.AnimatorUpdateListener() {
52 | @Override
53 | public void onAnimationUpdate(ValueAnimator animation) {
54 | alphaInts[index] = (int) animation.getAnimatedValue();
55 | postInvalidate();
56 | }
57 | });
58 | scaleAnim.setStartDelay(delays[i]);
59 |
60 | animators.add(scaleAnim);
61 | animators.add(alphaAnim);
62 | }
63 | return animators;
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/BallScaleRippleIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import android.view.animation.LinearInterpolator;
7 | import java.util.ArrayList;
8 |
9 | /**
10 | * Created by GJSON on 2015/10/19.
11 | */
12 | public class BallScaleRippleIndicator extends BallScaleIndicator {
13 |
14 |
15 | @Override
16 | public void draw(Canvas canvas, Paint paint) {
17 | paint.setStyle(Paint.Style.STROKE);
18 | paint.setStrokeWidth(3);
19 | super.draw(canvas, paint);
20 | }
21 |
22 | @Override
23 | public ArrayList onCreateAnimators() {
24 | ArrayList animators=new ArrayList<>();
25 | ValueAnimator scaleAnim=ValueAnimator.ofFloat(0,1);
26 | scaleAnim.setInterpolator(new LinearInterpolator());
27 | scaleAnim.setDuration(1000);
28 | scaleAnim.setRepeatCount(-1);
29 | addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() {
30 | @Override
31 | public void onAnimationUpdate(ValueAnimator animation) {
32 | scale = (float) animation.getAnimatedValue();
33 | postInvalidate();
34 | }
35 | });
36 |
37 | ValueAnimator alphaAnim=ValueAnimator.ofInt(0, 255);
38 | alphaAnim.setInterpolator(new LinearInterpolator());
39 | alphaAnim.setDuration(1000);
40 | alphaAnim.setRepeatCount(-1);
41 | addUpdateListener(alphaAnim,new ValueAnimator.AnimatorUpdateListener() {
42 | @Override
43 | public void onAnimationUpdate(ValueAnimator animation) {
44 | alpha = (int) animation.getAnimatedValue();
45 | postInvalidate();
46 | }
47 | });
48 |
49 | animators.add(scaleAnim);
50 | animators.add(alphaAnim);
51 | return animators;
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/BallScaleRippleMultipleIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import android.view.animation.LinearInterpolator;
7 | import java.util.ArrayList;
8 |
9 | /**
10 | * Created by GJSON on 2015/10/19.
11 | */
12 | public class BallScaleRippleMultipleIndicator extends BallScaleMultipleIndicator {
13 |
14 |
15 | @Override
16 | public void draw(Canvas canvas, Paint paint) {
17 | paint.setStyle(Paint.Style.STROKE);
18 | paint.setStrokeWidth(3);
19 | super.draw(canvas, paint);
20 | }
21 |
22 | @Override
23 | public ArrayList onCreateAnimators() {
24 | ArrayList animators=new ArrayList<>();
25 | long[] delays=new long[]{0, 200, 400};
26 | for (int i = 0; i < 3; i++) {
27 | final int index=i;
28 | ValueAnimator scaleAnim=ValueAnimator.ofFloat(0,1);
29 | scaleAnim.setInterpolator(new LinearInterpolator());
30 | scaleAnim.setDuration(1000);
31 | scaleAnim.setRepeatCount(-1);
32 | addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() {
33 | @Override
34 | public void onAnimationUpdate(ValueAnimator animation) {
35 | scaleFloats[index] = (float) animation.getAnimatedValue();
36 | postInvalidate();
37 | }
38 | });
39 | scaleAnim.setStartDelay(delays[i]);
40 |
41 | ValueAnimator alphaAnim=ValueAnimator.ofInt(0,255);
42 | scaleAnim.setInterpolator(new LinearInterpolator());
43 | alphaAnim.setDuration(1000);
44 | alphaAnim.setRepeatCount(-1);
45 | addUpdateListener(alphaAnim,new ValueAnimator.AnimatorUpdateListener() {
46 | @Override
47 | public void onAnimationUpdate(ValueAnimator animation) {
48 | alphaInts[index] = (int) animation.getAnimatedValue();
49 | postInvalidate();
50 | }
51 | });
52 | scaleAnim.setStartDelay(delays[i]);
53 |
54 | animators.add(scaleAnim);
55 | animators.add(alphaAnim);
56 | }
57 | return animators;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/BallZigZagDeflectIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.view.animation.LinearInterpolator;
5 | import java.util.ArrayList;
6 |
7 | /**
8 | * Created by GJSON on 2015/10/19.
9 | */
10 | public class BallZigZagDeflectIndicator extends BallZigZagIndicator {
11 |
12 | @Override public ArrayList onCreateAnimators() {
13 | ArrayList animators = new ArrayList<>();
14 | float startX = getWidth() / 6;
15 | float startY = getWidth() / 6;
16 | for (int i = 0; i < 2; i++) {
17 | final int index = i;
18 | ValueAnimator translateXAnim =
19 | ValueAnimator.ofFloat(startX, getWidth() - startX, startX, getWidth() - startX, startX);
20 | if (i == 1) {
21 | translateXAnim =
22 | ValueAnimator.ofFloat(getWidth() - startX, startX, getWidth() - startX, startX,
23 | getWidth() - startX);
24 | }
25 | ValueAnimator translateYAnim =
26 | ValueAnimator.ofFloat(startY, startY, getHeight() - startY, getHeight() - startY, startY);
27 | if (i == 1) {
28 | translateYAnim =
29 | ValueAnimator.ofFloat(getHeight() - startY, getHeight() - startY, startY, startY,
30 | getHeight() - startY);
31 | }
32 |
33 | translateXAnim.setDuration(2000);
34 | translateXAnim.setInterpolator(new LinearInterpolator());
35 | translateXAnim.setRepeatCount(-1);
36 | addUpdateListener(translateXAnim, new ValueAnimator.AnimatorUpdateListener() {
37 | @Override public void onAnimationUpdate(ValueAnimator animation) {
38 | translateX[index] = (float) animation.getAnimatedValue();
39 | postInvalidate();
40 | }
41 | });
42 |
43 | translateYAnim.setDuration(2000);
44 | translateYAnim.setInterpolator(new LinearInterpolator());
45 | translateYAnim.setRepeatCount(-1);
46 | addUpdateListener(translateYAnim, new ValueAnimator.AnimatorUpdateListener() {
47 | @Override public void onAnimationUpdate(ValueAnimator animation) {
48 | translateY[index] = (float) animation.getAnimatedValue();
49 | postInvalidate();
50 | }
51 | });
52 |
53 | animators.add(translateXAnim);
54 | animators.add(translateYAnim);
55 | }
56 | return animators;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/BallZigZagIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import android.view.animation.LinearInterpolator;
7 | import com.gjson.androidtools.commonview.loadingview.Indicator;
8 | import java.util.ArrayList;
9 |
10 | /**
11 | * Created by GJSON on 2015/10/19.
12 | */
13 | public class BallZigZagIndicator extends Indicator {
14 |
15 | float[] translateX=new float[2],translateY=new float[2];
16 |
17 |
18 | @Override
19 | public void draw(Canvas canvas, Paint paint) {
20 | for (int i = 0; i < 2; i++) {
21 | canvas.save();
22 | canvas.translate(translateX[i], translateY[i]);
23 | canvas.drawCircle(0, 0, getWidth() / 10, paint);
24 | canvas.restore();
25 | }
26 | }
27 |
28 | @Override
29 | public ArrayList onCreateAnimators() {
30 | ArrayList animators=new ArrayList<>();
31 | float startX=getWidth()/6;
32 | float startY=getWidth()/6;
33 | for (int i = 0; i < 2; i++) {
34 | final int index=i;
35 | ValueAnimator translateXAnim=ValueAnimator.ofFloat(startX,getWidth()-startX,getWidth()/2,startX);
36 | if (i==1){
37 | translateXAnim=ValueAnimator.ofFloat(getWidth()-startX,startX,getWidth()/2,getWidth()-startX);
38 | }
39 | ValueAnimator translateYAnim=ValueAnimator.ofFloat(startY,startY,getHeight()/2,startY);
40 | if (i==1){
41 | translateYAnim=ValueAnimator.ofFloat(getHeight()-startY,getHeight()-startY,getHeight()/2,getHeight()-startY);
42 | }
43 |
44 | translateXAnim.setDuration(1000);
45 | translateXAnim.setInterpolator(new LinearInterpolator());
46 | translateXAnim.setRepeatCount(-1);
47 | addUpdateListener(translateXAnim,new ValueAnimator.AnimatorUpdateListener() {
48 | @Override
49 | public void onAnimationUpdate(ValueAnimator animation) {
50 | translateX[index] = (float) animation.getAnimatedValue();
51 | postInvalidate();
52 | }
53 | });
54 |
55 | translateYAnim.setDuration(1000);
56 | translateYAnim.setInterpolator(new LinearInterpolator());
57 | translateYAnim.setRepeatCount(-1);
58 | addUpdateListener(translateYAnim,new ValueAnimator.AnimatorUpdateListener() {
59 | @Override
60 | public void onAnimationUpdate(ValueAnimator animation) {
61 | translateY[index] = (float) animation.getAnimatedValue();
62 | postInvalidate();
63 | }
64 | });
65 | animators.add(translateXAnim);
66 | animators.add(translateYAnim);
67 | }
68 | return animators;
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/LineScaleIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import android.graphics.RectF;
7 | import com.gjson.androidtools.commonview.loadingview.Indicator;
8 | import java.util.ArrayList;
9 |
10 | /**
11 | * Created by GJSON on 2015/10/19.
12 | */
13 | public class LineScaleIndicator extends Indicator {
14 |
15 | public static final float SCALE=1.0f;
16 |
17 | float[] scaleYFloats=new float[]{SCALE,
18 | SCALE,
19 | SCALE,
20 | SCALE,
21 | SCALE,};
22 |
23 | @Override
24 | public void draw(Canvas canvas, Paint paint) {
25 | float translateX=getWidth()/11;
26 | float translateY=getHeight()/2;
27 | for (int i = 0; i < 5; i++) {
28 | canvas.save();
29 | canvas.translate((2 + i * 2) * translateX - translateX / 2, translateY);
30 | canvas.scale(SCALE, scaleYFloats[i]);
31 | RectF rectF=new RectF(-translateX/2,-getHeight()/2.5f,translateX/2,getHeight()/2.5f);
32 | canvas.drawRoundRect(rectF, 5, 5, paint);
33 | canvas.restore();
34 | }
35 | }
36 |
37 | @Override
38 | public ArrayList onCreateAnimators() {
39 | ArrayList animators=new ArrayList<>();
40 | long[] delays=new long[]{100,200,300,400,500};
41 | for (int i = 0; i < 5; i++) {
42 | final int index=i;
43 | ValueAnimator scaleAnim=ValueAnimator.ofFloat(1, 0.4f, 1);
44 | scaleAnim.setDuration(1000);
45 | scaleAnim.setRepeatCount(-1);
46 | scaleAnim.setStartDelay(delays[i]);
47 | addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() {
48 | @Override
49 | public void onAnimationUpdate(ValueAnimator animation) {
50 | scaleYFloats[index] = (float) animation.getAnimatedValue();
51 | postInvalidate();
52 | }
53 | });
54 | animators.add(scaleAnim);
55 | }
56 | return animators;
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/LineScalePartyIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import android.graphics.RectF;
7 | import com.gjson.androidtools.commonview.loadingview.Indicator;
8 | import java.util.ArrayList;
9 |
10 | /**
11 | * Created by GJSON on 2015/10/19.
12 | */
13 | public class LineScalePartyIndicator extends Indicator {
14 |
15 | public static final float SCALE=1.0f;
16 |
17 | float[] scaleFloats=new float[]{SCALE,
18 | SCALE,
19 | SCALE,
20 | SCALE,
21 | SCALE,};
22 |
23 | @Override
24 | public void draw(Canvas canvas, Paint paint) {
25 | float translateX=getWidth()/9;
26 | float translateY=getHeight()/2;
27 | for (int i = 0; i < 4; i++) {
28 | canvas.save();
29 | canvas.translate((2 + i * 2) * translateX - translateX / 2, translateY);
30 | canvas.scale(scaleFloats[i], scaleFloats[i]);
31 | RectF rectF=new RectF(-translateX/2,-getHeight()/2.5f,translateX/2,getHeight()/2.5f);
32 | canvas.drawRoundRect(rectF,5,5,paint);
33 | canvas.restore();
34 | }
35 | }
36 |
37 |
38 | @Override
39 | public ArrayList onCreateAnimators() {
40 | ArrayList animators=new ArrayList<>();
41 | long[] durations=new long[]{1260, 430, 1010, 730};
42 | long[] delays=new long[]{770, 290, 280, 740};
43 | for (int i = 0; i < 4; i++) {
44 | final int index=i;
45 | ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.4f,1);
46 | scaleAnim.setDuration(durations[i]);
47 | scaleAnim.setRepeatCount(-1);
48 | scaleAnim.setStartDelay(delays[i]);
49 | addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() {
50 | @Override
51 | public void onAnimationUpdate(ValueAnimator animation) {
52 | scaleFloats[index] = (float) animation.getAnimatedValue();
53 | postInvalidate();
54 | }
55 | });
56 | animators.add(scaleAnim);
57 | }
58 | return animators;
59 | }
60 |
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/LineScalePulseOutIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import java.util.ArrayList;
5 |
6 | /**
7 | * Created by GJSON on 2015/10/19.
8 | */
9 | public class LineScalePulseOutIndicator extends LineScaleIndicator {
10 |
11 | @Override
12 | public ArrayList onCreateAnimators() {
13 | ArrayList animators=new ArrayList<>();
14 | long[] delays=new long[]{500,250,0,250,500};
15 | for (int i = 0; i < 5; i++) {
16 | final int index=i;
17 | ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.3f,1);
18 | scaleAnim.setDuration(900);
19 | scaleAnim.setRepeatCount(-1);
20 | scaleAnim.setStartDelay(delays[i]);
21 | addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() {
22 | @Override
23 | public void onAnimationUpdate(ValueAnimator animation) {
24 | scaleYFloats[index] = (float) animation.getAnimatedValue();
25 | postInvalidate();
26 | }
27 | });
28 | animators.add(scaleAnim);
29 | }
30 | return animators;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/LineScalePulseOutRapidIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import java.util.ArrayList;
5 |
6 | /**
7 | * Created by GJSON on 2015/10/19.
8 | */
9 | public class LineScalePulseOutRapidIndicator extends LineScaleIndicator {
10 |
11 | @Override
12 | public ArrayList onCreateAnimators() {
13 | ArrayList animators=new ArrayList<>();
14 | long[] delays=new long[]{400,200,0,200,400};
15 | for (int i = 0; i < 5; i++) {
16 | final int index=i;
17 | ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.4f,1);
18 | scaleAnim.setDuration(1000);
19 | scaleAnim.setRepeatCount(-1);
20 | scaleAnim.setStartDelay(delays[i]);
21 | addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() {
22 | @Override
23 | public void onAnimationUpdate(ValueAnimator animation) {
24 | scaleYFloats[index] = (float) animation.getAnimatedValue();
25 | postInvalidate();
26 | }
27 | });
28 | animators.add(scaleAnim);
29 | }
30 | return animators;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/LineSpinFadeLoaderIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.graphics.Canvas;
4 | import android.graphics.Paint;
5 | import android.graphics.RectF;
6 |
7 | /**
8 | * Created by GJSON on 2015/10/24.
9 | */
10 | public class LineSpinFadeLoaderIndicator extends BallSpinFadeLoaderIndicator {
11 |
12 |
13 | @Override
14 | public void draw(Canvas canvas, Paint paint) {
15 | float radius=getWidth()/10;
16 | for (int i = 0; i < 8; i++) {
17 | canvas.save();
18 | Point point=circleAt(getWidth(),getHeight(),getWidth()/2.5f-radius,i*(Math.PI/4));
19 | canvas.translate(point.x, point.y);
20 | canvas.scale(scaleFloats[i], scaleFloats[i]);
21 | canvas.rotate(i*45);
22 | paint.setAlpha(alphas[i]);
23 | RectF rectF=new RectF(-radius,-radius/1.5f,1.5f*radius,radius/1.5f);
24 | canvas.drawRoundRect(rectF,5,5,paint);
25 | canvas.restore();
26 | }
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/SemiCircleSpinIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import android.graphics.RectF;
7 | import com.gjson.androidtools.commonview.loadingview.Indicator;
8 | import java.util.ArrayList;
9 |
10 | /**
11 | * Created by GJSON on 2015/10/20.
12 | */
13 | public class SemiCircleSpinIndicator extends Indicator {
14 |
15 | private float degress;
16 |
17 | @Override
18 | public void draw(Canvas canvas, Paint paint) {
19 | canvas.rotate(degress,centerX(),centerY());
20 | RectF rectF=new RectF(0,0,getWidth(),getHeight());
21 | canvas.drawArc(rectF,-60,120,false,paint);
22 | }
23 |
24 | @Override
25 | public ArrayList onCreateAnimators() {
26 | ArrayList animators=new ArrayList<>();
27 | ValueAnimator rotateAnim=ValueAnimator.ofFloat(0,180,360);
28 | addUpdateListener(rotateAnim,new ValueAnimator.AnimatorUpdateListener() {
29 | @Override
30 | public void onAnimationUpdate(ValueAnimator animation) {
31 | degress= (float) animation.getAnimatedValue();
32 | postInvalidate();
33 | }
34 | });
35 | rotateAnim.setDuration(600);
36 | rotateAnim.setRepeatCount(-1);
37 | animators.add(rotateAnim);
38 | return animators;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/SquareSpinIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Camera;
5 | import android.graphics.Canvas;
6 | import android.graphics.Matrix;
7 | import android.graphics.Paint;
8 | import android.graphics.RectF;
9 | import android.view.animation.LinearInterpolator;
10 | import com.gjson.androidtools.commonview.loadingview.Indicator;
11 | import java.util.ArrayList;
12 |
13 | /**
14 | * Created by GJSON on 2015/10/16.
15 | */
16 | public class SquareSpinIndicator extends Indicator {
17 |
18 | private float rotateX;
19 | private float rotateY;
20 |
21 | private Camera mCamera;
22 | private Matrix mMatrix;
23 |
24 | public SquareSpinIndicator(){
25 | mCamera=new Camera();
26 | mMatrix=new Matrix();
27 | }
28 |
29 | @Override
30 | public void draw(Canvas canvas, Paint paint) {
31 |
32 | mMatrix.reset();
33 | mCamera.save();
34 | mCamera.rotateX(rotateX);
35 | mCamera.rotateY(rotateY);
36 | mCamera.getMatrix(mMatrix);
37 | mCamera.restore();
38 |
39 | mMatrix.preTranslate(-centerX(), -centerY());
40 | mMatrix.postTranslate(centerX(), centerY());
41 | canvas.concat(mMatrix);
42 |
43 | canvas.drawRect(new RectF(getWidth()/5,getHeight()/5,getWidth()*4/5,getHeight()*4/5),paint);
44 | }
45 |
46 | @Override
47 | public ArrayList onCreateAnimators() {
48 | ArrayList animators=new ArrayList<>();
49 | ValueAnimator animator=ValueAnimator.ofFloat(0,180,180,0,0);
50 | addUpdateListener(animator,new ValueAnimator.AnimatorUpdateListener() {
51 | @Override
52 | public void onAnimationUpdate(ValueAnimator animation) {
53 | rotateX= (float) animation.getAnimatedValue();
54 | postInvalidate();
55 | }
56 | });
57 | animator.setInterpolator(new LinearInterpolator());
58 | animator.setRepeatCount(-1);
59 | animator.setDuration(2500);
60 |
61 | ValueAnimator animator1=ValueAnimator.ofFloat(0,0,180,180,0);
62 | addUpdateListener(animator1,new ValueAnimator.AnimatorUpdateListener() {
63 | @Override
64 | public void onAnimationUpdate(ValueAnimator animation) {
65 | rotateY= (float) animation.getAnimatedValue();
66 | postInvalidate();
67 | }
68 | });
69 | animator1.setInterpolator(new LinearInterpolator());
70 | animator1.setRepeatCount(-1);
71 | animator1.setDuration(2500);
72 |
73 | animators.add(animator);
74 | animators.add(animator1);
75 | return animators;
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/loadingview/indicators/TriangleSkewSpinIndicator.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.loadingview.indicators;
2 |
3 | import android.animation.ValueAnimator;
4 | import android.graphics.Camera;
5 | import android.graphics.Canvas;
6 | import android.graphics.Matrix;
7 | import android.graphics.Paint;
8 | import android.graphics.Path;
9 | import android.view.animation.LinearInterpolator;
10 | import com.gjson.androidtools.commonview.loadingview.Indicator;
11 | import java.util.ArrayList;
12 |
13 | /**
14 | * Created by GJSON on 2015/10/20.
15 | */
16 | public class TriangleSkewSpinIndicator extends Indicator {
17 |
18 | private float rotateX;
19 | private float rotateY;
20 |
21 | private Camera mCamera;
22 | private Matrix mMatrix;
23 |
24 | public TriangleSkewSpinIndicator(){
25 | mCamera=new Camera();
26 | mMatrix=new Matrix();
27 | }
28 |
29 | @Override
30 | public void draw(Canvas canvas, Paint paint) {
31 |
32 |
33 | mMatrix.reset();
34 | mCamera.save();
35 | mCamera.rotateX(rotateX);
36 | mCamera.rotateY(rotateY);
37 | mCamera.getMatrix(mMatrix);
38 | mCamera.restore();
39 |
40 | mMatrix.preTranslate(-centerX(), -centerY());
41 | mMatrix.postTranslate(centerX(), centerY());
42 | canvas.concat(mMatrix);
43 |
44 | Path path=new Path();
45 | path.moveTo(getWidth()/5,getHeight()*4/5);
46 | path.lineTo(getWidth()*4/5, getHeight()*4/5);
47 | path.lineTo(getWidth()/2,getHeight()/5);
48 | path.close();
49 | canvas.drawPath(path, paint);
50 | }
51 |
52 | @Override
53 | public ArrayList onCreateAnimators() {
54 | ArrayList animators=new ArrayList<>();
55 | ValueAnimator animator=ValueAnimator.ofFloat(0,180,180,0,0);
56 | addUpdateListener(animator,new ValueAnimator.AnimatorUpdateListener() {
57 | @Override
58 | public void onAnimationUpdate(ValueAnimator animation) {
59 | rotateX= (float) animation.getAnimatedValue();
60 | postInvalidate();
61 | }
62 | });
63 | animator.setInterpolator(new LinearInterpolator());
64 | animator.setRepeatCount(-1);
65 | animator.setDuration(2500);
66 |
67 | ValueAnimator animator1=ValueAnimator.ofFloat(0,0,180,180,0);
68 | addUpdateListener(animator1,new ValueAnimator.AnimatorUpdateListener() {
69 | @Override
70 | public void onAnimationUpdate(ValueAnimator animation) {
71 | rotateY= (float) animation.getAnimatedValue();
72 | postInvalidate();
73 | }
74 | });
75 | animator1.setInterpolator(new LinearInterpolator());
76 | animator1.setRepeatCount(-1);
77 | animator1.setDuration(2500);
78 |
79 | animators.add(animator);
80 | animators.add(animator1);
81 | return animators;
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/rainview/BaseView.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.rainview;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.util.AttributeSet;
6 | import android.view.View;
7 |
8 | public abstract class BaseView extends View {
9 |
10 | private Thread thread;
11 |
12 | public BaseView(Context context, AttributeSet attrs) {
13 | super(context, attrs);
14 |
15 | }
16 |
17 | public BaseView(Context context) {
18 | super(context);
19 |
20 | }
21 |
22 | protected abstract void drawSub(Canvas canvas);
23 |
24 | protected abstract void logic();
25 |
26 | protected abstract void init();
27 |
28 | @Override
29 | protected final void onDraw(Canvas canvas) {
30 |
31 | if (thread == null) {
32 | thread = new MyThread();
33 | thread.start();
34 | } else {
35 | drawSub(canvas);
36 | }
37 | }
38 |
39 | @Override
40 | protected void onDetachedFromWindow() {
41 | running = false;
42 | super.onDetachedFromWindow();
43 | }
44 |
45 | private boolean running = true;
46 |
47 | class MyThread extends Thread {
48 |
49 | @Override
50 | public void run() {
51 | init();
52 | while (running) {
53 | logic();
54 | postInvalidate();
55 | try {
56 | Thread.sleep(30);
57 | } catch (InterruptedException e) {
58 | e.printStackTrace();
59 | }
60 | }
61 |
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/rainview/RainItem.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.rainview;
2 |
3 | import android.graphics.Canvas;
4 | import android.graphics.Paint;
5 |
6 | import java.util.Random;
7 |
8 | public class RainItem {
9 |
10 | private int width;
11 | private int height;
12 |
13 | private float startX;
14 | private float startY;
15 | private float stopX;
16 | private float stopY;
17 | private float sizeX;
18 | private float sizeY;
19 | private float opt;
20 | private Paint paint;
21 | private Random random;
22 |
23 | private int size=20;
24 | private int color;
25 | private boolean randColor=false;
26 |
27 | public RainItem(int width,int height){
28 | this.width=width;
29 | this.height=height;
30 | init();
31 | }
32 |
33 | public RainItem(int width,int height,int size){
34 | this.width=width;
35 | this.height=height;
36 | this.size=size;
37 | init();
38 | }
39 |
40 | public RainItem(int width,int height,int size,int color){
41 | this.width=width;
42 | this.height=height;
43 | this.size=size;
44 | this.color=color;
45 | init();
46 | }
47 |
48 | public RainItem(int width,int height,int size,int color,boolean randColor){
49 | this.width=width;
50 | this.height=height;
51 | this.size=size;
52 | this.color=color;
53 | this.randColor=randColor;
54 | init();
55 | }
56 | private void init() {
57 | random=new Random();
58 | sizeX = 1+random.nextInt(size/2 );
59 | sizeY = 10+random.nextInt(size);
60 | startX = random.nextInt(width);
61 | startY = random.nextInt(height);
62 | stopX = startX + sizeX;
63 | stopY = startY + sizeY;
64 | opt=0.2f+random.nextFloat();
65 | paint = new Paint();
66 | if(randColor){
67 |
68 | int r=random.nextInt(256);
69 | int g=random.nextInt(256);
70 | int b=random.nextInt(256);
71 | paint.setARGB(255, r, g, b);
72 | }else {
73 | paint.setColor(0xffffffff);
74 | }
75 |
76 | }
77 |
78 | public void draw(Canvas canvas) {
79 |
80 | canvas.drawLine(startX, startY, stopX, stopY, paint);
81 | }
82 |
83 | public void move() {
84 |
85 | startX += sizeX * opt;
86 | stopX += sizeX * opt;
87 |
88 | startY += sizeY * opt;
89 | stopY += sizeY * opt;
90 | if (startY > height) {
91 | init();
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/commonview/rainview/RainView.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.commonview.rainview;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Canvas;
6 | import android.util.AttributeSet;
7 |
8 | import com.gjson.androidtools.R;
9 |
10 | import java.util.ArrayList;
11 |
12 | public class RainView extends BaseView {
13 |
14 | private ArrayList list =new ArrayList();
15 | private int rainNum =80;
16 | private int size;
17 | private int rainColor;
18 | private boolean randColor;
19 |
20 | public RainView(Context context, AttributeSet attrs) {
21 | super(context, attrs);
22 |
23 | TypedArray ta=context.obtainStyledAttributes(attrs,R.styleable.RainView);
24 | rainNum=ta.getInteger(R.styleable.RainView_rainNum, 80);
25 | size=ta.getInteger(R.styleable.RainView_size, 20);
26 | rainColor=ta.getInteger(R.styleable.RainView_rainColor, 0xffffff);
27 | randColor=ta.getBoolean(R.styleable.RainView_randColor, false);
28 | ta.recycle();
29 | }
30 |
31 | public RainView(Context context) {
32 | super(context);
33 | }
34 |
35 | @Override
36 | protected void drawSub(Canvas canvas) {
37 | for(RainItem item:list){
38 | item.draw(canvas);
39 | }
40 |
41 | }
42 |
43 | @Override
44 | protected void logic() {
45 |
46 | for(RainItem item:list){
47 | item.move();
48 | }
49 | }
50 |
51 | @Override
52 | protected void init() {
53 | for (int i = 0; i < rainNum; i++) {
54 | RainItem item=new RainItem(getWidth(),getHeight(),size);
55 | list.add(item);
56 | }
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/entity/AdInfo.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.entity;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by gjson on 16/7/20.
7 | * Name AdInfo
8 | * Version 1.0
9 | */
10 | public class AdInfo implements Serializable {
11 | public String name;
12 | public String url;
13 |
14 | public AdInfo(String na, String ul) {
15 | this.name = na;
16 | this.url=ul;
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/rxjavaoretrofit/bean/WeatherBean.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.rxjavaoretrofit.bean;
2 |
3 | /**
4 | * @DateTime: 2016-07-07 13:31
5 | * @Author: gjson
6 | * @Deacription: 天气bean
7 | */
8 | public class WeatherBean {
9 | public WeatherinfoBean weatherinfo;
10 |
11 | public class WeatherinfoBean {
12 | public String city;
13 | public String cityid;
14 | public String temp1;
15 | public String temp2;
16 | public String weather;
17 | public String img1;
18 | public String img2;
19 | public String ptime;
20 |
21 | @Override
22 | public String toString() {
23 | StringBuilder sb = new StringBuilder();
24 | sb.append("city:");
25 | sb.append(city);
26 | sb.append("\r\n");
27 | sb.append("cityid:");
28 | sb.append(cityid);
29 | sb.append("\r\n");
30 | sb.append("temp1:");
31 | sb.append(temp1);
32 | sb.append("\r\n");
33 | sb.append("temp2:");
34 | sb.append(temp2);
35 | sb.append("\r\n");
36 | sb.append("weather:");
37 | sb.append(weather);
38 | sb.append("\r\n");
39 | sb.append("img1:");
40 | sb.append(img1);
41 | sb.append("\r\n");
42 | sb.append("img2:");
43 | sb.append(img2);
44 | sb.append("\r\n");
45 | sb.append("ptime:");
46 | sb.append(ptime);
47 | return sb.toString();
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/rxjavaoretrofit/config/HttpServerConfig.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.rxjavaoretrofit.config;
2 |
3 | /**
4 | * 系统配置
5 | */
6 | public interface HttpServerConfig {
7 | String server = "http://www.weather.com.cn/";//地址
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/rxjavaoretrofit/model/callback/OnWeatherCallback.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.rxjavaoretrofit.model.callback;
2 |
3 |
4 | import com.gjson.androidtools.rxjavaoretrofit.bean.WeatherBean;
5 |
6 | /**
7 | * @DateTime: 2016-07-08 11:03
8 | * @Author: gjson
9 | * @Deacription: 天气请求回调
10 | */
11 | public interface OnWeatherCallback {
12 | void onResponse(WeatherBean weatherBean);
13 | void onFailure(String error);
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/rxjavaoretrofit/model/impl/WeatherNetModelImpl.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.rxjavaoretrofit.model.impl;
2 |
3 |
4 | import com.gjson.androidtools.rxjavaoretrofit.bean.WeatherBean;
5 | import com.gjson.androidtools.rxjavaoretrofit.model.callback.OnWeatherCallback;
6 | import com.gjson.androidtools.rxjavaoretrofit.retrofitApi.IWeatherService;
7 | import com.gjson.androidtools.rxjavaoretrofit.retrofitApi.RetrofitManager;
8 | import com.gjson.androidtools.rxjavaoretrofit.model.interfaces.IWeatherModel;
9 |
10 | import retrofit2.Call;
11 | import retrofit2.Callback;
12 | import retrofit2.Response;
13 |
14 | /**
15 | * @DateTime: 2016-07-08 09:57
16 | * @Author: gjson
17 | * @Deacription: model层实现类,Retrofit方式
18 | */
19 | public class WeatherNetModelImpl implements IWeatherModel, Callback {
20 |
21 | private OnWeatherCallback listener;
22 |
23 | public WeatherNetModelImpl(OnWeatherCallback callback) {
24 | this.listener = callback;
25 | }
26 |
27 | @Override
28 | public void getWeather() {
29 | RetrofitManager.getInstance().createService(IWeatherService.class).getWeather().enqueue(this);
30 | }
31 |
32 | @Override
33 | public void onResponse(Call call, Response response) {
34 | WeatherBean weather = response.body();
35 | if (listener != null)
36 | listener.onResponse(weather);
37 | }
38 |
39 | @Override
40 | public void onFailure(Call call, Throwable t) {
41 | if (listener != null)
42 | listener.onFailure(t.getMessage());
43 | }
44 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/rxjavaoretrofit/model/impl/WeatherRxJavaModelImpl.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.rxjavaoretrofit.model.impl;
2 |
3 |
4 | import com.gjson.androidtools.rxjavaoretrofit.bean.WeatherBean;
5 | import com.gjson.androidtools.rxjavaoretrofit.model.callback.OnWeatherCallback;
6 | import com.gjson.androidtools.rxjavaoretrofit.model.interfaces.IWeatherModel;
7 | import com.gjson.androidtools.rxjavaoretrofit.retrofitApi.IWeatherService;
8 | import com.gjson.androidtools.rxjavaoretrofit.retrofitApi.RetrofitManager;
9 |
10 | import rx.Subscriber;
11 | import rx.android.schedulers.AndroidSchedulers;
12 | import rx.schedulers.Schedulers;
13 |
14 | /**
15 | * @DateTime: 2016-07-08 09:57
16 | * @Author: gjson
17 | * @Deacription: model层实现类,Retrofit + RxJava + RxAndroid
18 | */
19 | public class WeatherRxJavaModelImpl implements IWeatherModel {
20 |
21 | private OnWeatherCallback listener;
22 |
23 | public WeatherRxJavaModelImpl(OnWeatherCallback callback) {
24 | this.listener = callback;
25 | }
26 |
27 | @Override
28 | public void getWeather() {
29 | RetrofitManager.getInstance().createService(IWeatherService.class).getWeatherRxJava()
30 | .subscribeOn(Schedulers.io())//这连续几个方法都是RxJava里面的
31 | .observeOn(AndroidSchedulers.mainThread())//AndroidSchedulers是RxAndroid里面的类
32 | .subscribe(new Subscriber() {
33 | @Override
34 | public void onCompleted() {
35 |
36 | }
37 |
38 | @Override
39 | public void onError(Throwable e) {
40 | if (listener != null)
41 | listener.onFailure(e.getMessage());
42 | }
43 |
44 | @Override
45 | public void onNext(WeatherBean weather) {
46 | if (listener != null)
47 | listener.onResponse(weather);
48 | }
49 | });
50 | }
51 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/rxjavaoretrofit/model/interfaces/IWeatherModel.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.rxjavaoretrofit.model.interfaces;
2 |
3 | /**
4 | * @DateTime: 2016-07-07 11:36
5 | * @Author: gjson
6 | * @Deacription: model层接口
7 | */
8 | public interface IWeatherModel {
9 | void getWeather();
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/rxjavaoretrofit/presenter/impl/WeatherPresenterImpl.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.rxjavaoretrofit.presenter.impl;
2 |
3 |
4 | import com.gjson.androidtools.rxjavaoretrofit.bean.WeatherBean;
5 | import com.gjson.androidtools.rxjavaoretrofit.model.callback.OnWeatherCallback;
6 | import com.gjson.androidtools.rxjavaoretrofit.model.impl.WeatherRxJavaModelImpl;
7 | import com.gjson.androidtools.rxjavaoretrofit.presenter.interfaces.IWeatherPresenter;
8 | import com.gjson.androidtools.rxjavaoretrofit.view.interfaces.IWeatherView;
9 | import com.gjson.androidtools.rxjavaoretrofit.model.interfaces.IWeatherModel;
10 |
11 | /**
12 | * @DateTime: 2016-07-08 10:31
13 | * @Author: gjson
14 | * @Deacription: presenter实现类
15 | */
16 | public class WeatherPresenterImpl implements IWeatherPresenter, OnWeatherCallback {
17 | private IWeatherView iMainActivity;
18 | private IWeatherModel iWeatherModel;
19 |
20 | public WeatherPresenterImpl(IWeatherView iMainActivity) {
21 | this.iMainActivity = iMainActivity;
22 | //iWeatherModel = new WeatherNetModelImpl(this);
23 | iWeatherModel = new WeatherRxJavaModelImpl(this);
24 | }
25 |
26 | @Override
27 | public void getWeather() {
28 | iWeatherModel.getWeather();
29 | }
30 |
31 | @Override
32 | public void onResponse(WeatherBean weatherBean) {
33 | iMainActivity.setTextShow(weatherBean.weatherinfo.toString());
34 | }
35 |
36 | @Override
37 | public void onFailure(String error) {
38 | iMainActivity.setTextShow(error);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/rxjavaoretrofit/presenter/interfaces/IWeatherPresenter.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.rxjavaoretrofit.presenter.interfaces;
2 |
3 | /**
4 | * @DateTime: 2016-07-08 10:51
5 | * @Author: gjson
6 | * @Deacription: presenter层接口
7 | */
8 | public interface IWeatherPresenter {
9 | void getWeather();
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/rxjavaoretrofit/retrofitApi/IWeatherService.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.rxjavaoretrofit.retrofitApi;
2 |
3 |
4 | import com.gjson.androidtools.rxjavaoretrofit.bean.WeatherBean;
5 |
6 | import retrofit2.Call;
7 | import retrofit2.http.GET;
8 | import rx.Observable;
9 |
10 | /**
11 | * @DateTime: 2016-07-08 11:08
12 | * @Author: gjson
13 | * @Deacription: 天气的Retrofit服务接口
14 | */
15 | public interface IWeatherService {
16 |
17 | /**
18 | * Retrofit的原始用法
19 | * @return
20 | */
21 | @GET("data/cityinfo/101010100.html")
22 | Call getWeather();
23 |
24 | /**
25 | * Rxjava的用法
26 | * @return
27 | */
28 | @GET("data/cityinfo/101010100.html")
29 | Observable getWeatherRxJava();
30 |
31 | /*@POST("data/cityinfo/101010100.html")
32 | Observable getWeather();*/
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/rxjavaoretrofit/retrofitApi/RetrofitManager.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.rxjavaoretrofit.retrofitApi;
2 |
3 |
4 | import com.gjson.androidtools.rxjavaoretrofit.bean.WeatherBean;
5 | import com.gjson.androidtools.rxjavaoretrofit.config.HttpServerConfig;
6 |
7 | import java.util.concurrent.TimeUnit;
8 |
9 | import okhttp3.OkHttpClient;
10 | import retrofit2.Retrofit;
11 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
12 | import retrofit2.converter.jackson.JacksonConverterFactory;
13 | import rx.Subscriber;
14 | import rx.android.schedulers.AndroidSchedulers;
15 | import rx.schedulers.Schedulers;
16 |
17 | /**
18 | * @DateTime: 2016-07-08 15:56
19 | * @Author: gjson
20 | * @Deacription: retrofit管理类
21 | */
22 | public class RetrofitManager {
23 | private volatile static RetrofitManager mInstance;
24 | private OkHttpClient okHttpClient;
25 | private Retrofit retrofit;
26 |
27 | private RetrofitManager() {
28 | if (okHttpClient == null) {
29 | okHttpClient = new OkHttpClient.Builder()
30 | .readTimeout(10000, TimeUnit.MILLISECONDS)
31 | .writeTimeout(10000, TimeUnit.MILLISECONDS)
32 | .connectTimeout(10000, TimeUnit.MILLISECONDS)
33 | .build();
34 | }
35 |
36 | if (retrofit == null)
37 | retrofit = new Retrofit.Builder()
38 | .baseUrl(HttpServerConfig.server)
39 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create())//用于返回Rxjava调用,非必须
40 | .addConverterFactory(JacksonConverterFactory.create())
41 | .client(okHttpClient)
42 | .build();
43 | IWeatherService service = retrofit.create(IWeatherService.class);
44 | service.getWeatherRxJava().subscribeOn(Schedulers.io())//这连续几个方法都是RxJava里面的
45 | .observeOn(AndroidSchedulers.mainThread())//AndroidSchedulers是RxAndroid里面的类
46 | .subscribe(new Subscriber() {
47 | @Override
48 | public void onCompleted() {
49 |
50 | }
51 |
52 | @Override
53 | public void onError(Throwable e) {
54 |
55 | }
56 |
57 | @Override
58 | public void onNext(WeatherBean weather) {
59 |
60 | }
61 | });
62 | }
63 |
64 | public static RetrofitManager getInstance() {
65 | if (mInstance == null) {
66 | synchronized (RetrofitManager.class) {
67 | if (mInstance == null)
68 | mInstance = new RetrofitManager();
69 | }
70 | }
71 | return mInstance;
72 | }
73 |
74 | public T createService(Class clz) {
75 | return retrofit.create(clz);
76 | }
77 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/rxjavaoretrofit/view/activities/WeatherActivity.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.rxjavaoretrofit.view.activities;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.view.View;
6 | import android.widget.Button;
7 | import android.widget.TextView;
8 |
9 | import com.gjson.androidtools.R;
10 | import com.gjson.androidtools.rxjavaoretrofit.presenter.impl.WeatherPresenterImpl;
11 | import com.gjson.androidtools.rxjavaoretrofit.presenter.interfaces.IWeatherPresenter;
12 | import com.gjson.androidtools.rxjavaoretrofit.view.interfaces.IWeatherView;
13 |
14 |
15 | /**
16 | * View层实现类
17 | */
18 | public class WeatherActivity extends AppCompatActivity implements View.OnClickListener,IWeatherView {
19 | private Button search;
20 | private TextView show;
21 |
22 | //持有presenter层引用
23 | private IWeatherPresenter presenter = new WeatherPresenterImpl(this);
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.activity_weather);
29 |
30 | show = (TextView) findViewById(R.id.show);
31 | search = (Button) findViewById(R.id.search);
32 | search.setOnClickListener(this);
33 | }
34 |
35 | @Override
36 | public void onClick(View v) {
37 | presenter.getWeather();
38 | }
39 |
40 | @Override
41 | public void setTextShow(String weatherString) {
42 | show.setText(weatherString);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/rxjavaoretrofit/view/interfaces/IWeatherView.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.rxjavaoretrofit.view.interfaces;
2 |
3 | /**
4 | * Author: gjson
5 | * Date: 2016-07-10 21:09
6 | * Description: View层接口
7 | */
8 | public interface IWeatherView {
9 | /**
10 | * 回显天气信息
11 | */
12 | void setTextShow(String weatherString);
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/utils/Constant.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.utils;
2 |
3 | /**
4 | * Created by gjson on 16/11/9.
5 | * Name Constant
6 | * Version 1.0
7 | */
8 | public class Constant {
9 |
10 |
11 | //alibaichuan hotfix
12 | public static final String ALIBAICHUAN_HOTFIX_APP_ID = "your id";
13 |
14 | public static final String ALIBAICHUAN_HOTFIX_APP_SECRET = "you secret";
15 |
16 | public static final String ALIBAICHUAN_HOTFIX_APP_RSA = "your rsa";
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/utils/DensityUtil.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.utils;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * Created by gjson on 16/7/20.
7 | * Name DensityUtil
8 | * Version 1.0
9 | */
10 | public class DensityUtil {
11 |
12 |
13 | /**
14 | * 将单位为dip的值转换成单位为px的值
15 | *
16 | * @param context Context
17 | * @param dipValue dip值
18 | * @return px值
19 | */
20 | public static int dip2px(Context context, float dipValue) {
21 | final float scale = context.getResources().getDisplayMetrics().density;
22 | return (int) (dipValue * scale + 0.5f);
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/utils/GjsonJni.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.utils;
2 |
3 | /**
4 | * Created by gjson on 2016/11/28.
5 | * Name AndroidToolJniUtil
6 | * Version 1.0
7 | */
8 |
9 | public class GjsonJni {
10 |
11 | static {
12 | System.loadLibrary("app");
13 | }
14 |
15 | public static native String sayHello();
16 |
17 | public static native String converValue();
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/utils/GsonFactory.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.utils;
2 |
3 | import com.google.gson.Gson;
4 | import com.google.gson.GsonBuilder;
5 | import com.google.gson.JsonDeserializationContext;
6 | import com.google.gson.JsonDeserializer;
7 | import com.google.gson.JsonElement;
8 | import com.google.gson.JsonParseException;
9 | import com.google.gson.JsonPrimitive;
10 | import com.google.gson.JsonSerializationContext;
11 | import com.google.gson.JsonSerializer;
12 |
13 | import java.lang.reflect.Type;
14 | import java.text.ParseException;
15 | import java.text.SimpleDateFormat;
16 | import java.util.Date;
17 |
18 | /**
19 | * Created by gjson on 2016/10/21.
20 | * Name GjsonFactory
21 | * Version 1.0
22 | */
23 | public class GsonFactory {
24 |
25 | private static Gson gson;
26 |
27 | private GsonFactory() {
28 | }
29 |
30 | public static Gson getInstance() {
31 | if (gson == null) {
32 | GsonBuilder gsonBuilder = new GsonBuilder();
33 | gsonBuilder.setLenient();
34 | gsonBuilder.registerTypeAdapter(java.util.Date.class, new DateSerializer()).setDateFormat("yyyy-MM-dd'T'HH:mm:ss");
35 | gsonBuilder.registerTypeAdapter(java.util.Date.class, new DateDeserializer()).setDateFormat("yyyy-MM-dd'T'HH:mm:ss");
36 | gson = gsonBuilder.create();
37 | }
38 | return gson;
39 | }
40 |
41 | private static class DateDeserializer implements JsonDeserializer {
42 | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
43 |
44 | public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
45 | try {
46 | return df.parse(json.getAsString());
47 | } catch (ParseException e) {
48 | e.printStackTrace();
49 | }
50 | return null;
51 | }
52 | }
53 |
54 | private static class DateSerializer implements JsonSerializer {
55 | public JsonElement serialize(Date src, Type typeOfSrc, JsonSerializationContext context) {
56 | return new JsonPrimitive(src.getTime());
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/utils/LogUtil.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.utils;
2 |
3 | import android.util.Log;
4 |
5 | /**
6 | * Created by gjson on 2016/10/21.
7 | * Name LogUtil
8 | * Version 1.0
9 | */
10 | public class LogUtil {
11 |
12 | /**
13 | * @param tag
14 | * @param loginfo
15 | */
16 | public static void e(String tag, String loginfo) {
17 | Log.e(tag, loginfo);
18 |
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gjson/androidtools/utils/ToastManager.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.utils;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.widget.ImageView;
7 | import android.widget.Toast;
8 |
9 | import com.gjson.androidtools.R;
10 |
11 |
12 | /**
13 | * Created by gjson on 16/7/26.
14 | * Name ToastManager
15 | * Version 1.0
16 | */
17 | public class ToastManager {
18 |
19 | private static Toast mToast;
20 |
21 | public static final int TOAST_FLAG_SUCCESS = 0;// 操作成功
22 | public static final int TOAST_FLAG_FAILED = 1;// 操作失败
23 | public static final int TOAST_FLAG_EXCEPTION = 2;// 操作异常
24 |
25 | public static void showToast(Context context, String message, int flag) {
26 | if (context == null) {
27 | // context = MyApplication.getInstance().mContext;
28 | }
29 |
30 | if (mToast == null) {
31 | initToast(context);
32 | }
33 |
34 | View view = mToast.getView();
35 | ImageView iconImg = (ImageView) view.findViewById(R.id.toast_icon_img);
36 |
37 | if (flag == TOAST_FLAG_EXCEPTION) {
38 | iconImg.setImageResource(R.mipmap.toast_icon_prompt);
39 | } else if (flag == TOAST_FLAG_FAILED) {
40 | iconImg.setImageResource(R.mipmap.toast_icon_fail);
41 | } else {
42 | iconImg.setImageResource(R.mipmap.toast_icon_normal);
43 | }
44 | mToast.setText(message);
45 | mToast.show();
46 | }
47 |
48 | /**
49 | * 初始化toast
50 | *
51 | * @param context
52 | */
53 | public static void initToast(Context context) {
54 | LayoutInflater inflate = (LayoutInflater) context
55 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
56 | View view = inflate.inflate(R.layout.common_view_toast, null);
57 | mToast = new Toast(context);
58 | mToast.setView(view);
59 |
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/java/test/BaseTest.java:
--------------------------------------------------------------------------------
1 | package test;
2 |
3 | /**
4 | * Created by gjson on 2016/11/28.
5 | * Name BaseTest
6 | * Version 1.0
7 | */
8 |
9 | public class BaseTest {
10 |
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_bottom_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_bottom_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_left_to_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_left_to_left_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_left_to_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_right_to_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_click.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_shape_normal.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
10 |
11 |
12 |
17 |
18 |
19 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_shape_press.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
10 |
11 |
12 |
17 |
18 |
19 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/toast_frame.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/drawable/toast_frame.9.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_bezier.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_coupon.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
17 |
18 |
19 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_imagemake.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_loadingview_sample.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_lottie.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
15 |
16 |
17 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_weather.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/common_view_toast.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
18 |
19 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_couponview.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
23 |
24 |
29 |
30 |
36 |
37 |
43 |
44 |
50 |
51 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_indicator.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ico_app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-hdpi/ico_app.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-mdpi/ic_close.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_doubt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-mdpi/ic_doubt.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-mdpi/ic_open.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_pay_banlance_able.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-mdpi/ic_pay_banlance_able.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ico_app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-mdpi/ico_app.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/cart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/cart.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_xt_ayxx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/ic_xt_ayxx.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_xt_cjjb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/ic_xt_cjjb.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_xt_fczn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/ic_xt_fczn.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_xt_fy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/ic_xt_fy.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_xt_jhpt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/ic_xt_jhpt.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_xt_mrtx_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/ic_xt_mrtx_small.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_xt_sjzx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/ic_xt_sjzx.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_xt_whtx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/ic_xt_whtx.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_xt_ysdk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/ic_xt_ysdk.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ico_app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/ico_app.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/icon_tv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/icon_tv.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/img_horn_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/img_horn_small.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/just_experience_one.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/just_experience_one.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/just_experience_two.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/just_experience_two.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/toast_frame.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/toast_frame.9.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/toast_icon_fail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/toast_icon_fail.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/toast_icon_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/toast_icon_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/toast_icon_prompt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xhdpi/toast_icon_prompt.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/bg1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xxhdpi/bg1.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/bg2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xxhdpi/bg2.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/bg3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xxhdpi/bg3.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/bg4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xxhdpi/bg4.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/bg_srcolling_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xxhdpi/bg_srcolling_image.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/earth.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xxhdpi/earth.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/house2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xxhdpi/house2.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ico_app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xxhdpi/ico_app.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ico_app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/app/src/main/res/mipmap-xxxhdpi/ico_app.png
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | - @mipmap/bg1
7 | - @mipmap/bg2
8 | - @mipmap/bg3
9 | - @mipmap/bg4
10 |
11 |
12 | - 1
13 | - 1
14 | - 1
15 | - 1
16 |
17 |
--------------------------------------------------------------------------------
/app/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 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 | #eeeeee
8 | #777777
9 | #237aec
10 | #2e88ff
11 | #3da1ff
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AndroidTools
3 | RXJavaRetrofit
4 | 设置
5 |
6 | 当前应用缺少必要权限。\n请点击"设置"-"权限"-打开所需权限。\n最后点击两次后退按钮,即可返回。
7 |
8 | 请给予应用必要权限,让程序可正常工作。
9 | 取消
10 |
11 | 请给予相机权限,才能正常使用扫一扫
12 |
13 |
14 | //alibaichuan hotfix
15 | your rsa
16 | your secret
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
13 |
17 |
18 |
24 |
25 |
32 |
33 |
40 |
41 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/resources/META-INF/gradle-plugins/com.gjson.customplugin.transform.properties:
--------------------------------------------------------------------------------
1 | implementation-class=com.gjson.injecttransform.TransformPlugin
--------------------------------------------------------------------------------
/app/src/test/java/com/gjson/androidtools/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools;
2 |
3 | import com.gjson.androidtools.utils.EncodeUtil;
4 |
5 | import org.junit.Test;
6 |
7 | import static org.junit.Assert.*;
8 |
9 | /**
10 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 |
18 | @Test
19 | public void testGetMd5(){
20 | EncodeUtil.urlDecode("httpllkll:kfjkfjlsf");
21 | }
22 | }
--------------------------------------------------------------------------------
/app/transform.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'groovy'
2 | apply plugin: 'maven'
3 |
4 | dependencies {
5 | implementation gradleApi()
6 | implementation localGroovy()
7 |
8 | implementation 'com.android.tools.build:gradle:3.3.1'
9 | implementation group: 'org.javassist', name: 'javassist', version: '3.22.0-GA'
10 | }
11 |
12 | repositories {
13 | mavenCentral()
14 | }
15 |
16 |
17 | uploadArchives {
18 | repositories.mavenDeployer {
19 | repository(url: LOCAL_REPO_URL)
20 | pom.groupId = PROJ_GROUP
21 | pom.artifactId = PROJ_ARTIFACTID
22 | pom.version = PROJ_VERSION
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | mavenCentral()
7 | google()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.1.2'
11 | // classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | jcenter()
21 |
22 | maven {
23 | url "http://repo.baichuan-android.taobao.com/content/groups/public/"
24 | }
25 | google()
26 |
27 | mavenCentral()
28 |
29 | maven { url "https://jitpack.io" }
30 | }
31 | }
32 |
33 | task clean(type: Delete) {
34 | delete rootProject.buildDir
35 | }
36 |
--------------------------------------------------------------------------------
/gif/five.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/gif/five.gif
--------------------------------------------------------------------------------
/gif/four.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/gif/four.gif
--------------------------------------------------------------------------------
/gif/loadingview.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/gif/loadingview.gif
--------------------------------------------------------------------------------
/gif/main.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/gif/main.gif
--------------------------------------------------------------------------------
/gif/one.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/gif/one.gif
--------------------------------------------------------------------------------
/gif/three.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/gif/three.gif
--------------------------------------------------------------------------------
/gif/two.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/gif/two.gif
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 | #android.useDeprecatedNdk=true
20 | #android.deprecatedNdkCompileLease=1578313450934
21 |
22 | PROJ_NAME=transform
23 | PROJ_ARTIFACTID=transform
24 | PROJ_POM_NAME=Local Repository
25 |
26 | LOCAL_REPO_URL=file:///Users/gjson/Downloads/
27 |
28 | PROJ_GROUP=com.gjson.customplugin
29 |
30 | PROJ_VERSION=1.0.1
31 | PROJ_VERSION_CODE=1
32 |
33 | PROJ_WEBSITEURL=http://www.gjson.com/
34 | PROJ_ISSUETRACKERURL=https://github.com/GJson/AndroidTools/issues
35 | PROJ_VCSURL=https://github.com/GJson/AndroidTools
36 | PROJ_DESCRIPTION=AndroidTools
37 |
38 | PROJ_LICENCE_NAME=The Apache Software License, Version 2.0
39 | PROJ_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
40 | PROJ_LICENCE_DEST=repo
41 |
42 | DEVELOPER_ID=your-dev-id
43 | DEVELOPER_NAME=your-dev-name
44 | DEVELOPER_EMAIL=your-email@your-mailbox.com
45 |
46 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Nov 28 17:27:55 CST 2016
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-4.4-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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
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 Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/imagepicker/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/imagepicker/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 27
5 | buildToolsVersion "27.0.3"
6 |
7 | defaultConfig {
8 | minSdkVersion 14
9 | targetSdkVersion 26
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | vectorDrawables.useSupportLibrary = true
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 | }
16 |
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | }
24 |
25 | dependencies {
26 | implementation fileTree(dir: 'libs', include: ['*.jar'])
27 | implementation 'com.android.support:appcompat-v7:28.0.0'
28 | // testCompile 'junit:junit:4.12'
29 |
30 | implementation 'com.android.support:recyclerview-v7:28.0.0'
31 | implementation 'com.github.chrisbanes:PhotoView:2.0.0'
32 | }
33 |
--------------------------------------------------------------------------------
/imagepicker/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/imagepicker/src/androidTest/java/com/gjson/androidtools/library/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.library;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest {
18 | @Test public void useAppContext() {
19 | // Context of the app under test.
20 | Context appContext = InstrumentationRegistry.getTargetContext();
21 |
22 | assertEquals("com.gjson.androidtools.library.test", appContext.getPackageName());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/imagepicker/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
19 |
24 |
28 |
29 |
33 |
34 |
39 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/gjson/androidtools/library/ImagePickerProvider.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.library;
2 |
3 | import android.support.v4.content.FileProvider;
4 |
5 | /**
6 | * 自定义一个Provider,以免和引入的项目的provider冲突
7 | *
8 | *Created by gjson on 2018/6/22.
9 | */
10 |
11 | public class ImagePickerProvider extends FileProvider {
12 | }
13 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/gjson/androidtools/library/imagepicker/DataHolder.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.library.imagepicker;
2 |
3 | import com.gjson.androidtools.library.imagepicker.bean.ImageItem;
4 | import java.util.HashMap;
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | /**
9 | * 新的DataHolder,使用单例和弱引用解决崩溃问题
10 | * Created by gjson on 2018/6/22.
11 | */
12 | public class DataHolder {
13 | public static final String DH_CURRENT_IMAGE_FOLDER_ITEMS = "dh_current_image_folder_items";
14 |
15 | private static DataHolder mInstance;
16 | private Map> data;
17 |
18 | public static DataHolder getInstance() {
19 | if (mInstance == null){
20 | synchronized (DataHolder.class){
21 | if (mInstance == null){
22 | mInstance = new DataHolder();
23 | }
24 | }
25 | }
26 | return mInstance;
27 | }
28 |
29 | private DataHolder() {
30 | data = new HashMap<>();
31 | }
32 |
33 | public void save(String id, List object) {
34 | if (data != null){
35 | data.put(id, object);
36 | }
37 | }
38 |
39 | public Object retrieve(String id) {
40 | if (data == null || mInstance == null){
41 | throw new RuntimeException("你必须先初始化");
42 | }
43 | return data.get(id);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/gjson/androidtools/library/imagepicker/ImagePickerProvider.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.library.imagepicker;
2 |
3 | import android.support.v4.content.FileProvider;
4 |
5 | /**
6 | * 自定义一个Provider,以免和引入的项目的provider冲突
7 | *
8 | *Created by gjson on 2018/6/22.
9 | */
10 |
11 | public class ImagePickerProvider extends FileProvider {
12 | }
13 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/gjson/androidtools/library/imagepicker/adapter/ImagePageAdapter.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.library.imagepicker.adapter;
2 |
3 | import android.app.Activity;
4 | import android.support.v4.view.PagerAdapter;
5 | import android.util.DisplayMetrics;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.ImageView;
9 | import com.github.chrisbanes.photoview.OnPhotoTapListener;
10 | import com.github.chrisbanes.photoview.PhotoView;
11 | import com.github.chrisbanes.photoview.PhotoViewAttacher;
12 | import com.gjson.androidtools.library.imagepicker.ImagePicker;
13 | import com.gjson.androidtools.library.imagepicker.bean.ImageItem;
14 | import com.gjson.androidtools.library.imagepicker.util.Utils;
15 | import java.util.ArrayList;
16 |
17 | /**
18 | * Created by gjson on 2018/6/22.
19 | * Name ImagePageAdapter
20 | * Version 1.0
21 | */
22 | public class ImagePageAdapter extends PagerAdapter {
23 |
24 | private int screenWidth;
25 | private int screenHeight;
26 | private ImagePicker imagePicker;
27 | private ArrayList images = new ArrayList<>();
28 | private Activity mActivity;
29 | public PhotoViewClickListener listener;
30 |
31 | public ImagePageAdapter(Activity activity, ArrayList images) {
32 | this.mActivity = activity;
33 | this.images = images;
34 |
35 | DisplayMetrics dm = Utils.getScreenPix(activity);
36 | screenWidth = dm.widthPixels;
37 | screenHeight = dm.heightPixels;
38 | imagePicker = ImagePicker.getInstance();
39 | }
40 |
41 | public void setData(ArrayList images) {
42 | this.images = images;
43 | }
44 |
45 | public void setPhotoViewClickListener(PhotoViewClickListener listener) {
46 | this.listener = listener;
47 | }
48 |
49 | @Override
50 | public Object instantiateItem(ViewGroup container, int position) {
51 | PhotoView photoView = new PhotoView(mActivity);
52 | ImageItem imageItem = images.get(position);
53 | imagePicker.getImageLoader()
54 | .displayImagePreview(mActivity, imageItem.path, photoView, screenWidth, screenHeight);
55 | photoView.setOnPhotoTapListener(new OnPhotoTapListener() {
56 | @Override
57 | public void onPhotoTap(ImageView view, float x, float y) {
58 | if (listener != null) listener.OnPhotoTapListener(view, x, y);
59 | }
60 | });
61 | container.addView(photoView);
62 | return photoView;
63 | }
64 |
65 | @Override
66 | public int getCount() {
67 | return images.size();
68 | }
69 |
70 | @Override
71 | public boolean isViewFromObject(View view, Object object) {
72 | return view == object;
73 | }
74 |
75 | @Override
76 | public void destroyItem(ViewGroup container, int position, Object object) {
77 | container.removeView((View) object);
78 | }
79 |
80 | @Override
81 | public int getItemPosition(Object object) {
82 | return POSITION_NONE;
83 | }
84 |
85 | public interface PhotoViewClickListener {
86 | void OnPhotoTapListener(View view, float v, float v1);
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/gjson/androidtools/library/imagepicker/bean/ImageFolder.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.library.imagepicker.bean;
2 |
3 | import java.io.Serializable;
4 | import java.util.ArrayList;
5 |
6 | /**
7 | * Created by gjson on 2018/6/22.
8 | * Name ImageFolder 图片文件夹
9 | * Version 1.0
10 | */
11 | public class ImageFolder implements Serializable {
12 |
13 | public String name; //当前文件夹的名字
14 | public String path; //当前文件夹的路径
15 | public ImageItem cover; //当前文件夹需要要显示的缩略图,默认为最近的一次图片
16 | public ArrayList images; //当前文件夹下所有图片的集合
17 |
18 | /** 只要文件夹的路径和名字相同,就认为是相同的文件夹 */
19 | @Override
20 | public boolean equals(Object o) {
21 | try {
22 | ImageFolder other = (ImageFolder) o;
23 | return this.path.equalsIgnoreCase(other.path) && this.name.equalsIgnoreCase(other.name);
24 | } catch (ClassCastException e) {
25 | e.printStackTrace();
26 | }
27 | return super.equals(o);
28 | }
29 | }
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/gjson/androidtools/library/imagepicker/bean/ImageItem.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.library.imagepicker.bean;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 | import java.io.Serializable;
6 |
7 | /**
8 | * Created by gjson on 2018/6/22.
9 | * Name ImageItem 图片信息
10 | * Version 1.0
11 | */
12 | public class ImageItem implements Serializable, Parcelable {
13 |
14 | public String name; //图片的名字
15 | public String path; //图片的路径
16 | public long size; //图片的大小
17 | public int width; //图片的宽度
18 | public int height; //图片的高度
19 | public String mimeType; //图片的类型
20 | public long addTime; //图片的创建时间
21 |
22 | /** 图片的路径和创建时间相同就认为是同一张图片 */
23 | @Override
24 | public boolean equals(Object o) {
25 | if (o instanceof ImageItem) {
26 | ImageItem item = (ImageItem) o;
27 | return this.path.equalsIgnoreCase(item.path) && this.addTime == item.addTime;
28 | }
29 |
30 | return super.equals(o);
31 | }
32 |
33 |
34 | @Override
35 | public int describeContents() {
36 | return 0;
37 | }
38 |
39 | @Override
40 | public void writeToParcel(Parcel dest, int flags) {
41 | dest.writeString(this.name);
42 | dest.writeString(this.path);
43 | dest.writeLong(this.size);
44 | dest.writeInt(this.width);
45 | dest.writeInt(this.height);
46 | dest.writeString(this.mimeType);
47 | dest.writeLong(this.addTime);
48 | }
49 |
50 | public ImageItem() {
51 | }
52 |
53 | protected ImageItem(Parcel in) {
54 | this.name = in.readString();
55 | this.path = in.readString();
56 | this.size = in.readLong();
57 | this.width = in.readInt();
58 | this.height = in.readInt();
59 | this.mimeType = in.readString();
60 | this.addTime = in.readLong();
61 | }
62 |
63 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
64 | @Override
65 | public ImageItem createFromParcel(Parcel source) {
66 | return new ImageItem(source);
67 | }
68 |
69 | @Override
70 | public ImageItem[] newArray(int size) {
71 | return new ImageItem[size];
72 | }
73 | };
74 | }
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/gjson/androidtools/library/imagepicker/loader/ImageLoader.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.library.imagepicker.loader;
2 |
3 | import android.app.Activity;
4 | import android.widget.ImageView;
5 | import java.io.Serializable;
6 |
7 | /**
8 | * Created by gjson on 2018/6/22.
9 | * Name ImageLoader
10 | * Version 1.0
11 | *
12 | * ImageLoader抽象类,外部需要实现这个类去加载图片, 尽力减少对第三方库的依赖
13 | */
14 | public interface ImageLoader extends Serializable {
15 |
16 | void displayImage(Activity activity, String path, ImageView imageView, int width, int height);
17 |
18 | void displayImagePreview(Activity activity, String path, ImageView imageView, int width,
19 | int height);
20 |
21 | void clearMemoryCache();
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/gjson/androidtools/library/imagepicker/ui/ImageBaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.library.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.support.annotation.NonNull;
8 | import android.support.v4.app.ActivityCompat;
9 | import android.support.v7.app.AppCompatActivity;
10 | import android.view.Window;
11 | import android.view.WindowManager;
12 | import android.widget.Toast;
13 | import com.gjson.androidtools.library.R;
14 | import com.gjson.androidtools.library.imagepicker.ImagePicker;
15 | import com.gjson.androidtools.library.imagepicker.view.SystemBarTintManager;
16 |
17 | /**
18 | * Created by gjson on 2018/6/22.
19 | */
20 | public class ImageBaseActivity extends AppCompatActivity {
21 |
22 | protected SystemBarTintManager tintManager;
23 |
24 | @Override protected void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
27 | setTranslucentStatus(true);
28 | }
29 | tintManager = new SystemBarTintManager(this);
30 | tintManager.setStatusBarTintEnabled(true);
31 | tintManager.setStatusBarTintResource(R.color.ip_color_primary_dark); //设置上方状态栏的颜色
32 | }
33 |
34 | @TargetApi(19) private void setTranslucentStatus(boolean on) {
35 | Window win = getWindow();
36 | WindowManager.LayoutParams winParams = win.getAttributes();
37 | final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
38 | if (on) {
39 | winParams.flags |= bits;
40 | } else {
41 | winParams.flags &= ~bits;
42 | }
43 | win.setAttributes(winParams);
44 | }
45 |
46 | public boolean checkPermission(@NonNull String permission) {
47 | return ActivityCompat.checkSelfPermission(this, permission)
48 | == PackageManager.PERMISSION_GRANTED;
49 | }
50 |
51 | public void showToast(String toastText) {
52 | Toast.makeText(getApplicationContext(), toastText, Toast.LENGTH_SHORT).show();
53 | }
54 |
55 | @Override protected void onRestoreInstanceState(Bundle savedInstanceState) {
56 | super.onRestoreInstanceState(savedInstanceState);
57 | ImagePicker.getInstance().restoreInstanceState(savedInstanceState);
58 | }
59 |
60 | @Override protected void onSaveInstanceState(Bundle outState) {
61 | super.onSaveInstanceState(outState);
62 | ImagePicker.getInstance().saveInstanceState(outState);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/gjson/androidtools/library/imagepicker/util/BitmapUtil.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.library.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 | import java.io.File;
11 | import java.io.IOException;
12 |
13 | /**
14 | * Bitmap工具类,主要是解决拍照旋转的适配
15 | * Created by gjson on 2018/6/22.
16 | */
17 |
18 | public class BitmapUtil {
19 |
20 | private BitmapUtil() {
21 | throw new UnsupportedOperationException("u can't instantiate me...");
22 | }
23 |
24 | /**
25 | * 获取图片的旋转角度
26 | *
27 | * @param path 图片绝对路径
28 | * @return 图片的旋转角度
29 | */
30 | public static int getBitmapDegree(String path) {
31 | int degree = 0;
32 | try {
33 | // 从指定路径下读取图片,并获取其EXIF信息
34 | ExifInterface exifInterface = new ExifInterface(path);
35 | // 获取图片的旋转信息
36 | int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION,
37 | ExifInterface.ORIENTATION_NORMAL);
38 | switch (orientation) {
39 | case ExifInterface.ORIENTATION_ROTATE_90:
40 | degree = 90;
41 | break;
42 | case ExifInterface.ORIENTATION_ROTATE_180:
43 | degree = 180;
44 | break;
45 | case ExifInterface.ORIENTATION_ROTATE_270:
46 | degree = 270;
47 | break;
48 | }
49 | } catch (IOException e) {
50 | e.printStackTrace();
51 | }
52 | return degree;
53 | }
54 |
55 | /**
56 | * 将图片按照指定的角度进行旋转
57 | *
58 | * @param bitmap 需要旋转的图片
59 | * @param degree 指定的旋转角度
60 | * @return 旋转后的图片
61 | */
62 | public static Bitmap rotateBitmapByDegree(Bitmap bitmap, int degree) {
63 | // 根据旋转角度,生成旋转矩阵
64 | Matrix matrix = new Matrix();
65 | matrix.postRotate(degree);
66 | // 将原始图片按照旋转矩阵进行旋转,并得到新的图片
67 | Bitmap newBitmap =
68 | Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
69 | if (!bitmap.isRecycled()) {
70 | bitmap.recycle();
71 | }
72 | return newBitmap;
73 | }
74 |
75 | /**
76 | * 获取我们需要的整理过旋转角度的Uri
77 | *
78 | * @param activity 上下文环境
79 | * @param path 路径
80 | * @return 正常的Uri
81 | */
82 | public static Uri getRotatedUri(Activity activity, String path) {
83 | int degree = BitmapUtil.getBitmapDegree(path);
84 | if (degree != 0) {
85 | Bitmap bitmap = BitmapFactory.decodeFile(path);
86 | Bitmap newBitmap = BitmapUtil.rotateBitmapByDegree(bitmap, degree);
87 | return Uri.parse(
88 | MediaStore.Images.Media.insertImage(activity.getContentResolver(), newBitmap, null,
89 | 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 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/gjson/androidtools/library/imagepicker/util/ProviderUtil.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.library.imagepicker.util;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * 用于解决provider冲突的util
7 | *
8 | * Created by gjson on 2018/6/22.
9 | */
10 |
11 | public class ProviderUtil {
12 |
13 | public static String getFileProviderName(Context context) {
14 | return context.getPackageName() + ".provider";
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/gjson/androidtools/library/imagepicker/view/GridSpacingItemDecoration.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.library.imagepicker.view;
2 |
3 | import android.graphics.Rect;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.View;
6 |
7 | /**
8 | * Created by gjson on 2018/6/22.
9 | * desc : 为Recyclerview 的GridLayoutManager添加列间距
10 | */
11 |
12 | public class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
13 |
14 | private int spanCount;
15 | private int spacing;
16 | private boolean includeEdge;
17 |
18 | public GridSpacingItemDecoration(int spanCount, int spacing, boolean includeEdge) {
19 | this.spanCount = spanCount;
20 | this.spacing = spacing;
21 | this.includeEdge = includeEdge;
22 | }
23 |
24 | @Override
25 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
26 | int position = parent.getChildAdapterPosition(view); // item position
27 | int column = position % spanCount; // item column
28 |
29 | if (includeEdge) {
30 | outRect.left = spacing - column * spacing / spanCount; // spacing - column * ((1f / spanCount) * spacing)
31 | outRect.right = (column + 1) * spacing / spanCount; // (column + 1) * ((1f / spanCount) * spacing)
32 |
33 | if (position < spanCount) { // top edge
34 | outRect.top = spacing;
35 | }
36 | outRect.bottom = spacing; // item bottom
37 | } else {
38 | outRect.left = column * spacing / spanCount; // column * ((1f / spanCount) * spacing)
39 | outRect.right = spacing - (column + 1) * spacing / spanCount; // spacing - (column + 1) * ((1f / spanCount) * spacing)
40 | if (position >= spanCount) {
41 | outRect.top = spacing; // item top
42 | }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/gjson/androidtools/library/imagepicker/view/SuperCheckBox.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.library.imagepicker.view;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.AppCompatCheckBox;
5 | import android.util.AttributeSet;
6 | import android.view.SoundEffectConstants;
7 |
8 | /**
9 | Created by gjson on 2018/6/22.
10 | * 描 述:带声音的CheckBox
11 | */
12 | public class SuperCheckBox extends AppCompatCheckBox {
13 |
14 | public SuperCheckBox(Context context) {
15 | super(context);
16 | }
17 |
18 | public SuperCheckBox(Context context, AttributeSet attrs) {
19 | super(context, attrs);
20 | }
21 |
22 | public SuperCheckBox(Context context, AttributeSet attrs, int defStyle) {
23 | super(context, attrs, defStyle);
24 | }
25 |
26 | @Override
27 | public boolean performClick() {
28 | final boolean handled = super.performClick();
29 | if (!handled) {
30 | // View only makes a sound effect if the onClickListener was
31 | // called, so we'll need to make one here instead.
32 | playSoundEffect(SoundEffectConstants.CLICK);
33 | }
34 | return handled;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/imagepicker/src/main/java/com/gjson/androidtools/library/imagepicker/view/ViewPagerFixed.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.library.imagepicker.view;
2 |
3 | import android.content.Context;
4 | import android.support.v4.view.ViewPager;
5 | import android.util.AttributeSet;
6 | import android.view.MotionEvent;
7 |
8 | /**
9 | * Created by gjson on 2018/6/22.
10 | * 描 述:修复图片在ViewPager控件中缩放报错的BUG
11 | */
12 | public class ViewPagerFixed extends ViewPager {
13 |
14 | public ViewPagerFixed(Context context) {
15 | super(context);
16 | }
17 |
18 | public ViewPagerFixed(Context context, AttributeSet attrs) {
19 | super(context, attrs);
20 | }
21 |
22 | @Override public boolean onTouchEvent(MotionEvent ev) {
23 | try {
24 | return super.onTouchEvent(ev);
25 | } catch (IllegalArgumentException ex) {
26 | ex.printStackTrace();
27 | }
28 | return false;
29 | }
30 |
31 | @Override public boolean onInterceptTouchEvent(MotionEvent ev) {
32 | try {
33 | return super.onInterceptTouchEvent(ev);
34 | } catch (IllegalArgumentException ex) {
35 | ex.printStackTrace();
36 | }
37 | return false;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/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_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/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/imagepicker/src/main/res/mipmap-xxhdpi/checkbox_checked.png
--------------------------------------------------------------------------------
/imagepicker/src/main/res/mipmap-xxhdpi/checkbox_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/imagepicker/src/main/res/mipmap-xxhdpi/checkbox_normal.png
--------------------------------------------------------------------------------
/imagepicker/src/main/res/mipmap-xxhdpi/grid_camera.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/imagepicker/src/main/res/mipmap-xxhdpi/grid_camera.png
--------------------------------------------------------------------------------
/imagepicker/src/main/res/mipmap-xxhdpi/text_indicator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GJson/AndroidTools/a9055630632ba6fe820d09bbdbcf0d5796886239/imagepicker/src/main/res/mipmap-xxhdpi/text_indicator.png
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
7 |
8 |
11 |
12 |
13 |
16 |
17 |
23 |
--------------------------------------------------------------------------------
/imagepicker/src/main/res/xml/provider_paths.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/imagepicker/src/test/java/com/gjson/androidtools/library/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.gjson.androidtools.library;
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 public void addition_isCorrect() {
14 | assertEquals(4, 2 + 2);
15 | }
16 | }
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':imagepicker'
2 |
--------------------------------------------------------------------------------
/test.html:
--------------------------------------------------------------------------------
1 |
2 |
14 |
--------------------------------------------------------------------------------