vlistData = new ArrayList<>();
22 | vlistData.add("高德");
23 | vlistData.add("百度");
24 | BasePop.Builder builder = VSingleListPopView.showVSingleListPop(this, view,
25 | vlistData, 0xf0008DCF, new OnEventListenner.OnVListClickListenner() {
26 | @Override
27 | public void onClick(View view, int pos) {
28 | if (null != builder){
29 | builder.dissmiss();
30 | }
31 | }
32 | });
33 | ```
--------------------------------------------------------------------------------
/doc/library/webview_guid.md:
--------------------------------------------------------------------------------
1 | # API说明-提供调用类WebPopView.java
2 | >调用显示方法
3 | ```Java
4 | /**
5 | * 显示Webview承载内容的弹窗
6 | *
7 | * @param _context
8 | * @param _urlOrStr- html文本字符串
9 | * @return
10 | */
11 | public static BasePop.Builder showWebview(Context _context, String _urlOrStr) {
12 | }
13 |
14 | /**
15 | * 显示Webview承载内容的弹窗
16 | *
17 | * @param _context
18 | * @param _urlOrStr- html文本字符串
19 | * @param _closeResourceId- 支持关闭按钮背景资源自定义
20 | * @return
21 | */
22 | public static BasePop.Builder showWebview(Context _context, String _urlOrStr, int _closeResourceId) {
23 | }
24 |
25 | /**
26 | * 显示Webview承载内容的弹窗
27 | *
28 | * @param _context
29 | * @param _urlOrStr- html文本字符串
30 | * @param _closeResourceId- 支持关闭按钮背景资源自定义
31 | * @param _bScale- 是否带缩放动画
32 | * @return
33 | */
34 | public static BasePop.Builder showWebview(Context _context, String _urlOrStr,
35 | int _closeResourceId, boolean _bScale) {
36 | }
37 |
38 | /**
39 | * 显示Webview承载内容的弹窗
40 | *
41 | * @param _context
42 | * @param _urlOrStr- html文本字符串
43 | * @param _bScale- 是否带缩放动画
44 | * @return
45 | */
46 | public static BasePop.Builder showWebview(Context _context, String _urlOrStr, boolean _bScale) {
47 | }
48 |
49 | /**
50 | * 显示Webview承载内容的弹窗
51 | *
52 | * @param _context
53 | * @param _achor
54 | * @param _urlOrStr- html文本字符串
55 | * @param _closeResourceId- 支持关闭按钮背景资源自定义
56 | * @return
57 | */
58 | public static BasePop.Builder showWebview(Context _context, View _achor,
59 | String _urlOrStr, int _closeResourceId,
60 | boolean _bScale) {
61 | }
62 | ```
63 | # USE
64 | ```Java
65 | BasePop.Builder builder1 = WebPopView.showWebview(this, "1、独立根据客户需求完成媒体合作及投放方案;
2、负责对区域客户的销售工作,拓展新的客户和项目,并有效地形成销售机会;
3、通过深入了解客户的核心业务,挖掘和寻找潜在的项目机会;");
66 | BasePop.Builder builder2 = WebPopView.showWebview(this, "
\r\n", R.drawable.huawei);
67 | BasePop.Builder builder3 = WebPopView.showWebview(this, view, "1、独立根据客户需求完成媒体合作及投放方案;
2、负责对区域客户的销售工作,拓展新的客户和项目,并有效地形成销售机会;
3、通过深入了解客户的核心业务,挖掘和寻找潜在的项目机会;",
68 | -1, true);
69 | ```
70 |
71 | # 注意事项
72 | > 内容要为html字符串文本格式,内部Webview支持了js等相关配置;
73 |
--------------------------------------------------------------------------------
/doc/update_bg_app_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/doc/update_bg_app_top.png
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Feb 11 14:26:23 CST 2019
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 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/poplibrary/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/poplibrary/README.md:
--------------------------------------------------------------------------------
1 | # poplibrary
2 |
3 | ### project.properties
4 | project.version=x.x.x
5 |
6 | ### build.gradle (choice)
7 | versionCode 3
8 | versionName "2.1"
9 |
10 | ### upload to bintray
11 | gradlew bintrayUpload
--------------------------------------------------------------------------------
/poplibrary/bintrayUpload.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.github.dcendents.android-maven'
2 | apply plugin: 'com.jfrog.bintray'
3 |
4 | // load properties
5 | Properties properties = new Properties()
6 | File localPropertiesFile = project.file("local.properties");
7 | if(localPropertiesFile.exists()){
8 | properties.load(localPropertiesFile.newDataInputStream())
9 | }
10 | File projectPropertiesFile = project.file("project.properties");
11 | if(projectPropertiesFile.exists()){
12 | properties.load(projectPropertiesFile.newDataInputStream())
13 | }
14 |
15 | // read properties
16 | def projectName = properties.getProperty("project.name")
17 | def repoName = properties.getProperty("project.reponame")
18 | def projectGroupId = properties.getProperty("project.groupId")
19 | def projectArtifactId = properties.getProperty("project.artifactId")
20 | def projectVersionName = properties.getProperty("project.version")
21 | def projectPackaging = properties.getProperty("project.packaging")
22 | def projectSiteUrl = properties.getProperty("project.siteUrl")
23 | def projectGitUrl = properties.getProperty("project.gitUrl")
24 |
25 | def developerId = properties.getProperty("developer.id")
26 | def developerName = properties.getProperty("developer.name")
27 | def developerEmail = properties.getProperty("developer.email")
28 |
29 | def bintrayUser = properties.getProperty("bintray.user")
30 | def bintrayApikey = properties.getProperty("bintray.apikey")
31 |
32 | def javadocName = properties.getProperty("javadoc.name")
33 |
34 | group = projectGroupId
35 |
36 | // This generates POM.xml with proper parameters
37 | install {
38 | repositories.mavenInstaller {
39 | pom {
40 | project {
41 | name projectName
42 | groupId projectGroupId
43 | artifactId projectArtifactId
44 | version projectVersionName
45 | packaging projectPackaging
46 | url projectSiteUrl
47 | licenses {
48 | license {
49 | name 'The Apache Software License, Version 2.0'
50 | url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
51 | }
52 | }
53 | developers {
54 | developer {
55 | id developerId
56 | name developerName
57 | email developerEmail
58 | }
59 | }
60 | scm {
61 | connection projectGitUrl
62 | developerConnection projectGitUrl
63 | url projectSiteUrl
64 | }
65 | }
66 | }
67 | }
68 | }
69 |
70 | // This generates sources.jar
71 | task sourcesJar(type: Jar) {
72 | from android.sourceSets.main.java.srcDirs
73 | classifier = 'sources'
74 | }
75 |
76 | task javadoc(type: Javadoc) {
77 | source = android.sourceSets.main.java.srcDirs
78 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
79 | }
80 |
81 | // Add compile dependencies to javadoc
82 | afterEvaluate {
83 | javadoc.classpath += files(android.libraryVariants.collect { variant ->
84 | variant.javaCompile.classpath.files
85 | })
86 | }
87 |
88 | // This generates javadoc.jar
89 | task javadocJar(type: Jar, dependsOn: javadoc) {
90 | classifier = 'javadoc'
91 | from javadoc.destinationDir
92 | }
93 |
94 | artifacts {
95 | archives javadocJar
96 | archives sourcesJar
97 | }
98 |
99 | // javadoc configuration
100 | javadoc {
101 | options{
102 | encoding "UTF-8"
103 | charSet 'UTF-8'
104 | author true
105 | version projectVersionName
106 | links "http://docs.oracle.com/javase/7/docs/api"
107 | title javadocName
108 | }
109 | }
110 |
111 | // bintray configuration
112 | bintray {
113 | user = bintrayUser
114 | key = bintrayApikey
115 | configurations = ['archives']
116 | pkg {
117 | repo = repoName
118 | name = projectName
119 | websiteUrl = projectSiteUrl
120 | vcsUrl = projectGitUrl
121 | licenses = ["Apache-2.0"]
122 | publish = true
123 | }
124 | }
--------------------------------------------------------------------------------
/poplibrary/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | //转移到binatrayUpload中配置
3 | //apply plugin: 'com.jfrog.bintray'
4 | //apply plugin: 'com.github.dcendents.android-maven'
5 |
6 | android {
7 | compileSdkVersion 28
8 |
9 |
10 |
11 | defaultConfig {
12 | minSdkVersion 15
13 | targetSdkVersion 28
14 | versionCode 3
15 | versionName "2.1"
16 |
17 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
18 |
19 | }
20 |
21 | buildTypes {
22 | // release {
23 | // minifyEnabled false
24 | // proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
25 | // }
26 | release {
27 | consumerProguardFiles 'proguard-rules.pro'
28 | }
29 | debug {
30 | consumerProguardFiles 'proguard-rules.pro'
31 | }
32 | }
33 | lintOptions {
34 | abortOnError false
35 | }
36 | }
37 |
38 | //转移到binatrayUpload中配置
39 | //allprojects {
40 | // repositories {
41 | // jcenter()
42 | // }
43 | // tasks.withType(Javadoc) {
44 | // options{ encoding "UTF-8"
45 | // charSet 'UTF-8'
46 | // links "http://docs.oracle.com/javase/7/docs/api"
47 | // }
48 | // }
49 | //}
50 |
51 | dependencies {
52 | implementation fileTree(dir: 'libs', include: ['*.jar'])
53 |
54 | implementation 'com.android.support:appcompat-v7:28.0.0'
55 | testImplementation 'junit:junit:4.12'
56 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
57 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
58 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
59 | implementation 'com.android.support:recyclerview-v7:28.0.0'
60 | implementation 'com.android.support:design:28.+'
61 |
62 | ///< retrofit+rxjava - 下载处理
63 | implementation 'com.squareup.retrofit2:retrofit:2.3.0'
64 | implementation 'io.reactivex:rxandroid:1.2.1'
65 | implementation 'io.reactivex.rxjava2:rxjava:2.1.10'
66 | implementation 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
67 | ///< eventbus3.0 - 进度通知
68 | implementation 'org.greenrobot:eventbus:3.0.0'
69 | }
70 |
71 | apply from: "bintrayUpload.gradle"
72 |
--------------------------------------------------------------------------------
/poplibrary/local.properties:
--------------------------------------------------------------------------------
1 | #bintray
2 | bintray.user=resetmyself
3 | bintray.apikey=xxxxxxx
4 |
5 | #developer
6 | developer.id=FanChael
7 | developer.name=HuangLei
8 | developer.email=huangleililei@gmail.com
--------------------------------------------------------------------------------
/poplibrary/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 | # poplibrary
23 | -keep class pop.hl.com.poplibrary.bean.** { *; }
24 |
25 | # eventbus
26 | -keepattributes *Annotation*
27 | -keepclassmembers class ** {
28 | @org.greenrobot.eventbus.Subscribe ;
29 | }
30 | -keep enum org.greenrobot.eventbus.ThreadMode { *; }
31 |
32 | # Only required if you use AsyncExecutor
33 | -keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
34 | (java.lang.Throwable);
35 | }
36 |
37 | # rxjava+okhttp
38 | -dontwarn okhttp3.**
39 | -dontwarn okio.**
40 | -dontwarn javax.annotation.**
41 | -dontwarn org.conscrypt.**
42 | # A resource is loaded with a relative path so the package of this class must be preserved.
43 | -keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
44 | # rxjava retrofit2.**
45 | -dontwarn rx.internal.util.unsafe.*
46 | -dontwarn retrofit2.**
47 | -keep class retrofit2.** { *; }
48 | -keepattributes Exceptions
49 | -keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
50 | long producerIndex;
51 | long consumerIndex;
52 | }
53 | -keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
54 | rx.internal.util.atomic.LinkedQueueNode producerNode;
55 | }
56 | -keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
57 | rx.internal.util.atomic.LinkedQueueNode consumerNode;
58 | }
59 | -keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
60 | long producerNode;
61 | long consumerNode;
62 | }
63 | -keep class rx.schedulers.Schedulers {
64 | public static ;
65 | }
66 | -keep class rx.schedulers.Schedulers {
67 | public static ** test();
68 | }
69 | -keep class rx.schedulers.ImmediateScheduler {
70 | public ;
71 | }
72 | -keep class rx.schedulers.TestScheduler {
73 | public ;
74 | }
--------------------------------------------------------------------------------
/poplibrary/project.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/project.properties
--------------------------------------------------------------------------------
/poplibrary/src/androidTest/java/pop/hl/com/poplibrary/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary;
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)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("pop.hl.com.poplibrary.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/poplibrary/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/OnEventListenner.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary;
2 |
3 | import android.view.View;
4 |
5 | /*
6 | *@Description: 事件管理类
7 | *@Author: hl
8 | *@Time: 2019/2/15 15:38
9 | */
10 | public class OnEventListenner {
11 | /**
12 | * 自定义点击事件回调
13 | */
14 | public interface OnBaseClickListenner{
15 | void onClick(View view);
16 | }
17 | /**
18 | * 弹窗消失回调
19 | */
20 | public interface OnBaseListenner{
21 | void onDissmiss();
22 | }
23 | /**
24 | * 底部分享弹窗点击事件回调
25 | */
26 | public interface OnShareClickListenner{
27 | void onClick(View view, int pos);
28 | }
29 | /**
30 | * 登录注册弹窗点击事件回调
31 | * parmas - 表示当前弹窗对应的编辑框的内容(从上之下)的数组值
32 | * - 如果没有编辑框,则返回的是null(无编辑框内容返回)
33 | * callback_type - 是各个按钮点击类型LgRgPopView.CALLBACK_TYPE
34 | */
35 | public interface OnLRClickListenner{
36 | void onClick(View view, String[] parmas, LgRgPopView.CALLBACK_TYPE callback_type);
37 | }
38 |
39 | /**
40 | * 更新弹窗点击事件回调
41 | * 1. 如果是强制更新的情况,则会返回进度条控件progressBar给调用者,方便外部设置进度
42 | * 2. 如果是非强制更新,则不显示进度条控件; 此时显示暂不更新文本按钮
43 | */
44 | public interface OnUpdateClickListenner{
45 | void onClick(View view, View progressBar);
46 | }
47 |
48 | /**
49 | * 垂直列表弹窗条目点击事件
50 | */
51 | public interface OnVListClickListenner{
52 | void onClick(View view, int pos);
53 | }
54 |
55 | /**
56 | * 警告弹窗点击事件
57 | */
58 | public interface OnAlertClickListenner{
59 | void onClick(View view, AlertPopView.CALLBACK_TYPE callback_type);
60 | }
61 |
62 |
63 | /**
64 | * 地区弹窗点击事件
65 | */
66 | public interface OnLocationClickListenner{
67 | void onClick(View view, String[] locations);
68 | }
69 |
70 | /**
71 | * 单选选中弹窗点击事件
72 | */
73 | public interface OnItemSelectClickListenner{
74 | void onClick(View view, String item, int pos);
75 | }
76 |
77 | /**
78 | * 评论弹窗内容回调
79 | */
80 | public interface SendBackListener {
81 | void sendBack(String inputText);
82 | }
83 |
84 | /**
85 | * 相册/相机弹窗点击事件
86 | */
87 | public interface OnCameraClickListenner{
88 | void onClick(View view, CameraPicPopView.CALLBACK_TYPE callback_type);
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/VListPopView.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.LinearLayoutManager;
5 | import android.support.v7.widget.RecyclerView;
6 | import android.view.View;
7 | import android.widget.LinearLayout;
8 |
9 | import java.lang.ref.WeakReference;
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | import pop.hl.com.poplibrary.adapter.VListAdapter;
14 | import pop.hl.com.poplibrary.base.BasePop;
15 |
16 | /*
17 | *@Description: 垂直列表弹窗API + 包含点击事件回调
18 | *@Author: hl
19 | *@Time: 2019/2/12 14:38
20 | */
21 | public class VListPopView {
22 | /*
23 | *@Description: 垂直列表弹窗建造器
24 | *@Author: hl
25 | *@Time: 2019/2/15 16:04
26 | */
27 | public static class Builder {
28 | private WeakReference contextWeakReference;
29 | private BasePop.Builder builder = null;
30 | private BasePop.Builder bg_builder = null;
31 |
32 | public Builder(Context _context) {
33 | this.contextWeakReference = new WeakReference<>(_context);
34 | }
35 |
36 |
37 | /**
38 | * 垂直列表弹窗显示
39 | * @param _anchor
40 | * @return
41 | */
42 | public VListPopView.Builder create(View _anchor, int _popH) {
43 | ///< 创建弹窗视图
44 | builder = new BasePop.Builder(contextWeakReference.get())
45 | .create(_anchor)
46 | .setView(R.layout.pop_vlist)
47 | .setAnimation(BasePopView.ANIMATION.FOLD)
48 | .setBackgroundDrawable(0xffffffff)
49 | .setOutsideTouchable(true)
50 | .setWidthAndHeight(LinearLayout.LayoutParams.MATCH_PARENT, _popH);
51 | ///< 背景弹窗丫丫呀
52 | bg_builder = new BasePop.Builder(contextWeakReference.get())
53 | .create(_anchor)
54 | .setView(new View(contextWeakReference.get()))
55 | .setBackgroundDrawable(BasePop.bgColor)
56 | .setWidthAndHeight(LinearLayout.LayoutParams.MATCH_PARENT, -10000);
57 | return this;
58 | }
59 |
60 | /**
61 | * 显示垂直列表弹窗
62 | * @param _vListData
63 | * @param _onVListClickListenner
64 | * @return
65 | */
66 | public BasePop.Builder show(List _vListData,
67 | OnEventListenner.OnVListClickListenner _onVListClickListenner) {
68 | ///< 获取弹窗视图
69 | View popView = builder.getView();
70 | RecyclerView vListRv = popView.findViewById(R.id.pv_vListRv);
71 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(contextWeakReference.get());
72 | linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
73 | vListRv.setLayoutManager(linearLayoutManager);
74 | ///< 填充数据
75 | List vListData = new ArrayList<>();
76 | vListData.addAll(_vListData);
77 | VListAdapter vListAdapter = new VListAdapter(contextWeakReference.get(), vListData, _onVListClickListenner);
78 | vListRv.setAdapter(vListAdapter);
79 | ///< 背景弹窗走一走
80 | bg_builder.show(BasePopView.GRAVITY.LEFTTOP_TO_LEFTBOTTOM);
81 | builder.setOnDissmiss(new OnEventListenner.OnBaseListenner() {
82 | @Override
83 | public void onDissmiss() {
84 | bg_builder.dissmiss();
85 | }
86 | });
87 | ///< 显示弹窗
88 | builder.show(BasePopView.GRAVITY.LEFTTOP_TO_LEFTBOTTOM);
89 | return builder;
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/adapter/ItemSelectAdapter.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.adapter;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.os.Build;
6 | import android.support.annotation.NonNull;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.TextView;
12 |
13 | import java.lang.ref.WeakReference;
14 | import java.util.List;
15 |
16 | import pop.hl.com.poplibrary.OnEventListenner;
17 | import pop.hl.com.poplibrary.R;
18 | import pop.hl.com.poplibrary.utils.DensityUtil;
19 | import pop.hl.com.poplibrary.utils.ShapeUtil;
20 |
21 | /*
22 | *@Description: 垂直列表弹窗适配器
23 | *@Author: hl
24 | *@Time: 2019/2/15 14:21
25 | */
26 | public class ItemSelectAdapter extends RecyclerView.Adapter{
27 | private WeakReference contextWeakReference;
28 | private List vDataList = null;
29 | String fillColor, fontColor;
30 | private OnEventListenner.OnItemSelectClickListenner onItemSelectClickListenner = null;
31 |
32 | public ItemSelectAdapter(Context _context, List _vDataList,
33 | String _fillColor, String _fontColor,
34 | OnEventListenner.OnItemSelectClickListenner _onItemSelectClickListenner){
35 | this.contextWeakReference = new WeakReference<>(_context);
36 | this.vDataList = _vDataList;
37 | this.fillColor = _fillColor;
38 | this.fontColor = _fontColor;
39 | this.onItemSelectClickListenner = _onItemSelectClickListenner;
40 | }
41 |
42 | @NonNull
43 | @Override
44 | public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int i) {
45 | View view = LayoutInflater.from(contextWeakReference.get()).
46 | inflate(R.layout.pop_item_select_item, parent, false);
47 | return new ViewHolder(contextWeakReference.get(), view, fillColor, fontColor);
48 | }
49 |
50 | @Override
51 | public void onBindViewHolder(@NonNull ViewHolder viewHolder, int pos) {
52 | ///< 获取数据
53 | String title = (null == vDataList) ? null : vDataList.get(pos);
54 | ///< 绑定数据
55 | viewHolder.bindData(title, pos, onItemSelectClickListenner);
56 | }
57 |
58 | @Override
59 | public int getItemCount() {
60 | return (null == vDataList) ? 0 : vDataList.size();
61 | }
62 |
63 | /*
64 | *@Description: 垂直弹窗内容持有器
65 | *@Author: hl
66 | *@Time: 2019/2/15 15:24
67 | */
68 | public static class ViewHolder extends RecyclerView.ViewHolder{
69 | private String fillColor;
70 | private String fontColor;
71 | private TextView textView;
72 | public View itemView;
73 |
74 | public ViewHolder(@NonNull Context _context, View itemView, String _fillColor, String _fontColor) {
75 | super(itemView);
76 | this.fillColor = _fillColor;
77 | this.fontColor = _fontColor;
78 | this.itemView = itemView;
79 | if (null != fillColor && !fillColor.equals("")){
80 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
81 | itemView.setBackground(ShapeUtil.createShape(-1, DensityUtil.dip2px(_context, 6), -1, null, fillColor));
82 | } else {
83 | itemView.setBackgroundColor(Color.parseColor(fillColor));
84 | }
85 | }
86 | this.textView = itemView.findViewById(R.id.pisi_titleTv);
87 | if (null != fontColor && !fontColor.equals("")){
88 | textView.setTextColor(Color.parseColor(fontColor));
89 | }
90 | }
91 |
92 | public void bindData(String _name, final int pos,
93 | final OnEventListenner.OnItemSelectClickListenner _onItemSelectClickListenner) {
94 | textView.setText(_name);
95 | ///< 点击事件回调
96 | itemView.setOnClickListener(new View.OnClickListener() {
97 | @Override
98 | public void onClick(View v) {
99 | if (null != _onItemSelectClickListenner){
100 | _onItemSelectClickListenner.onClick(v, textView.getText().toString(), pos);
101 | }
102 | }
103 | });
104 | }
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/adapter/SpacesItemDecoration.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.adapter;
2 |
3 | import android.content.Context;
4 | import android.graphics.Rect;
5 | import android.support.v7.widget.RecyclerView;
6 | import android.view.View;
7 |
8 | /*
9 | *@Description: Rv间距
10 | *@Author: hl
11 | *@Time: 2019/2/15 16:37
12 | */
13 | public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
14 | private int space;
15 | private Context context;
16 | private int itemNum;
17 |
18 | public SpacesItemDecoration(Context _context, int _itemNum, int space) {
19 | this.space = space;
20 | this.itemNum = _itemNum;
21 | this.context = _context;
22 | }
23 |
24 | @Override
25 | public void getItemOffsets(Rect outRect, View view,
26 | RecyclerView parent, RecyclerView.State state) {
27 | //int position = parent.getChildAdapterPosition(view);
28 | outRect.left = space;
29 | outRect.right = space;
30 | outRect.bottom = space;
31 | outRect.top = space;
32 |
33 | // Add top margin only for the first item to avoid double space between items
34 | //if (parent.getChildAdapterPosition(view) == 0)
35 | // outRect.top = space;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/adapter/VListAdapter.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.adapter;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 | import android.support.v7.widget.RecyclerView;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.TextView;
10 |
11 | import java.lang.ref.WeakReference;
12 | import java.util.List;
13 |
14 | import pop.hl.com.poplibrary.OnEventListenner;
15 | import pop.hl.com.poplibrary.R;
16 | import pop.hl.com.poplibrary.utils.ScreenUtil;
17 |
18 | /*
19 | *@Description: 垂直列表弹窗适配器
20 | *@Author: hl
21 | *@Time: 2019/2/15 14:21
22 | */
23 | public class VListAdapter extends RecyclerView.Adapter{
24 | private WeakReference contextWeakReference;
25 | private List vDataList = null;
26 | private OnEventListenner.OnVListClickListenner onVListClickListenner = null;
27 |
28 | private boolean bHasBottomLine = true;
29 | private int revH;
30 |
31 | public VListAdapter(Context _context, List _vDataList,
32 | OnEventListenner.OnVListClickListenner _onVListClickListenner){
33 | this.contextWeakReference = new WeakReference<>(_context);
34 | this.vDataList = _vDataList;
35 | this.onVListClickListenner = _onVListClickListenner;
36 | }
37 |
38 | public VListAdapter(Context _context, List _vDataList,
39 | OnEventListenner.OnVListClickListenner _onVListClickListenner,
40 | int _revH,
41 | boolean _bNoBottomLine){
42 | this.contextWeakReference = new WeakReference<>(_context);
43 | this.vDataList = _vDataList;
44 | this.onVListClickListenner = _onVListClickListenner;
45 | this.bHasBottomLine = _bNoBottomLine;
46 | this.revH = _revH;
47 | }
48 |
49 | @NonNull
50 | @Override
51 | public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int i) {
52 | if (bHasBottomLine) {
53 | View view = LayoutInflater.from(contextWeakReference.get()).
54 | inflate(R.layout.pop_vlist_item, parent, false);
55 | return new ViewHolder(view);
56 | }else{
57 | View view = LayoutInflater.from(contextWeakReference.get()).
58 | inflate(R.layout.pop_vlist_nobottom_line_item, parent, false);
59 | return new ViewHolder(view, revH);
60 | }
61 | }
62 |
63 | @Override
64 | public void onBindViewHolder(@NonNull ViewHolder viewHolder, int pos) {
65 | ///< 获取数据
66 | String title = (null == vDataList) ? null : vDataList.get(pos);
67 | ///< 绑定数据
68 | viewHolder.bindData(title, pos, onVListClickListenner);
69 | }
70 |
71 | @Override
72 | public int getItemCount() {
73 | return (null == vDataList) ? 0 : vDataList.size();
74 | }
75 |
76 | /*
77 | *@Description: 垂直弹窗内容持有器
78 | *@Author: hl
79 | *@Time: 2019/2/15 15:24
80 | */
81 | public static class ViewHolder extends RecyclerView.ViewHolder{
82 | private TextView textView;
83 | public View itemView;
84 |
85 | public ViewHolder(@NonNull View itemView) {
86 | super(itemView);
87 | this.itemView = itemView;
88 | this.textView = itemView.findViewById(R.id.pvi_titleTv);
89 | }
90 | public ViewHolder(@NonNull View itemView, int revH) {
91 | super(itemView);
92 | this.itemView = itemView;
93 | this.textView = itemView.findViewById(R.id.pvi_titleTv);
94 | ///< 设置item的高度
95 | ScreenUtil.setRecyclerViewWH(itemView, -1, revH);
96 | ///< 设置item文本的大小 之前高度100对应了 15sp
97 | textView.setTextSize(revH > 100 ? (revH / 100 + 16) : 16);
98 | }
99 | public void bindData(String _name, final int pos,
100 | final OnEventListenner.OnVListClickListenner _onVListClickListenner) {
101 | textView.setText(_name);
102 | ///< 点击事件回调
103 | itemView.setOnClickListener(new View.OnClickListener() {
104 | @Override
105 | public void onClick(View v) {
106 | if (null != _onVListClickListenner){
107 | _onVListClickListenner.onClick(v, pos);
108 | }
109 | }
110 | });
111 | }
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/adapter/VSingleListAdapter.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.adapter;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 | import android.support.v7.widget.RecyclerView;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.TextView;
10 |
11 | import java.lang.ref.WeakReference;
12 | import java.util.List;
13 |
14 | import pop.hl.com.poplibrary.OnEventListenner;
15 | import pop.hl.com.poplibrary.R;
16 |
17 | /*
18 | *@Description: 垂直列表弹窗适配器
19 | *@Author: hl
20 | *@Time: 2019/2/15 14:21
21 | */
22 | public class VSingleListAdapter extends RecyclerView.Adapter{
23 | private WeakReference contextWeakReference;
24 | private List vDataList = null;
25 | private OnEventListenner.OnVListClickListenner onVListClickListenner = null;
26 | private int itemTextColor;
27 |
28 | public VSingleListAdapter(Context _context, List _vDataList,
29 | int _itemTextColor,
30 | OnEventListenner.OnVListClickListenner _onVListClickListenner){
31 | this.contextWeakReference = new WeakReference<>(_context);
32 | this.vDataList = _vDataList;
33 | this.itemTextColor = _itemTextColor;
34 | this.onVListClickListenner = _onVListClickListenner;
35 | }
36 |
37 | @NonNull
38 | @Override
39 | public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int i) {
40 | View view = LayoutInflater.from(contextWeakReference.get()).
41 | inflate(R.layout.pop_vsingle_list_item, parent, false);
42 | return new ViewHolder(view);
43 | }
44 |
45 | @Override
46 | public void onBindViewHolder(@NonNull ViewHolder viewHolder, int pos) {
47 | ///< 获取数据
48 | String title = (null == vDataList) ? null : vDataList.get(pos);
49 | ///< 绑定数据
50 | viewHolder.bindData(title, pos, itemTextColor, onVListClickListenner);
51 | }
52 |
53 | @Override
54 | public int getItemCount() {
55 | return (null == vDataList) ? 0 : vDataList.size();
56 | }
57 |
58 | /*
59 | *@Description: 垂直弹窗内容持有器
60 | *@Author: hl
61 | *@Time: 2019/2/15 15:24
62 | */
63 | public static class ViewHolder extends RecyclerView.ViewHolder{
64 | private TextView textView;
65 | public View itemView;
66 |
67 | public ViewHolder(@NonNull View itemView) {
68 | super(itemView);
69 | this.itemView = itemView;
70 | this.textView = itemView.findViewById(R.id.pvsi_titleTv);
71 | }
72 | public void bindData(String _name, final int pos,
73 | int _itemTextColor,
74 | final OnEventListenner.OnVListClickListenner _onVListClickListenner) {
75 | textView.setTextColor(_itemTextColor);
76 | textView.setText(_name);
77 | ///< 点击事件回调
78 | itemView.setOnClickListener(new View.OnClickListener() {
79 | @Override
80 | public void onClick(View v) {
81 | if (null != _onVListClickListenner){
82 | _onVListClickListenner.onClick(v, pos);
83 | }
84 | }
85 | });
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/bean/DownloadBean.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.bean;
2 |
3 | /**
4 | * Author:hl
5 | * Time: 2018/4/1 11:29
6 | * Des: This is DownloadBean
7 | */
8 | public class DownloadBean {
9 | private long contentLength;
10 | private long downBytes;
11 | private int status;
12 | private String message;
13 |
14 | public DownloadBean(long contentLength, long downBytes, int status, String message) {
15 | this.contentLength = contentLength;
16 | this.downBytes = downBytes;
17 | this.status = status;
18 | this.message = message;
19 | }
20 |
21 | public long getContentLength() {
22 | return contentLength;
23 | }
24 |
25 | public void setContentLength(long contentLength) {
26 | this.contentLength = contentLength;
27 | }
28 |
29 | public long getDownBytes() {
30 | return downBytes;
31 | }
32 |
33 | public void setDownBytes(long downBytes) {
34 | this.downBytes = downBytes;
35 | }
36 |
37 | public int getStatus() {
38 | return status;
39 | }
40 |
41 | public void setStatus(int status) {
42 | this.status = status;
43 | }
44 |
45 | public String getMessage() {
46 | return message;
47 | }
48 |
49 | public void setMessage(String message) {
50 | this.message = message;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/bean/LoactionBean.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.bean;
2 |
3 | import java.util.List;
4 |
5 | /*
6 | *@Description: 省、市、区列表对象
7 | *@Author: hl
8 | *@Time: 2019/3/18 12:08
9 | */
10 | public abstract class LoactionBean {
11 | /**
12 | * name : 北京市
13 | * city : [{"name":"北京市","area":["东城区","西城区","崇文区","宣武区","朝阳区","丰台区","石景山区","海淀区","门头沟区","房山区","通州区","顺义区","昌平区","大兴区","平谷区","怀柔区","密云县","延庆县"]}]
14 | */
15 |
16 | // private String provinceName;
17 | // private List cityList;
18 |
19 | // public LoactionBean(){}
20 | public abstract String getName();
21 |
22 | // public void setName(String provinceName) {
23 | // this.provinceName = provinceName;
24 | // }
25 |
26 | public abstract List getCity();
27 |
28 | // public void setCity(List cityList) {
29 | // this.cityList = cityList;
30 | // }
31 |
32 | public abstract static class CityBean {
33 | /**
34 | * name : 北京市
35 | * area : ["东城区","西城区","崇文区","宣武区","朝阳区","丰台区","石景山区","海淀区","门头沟区","房山区","通州区","顺义区","昌平区","大兴区","平谷区","怀柔区","密云县","延庆县"]
36 | */
37 |
38 | // private String cityName;
39 | // private List areaList;
40 |
41 | // public CityBean(){}
42 | public abstract String getName();
43 |
44 | // public void setName(String cityName) {
45 | // this.cityName = cityName;
46 | // }
47 |
48 | public abstract List getArea();
49 |
50 | // public void setArea(List area) {
51 | // this.areaList = area;
52 | // }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/update/ApiService.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.update;
2 |
3 | import okhttp3.ResponseBody;
4 | import retrofit2.Call;
5 | import retrofit2.http.GET;
6 | import retrofit2.http.Streaming;
7 | import retrofit2.http.Url;
8 | import rx.Observable;
9 |
10 | /**
11 | * Author:hl
12 | * Time: 2018/5/24 11:29
13 | * Des: This is ApiService
14 | */
15 | public interface ApiService {
16 | @Streaming ///< 注明为流文件,防止retrofit将大文件读入内存
17 | @GET()
18 | Observable down(@Url String url); ///< 通过@Url覆盖baseurl
19 | @Streaming ///< 注明为流文件,防止retrofit将大文件读入内存
20 | @GET()
21 | Call downSync(@Url String url); ///< 通过@Url覆盖baseurl
22 | }
23 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/update/FileResponseBody.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.update;
2 | import org.greenrobot.eventbus.EventBus;
3 |
4 | import java.io.IOException;
5 |
6 | import okhttp3.MediaType;
7 | import okhttp3.Response;
8 | import okhttp3.ResponseBody;
9 | import okio.Buffer;
10 | import okio.BufferedSource;
11 | import okio.ForwardingSource;
12 | import okio.Okio;
13 |
14 | /**
15 | * 下载文件
16 | * Author:hl
17 | * Time: 2018/5/24 11:31
18 | * Des: This is FileResponseBody
19 | */
20 | public class FileResponseBody extends ResponseBody {
21 |
22 | private Response originalResponse;//原结果
23 | private ProgressListener progressListener;
24 |
25 | public FileResponseBody(Response originalResponse) {
26 | this.originalResponse = originalResponse;
27 | }
28 |
29 | public FileResponseBody(Response responseBody, ProgressListener progressListener) {
30 | this.originalResponse = responseBody;
31 | this.progressListener = progressListener;
32 | }
33 |
34 | /**
35 | * 返回内容类型
36 | * @return
37 | */
38 | @Override
39 | public MediaType contentType() {
40 | return originalResponse.body().contentType();
41 | }
42 |
43 | /**
44 | * 返回内容长度,没有则返回-1
45 | * @return
46 | */
47 | @Override
48 | public long contentLength() {
49 | return originalResponse.body().contentLength();
50 | }
51 |
52 | /**
53 | * 返回缓存源,类似于io中的BufferedReader
54 | * @return
55 | */
56 | @Override
57 | public BufferedSource source() {
58 | return Okio.buffer(new ForwardingSource(originalResponse.body().source()) {
59 | long bytesReaded = 0;
60 | //返回读取到的长度
61 | @Override
62 | public long read(Buffer sink, long byteCount) throws IOException {
63 | long bytesRead = super.read(sink, byteCount);
64 | bytesReaded += bytesRead == -1 ? 0 : bytesRead;
65 | ///< 进度回调
66 | progressListener.onProgress(bytesReaded, contentLength(), bytesRead == -1);
67 | return bytesRead;
68 | }
69 | });
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/update/NetWork.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.update;
2 |
3 | import java.io.IOException;
4 | import java.util.concurrent.TimeUnit;
5 |
6 | import okhttp3.Interceptor;
7 | import okhttp3.OkHttpClient;
8 | import okhttp3.Response;
9 | import okhttp3.ResponseBody;
10 | import retrofit2.Call;
11 | import retrofit2.Retrofit;
12 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
13 | import rx.Observable;
14 |
15 | /**
16 | * Created by hl on 2018/4/1.
17 | */
18 |
19 | public class NetWork {
20 |
21 | private static NetWork netWork = null;
22 |
23 | public static NetWork getInstance() {
24 | if (null == netWork){
25 | netWork = new NetWork();
26 | }
27 | return netWork;
28 | }
29 |
30 | /**
31 | * 下载文件 - 超时10秒
32 | * @param url
33 | * @param progressListener
34 | * @return
35 | */
36 | public Observable down(String url, final ProgressListener progressListener) {
37 | OkHttpClient client = new OkHttpClient.Builder()
38 | .connectTimeout(10000, TimeUnit.MILLISECONDS)
39 | .addNetworkInterceptor(new Interceptor() {
40 | @Override
41 | public Response intercept(Chain chain) throws IOException {
42 | Response originalResponse = chain.proceed(chain.request());//对结果重新处理
43 | return originalResponse
44 | .newBuilder()
45 | .body(new FileResponseBody(originalResponse, progressListener))//将自定义的ResposeBody设置给它
46 | .build();
47 | }
48 | })
49 | .build();
50 |
51 | String baseUrl = url.substring(0, url.indexOf(":") + 1) + "//" + url.split("/")[2] + "/" ; ///< new URL(url).getHost()
52 | Retrofit retrofit = new Retrofit.Builder()
53 | .client(client)
54 | .baseUrl(baseUrl)
55 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
56 | .build();
57 | ApiService api = retrofit.create(ApiService.class);
58 | return api.down(url);
59 | }
60 |
61 | /**
62 | * 下载文件 - 超时10秒
63 | * @param url
64 | * @param progressListener
65 | * @return
66 | */
67 | public Call downSync(String url, final ProgressListener progressListener) {
68 | OkHttpClient client = new OkHttpClient.Builder()
69 | .connectTimeout(10000, TimeUnit.MILLISECONDS)
70 | .addNetworkInterceptor(new Interceptor() {
71 | @Override
72 | public Response intercept(Chain chain) throws IOException {
73 | Response originalResponse = chain.proceed(chain.request());//对结果重新处理
74 | return originalResponse
75 | .newBuilder()
76 | .body(new FileResponseBody(originalResponse, progressListener))//将自定义的ResposeBody设置给它
77 | .build();
78 | }
79 | })
80 | .build();
81 |
82 | String baseUrl = url.substring(0, url.indexOf(":") + 1) + "//" + url.split("/")[2] + "/" ; ///< new URL(url).getHost()
83 | Retrofit retrofit = new Retrofit.Builder()
84 | .client(client)
85 | .baseUrl(baseUrl)
86 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
87 | .build();
88 | ApiService api = retrofit.create(ApiService.class);
89 | return api.downSync(url);
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/update/ProgressListener.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.update;
2 |
3 | /**
4 | * Created by hl on 2018/4/1.
5 | */
6 |
7 | public interface ProgressListener {
8 | /**
9 | * @param progress 已经下载或上传字节数
10 | * @param total 总字节数
11 | * @param done 是否完成
12 | */
13 | void onProgress(long progress, long total, boolean done);
14 |
15 | /**
16 | * 结束状态
17 | * @param status -1 -> 发送中 0 -> 成功 1 -> 发送错误/失败 2 -> 读写异常
18 | * @param msg
19 | */
20 | void onFinish(int status, String msg);
21 | }
22 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/update/UpdateManager.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.update;
2 |
3 | import android.content.Context;
4 |
5 | import java.io.File;
6 | import java.io.IOException;
7 |
8 | import okhttp3.ResponseBody;
9 | import okio.BufferedSink;
10 | import okio.BufferedSource;
11 | import okio.Okio;
12 | import pop.hl.com.poplibrary.utils.AppUtil;
13 | import rx.Observer;
14 | import rx.Subscription;
15 | import rx.android.schedulers.AndroidSchedulers;
16 | import rx.functions.Func1;
17 | import rx.schedulers.Schedulers;
18 |
19 | /**
20 | * Created by hl on 2018/4/1.
21 | */
22 |
23 | public class UpdateManager {
24 | /**
25 | * 是否需要更新,需要则下载
26 | *
27 | * @param context 上下文
28 | * @param url 新版本地址
29 | * @param apkPath 本地apk保存路径
30 | */
31 | public static Subscription downloadApk(final Context context, final String _fileProvider, final String url, final String apkPath, final ProgressListener progressListener) {
32 | Subscription subscription = NetWork.getInstance().down(url, progressListener)
33 | .subscribeOn(Schedulers.io())
34 | .map(new Func1() {
35 | @Override
36 | public String call(ResponseBody responseBody) {
37 | try {
38 | writeFile(responseBody.source(), new File(apkPath));
39 | } catch (IOException e) {
40 | return "IO:" + e.getMessage();
41 | }
42 | return apkPath;
43 | }
44 | })
45 | .observeOn(AndroidSchedulers.mainThread())
46 | .subscribe(new Observer() {
47 | @Override
48 | public void onCompleted() {
49 | //unSubscribe(cd);
50 | }
51 |
52 | @Override
53 | public void onError(Throwable e) {
54 | //unSubscribe(cd);
55 | progressListener.onFinish(1, "error:" + e.getMessage());
56 | }
57 |
58 | @Override
59 | public void onNext(String o) {
60 | if (o.contains("IO:")){
61 | progressListener.onFinish(2, o);
62 | }
63 | else{
64 | progressListener.onFinish(0, "completed");
65 | ///< 下载完成,直接提示安装即可
66 | AppUtil.installApp(context, _fileProvider, apkPath);
67 | }
68 | }
69 | });
70 | return subscription;
71 | }
72 |
73 |
74 | /**
75 | * 写入文件
76 | * @param source - BufferedSource
77 | * @param file
78 | * @throws IOException
79 | */
80 | private static void writeFile(BufferedSource source, File file) throws IOException {
81 | if (!file.getParentFile().exists())
82 | file.getParentFile().mkdirs();
83 |
84 | if (file.exists())
85 | file.delete();
86 |
87 | BufferedSink bufferedSink = Okio.buffer(Okio.sink(file));
88 | bufferedSink.writeAll(source);
89 |
90 | bufferedSink.close();
91 | source.close();
92 | }
93 |
94 | /**
95 | * 解除订阅
96 | *
97 | * @param subscription 订阅关系集合
98 | */
99 | public static void unSubscribe(Subscription subscription) {
100 | if (subscription != null && !subscription.isUnsubscribed()){
101 | subscription.unsubscribe();
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/utils/AppUtil.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.utils;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.content.pm.ApplicationInfo;
6 | import android.content.pm.PackageInfo;
7 | import android.content.pm.PackageManager;
8 | import android.net.Uri;
9 | import android.os.Build;
10 | import android.support.v4.content.FileProvider;
11 |
12 | import java.io.File;
13 |
14 | /*
15 | *@Description: APP工具类
16 | *@Author: hl
17 | *@Time: 2019/2/22 12:01
18 | */
19 | public class AppUtil {
20 | /**
21 | * 获取应用程序名称
22 | */
23 | public static synchronized String getAppName(Context context) {
24 | try {
25 | PackageManager packageManager = context.getPackageManager();
26 | PackageInfo packageInfo = packageManager.getPackageInfo(
27 | context.getPackageName(), 0);
28 | int labelRes = packageInfo.applicationInfo.labelRes;
29 | return context.getResources().getString(labelRes);
30 | } catch (Exception e) {
31 | e.printStackTrace();
32 | }
33 | return "我很酷";
34 | }
35 |
36 | /**
37 | * 应用安装
38 | * @param context
39 | * @param fileProvider
40 | * @param apkPath
41 | */
42 | public static void installApp(Context context, String fileProvider, String apkPath){
43 | Intent intent = new Intent(Intent.ACTION_VIEW);
44 | ///< 判断是否是AndroidN以及更高的版本
45 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
46 | intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
47 | Uri contentUri = FileProvider.getUriForFile(context, fileProvider, new File(apkPath));
48 | intent.setDataAndType(contentUri, "application/vnd.android.package-archive");
49 | } else {
50 | intent.setDataAndType(Uri.fromFile(new File(apkPath)), "application/vnd.android.package-archive");
51 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
52 | }
53 | context.startActivity(intent);
54 | }
55 |
56 | /*
57 | * 採用了新的办法获取VersionCode。之前的失败是由于android中存在的一个BUG,通过
58 | * appInfo.publicSourceDir = apkPath;来修正这个问题,详情參见:
59 | * http://code.google.com/p/android/issues/detail?id=9151
60 | */
61 | public static int getApkVersionCode(Context context, String apkPath) {
62 | PackageManager pm = context.getPackageManager();
63 | PackageInfo info = pm.getPackageArchiveInfo(apkPath,
64 | PackageManager.GET_ACTIVITIES);
65 | if (info != null) {
66 | ApplicationInfo appInfo = info.applicationInfo;
67 | appInfo.sourceDir = apkPath;
68 | appInfo.publicSourceDir = apkPath;
69 | try {
70 | return info.versionCode;
71 | } catch (OutOfMemoryError e) {
72 | return -1;
73 | }
74 | }
75 | return -1;
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/utils/DensityUtil.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.utils;
2 |
3 | import android.content.Context;
4 | /**
5 | * Created by hl on 2018/3/13.
6 | */
7 |
8 | public class DensityUtil {
9 |
10 | /**
11 | * 根据手机的分辨率从 dp 的单位 转成为 px(像素)
12 | * @param context
13 | * @param dpValue
14 | * @return
15 | */
16 | public static int dip2px(Context context, float dpValue) {
17 | final float scale = context.getResources().getDisplayMetrics().density;
18 | return (int) (dpValue * scale + 0.5f);
19 | }
20 |
21 | /**
22 | * 根据手机的分辨率从 px(像素) 的单位 转成为 dp
23 | * @param context
24 | * @param pxValue
25 | * @return
26 | */
27 | public static int px2dip(Context context, float pxValue) {
28 | final float scale = context.getResources().getDisplayMetrics().density;
29 | return (int) (pxValue / scale + 0.5f);
30 | }
31 | }
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/utils/EditTextUtil.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.utils;
2 |
3 | import android.graphics.PorterDuff;
4 | import android.graphics.drawable.Drawable;
5 | import android.widget.EditText;
6 | import android.widget.TextView;
7 |
8 | import java.lang.reflect.Field;
9 |
10 | /*
11 | *@Description: 编辑框工具类
12 | *@Author: hl
13 | *@Time: 2019/2/20 9:29
14 | */
15 | public class EditTextUtil {
16 | /**
17 | * 代码设置光标颜色
18 | *
19 | * @param editText 你使用的EditText
20 | * @param color 光标颜色
21 | */
22 | public static void setCursorDrawableColor(EditText editText, int color) {
23 | try {
24 | Field fCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");//获取这个字段
25 | fCursorDrawableRes.setAccessible(true);//代表这个字段、方法等等可以被访问
26 | int mCursorDrawableRes = fCursorDrawableRes.getInt(editText);
27 |
28 | Field fEditor = TextView.class.getDeclaredField("mEditor");
29 | fEditor.setAccessible(true);
30 | Object editor = fEditor.get(editText);
31 |
32 | Class> clazz = editor.getClass();
33 | Field fCursorDrawable = clazz.getDeclaredField("mCursorDrawable");
34 | fCursorDrawable.setAccessible(true);
35 |
36 | Drawable[] drawables = new Drawable[2];
37 | drawables[0] = editText.getContext().getResources().getDrawable(mCursorDrawableRes);
38 | drawables[1] = editText.getContext().getResources().getDrawable(mCursorDrawableRes);
39 | drawables[0].setColorFilter(color, PorterDuff.Mode.SRC_IN);//SRC_IN 上下层都显示。下层居上显示。
40 | drawables[1].setColorFilter(color, PorterDuff.Mode.SRC_IN);
41 | fCursorDrawable.set(editor, drawables);
42 | } catch (Throwable ignored) {
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/utils/FileHelper.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.utils;
2 |
3 | import android.util.Log;
4 |
5 | import java.io.File;
6 | import java.io.FileInputStream;
7 | import java.text.DecimalFormat;
8 |
9 | /**
10 | * Created by hl on 2018/3/16.
11 | */
12 |
13 | /**
14 | * @1 Glide缓存图片初版本,没有使用子线程,不好.
15 | */
16 | public class FileHelper {
17 |
18 | public static final int SIZETYPE_B = 1;// 获取文件大小单位为B的double值
19 | public static final int SIZETYPE_KB = 2;// 获取文件大小单位为KB的double值
20 | public static final int SIZETYPE_MB = 3;// 获取文件大小单位为MB的double值
21 | public static final int SIZETYPE_GB = 4;// 获取文件大小单位为GB的double值
22 |
23 | /**
24 | * 获取文件指定文件的指定单位的大小
25 | *
26 | * @param filePath 文件路径
27 | * @param sizeType 获取大小的类型1为B、2为KB、3为MB、4为GB
28 | * @return double值的大小
29 | */
30 | public static double getFileOrFilesSize(String filePath, int sizeType) {
31 | File file = new File(filePath);
32 | long blockSize = 0;
33 | try {
34 | if (file.isDirectory()) {
35 | blockSize = getFileSizes(file);
36 | } else {
37 | blockSize = getFileSize(file);
38 | }
39 | } catch (Exception e) {
40 | e.printStackTrace();
41 | Log.e("获取文件大小", "获取失败!");
42 | }
43 | return FormetFileSize(blockSize, sizeType);
44 | }
45 |
46 | /**
47 | * 获取指定文件大小
48 | *
49 | * @param file
50 | * @return
51 | * @throws Exception
52 | */
53 | private static long getFileSize(File file) throws Exception {
54 | long size = 0;
55 | if (file.exists()) {
56 | FileInputStream fis = null;
57 | fis = new FileInputStream(file);
58 | size = fis.available();
59 | } else {
60 | file.createNewFile();
61 | Log.e("获取文件大小", "文件不存在!");
62 | }
63 | return size;
64 | }
65 |
66 | /**
67 | * 获取指定文件夹
68 | *
69 | * @param f
70 | * @return
71 | * @throws Exception
72 | */
73 | private static long getFileSizes(File f) throws Exception {
74 | long size = 0;
75 | File flist[] = f.listFiles();
76 | for (int i = 0; i < flist.length; i++) {
77 | if (flist[i].isDirectory()) {
78 | size = size + getFileSizes(flist[i]);
79 | } else {
80 | size = size + getFileSize(flist[i]);
81 | }
82 | }
83 | return size;
84 | }
85 |
86 | /**
87 | * 转换文件大小
88 | *
89 | * @param fileS
90 | * @return
91 | */
92 | private static String FormetFileSize(long fileS) {
93 | DecimalFormat df = new DecimalFormat("#.00");
94 | String fileSizeString = "";
95 | String wrongSize = "0B";
96 | if (fileS == 0) {
97 | return wrongSize;
98 | }
99 | if (fileS < 1024) {
100 | fileSizeString = df.format((double) fileS) + "B";
101 | } else if (fileS < 1048576) {
102 | fileSizeString = df.format((double) fileS / 1024) + "KB";
103 | } else if (fileS < 1073741824) {
104 | fileSizeString = df.format((double) fileS / 1048576) + "MB";
105 | } else {
106 | fileSizeString = df.format((double) fileS / 1073741824) + "GB";
107 | }
108 | return fileSizeString;
109 | }
110 |
111 | /**
112 | * 转换文件大小,指定转换的类型
113 | *
114 | * @param fileS
115 | * @param sizeType
116 | * @return
117 | */
118 | private static double FormetFileSize(long fileS, int sizeType) {
119 | DecimalFormat df = new DecimalFormat("#.00");
120 | double fileSizeLong = 0;
121 | switch (sizeType) {
122 | case SIZETYPE_B:
123 | fileSizeLong = Double.valueOf(df.format((double) fileS));
124 | break;
125 | case SIZETYPE_KB:
126 | fileSizeLong = Double.valueOf(df.format((double) fileS / 1024));
127 | break;
128 | case SIZETYPE_MB:
129 | fileSizeLong = Double.valueOf(df.format((double) fileS / 1048576));
130 | break;
131 | case SIZETYPE_GB:
132 | fileSizeLong = Double.valueOf(df
133 | .format((double) fileS / 1073741824));
134 | break;
135 | default:
136 | break;
137 | }
138 | return fileSizeLong;
139 | }
140 | }
141 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/utils/MD5Util.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.utils;
2 |
3 | import android.content.Context;
4 | import android.content.pm.PackageInfo;
5 | import android.content.pm.PackageManager;
6 | import android.content.pm.Signature;
7 |
8 | import java.security.MessageDigest;
9 | import java.security.NoSuchAlgorithmException;
10 |
11 | /**
12 | * Created by hl on 2018/3/23.
13 | */
14 |
15 | public class MD5Util {
16 | /**
17 | * 加密
18 | * @param plaintext 明文
19 | * @return ciphertext 密文
20 | */
21 | public final static String encrypt(String plaintext) {
22 | char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
23 | 'a', 'b', 'c', 'd', 'e', 'f' };
24 | try {
25 | byte[] btInput = plaintext.getBytes();
26 | // 获得MD5摘要算法的 MessageDigest 对象
27 | MessageDigest mdInst = MessageDigest.getInstance("MD5");
28 | // 使用指定的字节更新摘要
29 | mdInst.update(btInput);
30 | // 获得密文
31 | byte[] md = mdInst.digest();
32 | // 把密文转换成十六进制的字符串形式
33 | int j = md.length;
34 | char str[] = new char[j * 2];
35 | int k = 0;
36 | for (int i = 0; i < j; i++) {
37 | byte byte0 = md[i];
38 | str[k++] = hexDigits[byte0 >>> 4 & 0xf];
39 | str[k++] = hexDigits[byte0 & 0xf];
40 | }
41 | return new String(str);
42 | } catch (Exception e) {
43 | return null;
44 | }
45 | }
46 |
47 | /**
48 | * 获取apk签名md5
49 | * @param context
50 | * @param apkPath
51 | * @return
52 | * @throws Exception
53 | */
54 | public static String getApkSignatureMD5New(Context context, String apkPath) throws Exception {
55 | try {
56 | PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES);
57 | Signature[] signs = packageInfo.signatures;
58 | Signature sign = signs[0];
59 | String signStr = encryptionMD5(sign.toByteArray());
60 | return signStr;
61 | } catch (PackageManager.NameNotFoundException e) {
62 | e.printStackTrace();
63 | }
64 | return "";
65 | }
66 |
67 | /**
68 | * MD5加密
69 | * @param byteStr 需要加密的内容
70 | * @return 返回 byteStr的md5值
71 | */
72 | public static String encryptionMD5(byte[] byteStr) {
73 | MessageDigest messageDigest = null;
74 | StringBuffer md5StrBuff = new StringBuffer();
75 | try {
76 | messageDigest = MessageDigest.getInstance("MD5");
77 | messageDigest.reset();
78 | messageDigest.update(byteStr);
79 | byte[] byteArray = messageDigest.digest();
80 | for (int i = 0; i < byteArray.length; i++) {
81 | if (Integer.toHexString(0xFF & byteArray[i]).length() == 1) {
82 | md5StrBuff.append("0").append(Integer.toHexString(0xFF & byteArray[i]));
83 | } else {
84 | md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
85 | }
86 | }
87 | } catch (NoSuchAlgorithmException e) {
88 | e.printStackTrace();
89 | }
90 | return md5StrBuff.toString();
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/utils/ProgressUtil.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.utils;
2 |
3 | import android.graphics.drawable.ClipDrawable;
4 | import android.graphics.drawable.ColorDrawable;
5 | import android.graphics.drawable.Drawable;
6 | import android.graphics.drawable.LayerDrawable;
7 | import android.view.Gravity;
8 | import android.widget.ProgressBar;
9 |
10 | /*
11 | *@Description: 进度条工具类
12 | *@Author: hl
13 | *@Time: 2019/2/20 9:29
14 | */
15 | public class ProgressUtil {
16 | /**
17 | * 设置进度颜色
18 | * @param progressBar
19 | * @param backgroundColor
20 | * @param progressColor
21 | */
22 | public static void setColors(ProgressBar progressBar, int backgroundColor, int progressColor) {
23 | //Background
24 | ClipDrawable bgClipDrawable = new ClipDrawable(new ColorDrawable(backgroundColor), Gravity.LEFT, ClipDrawable.HORIZONTAL);
25 | bgClipDrawable.setLevel(10000);
26 | //Progress
27 | ClipDrawable progressClip = new ClipDrawable(new ColorDrawable(progressColor), Gravity.LEFT, ClipDrawable.HORIZONTAL);
28 | //Setup LayerDrawable and assign to progressBar
29 | Drawable[] progressDrawables = {bgClipDrawable, progressClip/*second*/, progressClip};
30 | LayerDrawable progressLayerDrawable = new LayerDrawable(progressDrawables);
31 | progressLayerDrawable.setId(0, android.R.id.background);
32 | progressLayerDrawable.setId(1, android.R.id.secondaryProgress);
33 | progressLayerDrawable.setId(2, android.R.id.progress);
34 |
35 | progressBar.setProgressDrawable(progressLayerDrawable);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/utils/ScreenUtil.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.utils;
2 |
3 | import android.content.Context;
4 | import android.support.constraint.ConstraintLayout;
5 | import android.support.v7.widget.RecyclerView;
6 | import android.util.DisplayMetrics;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | /**
11 | * Author:hl
12 | * Time: 2018/5/24 11:34
13 | * Des: This is ScreenUtil
14 | */
15 | public class ScreenUtil
16 | {
17 | /**
18 | * 获取屏幕宽度
19 | * @param mContext
20 | * @return
21 | */
22 | public static int getScreenW(Context mContext)
23 | {
24 | return getScreenWH(mContext, false);
25 | }
26 |
27 | /**
28 | * 获取屏幕高度
29 | * @param mContext
30 | * @return
31 | */
32 | public static int getScreenH(Context mContext)
33 | {
34 | return getScreenWH(mContext, true);
35 | }
36 |
37 | private static int getScreenWH(Context mContext, boolean bGetH){
38 | DisplayMetrics dm = new DisplayMetrics();
39 | dm = mContext.getResources().getDisplayMetrics();
40 | int screen_w = dm.widthPixels;
41 | int screen_h = dm.heightPixels;
42 | ///< 如果宽大于高,宽高互换
43 | if(screen_w > screen_h)
44 | {
45 | int temp = screen_h;
46 | screen_h = screen_w;
47 | screen_w = temp;
48 | }
49 | if (bGetH){
50 | return screen_h;
51 | }
52 | return screen_w;
53 | }
54 |
55 | /**
56 | * 设置控件间距
57 | * @param v
58 | * @param _l
59 | * @param _t
60 | * @param _r
61 | * @param _b
62 | */
63 | public static void setMargin(View v, int _l, int _t, int _r, int _b)
64 | {
65 | if (v.getLayoutParams() instanceof ViewGroup.MarginLayoutParams)
66 | {
67 | ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
68 | int l = _l, t = _t,
69 | r = _r, b = _b;
70 | if (-10000 == _l)
71 | {
72 | l = p.leftMargin;
73 | }
74 | if (-10000 == _r)
75 | {
76 | r = p.rightMargin;
77 | }
78 | if (-10000 == _t)
79 | {
80 | t = p.topMargin;
81 | }
82 | if (-10000 == _b)
83 | {
84 | b = p.bottomMargin;
85 | }
86 | p.setMargins(l, t, r, b);
87 | v.requestLayout();
88 | }
89 | }
90 |
91 | /**
92 | * 获取控件的间距
93 | * @param v
94 | * @param flag 0 - 3 -> 左上右下
95 | * @return 其他flag为-1
96 | */
97 | public static int getMargin(View v, int flag)
98 | {
99 | if (v.getLayoutParams() instanceof ViewGroup.MarginLayoutParams)
100 | {
101 | ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
102 | if (0 == flag){
103 | return p.leftMargin;
104 | }
105 | if (1 == flag){
106 | return p.topMargin;
107 | }
108 | if (2 == flag){
109 | return p.rightMargin;
110 | }
111 | if (3 == flag){
112 | return p.bottomMargin;
113 | }
114 | }
115 | return -1;
116 | }
117 |
118 | /**
119 | * 设置父组件是ConstraintLayout的控件的宽高
120 | * @param v
121 | * @param w -1表示无效设置
122 | * @param h -1表示无效设置
123 | */
124 | public static void setConstraintLayoutWH(View v, int w, int h) {
125 | ConstraintLayout.LayoutParams layoutT = (ConstraintLayout.LayoutParams) v.getLayoutParams();
126 | if (-1 != w){
127 | layoutT.width = w;
128 | }
129 | if (-1 != h){
130 | layoutT.height = h;
131 | }
132 | v.setLayoutParams(layoutT);
133 | }
134 |
135 | /**
136 | * 设置父组件是RecyclerView的控件的宽高
137 | * @param v
138 | * @param w -1表示无效设置
139 | * @param h -1表示无效设置
140 | */
141 | public static void setRecyclerViewWH(View v, int w, int h) {
142 | RecyclerView.LayoutParams layoutT = (RecyclerView.LayoutParams) v.getLayoutParams();
143 | v.setLayoutParams(layoutT);
144 | if (-1 != w){
145 | layoutT.width = w;
146 | }
147 | if (-1 != h){
148 | layoutT.height = h;
149 | }
150 | v.setLayoutParams(layoutT);
151 | }
152 | }
153 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/utils/ShapeUtil.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.utils;
2 |
3 | import android.graphics.Color;
4 | import android.graphics.drawable.GradientDrawable;
5 |
6 | /*
7 | *@Description: Shape创建工具
8 | *@Author: hl
9 | *@Time: 2019/2/19 16:42
10 | */
11 | public class ShapeUtil {
12 | /**
13 | * 创建一个Shape - GradientDrawable
14 | *
15 | * @param _strokeWidth - 沿边线厚度;无需传入-1
16 | * @param _roundRadius - 圆角半径;无需传入-1
17 | * @param _shape - shape绘制类型(rectangle、oval等);无需传入-1,将采用默认的GradientDrawable.RECTANGLE
18 | * @param _strokeColor - 沿边线颜色;无需传入null/""
19 | * @param _fillColor - 内部填充颜色
20 | * @return
21 | */
22 | public static GradientDrawable createShape(int _strokeWidth,
23 | int _roundRadius, int _shape,
24 | String _strokeColor, String _fillColor) {
25 | int strokeWidth = _strokeWidth; // px not dp
26 | int roundRadius = _roundRadius; // px not dp
27 | int strokeColor = -1;
28 | if (null != _strokeColor && !_strokeColor.equals("")) {
29 | strokeColor = Color.parseColor(_strokeColor);
30 | }
31 | int fillColor = Color.parseColor(_fillColor);
32 |
33 | GradientDrawable gd = new GradientDrawable();
34 | gd.setColor(fillColor);
35 |
36 | if (-1 == _shape) {
37 | gd.setShape(GradientDrawable.RECTANGLE);
38 | } else {
39 | gd.setShape(_shape);
40 | }
41 |
42 | if (-1 != roundRadius) {
43 | gd.setCornerRadius(roundRadius);
44 | }
45 | if (-1 != strokeWidth && -1 != strokeColor) {
46 | gd.setStroke(strokeWidth, strokeColor);
47 | }
48 | return gd;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/poplibrary/src/main/java/pop/hl/com/poplibrary/utils/WebviewUtil.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary.utils;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.os.Build;
5 | import android.webkit.WebSettings;
6 | import android.webkit.WebView;
7 |
8 | public class WebviewUtil {
9 | /**
10 | * 初始化Webview
11 | */
12 | @SuppressLint("JavascriptInterface")
13 | public static WebView initWebView(WebView detialWv, Object obj, String interfaceName) {
14 | WebSettings settings = detialWv.getSettings();
15 | ///< 开启JavaScript支持
16 | detialWv.getSettings().setJavaScriptEnabled(true);
17 | ///< 加入JS接口
18 | if (null != obj && null != interfaceName && !interfaceName.equals("")) {
19 | detialWv.addJavascriptInterface(obj, interfaceName);
20 | }
21 | // 设置WebView是否支持使用屏幕控件或手势进行缩放,默认是true,支持缩放
22 | detialWv.getSettings().setSupportZoom(false);
23 | ///< 设置WebView是否使用其内置的变焦机制,该机制结合屏幕缩放控件使用,默认是false,不使用内置变焦机制。
24 | detialWv.getSettings().setBuiltInZoomControls(false);
25 | ///< 设置是否开启DOM存储API权限,默认false,未开启,设置为true,WebView能够使用DOM storage API
26 | detialWv.getSettings().setDomStorageEnabled(true);
27 | ///< 触摸焦点起作用.如果不设置,则在点击网页文本输入框时,不能弹出软键盘及不响应其他的一些事件。
28 | detialWv.requestFocus();
29 | ///< 设置此属性,可任意比例缩放,设置webview推荐使用的窗口
30 | detialWv.getSettings().setUseWideViewPort(false);
31 | ///< 设置webview加载的页面的模式,缩放至屏幕的大小
32 | detialWv.getSettings().setLoadWithOverviewMode(true);
33 | ///< 允许webview对文件的操作
34 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
35 | detialWv.getSettings().setAllowUniversalAccessFromFileURLs(true);
36 | }
37 | detialWv.getSettings().setAllowFileAccess(true);
38 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
39 | detialWv.getSettings().setAllowFileAccessFromFileURLs(true);
40 | }
41 | ///< 设置加载状态
42 | // android 5.0以上默认不支持Mixed Content
43 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
44 | detialWv.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
45 | }
46 | return detialWv;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_fold_in_from_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_fold_in_from_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_fold_out_from_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_fold_out_from_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_in_from_center.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_in_from_leftbottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_in_from_lefttop.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_in_from_rightbottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_in_from_righttop.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_out_from_center.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_out_from_leftbottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_out_from_lefttop.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_out_from_rightbottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_out_from_righttop.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_translate_in_from_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_translate_in_from_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_translate_in_from_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_translate_in_from_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_translate_out_from_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_translate_out_from_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_translate_out_from_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/anim/anim_pop_translate_out_from_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-hdpi/profile_icon_close_n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-hdpi/profile_icon_close_n.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-hdpi/profile_icon_password.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-hdpi/profile_icon_password.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-hdpi/profile_icon_username.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-hdpi/profile_icon_username.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-hdpi/profile_icon_verify.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-hdpi/profile_icon_verify.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-hdpi/share_circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-hdpi/share_circle.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-hdpi/share_link.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-hdpi/share_link.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-hdpi/share_qq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-hdpi/share_qq.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-hdpi/share_sina.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-hdpi/share_sina.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-hdpi/share_wechat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-hdpi/share_wechat.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-hdpi/update_bg_app_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-hdpi/update_bg_app_top.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-hdpi/update_img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-hdpi/update_img.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-mdpi/profile_icon_close_n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-mdpi/profile_icon_close_n.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-mdpi/profile_icon_password.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-mdpi/profile_icon_password.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-mdpi/profile_icon_username.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-mdpi/profile_icon_username.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-mdpi/profile_icon_verify.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-mdpi/profile_icon_verify.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-mdpi/share_circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-mdpi/share_circle.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-mdpi/share_link.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-mdpi/share_link.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-mdpi/share_qq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-mdpi/share_qq.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-mdpi/share_sina.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-mdpi/share_sina.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-mdpi/share_wechat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-mdpi/share_wechat.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xhdpi/profile_icon_close_n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xhdpi/profile_icon_close_n.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xhdpi/profile_icon_password.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xhdpi/profile_icon_password.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xhdpi/profile_icon_username.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xhdpi/profile_icon_username.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xhdpi/profile_icon_verify.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xhdpi/profile_icon_verify.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xhdpi/share_circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xhdpi/share_circle.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xhdpi/share_link.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xhdpi/share_link.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xhdpi/share_qq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xhdpi/share_qq.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xhdpi/share_sina.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xhdpi/share_sina.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xhdpi/share_wechat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xhdpi/share_wechat.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxhdpi/profile_icon_close_n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxhdpi/profile_icon_close_n.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxhdpi/profile_icon_password.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxhdpi/profile_icon_password.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxhdpi/profile_icon_username.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxhdpi/profile_icon_username.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxhdpi/profile_icon_verify.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxhdpi/profile_icon_verify.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxhdpi/share_circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxhdpi/share_circle.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxhdpi/share_link.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxhdpi/share_link.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxhdpi/share_qq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxhdpi/share_qq.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxhdpi/share_sina.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxhdpi/share_sina.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxhdpi/share_wechat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxhdpi/share_wechat.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxxhdpi/profile_icon_close_n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxxhdpi/profile_icon_close_n.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxxhdpi/profile_icon_password.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxxhdpi/profile_icon_password.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxxhdpi/profile_icon_username.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxxhdpi/profile_icon_username.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxxhdpi/profile_icon_verify.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxxhdpi/profile_icon_verify.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxxhdpi/share_circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxxhdpi/share_circle.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxxhdpi/share_link.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxxhdpi/share_link.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxxhdpi/share_qq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxxhdpi/share_qq.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxxhdpi/share_sina.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxxhdpi/share_sina.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable-xxxhdpi/share_wechat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FanChael/CommonPopupWindow/49f13b28314fc718b5e48888103845b26fb71cd9/poplibrary/src/main/res/drawable-xxxhdpi/share_wechat.png
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable/corner_blue_bg_b_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable/corner_blue_bg_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable/corner_bottom_white_bg_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
8 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable/corner_middle_white_bg_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable/corner_translucent_a_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
8 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable/corner_white_bg_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable/corners_review_cansend.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | />
10 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable/corners_review_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | />
10 |
13 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable/corners_review_send.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | />
9 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable/nocorner_translucent__c_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable/nocorner_translucent_b_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable/nocorner_translucent_gradiant_bottom_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
10 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable/nocorner_translucent_gradiant_top_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
10 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/drawable/progressbar.xml:
--------------------------------------------------------------------------------
1 |
2 | -
3 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | -
27 |
28 |
29 |
30 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_bottom_shareborder.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
19 |
20 |
26 |
27 |
33 |
34 |
43 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_bottom_shareborder_grid_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
23 |
24 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_bottom_shareborder_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
25 |
26 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_bottom_shareborder_tencent.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
16 |
17 |
30 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_camerapic.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
22 |
23 |
32 |
33 |
38 |
39 |
49 |
50 |
51 |
55 |
56 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_comment.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
28 |
29 |
42 |
43 |
44 |
58 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_item_select.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
20 |
21 |
30 |
31 |
38 |
39 |
50 |
51 |
52 |
53 |
54 |
63 |
64 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_item_select_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
24 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_location.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
22 |
23 |
31 |
32 |
40 |
41 |
47 |
48 |
54 |
55 |
61 |
62 |
63 |
69 |
70 |
81 |
82 |
92 |
93 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_normal_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
20 |
21 |
31 |
32 |
42 |
43 |
44 |
45 |
55 |
56 |
66 |
67 |
68 |
69 |
82 |
83 |
88 |
89 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_normal_update.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
19 |
20 |
21 |
26 |
27 |
33 |
34 |
35 |
36 |
41 |
42 |
56 |
57 |
58 |
59 |
71 |
72 |
73 |
91 |
92 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_third_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
21 |
22 |
31 |
32 |
33 |
41 |
42 |
47 |
48 |
57 |
58 |
65 |
66 |
75 |
76 |
77 |
82 |
83 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_vlist.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
20 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_vlist_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
19 |
20 |
21 |
28 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_vlist_nobottom_line_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
22 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_vsingle_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
20 |
21 |
27 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_vsingle_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
16 |
17 |
27 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/layout/pop_webview.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
23 |
24 |
30 |
31 |
32 |
33 |
42 |
43 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #00000000
4 | #60000000
5 | #80000000
6 | #9e9e9e9e
7 | #9e9e9e
8 | #777777
9 | #ffffff
10 | #f0008DCF
11 | #009BFB
12 | #e4e4e4
13 | #000000
14 | #515055
15 | #f6f6f6
16 |
17 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | poplibrary
3 |
4 |
5 | 取消
6 | 确定
7 | 分享至
8 |
9 |
10 | 获取验证码
11 | 登录
12 | 立即注册
13 | 请输入手机号
14 | 请输入手机号/用户名
15 | 请输入验证码
16 | 请输入密码
17 |
18 |
19 | 更新
20 | 暂不更新
21 |
22 |
23 | 选择地区
24 |
25 |
--------------------------------------------------------------------------------
/poplibrary/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
14 |
18 |
22 |
26 |
30 |
34 |
38 |
42 |
46 |
47 |
--------------------------------------------------------------------------------
/poplibrary/src/test/java/pop/hl/com/poplibrary/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package pop.hl.com.poplibrary;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':poplibrary'
2 |
--------------------------------------------------------------------------------