97个文件已修改
69个文件已添加
1 文件已重命名
3个文件已删除
| | |
| | | <show-object-properties value="true" /> |
| | | <loaded-nodes /> |
| | | </component> |
| | | <component name="DBNavigator.Project.DatabaseConsoleManager"> |
| | | <connection id="d6bf7476-27cf-4020-a354-8497d385be14"> |
| | | <console name="Connection" type="STANDARD" schema="" session="Main" /> |
| | | </connection> |
| | | <connection id="403d0ab5-a4eb-4f7d-9c18-c4584be9eed1"> |
| | | <console name="Connection 1" type="STANDARD" schema="" session="Main" /> |
| | | </connection> |
| | | </component> |
| | | <component name="DBNavigator.Project.DatabaseEditorStateManager"> |
| | | <last-used-providers /> |
| | | </component> |
| | |
| | | <component name="DBNavigator.Project.ExecutionManager"> |
| | | <retain-sticky-names value="false" /> |
| | | </component> |
| | | <component name="DBNavigator.Project.ObjectQuickFilterManager"> |
| | | <last-used-operator value="EQUAL" /> |
| | | <filters /> |
| | | </component> |
| | | <component name="DBNavigator.Project.ParserDiagnosticsManager"> |
| | | <diagnostics-history /> |
| | | </component> |
| | | <component name="DBNavigator.Project.Settings"> |
| | | <connections /> |
| | | <connections> |
| | | <connection id="d6bf7476-27cf-4020-a354-8497d385be14" active="true" signed="true"> |
| | | <database> |
| | | <name value="Connection" /> |
| | | <description value="" /> |
| | | <database-type value="SQLITE" /> |
| | | <config-type value="BASIC" /> |
| | | <database-version value="9999.0" /> |
| | | <driver-source value="BUILTIN" /> |
| | | <driver-library value="" /> |
| | | <driver value="" /> |
| | | <url-type value="FILE" /> |
| | | <host value="" /> |
| | | <port value="" /> |
| | | <database value="" /> |
| | | <files> |
| | | <file path="sqlite.db" schema="main" /> |
| | | </files> |
| | | <type value="NONE" /> |
| | | <user value="" /> |
| | | <deprecated-pwd value="" /> |
| | | </database> |
| | | <properties> |
| | | <auto-commit value="false" /> |
| | | </properties> |
| | | <ssh-settings> |
| | | <active value="false" /> |
| | | <proxy-host value="" /> |
| | | <proxy-port value="22" /> |
| | | <proxy-user value="" /> |
| | | <deprecated-proxy-pwd value="" /> |
| | | <auth-type value="PASSWORD" /> |
| | | <key-file value="" /> |
| | | <key-passphrase value="" /> |
| | | </ssh-settings> |
| | | <ssl-settings> |
| | | <active value="false" /> |
| | | <certificate-authority-file value="" /> |
| | | <client-certificate-file value="" /> |
| | | <client-key-file value="" /> |
| | | </ssl-settings> |
| | | <details> |
| | | <charset value="UTF-8" /> |
| | | <session-management value="true" /> |
| | | <ddl-file-binding value="true" /> |
| | | <database-logging value="true" /> |
| | | <connect-automatically value="true" /> |
| | | <restore-workspace value="true" /> |
| | | <restore-workspace-deep value="false" /> |
| | | <environment-type value="default" /> |
| | | <connectivity-timeout value="10" /> |
| | | <idle-time-to-disconnect value="30" /> |
| | | <idle-time-to-disconnect-pool value="5" /> |
| | | <credential-expiry-time value="10" /> |
| | | <max-connection-pool-size value="7" /> |
| | | <alternative-statement-delimiter value="" /> |
| | | </details> |
| | | <object-filters hide-empty-schemas="false" hide-pseudo-columns="false"> |
| | | <object-type-filter> |
| | | <object-type name="SCHEMA" enabled="true" /> |
| | | <object-type name="USER" enabled="true" /> |
| | | <object-type name="ROLE" enabled="true" /> |
| | | <object-type name="PRIVILEGE" enabled="true" /> |
| | | <object-type name="CHARSET" enabled="true" /> |
| | | <object-type name="TABLE" enabled="true" /> |
| | | <object-type name="VIEW" enabled="true" /> |
| | | <object-type name="MATERIALIZED_VIEW" enabled="true" /> |
| | | <object-type name="NESTED_TABLE" enabled="true" /> |
| | | <object-type name="COLUMN" enabled="true" /> |
| | | <object-type name="INDEX" enabled="true" /> |
| | | <object-type name="CONSTRAINT" enabled="true" /> |
| | | <object-type name="DATASET_TRIGGER" enabled="true" /> |
| | | <object-type name="DATABASE_TRIGGER" enabled="true" /> |
| | | <object-type name="SYNONYM" enabled="true" /> |
| | | <object-type name="SEQUENCE" enabled="true" /> |
| | | <object-type name="PROCEDURE" enabled="true" /> |
| | | <object-type name="FUNCTION" enabled="true" /> |
| | | <object-type name="PACKAGE" enabled="true" /> |
| | | <object-type name="TYPE" enabled="true" /> |
| | | <object-type name="TYPE_ATTRIBUTE" enabled="true" /> |
| | | <object-type name="ARGUMENT" enabled="true" /> |
| | | <object-type name="DIMENSION" enabled="true" /> |
| | | <object-type name="CLUSTER" enabled="true" /> |
| | | <object-type name="DBLINK" enabled="true" /> |
| | | </object-type-filter> |
| | | <object-name-filters /> |
| | | </object-filters> |
| | | </connection> |
| | | <connection id="403d0ab5-a4eb-4f7d-9c18-c4584be9eed1" active="true" signed="true"> |
| | | <database> |
| | | <name value="Connection 1" /> |
| | | <description value="" /> |
| | | <database-type value="SQLITE" /> |
| | | <config-type value="BASIC" /> |
| | | <database-version value="9999.0" /> |
| | | <driver-source value="BUILTIN" /> |
| | | <driver-library value="" /> |
| | | <driver value="" /> |
| | | <url-type value="FILE" /> |
| | | <host value="" /> |
| | | <port value="" /> |
| | | <database value="" /> |
| | | <files> |
| | | <file path="sqlite.db" schema="main" /> |
| | | </files> |
| | | <type value="NONE" /> |
| | | <user value="" /> |
| | | <deprecated-pwd value="" /> |
| | | </database> |
| | | <properties> |
| | | <auto-commit value="false" /> |
| | | </properties> |
| | | <ssh-settings> |
| | | <active value="false" /> |
| | | <proxy-host value="" /> |
| | | <proxy-port value="22" /> |
| | | <proxy-user value="" /> |
| | | <deprecated-proxy-pwd value="" /> |
| | | <auth-type value="PASSWORD" /> |
| | | <key-file value="" /> |
| | | <key-passphrase value="" /> |
| | | </ssh-settings> |
| | | <ssl-settings> |
| | | <active value="false" /> |
| | | <certificate-authority-file value="" /> |
| | | <client-certificate-file value="" /> |
| | | <client-key-file value="" /> |
| | | </ssl-settings> |
| | | <details> |
| | | <charset value="UTF-8" /> |
| | | <session-management value="true" /> |
| | | <ddl-file-binding value="true" /> |
| | | <database-logging value="true" /> |
| | | <connect-automatically value="true" /> |
| | | <restore-workspace value="true" /> |
| | | <restore-workspace-deep value="false" /> |
| | | <environment-type value="default" /> |
| | | <connectivity-timeout value="10" /> |
| | | <idle-time-to-disconnect value="30" /> |
| | | <idle-time-to-disconnect-pool value="5" /> |
| | | <credential-expiry-time value="10" /> |
| | | <max-connection-pool-size value="7" /> |
| | | <alternative-statement-delimiter value="" /> |
| | | </details> |
| | | <object-filters hide-empty-schemas="false" hide-pseudo-columns="false"> |
| | | <object-type-filter> |
| | | <object-type name="SCHEMA" enabled="true" /> |
| | | <object-type name="USER" enabled="true" /> |
| | | <object-type name="ROLE" enabled="true" /> |
| | | <object-type name="PRIVILEGE" enabled="true" /> |
| | | <object-type name="CHARSET" enabled="true" /> |
| | | <object-type name="TABLE" enabled="true" /> |
| | | <object-type name="VIEW" enabled="true" /> |
| | | <object-type name="MATERIALIZED_VIEW" enabled="true" /> |
| | | <object-type name="NESTED_TABLE" enabled="true" /> |
| | | <object-type name="COLUMN" enabled="true" /> |
| | | <object-type name="INDEX" enabled="true" /> |
| | | <object-type name="CONSTRAINT" enabled="true" /> |
| | | <object-type name="DATASET_TRIGGER" enabled="true" /> |
| | | <object-type name="DATABASE_TRIGGER" enabled="true" /> |
| | | <object-type name="SYNONYM" enabled="true" /> |
| | | <object-type name="SEQUENCE" enabled="true" /> |
| | | <object-type name="PROCEDURE" enabled="true" /> |
| | | <object-type name="FUNCTION" enabled="true" /> |
| | | <object-type name="PACKAGE" enabled="true" /> |
| | | <object-type name="TYPE" enabled="true" /> |
| | | <object-type name="TYPE_ATTRIBUTE" enabled="true" /> |
| | | <object-type name="ARGUMENT" enabled="true" /> |
| | | <object-type name="DIMENSION" enabled="true" /> |
| | | <object-type name="CLUSTER" enabled="true" /> |
| | | <object-type name="DBLINK" enabled="true" /> |
| | | </object-type-filter> |
| | | <object-name-filters /> |
| | | </object-filters> |
| | | </connection> |
| | | </connections> |
| | | <browser-settings> |
| | | <general> |
| | | <display-mode value="TABBED" /> |
| | |
| | | </deviceKey> |
| | | </Target> |
| | | </targetSelectedWithDropDown> |
| | | <timeTargetWasSelectedWithDropDown value="2023-06-02T09:12:50.343936200Z" /> |
| | | <timeTargetWasSelectedWithDropDown value="2023-08-22T08:53:37.805871200Z" /> |
| | | </component> |
| | | </project> |
| | |
| | | applicationId "com.application.zhangshi_app_android" |
| | | minSdk 24 |
| | | targetSdk 33 |
| | | versionCode 1 |
| | | versionName getVersionName() |
| | | versionCode 3 |
| | | versionName "1.0.2" |
| | | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
| | | ndk { |
| | | //APP的build.gradle设置支持的SO库架构 |
| | | abiFilters 'armeabi', 'armeabi-v7a', 'x86' |
| | | } |
| | | } |
| | | signingConfigs { |
| | | release { |
| | |
| | | minifyEnabled true //启用Proguard |
| | | shrinkResources true //是否清理无用资源,依赖于minifyEnabled |
| | | zipAlignEnabled true //是否启用zipAlign压缩 |
| | | // signingConfig signingConfigs.release |
| | | signingConfig signingConfigs.release |
| | | // proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' |
| | | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
| | | } |
| | |
| | | minifyEnabled false //不启用Proguard |
| | | shrinkResources false //是否清理无用资源,依赖于minifyEnabled |
| | | zipAlignEnabled false //是否启用zipAlign压缩 |
| | | // signingConfig signingConfigs.release |
| | | signingConfig signingConfigs.release |
| | | } |
| | | } |
| | | |
| | | |
| | | buildFeatures{ |
| | | dataBinding = true |
| | | viewBinding true |
| | |
| | | implementation project(path: ':app_base') |
| | | |
| | | } |
| | | |
| | | def getVersionName() { |
| | | return new Date().format("yyyyMMddHHmmss", TimeZone.getTimeZone("UTC")) |
| | | } |
| | |
| | | |
| | | # If you keep the line number information, uncomment this to |
| | | # hide the original source file name. |
| | | #-renamesourcefileattribute SourceFile |
| | | #-renamesourcefileattribute SourceFile |
| | | |
| | | # 指定代码的压缩级别 |
| | | -optimizationpasses 5 |
| | | # 是否使用大小写混合 |
| | | -dontusemixedcaseclassnames |
| | | # 是否混淆第三方jar |
| | | -dontskipnonpubliclibraryclasses |
| | | # 混淆时是否做预校验 |
| | | -dontpreverify |
| | | # 混淆时是否记录日志 |
| | | -verbose |
| | | # 混淆时所采用的算法 |
| | | -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* |
| | | -ignorewarnings |
| | | #-ignorewarnings |
| | | -keepattributes *Annotation* |
| | | -keepattributes Signature |
| | | -keepattributes SourceFile,LineNumberTable |
| | | -keepattributes Exceptions,InnerClasses,Deprecated,LocalVariable*Table,Synthetic,EnclosingMethod |
| | | -keepattributes EnclosingMethod |
| | | |
| | | # Keep native methods |
| | | -keepclassmembers class * { |
| | | native <methods>; |
| | | } |
| | | |
| | | -keepclassmembers class * implements java.io.Serializable { |
| | | static final long serialVersionUID; |
| | | private static final java.io.ObjectStreamField[] serialPersistentFields; |
| | | private void writeObject(java.io.ObjectOutputStream); |
| | | private void readObject(java.io.ObjectInputStream); |
| | | java.lang.Object writeReplace(); |
| | | java.lang.Object readResolve(); |
| | | } |
| | | |
| | | -keep public class * implements java.io.Serializable { |
| | | public *; |
| | | } |
| | | |
| | | -keep class **.R$*{ |
| | | *; |
| | | } |
| | | |
| | | -keepclassmembers class * { |
| | | public <init>(org.json.JSONObject); |
| | | } |
| | | |
| | | -keepclasseswithmembernames class * { |
| | | native <methods>; |
| | | } |
| | | |
| | | -keepclassmembers enum * { |
| | | public static **[] values(); |
| | | public static ** valueOf(java.lang.String); |
| | | } |
| | | |
| | | |
| | | # 对于带有回调函数的onXXEvent、**On*Listener的,不能被混淆 |
| | | -keepclassmembers class * { |
| | | void *(**On*Event); |
| | | void *(**On*Listener); |
| | | } |
| | | |
| | | # OKHttp |
| | | -dontwarn okhttp3.internal.platform.** |
| | | -dontwarn org.conscrypt.** |
| | | -dontwarn org.bouncycastle.** |
| | | -dontwarn org.openjsse.** |
| | | |
| | | |
| | | # ButterKnife |
| | | -keep class butterknife.** { *; } |
| | | -dontwarn butterknife.internal.** |
| | | -keep class **$$ViewBinder { *; } |
| | | -keepclasseswithmembernames class * { |
| | | @butterknife.* <fields>; |
| | | } |
| | | -keepclasseswithmembernames class * { |
| | | @butterknife.* <methods>; |
| | | } |
| | | |
| | | # Glide |
| | | -keep public class * implements com.bumptech.glide.module.GlideModule |
| | | -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** { |
| | | **[] $VALUES; |
| | | public *; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | # 保留我们自定义控件(继承自View)不被混淆 |
| | | -keep public class * extends android.view.View{ |
| | | *** get*(); |
| | | void set*(***); |
| | | public <init>(android.content.Context); |
| | | public <init>(android.content.Context, android.util.AttributeSet); |
| | | public <init>(android.content.Context, android.util.AttributeSet, int); |
| | | } |
| | | -keep class com.shuyu.gsyvideoplayer.video.** { *; } |
| | | -dontwarn com.shuyu.gsyvideoplayer.video.** |
| | | -keep class com.shuyu.gsyvideoplayer.video.base.** { *; } |
| | | -dontwarn com.shuyu.gsyvideoplayer.video.base.** |
| | | -keep class com.shuyu.gsyvideoplayer.utils.** { *; } |
| | | -dontwarn com.shuyu.gsyvideoplayer.utils.** |
| | | -keep class tv.danmaku.ijk.** { *; } |
| | | -dontwarn tv.danmaku.ijk.** |
| | | |
| | | -keep class androidx.media3.** {*;} |
| | | -keep interface androidx.media3.** |
| | | |
| | | -keep class com.google.android.exoplayer2.** {*;} |
| | | -keep interface com.google.android.exoplayer2.** |
| | | |
| | | -keep class com.shuyu.alipay.** {*;} |
| | | -keep interface com.shuyu.alipay.** |
| | | |
| | | -keep class com.alivc.**{*;} |
| | | -keep class com.aliyun.**{*;} |
| | | -keep class com.cicada.**{*;} |
| | | -dontwarn com.alivc.** |
| | | -dontwarn com.aliyun.** |
| | | -dontwarn com.cicada.** |
| | |
| | | xmlns:tools="http://schemas.android.com/tools" |
| | | > |
| | | <!-- 网络相关 --> |
| | | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
| | | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
| | | <uses-permission android:name="android.permission.INTERNET" /> |
| | | <uses-permission android:name="android.permission.READ_CONTACTS" /> <!-- 外部存储 --> |
| | | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 网络状态 --> |
| | | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- wifi状态 --> |
| | | <uses-permission android:name="android.permission.INTERNET" /> <!-- 网络 --> |
| | | |
| | | <uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> <!-- 发送通知 --> |
| | | <uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" /> <!-- 下载器隐藏通知 --> |
| | | <uses-permission android:name="android.permission.READ_CONTACTS" /> <!-- 读取联系人 --> |
| | | <uses-permission android:name="android.permission.WRITE_CONTACTS" /> <!-- 写入联系人 --> |
| | | <!-- Android 13开始,如果你的应用targetSdk指定到了33或以上,READ_EXTERNAL_STORAGE权限就完全失去了作用,需要细化 --> |
| | | <uses-permission |
| | | android:name="android.permission.READ_EXTERNAL_STORAGE" |
| | |
| | | <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> |
| | | <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> |
| | | <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> |
| | | <uses-permission android:name="android.permission.RECORD_AUDIO" /> <!-- Android 13版本适配,细化存储权限,READ_EXTERNAL_STORAGE无法再使用 --> |
| | | <uses-permission android:name="android.permission.RECORD_AUDIO" /> |
| | | <!-- Android 13版本适配,细化存储权限下面三种,READ_EXTERNAL_STORAGE无法再使用 --> |
| | | <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" /> |
| | | <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" /> |
| | | <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" /> |
| | |
| | | android:allowBackup="true" |
| | | android:dataExtractionRules="@xml/data_extraction_rules" |
| | | android:fullBackupContent="@xml/backup_rules" |
| | | android:icon="@mipmap/ic_launcher" |
| | | android:icon="@mipmap/ic_logo" |
| | | android:label="@string/app_name" |
| | | android:maxAspectRatio="2.4" |
| | | android:networkSecurityConfig="@xml/network_security_config" |
| | |
| | | <!-- 安装APP --> |
| | | <provider |
| | | android:name="androidx.core.content.FileProvider" |
| | | android:authorities="${applicationId}.fileprovider" |
| | | android:authorities="${applicationId}.file-provider" |
| | | android:exported="false" |
| | | android:grantUriPermissions="true"> |
| | | <meta-data |
| | |
| | | android:name=".ui.function.ContactsActivity" |
| | | android:exported="false" /> |
| | | <activity |
| | | android:name=".ui.function.ContactsImportActivity" |
| | | android:exported="false" /> |
| | | <activity |
| | | android:name=".ui.function.PersonalNotepadActivity" |
| | | android:exported="false" /> |
| | | <activity |
| | |
| | | <activity |
| | | android:name=".ui.function.PetActivity" |
| | | android:exported="false" /> |
| | | <activity |
| | | android:name=".ui.function.ImageSelectActivity" |
| | | android:exported="false" /> |
| | | <activity android:name=".ui.home.GenealogyActivity" |
| | | android:exported="false"/> |
| | | <activity android:name=".ui.TestActivity" |
| | | /> |
| | | <activity android:name=".ui.personal_center.LoginBgChangeActivity" |
| | | android:exported="false"/> |
| | | <activity android:name=".ui.home.HomeMindMapActivity" |
| | | android:exported="false"/> |
| | | |
| | | <!-- 查看大图 --> |
| | | <activity |
| | | android:name=".ui.ImagePreviewActivity" |
| | | android:launchMode="singleTop" |
| | | android:screenOrientation="portrait" /> |
| | | |
| | | <!-- 播放视频(自适应方向) --> |
| | | <activity |
| | | android:name=".ui.VideoPlayActivity" |
| | | android:launchMode="singleTop" |
| | | android:theme="@style/FullScreenTheme" /> |
| | | |
| | | <!-- 播放视频(竖屏方向) --> |
| | | <activity |
| | | android:name=".ui.VideoPlayActivity$Portrait" |
| | | android:launchMode="singleTop" |
| | | android:screenOrientation="portrait" |
| | | android:theme="@style/FullScreenTheme" /> |
| | | |
| | | <!-- 播放视频(横屏方向) --> |
| | | <activity |
| | | android:name=".ui.VideoPlayActivity$Landscape" |
| | | android:launchMode="singleTop" |
| | | android:screenOrientation="landscape" |
| | | android:theme="@style/FullScreenTheme" /> |
| | | |
| | | </application> |
| | | |
| | | </manifest> |
New file |
| | |
| | | // https://d3js.org v7.8.5 Copyright 2010-2023 Mike Bostock |
| | | !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).d3=t.d3||{})}(this,(function(t){"use strict";function n(t,n){return null==t||null==n?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function e(t,n){return null==t||null==n?NaN:n<t?-1:n>t?1:n>=t?0:NaN}function r(t){let r,o,a;function u(t,n,e=0,i=t.length){if(e<i){if(0!==r(n,n))return i;do{const r=e+i>>>1;o(t[r],n)<0?e=r+1:i=r}while(e<i)}return e}return 2!==t.length?(r=n,o=(e,r)=>n(t(e),r),a=(n,e)=>t(n)-e):(r=t===n||t===e?t:i,o=t,a=t),{left:u,center:function(t,n,e=0,r=t.length){const i=u(t,n,e,r-1);return i>e&&a(t[i-1],n)>-a(t[i],n)?i-1:i},right:function(t,n,e=0,i=t.length){if(e<i){if(0!==r(n,n))return i;do{const r=e+i>>>1;o(t[r],n)<=0?e=r+1:i=r}while(e<i)}return e}}}function i(){return 0}function o(t){return null===t?NaN:+t}const a=r(n),u=a.right,c=a.left,f=r(o).center;var s=u;const l=d(y),h=d((function(t){const n=y(t);return(t,e,r,i,o)=>{n(t,e,(r<<=2)+0,(i<<=2)+0,o<<=2),n(t,e,r+1,i+1,o),n(t,e,r+2,i+2,o),n(t,e,r+3,i+3,o)}}));function d(t){return function(n,e,r=e){if(!((e=+e)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:i,width:o,height:a}=n;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((a=Math.floor(void 0!==a?a:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!a||!e&&!r)return n;const u=e&&t(e),c=r&&t(r),f=i.slice();return u&&c?(p(u,f,i,o,a),p(u,i,f,o,a),p(u,f,i,o,a),g(c,i,f,o,a),g(c,f,i,o,a),g(c,i,f,o,a)):u?(p(u,i,f,o,a),p(u,f,i,o,a),p(u,i,f,o,a)):c&&(g(c,i,f,o,a),g(c,f,i,o,a),g(c,i,f,o,a)),n}}function p(t,n,e,r,i){for(let o=0,a=r*i;o<a;)t(n,e,o,o+=r,1)}function g(t,n,e,r,i){for(let o=0,a=r*i;o<r;++o)t(n,e,o,o+a,r)}function y(t){const n=Math.floor(t);if(n===t)return function(t){const n=2*t+1;return(e,r,i,o,a)=>{if(!((o-=a)>=i))return;let u=t*r[i];const c=a*t;for(let t=i,n=i+c;t<n;t+=a)u+=r[Math.min(o,t)];for(let t=i,f=o;t<=f;t+=a)u+=r[Math.min(o,t+c)],e[t]=u/n,u-=r[Math.max(i,t-c)]}}(t);const e=t-n,r=2*t+1;return(t,i,o,a,u)=>{if(!((a-=u)>=o))return;let c=n*i[o];const f=u*n,s=f+u;for(let t=o,n=o+f;t<n;t+=u)c+=i[Math.min(a,t)];for(let n=o,l=a;n<=l;n+=u)c+=i[Math.min(a,n+f)],t[n]=(c+e*(i[Math.max(o,n-s)]+i[Math.min(a,n+s)]))/r,c-=i[Math.max(o,n-f)]}}function v(t,n){let e=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&++e;else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(i=+i)>=i&&++e}return e}function _(t){return 0|t.length}function b(t){return!(t>0)}function m(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function x(t,n){let e,r=0,i=0,o=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(e=n-i,i+=e/++r,o+=e*(n-i));else{let a=-1;for(let u of t)null!=(u=n(u,++a,t))&&(u=+u)>=u&&(e=u-i,i+=e/++r,o+=e*(u-i))}if(r>1)return o/(r-1)}function w(t,n){const e=x(t,n);return e?Math.sqrt(e):e}function M(t,n){let e,r;if(void 0===n)for(const n of t)null!=n&&(void 0===e?n>=n&&(e=r=n):(e>n&&(e=n),r<n&&(r=n)));else{let i=-1;for(let o of t)null!=(o=n(o,++i,t))&&(void 0===e?o>=o&&(e=r=o):(e>o&&(e=o),r<o&&(r=o)))}return[e,r]}class T{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let e=0;for(let r=0;r<this._n&&r<32;r++){const i=n[r],o=t+i,a=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);a&&(n[e++]=a),t=o}return n[e]=t,this._n=e+1,this}valueOf(){const t=this._partials;let n,e,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(n=o,e=t[--i],o=n+e,r=e-(o-n),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(e=2*r,n=o+e,e==n-o&&(o=n))}return o}}class InternMap extends Map{constructor(t,n=N){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const[n,e]of t)this.set(n,e)}get(t){return super.get(A(this,t))}has(t){return super.has(A(this,t))}set(t,n){return super.set(S(this,t),n)}delete(t){return super.delete(E(this,t))}}class InternSet extends Set{constructor(t,n=N){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const n of t)this.add(n)}has(t){return super.has(A(this,t))}add(t){return super.add(S(this,t))}delete(t){return super.delete(E(this,t))}}function A({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):e}function S({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):(t.set(r,e),e)}function E({_intern:t,_key:n},e){const r=n(e);return t.has(r)&&(e=t.get(r),t.delete(r)),e}function N(t){return null!==t&&"object"==typeof t?t.valueOf():t}function k(t){return t}function C(t,...n){return F(t,k,k,n)}function P(t,...n){return F(t,Array.from,k,n)}function z(t,n){for(let e=1,r=n.length;e<r;++e)t=t.flatMap((t=>t.pop().map((([n,e])=>[...t,n,e]))));return t}function $(t,n,...e){return F(t,k,n,e)}function D(t,n,...e){return F(t,Array.from,n,e)}function R(t){if(1!==t.length)throw new Error("duplicate key");return t[0]}function F(t,n,e,r){return function t(i,o){if(o>=r.length)return e(i);const a=new InternMap,u=r[o++];let c=-1;for(const t of i){const n=u(t,++c,i),e=a.get(n);e?e.push(t):a.set(n,[t])}for(const[n,e]of a)a.set(n,t(e,o));return n(a)}(t,0)}function q(t,n){return Array.from(n,(n=>t[n]))}function U(t,...n){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");t=Array.from(t);let[e]=n;if(e&&2!==e.length||n.length>1){const r=Uint32Array.from(t,((t,n)=>n));return n.length>1?(n=n.map((n=>t.map(n))),r.sort(((t,e)=>{for(const r of n){const n=O(r[t],r[e]);if(n)return n}}))):(e=t.map(e),r.sort(((t,n)=>O(e[t],e[n])))),q(t,r)}return t.sort(I(e))}function I(t=n){if(t===n)return O;if("function"!=typeof t)throw new TypeError("compare is not a function");return(n,e)=>{const r=t(n,e);return r||0===r?r:(0===t(e,e))-(0===t(n,n))}}function O(t,n){return(null==t||!(t>=t))-(null==n||!(n>=n))||(t<n?-1:t>n?1:0)}var B=Array.prototype.slice;function Y(t){return()=>t}const L=Math.sqrt(50),j=Math.sqrt(10),H=Math.sqrt(2);function X(t,n,e){const r=(n-t)/Math.max(0,e),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=L?10:o>=j?5:o>=H?2:1;let u,c,f;return i<0?(f=Math.pow(10,-i)/a,u=Math.round(t*f),c=Math.round(n*f),u/f<t&&++u,c/f>n&&--c,f=-f):(f=Math.pow(10,i)*a,u=Math.round(t/f),c=Math.round(n/f),u*f<t&&++u,c*f>n&&--c),c<u&&.5<=e&&e<2?X(t,n,2*e):[u,c,f]}function G(t,n,e){if(!((e=+e)>0))return[];if((t=+t)===(n=+n))return[t];const r=n<t,[i,o,a]=r?X(n,t,e):X(t,n,e);if(!(o>=i))return[];const u=o-i+1,c=new Array(u);if(r)if(a<0)for(let t=0;t<u;++t)c[t]=(o-t)/-a;else for(let t=0;t<u;++t)c[t]=(o-t)*a;else if(a<0)for(let t=0;t<u;++t)c[t]=(i+t)/-a;else for(let t=0;t<u;++t)c[t]=(i+t)*a;return c}function V(t,n,e){return X(t=+t,n=+n,e=+e)[2]}function W(t,n,e){e=+e;const r=(n=+n)<(t=+t),i=r?V(n,t,e):V(t,n,e);return(r?-1:1)*(i<0?1/-i:i)}function Z(t,n,e){let r;for(;;){const i=V(t,n,e);if(i===r||0===i||!isFinite(i))return[t,n];i>0?(t=Math.floor(t/i)*i,n=Math.ceil(n/i)*i):i<0&&(t=Math.ceil(t*i)/i,n=Math.floor(n*i)/i),r=i}}function K(t){return Math.max(1,Math.ceil(Math.log(v(t))/Math.LN2)+1)}function Q(){var t=k,n=M,e=K;function r(r){Array.isArray(r)||(r=Array.from(r));var i,o,a,u=r.length,c=new Array(u);for(i=0;i<u;++i)c[i]=t(r[i],i,r);var f=n(c),l=f[0],h=f[1],d=e(c,l,h);if(!Array.isArray(d)){const t=h,e=+d;if(n===M&&([l,h]=Z(l,h,e)),(d=G(l,h,e))[0]<=l&&(a=V(l,h,e)),d[d.length-1]>=h)if(t>=h&&n===M){const t=V(l,h,e);isFinite(t)&&(t>0?h=(Math.floor(h/t)+1)*t:t<0&&(h=(Math.ceil(h*-t)+1)/-t))}else d.pop()}for(var p=d.length,g=0,y=p;d[g]<=l;)++g;for(;d[y-1]>h;)--y;(g||y<p)&&(d=d.slice(g,y),p=y-g);var v,_=new Array(p+1);for(i=0;i<=p;++i)(v=_[i]=[]).x0=i>0?d[i-1]:l,v.x1=i<p?d[i]:h;if(isFinite(a)){if(a>0)for(i=0;i<u;++i)null!=(o=c[i])&&l<=o&&o<=h&&_[Math.min(p,Math.floor((o-l)/a))].push(r[i]);else if(a<0)for(i=0;i<u;++i)if(null!=(o=c[i])&&l<=o&&o<=h){const t=Math.floor((l-o)*a);_[Math.min(p,t+(d[t]<=o))].push(r[i])}}else for(i=0;i<u;++i)null!=(o=c[i])&&l<=o&&o<=h&&_[s(d,o,0,p)].push(r[i]);return _}return r.value=function(n){return arguments.length?(t="function"==typeof n?n:Y(n),r):t},r.domain=function(t){return arguments.length?(n="function"==typeof t?t:Y([t[0],t[1]]),r):n},r.thresholds=function(t){return arguments.length?(e="function"==typeof t?t:Y(Array.isArray(t)?B.call(t):t),r):e},r}function J(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e<n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e<i||void 0===e&&i>=i)&&(e=i)}return e}function tt(t,n){let e,r=-1,i=-1;if(void 0===n)for(const n of t)++i,null!=n&&(e<n||void 0===e&&n>=n)&&(e=n,r=i);else for(let o of t)null!=(o=n(o,++i,t))&&(e<o||void 0===e&&o>=o)&&(e=o,r=i);return r}function nt(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e>n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e>i||void 0===e&&i>=i)&&(e=i)}return e}function et(t,n){let e,r=-1,i=-1;if(void 0===n)for(const n of t)++i,null!=n&&(e>n||void 0===e&&n>=n)&&(e=n,r=i);else for(let o of t)null!=(o=n(o,++i,t))&&(e>o||void 0===e&&o>=o)&&(e=o,r=i);return r}function rt(t,n,e=0,r=1/0,i){if(n=Math.floor(n),e=Math.floor(Math.max(0,e)),r=Math.floor(Math.min(t.length-1,r)),!(e<=n&&n<=r))return t;for(i=void 0===i?O:I(i);r>e;){if(r-e>600){const o=r-e+1,a=n-e+1,u=Math.log(o),c=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*c*(o-c)/o)*(a-o/2<0?-1:1);rt(t,n,Math.max(e,Math.floor(n-a*c/o+f)),Math.min(r,Math.floor(n+(o-a)*c/o+f)),i)}const o=t[n];let a=e,u=r;for(it(t,e,n),i(t[r],o)>0&&it(t,e,r);a<u;){for(it(t,a,u),++a,--u;i(t[a],o)<0;)++a;for(;i(t[u],o)>0;)--u}0===i(t[e],o)?it(t,e,u):(++u,it(t,u,r)),u<=n&&(e=u+1),n<=u&&(r=u-1)}return t}function it(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function ot(t,e=n){let r,i=!1;if(1===e.length){let o;for(const a of t){const t=e(a);(i?n(t,o)>0:0===n(t,t))&&(r=a,o=t,i=!0)}}else for(const n of t)(i?e(n,r)>0:0===e(n,n))&&(r=n,i=!0);return r}function at(t,n,e){if(t=Float64Array.from(function*(t,n){if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)null!=(r=n(r,++e,t))&&(r=+r)>=r&&(yield r)}}(t,e)),(r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return nt(t);if(n>=1)return J(t);var r,i=(r-1)*n,o=Math.floor(i),a=J(rt(t,o).subarray(0,o+1));return a+(nt(t.subarray(o+1))-a)*(i-o)}}function ut(t,n,e=o){if((r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,a=Math.floor(i),u=+e(t[a],a,t);return u+(+e(t[a+1],a+1,t)-u)*(i-a)}}function ct(t,n,e=o){if(!isNaN(n=+n)){if(r=Float64Array.from(t,((n,r)=>o(e(t[r],r,t)))),n<=0)return et(r);if(n>=1)return tt(r);var r,i=Uint32Array.from(t,((t,n)=>n)),a=r.length-1,u=Math.floor(a*n);return rt(i,u,0,a,((t,n)=>O(r[t],r[n]))),(u=ot(i.subarray(0,u+1),(t=>r[t])))>=0?u:-1}}function ft(t){return Array.from(function*(t){for(const n of t)yield*n}(t))}function st(t,n){return[t,n]}function lt(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r<i;)o[r]=t+r*e;return o}function ht(t,e=n){if(1===e.length)return et(t,e);let r,i=-1,o=-1;for(const n of t)++o,(i<0?0===e(n,n):e(n,r)<0)&&(r=n,i=o);return i}var dt=pt(Math.random);function pt(t){return function(n,e=0,r=n.length){let i=r-(e=+e);for(;i;){const r=t()*i--|0,o=n[i+e];n[i+e]=n[r+e],n[r+e]=o}return n}}function gt(t){if(!(i=t.length))return[];for(var n=-1,e=nt(t,yt),r=new Array(e);++n<e;)for(var i,o=-1,a=r[n]=new Array(i);++o<i;)a[o]=t[o][n];return r}function yt(t){return t.length}function vt(t){return t instanceof InternSet?t:new InternSet(t)}function _t(t,n){const e=t[Symbol.iterator](),r=new Set;for(const t of n){const n=bt(t);if(r.has(n))continue;let i,o;for(;({value:i,done:o}=e.next());){if(o)return!1;const t=bt(i);if(r.add(t),Object.is(n,t))break}}return!0}function bt(t){return null!==t&&"object"==typeof t?t.valueOf():t}function mt(t){return t}var xt=1,wt=2,Mt=3,Tt=4,At=1e-6;function St(t){return"translate("+t+",0)"}function Et(t){return"translate(0,"+t+")"}function Nt(t){return n=>+t(n)}function kt(t,n){return n=Math.max(0,t.bandwidth()-2*n)/2,t.round()&&(n=Math.round(n)),e=>+t(e)+n}function Ct(){return!this.__axis}function Pt(t,n){var e=[],r=null,i=null,o=6,a=6,u=3,c="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,f=t===xt||t===Tt?-1:1,s=t===Tt||t===wt?"x":"y",l=t===xt||t===Mt?St:Et;function h(h){var d=null==r?n.ticks?n.ticks.apply(n,e):n.domain():r,p=null==i?n.tickFormat?n.tickFormat.apply(n,e):mt:i,g=Math.max(o,0)+u,y=n.range(),v=+y[0]+c,_=+y[y.length-1]+c,b=(n.bandwidth?kt:Nt)(n.copy(),c),m=h.selection?h.selection():h,x=m.selectAll(".domain").data([null]),w=m.selectAll(".tick").data(d,n).order(),M=w.exit(),T=w.enter().append("g").attr("class","tick"),A=w.select("line"),S=w.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),w=w.merge(T),A=A.merge(T.append("line").attr("stroke","currentColor").attr(s+"2",f*o)),S=S.merge(T.append("text").attr("fill","currentColor").attr(s,f*g).attr("dy",t===xt?"0em":t===Mt?"0.71em":"0.32em")),h!==m&&(x=x.transition(h),w=w.transition(h),A=A.transition(h),S=S.transition(h),M=M.transition(h).attr("opacity",At).attr("transform",(function(t){return isFinite(t=b(t))?l(t+c):this.getAttribute("transform")})),T.attr("opacity",At).attr("transform",(function(t){var n=this.parentNode.__axis;return l((n&&isFinite(n=n(t))?n:b(t))+c)}))),M.remove(),x.attr("d",t===Tt||t===wt?a?"M"+f*a+","+v+"H"+c+"V"+_+"H"+f*a:"M"+c+","+v+"V"+_:a?"M"+v+","+f*a+"V"+c+"H"+_+"V"+f*a:"M"+v+","+c+"H"+_),w.attr("opacity",1).attr("transform",(function(t){return l(b(t)+c)})),A.attr(s+"2",f*o),S.attr(s,f*g).text(p),m.filter(Ct).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===wt?"start":t===Tt?"end":"middle"),m.each((function(){this.__axis=b}))}return h.scale=function(t){return arguments.length?(n=t,h):n},h.ticks=function(){return e=Array.from(arguments),h},h.tickArguments=function(t){return arguments.length?(e=null==t?[]:Array.from(t),h):e.slice()},h.tickValues=function(t){return arguments.length?(r=null==t?null:Array.from(t),h):r&&r.slice()},h.tickFormat=function(t){return arguments.length?(i=t,h):i},h.tickSize=function(t){return arguments.length?(o=a=+t,h):o},h.tickSizeInner=function(t){return arguments.length?(o=+t,h):o},h.tickSizeOuter=function(t){return arguments.length?(a=+t,h):a},h.tickPadding=function(t){return arguments.length?(u=+t,h):u},h.offset=function(t){return arguments.length?(c=+t,h):c},h}var zt={value:()=>{}};function $t(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new Dt(r)}function Dt(t){this._=t}function Rt(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function Ft(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=zt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}Dt.prototype=$t.prototype={constructor:Dt,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))),a=-1,u=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(e=(t=o[a]).type)i[e]=Ft(i[e],t.name,n);else if(null==n)for(e in i)i[e]=Ft(i[e],t.name,null);return this}for(;++a<u;)if((e=(t=o[a]).type)&&(e=Rt(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new Dt(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var qt="http://www.w3.org/1999/xhtml",Ut={svg:"http://www.w3.org/2000/svg",xhtml:qt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function It(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Ut.hasOwnProperty(n)?{space:Ut[n],local:t}:t}function Ot(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===qt&&n.documentElement.namespaceURI===qt?n.createElement(t):n.createElementNS(e,t)}}function Bt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Yt(t){var n=It(t);return(n.local?Bt:Ot)(n)}function Lt(){}function jt(t){return null==t?Lt:function(){return this.querySelector(t)}}function Ht(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function Xt(){return[]}function Gt(t){return null==t?Xt:function(){return this.querySelectorAll(t)}}function Vt(t){return function(){return this.matches(t)}}function Wt(t){return function(n){return n.matches(t)}}var Zt=Array.prototype.find;function Kt(){return this.firstElementChild}var Qt=Array.prototype.filter;function Jt(){return Array.from(this.children)}function tn(t){return new Array(t.length)}function nn(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function en(t,n,e,r,i,o){for(var a,u=0,c=n.length,f=o.length;u<f;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new nn(t,o[u]);for(;u<c;++u)(a=n[u])&&(i[u]=a)}function rn(t,n,e,r,i,o,a){var u,c,f,s=new Map,l=n.length,h=o.length,d=new Array(l);for(u=0;u<l;++u)(c=n[u])&&(d[u]=f=a.call(c,c.__data__,u,n)+"",s.has(f)?i[u]=c:s.set(f,c));for(u=0;u<h;++u)f=a.call(t,o[u],u,o)+"",(c=s.get(f))?(r[u]=c,c.__data__=o[u],s.delete(f)):e[u]=new nn(t,o[u]);for(u=0;u<l;++u)(c=n[u])&&s.get(d[u])===c&&(i[u]=c)}function on(t){return t.__data__}function an(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function un(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function cn(t){return function(){this.removeAttribute(t)}}function fn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function sn(t,n){return function(){this.setAttribute(t,n)}}function ln(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function hn(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function dn(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function pn(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function gn(t){return function(){this.style.removeProperty(t)}}function yn(t,n,e){return function(){this.style.setProperty(t,n,e)}}function vn(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function _n(t,n){return t.style.getPropertyValue(n)||pn(t).getComputedStyle(t,null).getPropertyValue(n)}function bn(t){return function(){delete this[t]}}function mn(t,n){return function(){this[t]=n}}function xn(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function wn(t){return t.trim().split(/^|\s+/)}function Mn(t){return t.classList||new Tn(t)}function Tn(t){this._node=t,this._names=wn(t.getAttribute("class")||"")}function An(t,n){for(var e=Mn(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function Sn(t,n){for(var e=Mn(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function En(t){return function(){An(this,t)}}function Nn(t){return function(){Sn(this,t)}}function kn(t,n){return function(){(n.apply(this,arguments)?An:Sn)(this,t)}}function Cn(){this.textContent=""}function Pn(t){return function(){this.textContent=t}}function zn(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function $n(){this.innerHTML=""}function Dn(t){return function(){this.innerHTML=t}}function Rn(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function Fn(){this.nextSibling&&this.parentNode.appendChild(this)}function qn(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Un(){return null}function In(){var t=this.parentNode;t&&t.removeChild(this)}function On(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function Bn(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function Yn(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.options);++i?n.length=i:delete this.__on}}}function Ln(t,n,e){return function(){var r,i=this.__on,o=function(t){return function(n){t.call(this,n,this.__data__)}}(n);if(i)for(var a=0,u=i.length;a<u;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=e),void(r.value=n);this.addEventListener(t.type,o,e),r={type:t.type,name:t.name,value:n,listener:o,options:e},i?i.push(r):this.__on=[r]}}function jn(t,n,e){var r=pn(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function Hn(t,n){return function(){return jn(this,t,n)}}function Xn(t,n){return function(){return jn(this,t,n.apply(this,arguments))}}nn.prototype={constructor:nn,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},Tn.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Gn=[null];function Vn(t,n){this._groups=t,this._parents=n}function Wn(){return new Vn([[document.documentElement]],Gn)}function Zn(t){return"string"==typeof t?new Vn([[document.querySelector(t)]],[document.documentElement]):new Vn([[t]],Gn)}Vn.prototype=Wn.prototype={constructor:Vn,select:function(t){"function"!=typeof t&&(t=jt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,u=n[i],c=u.length,f=r[i]=new Array(c),s=0;s<c;++s)(o=u[s])&&(a=t.call(o,o.__data__,s,u))&&("__data__"in o&&(a.__data__=o.__data__),f[s]=a);return new Vn(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return Ht(t.apply(this,arguments))}}(t):Gt(t);for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,u=n[o],c=u.length,f=0;f<c;++f)(a=u[f])&&(r.push(t.call(a,a.__data__,f,u)),i.push(a));return new Vn(r,i)},selectChild:function(t){return this.select(null==t?Kt:function(t){return function(){return Zt.call(this.children,t)}}("function"==typeof t?t:Wt(t)))},selectChildren:function(t){return this.selectAll(null==t?Jt:function(t){return function(){return Qt.call(this.children,t)}}("function"==typeof t?t:Wt(t)))},filter:function(t){"function"!=typeof t&&(t=Vt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,c=r[i]=[],f=0;f<u;++f)(o=a[f])&&t.call(o,o.__data__,f,a)&&c.push(o);return new Vn(r,this._parents)},data:function(t,n){if(!arguments.length)return Array.from(this,on);var e=n?rn:en,r=this._parents,i=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var o=i.length,a=new Array(o),u=new Array(o),c=new Array(o),f=0;f<o;++f){var s=r[f],l=i[f],h=l.length,d=an(t.call(s,s&&s.__data__,f,r)),p=d.length,g=u[f]=new Array(p),y=a[f]=new Array(p);e(s,l,g,y,c[f]=new Array(h),d,n);for(var v,_,b=0,m=0;b<p;++b)if(v=g[b]){for(b>=m&&(m=b+1);!(_=y[m])&&++m<p;);v._next=_||null}}return(a=new Vn(a,r))._enter=u,a._exit=c,a},enter:function(){return new Vn(this._enter||this._groups.map(tn),this._parents)},exit:function(){return new Vn(this._exit||this._groups.map(tn),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=n&&(i=n(i))&&(i=i.selection()),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){for(var n=t.selection?t.selection():t,e=this._groups,r=n._groups,i=e.length,o=r.length,a=Math.min(i,o),u=new Array(i),c=0;c<a;++c)for(var f,s=e[c],l=r[c],h=s.length,d=u[c]=new Array(h),p=0;p<h;++p)(f=s[p]||l[p])&&(d[p]=f);for(;c<i;++c)u[c]=e[c];return new Vn(u,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=un);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],c=u.length,f=i[o]=new Array(c),s=0;s<c;++s)(a=u[s])&&(f[s]=a);f.sort(n)}return new Vn(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const n of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=It(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?fn:cn:"function"==typeof n?e.local?dn:hn:e.local?ln:sn)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?gn:"function"==typeof n?vn:yn)(t,n,null==e?"":e)):_n(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?bn:"function"==typeof n?xn:mn)(t,n)):this.node()[t]},classed:function(t,n){var e=wn(t+"");if(arguments.length<2){for(var r=Mn(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?kn:n?En:Nn)(e,n))},text:function(t){return arguments.length?this.each(null==t?Cn:("function"==typeof t?zn:Pn)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?$n:("function"==typeof t?Rn:Dn)(t)):this.node().innerHTML},raise:function(){return this.each(Fn)},lower:function(){return this.each(qn)},append:function(t){var n="function"==typeof t?t:Yt(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(t,n){var e="function"==typeof t?t:Yt(t),r=null==n?Un:"function"==typeof n?n:jt(n);return this.select((function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(In)},clone:function(t){return this.select(t?Bn:On)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=function(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?Ln:Yn,r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var c,f=0,s=u.length;f<s;++f)for(r=0,c=u[f];r<a;++r)if((i=o[r]).type===c.type&&i.name===c.name)return c.value},dispatch:function(t,n){return this.each(("function"==typeof n?Xn:Hn)(t,n))},[Symbol.iterator]:function*(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r,i=t[n],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};var Kn=0;function Qn(){return new Jn}function Jn(){this._="@"+(++Kn).toString(36)}function te(t){let n;for(;n=t.sourceEvent;)t=n;return t}function ne(t,n){if(t=te(t),void 0===n&&(n=t.currentTarget),n){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}}return[t.pageX,t.pageY]}Jn.prototype=Qn.prototype={constructor:Jn,get:function(t){for(var n=this._;!(n in t);)if(!(t=t.parentNode))return;return t[n]},set:function(t,n){return t[this._]=n},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};const ee={passive:!1},re={capture:!0,passive:!1};function ie(t){t.stopImmediatePropagation()}function oe(t){t.preventDefault(),t.stopImmediatePropagation()}function ae(t){var n=t.document.documentElement,e=Zn(t).on("dragstart.drag",oe,re);"onselectstart"in n?e.on("selectstart.drag",oe,re):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function ue(t,n){var e=t.document.documentElement,r=Zn(t).on("dragstart.drag",null);n&&(r.on("click.drag",oe,re),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}var ce=t=>()=>t;function fe(t,{sourceEvent:n,subject:e,target:r,identifier:i,active:o,x:a,y:u,dx:c,dy:f,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:s}})}function se(t){return!t.ctrlKey&&!t.button}function le(){return this.parentNode}function he(t,n){return null==n?{x:t.x,y:t.y}:n}function de(){return navigator.maxTouchPoints||"ontouchstart"in this}function pe(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function ge(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function ye(){}fe.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var ve=.7,_e=1/ve,be="\\s*([+-]?\\d+)\\s*",me="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",we=/^#([0-9a-f]{3,8})$/,Me=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),Te=new RegExp(`^rgb\\(${xe},${xe},${xe}\\)$`),Ae=new RegExp(`^rgba\\(${be},${be},${be},${me}\\)$`),Se=new RegExp(`^rgba\\(${xe},${xe},${xe},${me}\\)$`),Ee=new RegExp(`^hsl\\(${me},${xe},${xe}\\)$`),Ne=new RegExp(`^hsla\\(${me},${xe},${xe},${me}\\)$`),ke={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ce(){return this.rgb().formatHex()}function Pe(){return this.rgb().formatRgb()}function ze(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=we.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?$e(n):3===e?new qe(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?De(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?De(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=Me.exec(t))?new qe(n[1],n[2],n[3],1):(n=Te.exec(t))?new qe(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Ae.exec(t))?De(n[1],n[2],n[3],n[4]):(n=Se.exec(t))?De(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Ee.exec(t))?Le(n[1],n[2]/100,n[3]/100,1):(n=Ne.exec(t))?Le(n[1],n[2]/100,n[3]/100,n[4]):ke.hasOwnProperty(t)?$e(ke[t]):"transparent"===t?new qe(NaN,NaN,NaN,0):null}function $e(t){return new qe(t>>16&255,t>>8&255,255&t,1)}function De(t,n,e,r){return r<=0&&(t=n=e=NaN),new qe(t,n,e,r)}function Re(t){return t instanceof ye||(t=ze(t)),t?new qe((t=t.rgb()).r,t.g,t.b,t.opacity):new qe}function Fe(t,n,e,r){return 1===arguments.length?Re(t):new qe(t,n,e,null==r?1:r)}function qe(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Ue(){return`#${Ye(this.r)}${Ye(this.g)}${Ye(this.b)}`}function Ie(){const t=Oe(this.opacity);return`${1===t?"rgb(":"rgba("}${Be(this.r)}, ${Be(this.g)}, ${Be(this.b)}${1===t?")":`, ${t})`}`}function Oe(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Be(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ye(t){return((t=Be(t))<16?"0":"")+t.toString(16)}function Le(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Xe(t,n,e,r)}function je(t){if(t instanceof Xe)return new Xe(t.h,t.s,t.l,t.opacity);if(t instanceof ye||(t=ze(t)),!t)return new Xe;if(t instanceof Xe)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,c=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e<r):e===o?(r-n)/u+2:(n-e)/u+4,u/=c<.5?o+i:2-o-i,a*=60):u=c>0&&c<1?0:a,new Xe(a,u,c,t.opacity)}function He(t,n,e,r){return 1===arguments.length?je(t):new Xe(t,n,e,null==r?1:r)}function Xe(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Ge(t){return(t=(t||0)%360)<0?t+360:t}function Ve(t){return Math.max(0,Math.min(1,t||0))}function We(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}pe(ye,ze,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ce,formatHex:Ce,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return je(this).formatHsl()},formatRgb:Pe,toString:Pe}),pe(qe,Fe,ge(ye,{brighter(t){return t=null==t?_e:Math.pow(_e,t),new qe(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?ve:Math.pow(ve,t),new qe(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new qe(Be(this.r),Be(this.g),Be(this.b),Oe(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ue,formatHex:Ue,formatHex8:function(){return`#${Ye(this.r)}${Ye(this.g)}${Ye(this.b)}${Ye(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ie,toString:Ie})),pe(Xe,He,ge(ye,{brighter(t){return t=null==t?_e:Math.pow(_e,t),new Xe(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ve:Math.pow(ve,t),new Xe(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new qe(We(t>=240?t-240:t+120,i,r),We(t,i,r),We(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Xe(Ge(this.h),Ve(this.s),Ve(this.l),Oe(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Oe(this.opacity);return`${1===t?"hsl(":"hsla("}${Ge(this.h)}, ${100*Ve(this.s)}%, ${100*Ve(this.l)}%${1===t?")":`, ${t})`}`}}));const Ze=Math.PI/180,Ke=180/Math.PI,Qe=.96422,Je=1,tr=.82521,nr=4/29,er=6/29,rr=3*er*er,ir=er*er*er;function or(t){if(t instanceof ur)return new ur(t.l,t.a,t.b,t.opacity);if(t instanceof pr)return gr(t);t instanceof qe||(t=Re(t));var n,e,r=lr(t.r),i=lr(t.g),o=lr(t.b),a=cr((.2225045*r+.7168786*i+.0606169*o)/Je);return r===i&&i===o?n=e=a:(n=cr((.4360747*r+.3850649*i+.1430804*o)/Qe),e=cr((.0139322*r+.0971045*i+.7141733*o)/tr)),new ur(116*a-16,500*(n-a),200*(a-e),t.opacity)}function ar(t,n,e,r){return 1===arguments.length?or(t):new ur(t,n,e,null==r?1:r)}function ur(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function cr(t){return t>ir?Math.pow(t,1/3):t/rr+nr}function fr(t){return t>er?t*t*t:rr*(t-nr)}function sr(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function lr(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function hr(t){if(t instanceof pr)return new pr(t.h,t.c,t.l,t.opacity);if(t instanceof ur||(t=or(t)),0===t.a&&0===t.b)return new pr(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*Ke;return new pr(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function dr(t,n,e,r){return 1===arguments.length?hr(t):new pr(t,n,e,null==r?1:r)}function pr(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function gr(t){if(isNaN(t.h))return new ur(t.l,0,0,t.opacity);var n=t.h*Ze;return new ur(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}pe(ur,ar,ge(ye,{brighter(t){return new ur(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new ur(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new qe(sr(3.1338561*(n=Qe*fr(n))-1.6168667*(t=Je*fr(t))-.4906146*(e=tr*fr(e))),sr(-.9787684*n+1.9161415*t+.033454*e),sr(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),pe(pr,dr,ge(ye,{brighter(t){return new pr(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new pr(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return gr(this).rgb()}}));var yr=-.14861,vr=1.78277,_r=-.29227,br=-.90649,mr=1.97294,xr=mr*br,wr=mr*vr,Mr=vr*_r-br*yr;function Tr(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Ar)return new Ar(t.h,t.s,t.l,t.opacity);t instanceof qe||(t=Re(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(Mr*r+xr*n-wr*e)/(Mr+xr-wr),o=r-i,a=(mr*(e-i)-_r*o)/br,u=Math.sqrt(a*a+o*o)/(mr*i*(1-i)),c=u?Math.atan2(a,o)*Ke-120:NaN;return new Ar(c<0?c+360:c,u,i,t.opacity)}(t):new Ar(t,n,e,null==r?1:r)}function Ar(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Sr(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}function Er(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=r<n-1?t[r+2]:2*o-i;return Sr((e-r/n)*n,a,i,o,u)}}function Nr(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n),i=t[(r+n-1)%n],o=t[r%n],a=t[(r+1)%n],u=t[(r+2)%n];return Sr((e-r/n)*n,i,o,a,u)}}pe(Ar,Tr,ge(ye,{brighter(t){return t=null==t?_e:Math.pow(_e,t),new Ar(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ve:Math.pow(ve,t),new Ar(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*Ze,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new qe(255*(n+e*(yr*r+vr*i)),255*(n+e*(_r*r+br*i)),255*(n+e*(mr*r)),this.opacity)}}));var kr=t=>()=>t;function Cr(t,n){return function(e){return t+e*n}}function Pr(t,n){var e=n-t;return e?Cr(t,e>180||e<-180?e-360*Math.round(e/360):e):kr(isNaN(t)?n:t)}function zr(t){return 1==(t=+t)?$r:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):kr(isNaN(n)?e:n)}}function $r(t,n){var e=n-t;return e?Cr(t,e):kr(isNaN(t)?n:t)}var Dr=function t(n){var e=zr(n);function r(t,n){var r=e((t=Fe(t)).r,(n=Fe(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=$r(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function Rr(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;e<i;++e)r=Fe(n[e]),o[e]=r.r||0,a[e]=r.g||0,u[e]=r.b||0;return o=t(o),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=u(t),r+""}}}var Fr=Rr(Er),qr=Rr(Nr);function Ur(t,n){n||(n=[]);var e,r=t?Math.min(n.length,t.length):0,i=n.slice();return function(o){for(e=0;e<r;++e)i[e]=t[e]*(1-o)+n[e]*o;return i}}function Ir(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Or(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(e=0;e<i;++e)o[e]=Gr(t[e],n[e]);for(;e<r;++e)a[e]=n[e];return function(t){for(e=0;e<i;++e)a[e]=o[e](t);return a}}function Br(t,n){var e=new Date;return t=+t,n=+n,function(r){return e.setTime(t*(1-r)+n*r),e}}function Yr(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function Lr(t,n){var e,r={},i={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?r[e]=Gr(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}var jr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Hr=new RegExp(jr.source,"g");function Xr(t,n){var e,r,i,o=jr.lastIndex=Hr.lastIndex=0,a=-1,u=[],c=[];for(t+="",n+="";(e=jr.exec(t))&&(r=Hr.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:Yr(e,r)})),o=Hr.lastIndex;return o<n.length&&(i=n.slice(o),u[a]?u[a]+=i:u[++a]=i),u.length<2?c[0]?function(t){return function(n){return t(n)+""}}(c[0].x):function(t){return function(){return t}}(n):(n=c.length,function(t){for(var e,r=0;r<n;++r)u[(e=c[r]).i]=e.x(t);return u.join("")})}function Gr(t,n){var e,r=typeof n;return null==n||"boolean"===r?kr(n):("number"===r?Yr:"string"===r?(e=ze(n))?(n=e,Dr):Xr:n instanceof ze?Dr:n instanceof Date?Br:Ir(n)?Ur:Array.isArray(n)?Or:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?Lr:Yr)(t,n)}function Vr(t,n){return t=+t,n=+n,function(e){return Math.round(t*(1-e)+n*e)}}var Wr,Zr=180/Math.PI,Kr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Qr(t,n,e,r,i,o){var a,u,c;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(c=t*e+n*r)&&(e-=t*c,r-=n*c),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,c/=u),t*r<n*e&&(t=-t,n=-n,c=-c,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*Zr,skewX:Math.atan(c)*Zr,scaleX:a,scaleY:u}}function Jr(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u=[],c=[];return o=t(o),a=t(a),function(t,r,i,o,a,u){if(t!==i||r!==o){var c=a.push("translate(",null,n,null,e);u.push({i:c-4,x:Yr(t,i)},{i:c-2,x:Yr(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,u,c),function(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Yr(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,c),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Yr(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,c),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:Yr(t,e)},{i:u-2,x:Yr(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,c),o=a=null,function(t){for(var n,e=-1,r=c.length;++e<r;)u[(n=c[e]).i]=n.x(t);return u.join("")}}}var ti=Jr((function(t){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return n.isIdentity?Kr:Qr(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),ni=Jr((function(t){return null==t?Kr:(Wr||(Wr=document.createElementNS("http://www.w3.org/2000/svg","g")),Wr.setAttribute("transform",t),(t=Wr.transform.baseVal.consolidate())?Qr((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Kr)}),", ",")",")");function ei(t){return((t=Math.exp(t))+1/t)/2}var ri=function t(n,e,r){function i(t,i){var o,a,u=t[0],c=t[1],f=t[2],s=i[0],l=i[1],h=i[2],d=s-u,p=l-c,g=d*d+p*p;if(g<1e-12)a=Math.log(h/f)/n,o=function(t){return[u+t*d,c+t*p,f*Math.exp(n*t*a)]};else{var y=Math.sqrt(g),v=(h*h-f*f+r*g)/(2*f*e*y),_=(h*h-f*f-r*g)/(2*h*e*y),b=Math.log(Math.sqrt(v*v+1)-v),m=Math.log(Math.sqrt(_*_+1)-_);a=(m-b)/n,o=function(t){var r=t*a,i=ei(b),o=f/(e*y)*(i*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(n*r+b)-function(t){return((t=Math.exp(t))-1/t)/2}(b));return[u+o*d,c+o*p,f*i/ei(n*r+b)]}}return o.duration=1e3*a*n/Math.SQRT2,o}return i.rho=function(n){var e=Math.max(.001,+n),r=e*e;return t(e,r,r*r)},i}(Math.SQRT2,2,4);function ii(t){return function(n,e){var r=t((n=He(n)).h,(e=He(e)).h),i=$r(n.s,e.s),o=$r(n.l,e.l),a=$r(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var oi=ii(Pr),ai=ii($r);function ui(t){return function(n,e){var r=t((n=dr(n)).h,(e=dr(e)).h),i=$r(n.c,e.c),o=$r(n.l,e.l),a=$r(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var ci=ui(Pr),fi=ui($r);function si(t){return function n(e){function r(n,r){var i=t((n=Tr(n)).h,(r=Tr(r)).h),o=$r(n.s,r.s),a=$r(n.l,r.l),u=$r(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=a(Math.pow(t,e)),n.opacity=u(t),n+""}}return e=+e,r.gamma=n,r}(1)}var li=si(Pr),hi=si($r);function di(t,n){void 0===n&&(n=t,t=Gr);for(var e=0,r=n.length-1,i=n[0],o=new Array(r<0?0:r);e<r;)o[e]=t(i,i=n[++e]);return function(t){var n=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[n](t-n)}}var pi,gi,yi=0,vi=0,_i=0,bi=1e3,mi=0,xi=0,wi=0,Mi="object"==typeof performance&&performance.now?performance:Date,Ti="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ai(){return xi||(Ti(Si),xi=Mi.now()+wi)}function Si(){xi=0}function Ei(){this._call=this._time=this._next=null}function Ni(t,n,e){var r=new Ei;return r.restart(t,n,e),r}function ki(){Ai(),++yi;for(var t,n=pi;n;)(t=xi-n._time)>=0&&n._call.call(void 0,t),n=n._next;--yi}function Ci(){xi=(mi=Mi.now())+wi,yi=vi=0;try{ki()}finally{yi=0,function(){var t,n,e=pi,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:pi=n);gi=t,zi(r)}(),xi=0}}function Pi(){var t=Mi.now(),n=t-mi;n>bi&&(wi-=n,mi=t)}function zi(t){yi||(vi&&(vi=clearTimeout(vi)),t-xi>24?(t<1/0&&(vi=setTimeout(Ci,t-Mi.now()-wi)),_i&&(_i=clearInterval(_i))):(_i||(mi=Mi.now(),_i=setInterval(Pi,bi)),yi=1,Ti(Ci)))}function $i(t,n,e){var r=new Ei;return n=null==n?0:+n,r.restart((e=>{r.stop(),t(e+n)}),n,e),r}Ei.prototype=Ni.prototype={constructor:Ei,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Ai():+e)+(null==n?0:+n),this._next||gi===this||(gi?gi._next=this:pi=this,gi=this),this._call=t,this._time=e,zi()},stop:function(){this._call&&(this._call=null,this._time=1/0,zi())}};var Di=$t("start","end","cancel","interrupt"),Ri=[],Fi=0,qi=1,Ui=2,Ii=3,Oi=4,Bi=5,Yi=6;function Li(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(t){e.state=qi,e.timer.restart(a,e.delay,e.time),e.delay<=t&&a(t-e.delay)}function a(o){var f,s,l,h;if(e.state!==qi)return c();for(f in i)if((h=i[f]).name===e.name){if(h.state===Ii)return $i(a);h.state===Oi?(h.state=Yi,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[f]):+f<n&&(h.state=Yi,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete i[f])}if($i((function(){e.state===Ii&&(e.state=Oi,e.timer.restart(u,e.delay,e.time),u(o))})),e.state=Ui,e.on.call("start",t,t.__data__,e.index,e.group),e.state===Ui){for(e.state=Ii,r=new Array(l=e.tween.length),f=0,s=-1;f<l;++f)(h=e.tween[f].value.call(t,t.__data__,e.index,e.group))&&(r[++s]=h);r.length=s+1}}function u(n){for(var i=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(c),e.state=Bi,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);e.state===Bi&&(e.on.call("end",t,t.__data__,e.index,e.group),c())}function c(){for(var r in e.state=Yi,e.timer.stop(),delete i[n],i)return;delete t.__transition}i[n]=e,e.timer=Ni(o,0,e.time)}(t,e,{name:n,index:r,group:i,on:Di,tween:Ri,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Fi})}function ji(t,n){var e=Xi(t,n);if(e.state>Fi)throw new Error("too late; already scheduled");return e}function Hi(t,n){var e=Xi(t,n);if(e.state>Ii)throw new Error("too late; already running");return e}function Xi(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Gi(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>Ui&&e.state<Bi,e.state=Yi,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}}function Vi(t,n){var e,r;return function(){var i=Hi(this,t),o=i.tween;if(o!==e)for(var a=0,u=(r=e=o).length;a<u;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}i.tween=r}}function Wi(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=Hi(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var u={name:n,value:e},c=0,f=i.length;c<f;++c)if(i[c].name===n){i[c]=u;break}c===f&&i.push(u)}o.tween=i}}function Zi(t,n,e){var r=t._id;return t.each((function(){var t=Hi(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)})),function(t){return Xi(t,r).value[n]}}function Ki(t,n){var e;return("number"==typeof n?Yr:n instanceof ze?Dr:(e=ze(n))?(n=e,Dr):Xr)(t,n)}function Qi(t){return function(){this.removeAttribute(t)}}function Ji(t){return function(){this.removeAttributeNS(t.space,t.local)}}function to(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=n(r=a,e)}}function no(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=n(r=a,e)}}function eo(t,n,e){var r,i,o;return function(){var a,u,c=e(this);if(null!=c)return(a=this.getAttribute(t))===(u=c+"")?null:a===r&&u===i?o:(i=u,o=n(r=a,c));this.removeAttribute(t)}}function ro(t,n,e){var r,i,o;return function(){var a,u,c=e(this);if(null!=c)return(a=this.getAttributeNS(t.space,t.local))===(u=c+"")?null:a===r&&u===i?o:(i=u,o=n(r=a,c));this.removeAttributeNS(t.space,t.local)}}function io(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttributeNS(t.space,t.local,n.call(this,e))}}(t,i)),e}return i._value=n,i}function oo(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttribute(t,n.call(this,e))}}(t,i)),e}return i._value=n,i}function ao(t,n){return function(){ji(this,t).delay=+n.apply(this,arguments)}}function uo(t,n){return n=+n,function(){ji(this,t).delay=n}}function co(t,n){return function(){Hi(this,t).duration=+n.apply(this,arguments)}}function fo(t,n){return n=+n,function(){Hi(this,t).duration=n}}var so=Wn.prototype.constructor;function lo(t){return function(){this.style.removeProperty(t)}}var ho=0;function po(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function go(t){return Wn().transition(t)}function yo(){return++ho}var vo=Wn.prototype;po.prototype=go.prototype={constructor:po,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=jt(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var u,c,f=r[a],s=f.length,l=o[a]=new Array(s),h=0;h<s;++h)(u=f[h])&&(c=t.call(u,u.__data__,h,f))&&("__data__"in u&&(c.__data__=u.__data__),l[h]=c,Li(l[h],n,e,h,l,Xi(u,e)));return new po(o,this._parents,n,e)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=Gt(t));for(var r=this._groups,i=r.length,o=[],a=[],u=0;u<i;++u)for(var c,f=r[u],s=f.length,l=0;l<s;++l)if(c=f[l]){for(var h,d=t.call(c,c.__data__,l,f),p=Xi(c,e),g=0,y=d.length;g<y;++g)(h=d[g])&&Li(h,n,e,g,d,p);o.push(d),a.push(c)}return new po(o,a,n,e)},selectChild:vo.selectChild,selectChildren:vo.selectChildren,filter:function(t){"function"!=typeof t&&(t=Vt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,c=r[i]=[],f=0;f<u;++f)(o=a[f])&&t.call(o,o.__data__,f,a)&&c.push(o);return new po(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var c,f=n[u],s=e[u],l=f.length,h=a[u]=new Array(l),d=0;d<l;++d)(c=f[d]||s[d])&&(h[d]=c);for(;u<r;++u)a[u]=n[u];return new po(a,this._parents,this._name,this._id)},selection:function(){return new so(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=yo(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],c=u.length,f=0;f<c;++f)if(a=u[f]){var s=Xi(a,n);Li(a,t,e,f,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new po(r,this._parents,t,e)},call:vo.call,nodes:vo.nodes,node:vo.node,size:vo.size,empty:vo.empty,each:vo.each,on:function(t,n){var e=this._id;return arguments.length<2?Xi(this.node(),e).on.on(t):this.each(function(t,n,e){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?ji:Hi;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(n,e),a.on=i}}(e,t,n))},attr:function(t,n){var e=It(t),r="transform"===e?ni:Ki;return this.attrTween(t,"function"==typeof n?(e.local?ro:eo)(e,r,Zi(this,"attr."+t,n)):null==n?(e.local?Ji:Qi)(e):(e.local?no:to)(e,r,n))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=It(t);return this.tween(e,(r.local?io:oo)(r,n))},style:function(t,n,e){var r="transform"==(t+="")?ti:Ki;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=_n(this,t),a=(this.style.removeProperty(t),_n(this,t));return o===a?null:o===e&&a===r?i:i=n(e=o,r=a)}}(t,r)).on("end.style."+t,lo(t)):"function"==typeof n?this.styleTween(t,function(t,n,e){var r,i,o;return function(){var a=_n(this,t),u=e(this),c=u+"";return null==u&&(this.style.removeProperty(t),c=u=_n(this,t)),a===c?null:a===r&&c===i?o:(i=c,o=n(r=a,u))}}(t,r,Zi(this,"style."+t,n))).each(function(t,n){var e,r,i,o,a="style."+n,u="end."+a;return function(){var c=Hi(this,t),f=c.on,s=null==c.value[a]?o||(o=lo(n)):void 0;f===e&&i===s||(r=(e=f).copy()).on(u,i=s),c.on=r}}(this._id,t)):this.styleTween(t,function(t,n,e){var r,i,o=e+"";return function(){var a=_n(this,t);return a===o?null:a===r?i:i=n(r=a,e)}}(t,r,n),e).on("end.style."+t,null)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}(t,o,e)),r}return o._value=n,o}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(Zi(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;return this.tween(n,function(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&function(t){return function(n){this.textContent=t.call(this,n)}}(r)),n}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}(this._id))},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Xi(this.node(),e).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?Vi:Wi)(e,t,n))},delay:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?ao:uo)(n,t)):Xi(this.node(),n).delay},duration:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?co:fo)(n,t)):Xi(this.node(),n).duration},ease:function(t){var n=this._id;return arguments.length?this.each(function(t,n){if("function"!=typeof n)throw new Error;return function(){Hi(this,t).ease=n}}(n,t)):Xi(this.node(),n).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,n){return function(){var e=n.apply(this,arguments);if("function"!=typeof e)throw new Error;Hi(this,t).ease=e}}(this._id,t))},end:function(){var t,n,e=this,r=e._id,i=e.size();return new Promise((function(o,a){var u={value:a},c={value:function(){0==--i&&o()}};e.each((function(){var e=Hi(this,r),i=e.on;i!==t&&((n=(t=i).copy())._.cancel.push(u),n._.interrupt.push(u),n._.end.push(c)),e.on=n})),0===i&&o()}))},[Symbol.iterator]:vo[Symbol.iterator]};function _o(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function bo(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var mo=function t(n){function e(t){return Math.pow(t,n)}return n=+n,e.exponent=t,e}(3),xo=function t(n){function e(t){return 1-Math.pow(1-t,n)}return n=+n,e.exponent=t,e}(3),wo=function t(n){function e(t){return((t*=2)<=1?Math.pow(t,n):2-Math.pow(2-t,n))/2}return n=+n,e.exponent=t,e}(3),Mo=Math.PI,To=Mo/2;function Ao(t){return(1-Math.cos(Mo*t))/2}function So(t){return 1.0009775171065494*(Math.pow(2,-10*t)-.0009765625)}function Eo(t){return((t*=2)<=1?So(1-t):2-So(t-1))/2}function No(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}var ko=4/11,Co=6/11,Po=8/11,zo=3/4,$o=9/11,Do=10/11,Ro=15/16,Fo=21/22,qo=63/64,Uo=1/ko/ko;function Io(t){return(t=+t)<ko?Uo*t*t:t<Po?Uo*(t-=Co)*t+zo:t<Do?Uo*(t-=$o)*t+Ro:Uo*(t-=Fo)*t+qo}var Oo=1.70158,Bo=function t(n){function e(t){return(t=+t)*t*(n*(t-1)+t)}return n=+n,e.overshoot=t,e}(Oo),Yo=function t(n){function e(t){return--t*t*((t+1)*n+t)+1}return n=+n,e.overshoot=t,e}(Oo),Lo=function t(n){function e(t){return((t*=2)<1?t*t*((n+1)*t-n):(t-=2)*t*((n+1)*t+n)+2)/2}return n=+n,e.overshoot=t,e}(Oo),jo=2*Math.PI,Ho=function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=jo);function i(t){return n*So(- --t)*Math.sin((r-t)/e)}return i.amplitude=function(n){return t(n,e*jo)},i.period=function(e){return t(n,e)},i}(1,.3),Xo=function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=jo);function i(t){return 1-n*So(t=+t)*Math.sin((t+r)/e)}return i.amplitude=function(n){return t(n,e*jo)},i.period=function(e){return t(n,e)},i}(1,.3),Go=function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=jo);function i(t){return((t=2*t-1)<0?n*So(-t)*Math.sin((r-t)/e):2-n*So(t)*Math.sin((r+t)/e))/2}return i.amplitude=function(n){return t(n,e*jo)},i.period=function(e){return t(n,e)},i}(1,.3),Vo={time:null,delay:0,duration:250,ease:bo};function Wo(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))throw new Error(`transition ${n} not found`);return e}Wn.prototype.interrupt=function(t){return this.each((function(){Gi(this,t)}))},Wn.prototype.transition=function(t){var n,e;t instanceof po?(n=t._id,t=t._name):(n=yo(),(e=Vo).time=Ai(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],c=u.length,f=0;f<c;++f)(a=u[f])&&Li(a,t,n,f,u,e||Wo(a,n));return new po(r,this._parents,t,n)};var Zo=[null];var Ko=t=>()=>t;function Qo(t,{sourceEvent:n,target:e,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Jo(t){t.preventDefault(),t.stopImmediatePropagation()}var ta={name:"drag"},na={name:"space"},ea={name:"handle"},ra={name:"center"};const{abs:ia,max:oa,min:aa}=Math;function ua(t){return[+t[0],+t[1]]}function ca(t){return[ua(t[0]),ua(t[1])]}var fa={name:"x",handles:["w","e"].map(va),input:function(t,n){return null==t?null:[[+t[0],n[0][1]],[+t[1],n[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},sa={name:"y",handles:["n","s"].map(va),input:function(t,n){return null==t?null:[[n[0][0],+t[0]],[n[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},la={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(va),input:function(t){return null==t?null:ca(t)},output:function(t){return t}},ha={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},da={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},pa={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},ga={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},ya={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function va(t){return{type:t}}function _a(t){return!t.ctrlKey&&!t.button}function ba(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function ma(){return navigator.maxTouchPoints||"ontouchstart"in this}function xa(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function wa(t){var n,e=ba,r=_a,i=ma,o=!0,a=$t("start","brush","end"),u=6;function c(n){var e=n.property("__brush",g).selectAll(".overlay").data([va("overlay")]);e.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",ha.overlay).merge(e).each((function(){var t=xa(this).extent;Zn(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])})),n.selectAll(".selection").data([va("selection")]).enter().append("rect").attr("class","selection").attr("cursor",ha.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=n.selectAll(".handle").data(t.handles,(function(t){return t.type}));r.exit().remove(),r.enter().append("rect").attr("class",(function(t){return"handle handle--"+t.type})).attr("cursor",(function(t){return ha[t.type]})),n.each(f).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",h).filter(i).on("touchstart.brush",h).on("touchmove.brush",d).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(){var t=Zn(this),n=xa(this).selection;n?(t.selectAll(".selection").style("display",null).attr("x",n[0][0]).attr("y",n[0][1]).attr("width",n[1][0]-n[0][0]).attr("height",n[1][1]-n[0][1]),t.selectAll(".handle").style("display",null).attr("x",(function(t){return"e"===t.type[t.type.length-1]?n[1][0]-u/2:n[0][0]-u/2})).attr("y",(function(t){return"s"===t.type[0]?n[1][1]-u/2:n[0][1]-u/2})).attr("width",(function(t){return"n"===t.type||"s"===t.type?n[1][0]-n[0][0]+u:u})).attr("height",(function(t){return"e"===t.type||"w"===t.type?n[1][1]-n[0][1]+u:u}))):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function s(t,n,e){var r=t.__brush.emitter;return!r||e&&r.clean?new l(t,n,e):r}function l(t,n,e){this.that=t,this.args=n,this.state=t.__brush,this.active=0,this.clean=e}function h(e){if((!n||e.touches)&&r.apply(this,arguments)){var i,a,u,c,l,h,d,p,g,y,v,_=this,b=e.target.__data__.type,m="selection"===(o&&e.metaKey?b="overlay":b)?ta:o&&e.altKey?ra:ea,x=t===sa?null:ga[b],w=t===fa?null:ya[b],M=xa(_),T=M.extent,A=M.selection,S=T[0][0],E=T[0][1],N=T[1][0],k=T[1][1],C=0,P=0,z=x&&w&&o&&e.shiftKey,$=Array.from(e.touches||[e],(t=>{const n=t.identifier;return(t=ne(t,_)).point0=t.slice(),t.identifier=n,t}));Gi(_);var D=s(_,arguments,!0).beforestart();if("overlay"===b){A&&(g=!0);const n=[$[0],$[1]||$[0]];M.selection=A=[[i=t===sa?S:aa(n[0][0],n[1][0]),u=t===fa?E:aa(n[0][1],n[1][1])],[l=t===sa?N:oa(n[0][0],n[1][0]),d=t===fa?k:oa(n[0][1],n[1][1])]],$.length>1&&I(e)}else i=A[0][0],u=A[0][1],l=A[1][0],d=A[1][1];a=i,c=u,h=l,p=d;var R=Zn(_).attr("pointer-events","none"),F=R.selectAll(".overlay").attr("cursor",ha[b]);if(e.touches)D.moved=U,D.ended=O;else{var q=Zn(e.view).on("mousemove.brush",U,!0).on("mouseup.brush",O,!0);o&&q.on("keydown.brush",(function(t){switch(t.keyCode){case 16:z=x&&w;break;case 18:m===ea&&(x&&(l=h-C*x,i=a+C*x),w&&(d=p-P*w,u=c+P*w),m=ra,I(t));break;case 32:m!==ea&&m!==ra||(x<0?l=h-C:x>0&&(i=a-C),w<0?d=p-P:w>0&&(u=c-P),m=na,F.attr("cursor",ha.selection),I(t));break;default:return}Jo(t)}),!0).on("keyup.brush",(function(t){switch(t.keyCode){case 16:z&&(y=v=z=!1,I(t));break;case 18:m===ra&&(x<0?l=h:x>0&&(i=a),w<0?d=p:w>0&&(u=c),m=ea,I(t));break;case 32:m===na&&(t.altKey?(x&&(l=h-C*x,i=a+C*x),w&&(d=p-P*w,u=c+P*w),m=ra):(x<0?l=h:x>0&&(i=a),w<0?d=p:w>0&&(u=c),m=ea),F.attr("cursor",ha[b]),I(t));break;default:return}Jo(t)}),!0),ae(e.view)}f.call(_),D.start(e,m.name)}function U(t){for(const n of t.changedTouches||[t])for(const t of $)t.identifier===n.identifier&&(t.cur=ne(n,_));if(z&&!y&&!v&&1===$.length){const t=$[0];ia(t.cur[0]-t[0])>ia(t.cur[1]-t[1])?v=!0:y=!0}for(const t of $)t.cur&&(t[0]=t.cur[0],t[1]=t.cur[1]);g=!0,Jo(t),I(t)}function I(t){const n=$[0],e=n.point0;var r;switch(C=n[0]-e[0],P=n[1]-e[1],m){case na:case ta:x&&(C=oa(S-i,aa(N-l,C)),a=i+C,h=l+C),w&&(P=oa(E-u,aa(k-d,P)),c=u+P,p=d+P);break;case ea:$[1]?(x&&(a=oa(S,aa(N,$[0][0])),h=oa(S,aa(N,$[1][0])),x=1),w&&(c=oa(E,aa(k,$[0][1])),p=oa(E,aa(k,$[1][1])),w=1)):(x<0?(C=oa(S-i,aa(N-i,C)),a=i+C,h=l):x>0&&(C=oa(S-l,aa(N-l,C)),a=i,h=l+C),w<0?(P=oa(E-u,aa(k-u,P)),c=u+P,p=d):w>0&&(P=oa(E-d,aa(k-d,P)),c=u,p=d+P));break;case ra:x&&(a=oa(S,aa(N,i-C*x)),h=oa(S,aa(N,l+C*x))),w&&(c=oa(E,aa(k,u-P*w)),p=oa(E,aa(k,d+P*w)))}h<a&&(x*=-1,r=i,i=l,l=r,r=a,a=h,h=r,b in da&&F.attr("cursor",ha[b=da[b]])),p<c&&(w*=-1,r=u,u=d,d=r,r=c,c=p,p=r,b in pa&&F.attr("cursor",ha[b=pa[b]])),M.selection&&(A=M.selection),y&&(a=A[0][0],h=A[1][0]),v&&(c=A[0][1],p=A[1][1]),A[0][0]===a&&A[0][1]===c&&A[1][0]===h&&A[1][1]===p||(M.selection=[[a,c],[h,p]],f.call(_),D.brush(t,m.name))}function O(t){if(function(t){t.stopImmediatePropagation()}(t),t.touches){if(t.touches.length)return;n&&clearTimeout(n),n=setTimeout((function(){n=null}),500)}else ue(t.view,g),q.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);R.attr("pointer-events","all"),F.attr("cursor",ha.overlay),M.selection&&(A=M.selection),function(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}(A)&&(M.selection=null,f.call(_)),D.end(t,m.name)}}function d(t){s(this,arguments).moved(t)}function p(t){s(this,arguments).ended(t)}function g(){var n=this.__brush||{selection:null};return n.extent=ca(e.apply(this,arguments)),n.dim=t,n}return c.move=function(n,e,r){n.tween?n.on("start.brush",(function(t){s(this,arguments).beforestart().start(t)})).on("interrupt.brush end.brush",(function(t){s(this,arguments).end(t)})).tween("brush",(function(){var n=this,r=n.__brush,i=s(n,arguments),o=r.selection,a=t.input("function"==typeof e?e.apply(this,arguments):e,r.extent),u=Gr(o,a);function c(t){r.selection=1===t&&null===a?null:u(t),f.call(n),i.brush()}return null!==o&&null!==a?c:c(1)})):n.each((function(){var n=this,i=arguments,o=n.__brush,a=t.input("function"==typeof e?e.apply(n,i):e,o.extent),u=s(n,i).beforestart();Gi(n),o.selection=null===a?null:a,f.call(n),u.start(r).brush(r).end(r)}))},c.clear=function(t,n){c.move(t,null,n)},l.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(t,n){return this.starting?(this.starting=!1,this.emit("start",t,n)):this.emit("brush",t),this},brush:function(t,n){return this.emit("brush",t,n),this},end:function(t,n){return 0==--this.active&&(delete this.state.emitter,this.emit("end",t,n)),this},emit:function(n,e,r){var i=Zn(this.that).datum();a.call(n,this.that,new Qo(n,{sourceEvent:e,target:c,selection:t.output(this.state.selection),mode:r,dispatch:a}),i)}},c.extent=function(t){return arguments.length?(e="function"==typeof t?t:Ko(ca(t)),c):e},c.filter=function(t){return arguments.length?(r="function"==typeof t?t:Ko(!!t),c):r},c.touchable=function(t){return arguments.length?(i="function"==typeof t?t:Ko(!!t),c):i},c.handleSize=function(t){return arguments.length?(u=+t,c):u},c.keyModifiers=function(t){return arguments.length?(o=!!t,c):o},c.on=function(){var t=a.on.apply(a,arguments);return t===a?c:t},c}var Ma=Math.abs,Ta=Math.cos,Aa=Math.sin,Sa=Math.PI,Ea=Sa/2,Na=2*Sa,ka=Math.max,Ca=1e-12;function Pa(t,n){return Array.from({length:n-t},((n,e)=>t+e))}function za(t,n){var e=0,r=null,i=null,o=null;function a(a){var u,c=a.length,f=new Array(c),s=Pa(0,c),l=new Array(c*c),h=new Array(c),d=0;a=Float64Array.from({length:c*c},n?(t,n)=>a[n%c][n/c|0]:(t,n)=>a[n/c|0][n%c]);for(let n=0;n<c;++n){let e=0;for(let r=0;r<c;++r)e+=a[n*c+r]+t*a[r*c+n];d+=f[n]=e}u=(d=ka(0,Na-e*c)/d)?e:Na/c;{let n=0;r&&s.sort(((t,n)=>r(f[t],f[n])));for(const e of s){const r=n;if(t){const t=Pa(1+~c,c).filter((t=>t<0?a[~t*c+e]:a[e*c+t]));i&&t.sort(((t,n)=>i(t<0?-a[~t*c+e]:a[e*c+t],n<0?-a[~n*c+e]:a[e*c+n])));for(const r of t)if(r<0){(l[~r*c+e]||(l[~r*c+e]={source:null,target:null})).target={index:e,startAngle:n,endAngle:n+=a[~r*c+e]*d,value:a[~r*c+e]}}else{(l[e*c+r]||(l[e*c+r]={source:null,target:null})).source={index:e,startAngle:n,endAngle:n+=a[e*c+r]*d,value:a[e*c+r]}}h[e]={index:e,startAngle:r,endAngle:n,value:f[e]}}else{const t=Pa(0,c).filter((t=>a[e*c+t]||a[t*c+e]));i&&t.sort(((t,n)=>i(a[e*c+t],a[e*c+n])));for(const r of t){let t;if(e<r?(t=l[e*c+r]||(l[e*c+r]={source:null,target:null}),t.source={index:e,startAngle:n,endAngle:n+=a[e*c+r]*d,value:a[e*c+r]}):(t=l[r*c+e]||(l[r*c+e]={source:null,target:null}),t.target={index:e,startAngle:n,endAngle:n+=a[e*c+r]*d,value:a[e*c+r]},e===r&&(t.source=t.target)),t.source&&t.target&&t.source.value<t.target.value){const n=t.source;t.source=t.target,t.target=n}}h[e]={index:e,startAngle:r,endAngle:n,value:f[e]}}n+=u}}return(l=Object.values(l)).groups=h,o?l.sort(o):l}return a.padAngle=function(t){return arguments.length?(e=ka(0,t),a):e},a.sortGroups=function(t){return arguments.length?(r=t,a):r},a.sortSubgroups=function(t){return arguments.length?(i=t,a):i},a.sortChords=function(t){return arguments.length?(null==t?o=null:(n=t,o=function(t,e){return n(t.source.value+t.target.value,e.source.value+e.target.value)})._=t,a):o&&o._;var n},a}const $a=Math.PI,Da=2*$a,Ra=1e-6,Fa=Da-Ra;function qa(t){this._+=t[0];for(let n=1,e=t.length;n<e;++n)this._+=arguments[n]+t[n]}let Ua=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?qa:function(t){let n=Math.floor(t);if(!(n>=0))throw new Error(`invalid digits: ${t}`);if(n>15)return qa;const e=10**n;return function(t){this._+=t[0];for(let n=1,r=t.length;n<r;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,e,r){this._append`Q${+t},${+n},${this._x1=+e},${this._y1=+r}`}bezierCurveTo(t,n,e,r,i,o){this._append`C${+t},${+n},${+e},${+r},${this._x1=+i},${this._y1=+o}`}arcTo(t,n,e,r,i){if(t=+t,n=+n,e=+e,r=+r,(i=+i)<0)throw new Error(`negative radius: ${i}`);let o=this._x1,a=this._y1,u=e-t,c=r-n,f=o-t,s=a-n,l=f*f+s*s;if(null===this._x1)this._append`M${this._x1=t},${this._y1=n}`;else if(l>Ra)if(Math.abs(s*u-c*f)>Ra&&i){let h=e-o,d=r-a,p=u*u+c*c,g=h*h+d*d,y=Math.sqrt(p),v=Math.sqrt(l),_=i*Math.tan(($a-Math.acos((p+l-g)/(2*y*v)))/2),b=_/v,m=_/y;Math.abs(b-1)>Ra&&this._append`L${t+b*f},${n+b*s}`,this._append`A${i},${i},0,0,${+(s*h>f*d)},${this._x1=t+m*u},${this._y1=n+m*c}`}else this._append`L${this._x1=t},${this._y1=n}`;else;}arc(t,n,e,r,i,o){if(t=+t,n=+n,o=!!o,(e=+e)<0)throw new Error(`negative radius: ${e}`);let a=e*Math.cos(r),u=e*Math.sin(r),c=t+a,f=n+u,s=1^o,l=o?r-i:i-r;null===this._x1?this._append`M${c},${f}`:(Math.abs(this._x1-c)>Ra||Math.abs(this._y1-f)>Ra)&&this._append`L${c},${f}`,e&&(l<0&&(l=l%Da+Da),l>Fa?this._append`A${e},${e},0,1,${s},${t-a},${n-u}A${e},${e},0,1,${s},${this._x1=c},${this._y1=f}`:l>Ra&&this._append`A${e},${e},0,${+(l>=$a)},${s},${this._x1=t+e*Math.cos(i)},${this._y1=n+e*Math.sin(i)}`)}rect(t,n,e,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${e=+e}v${+r}h${-e}Z`}toString(){return this._}};function Ia(){return new Ua}Ia.prototype=Ua.prototype;var Oa=Array.prototype.slice;function Ba(t){return function(){return t}}function Ya(t){return t.source}function La(t){return t.target}function ja(t){return t.radius}function Ha(t){return t.startAngle}function Xa(t){return t.endAngle}function Ga(){return 0}function Va(){return 10}function Wa(t){var n=Ya,e=La,r=ja,i=ja,o=Ha,a=Xa,u=Ga,c=null;function f(){var f,s=n.apply(this,arguments),l=e.apply(this,arguments),h=u.apply(this,arguments)/2,d=Oa.call(arguments),p=+r.apply(this,(d[0]=s,d)),g=o.apply(this,d)-Ea,y=a.apply(this,d)-Ea,v=+i.apply(this,(d[0]=l,d)),_=o.apply(this,d)-Ea,b=a.apply(this,d)-Ea;if(c||(c=f=Ia()),h>Ca&&(Ma(y-g)>2*h+Ca?y>g?(g+=h,y-=h):(g-=h,y+=h):g=y=(g+y)/2,Ma(b-_)>2*h+Ca?b>_?(_+=h,b-=h):(_-=h,b+=h):_=b=(_+b)/2),c.moveTo(p*Ta(g),p*Aa(g)),c.arc(0,0,p,g,y),g!==_||y!==b)if(t){var m=v-+t.apply(this,arguments),x=(_+b)/2;c.quadraticCurveTo(0,0,m*Ta(_),m*Aa(_)),c.lineTo(v*Ta(x),v*Aa(x)),c.lineTo(m*Ta(b),m*Aa(b))}else c.quadraticCurveTo(0,0,v*Ta(_),v*Aa(_)),c.arc(0,0,v,_,b);if(c.quadraticCurveTo(0,0,p*Ta(g),p*Aa(g)),c.closePath(),f)return c=null,f+""||null}return t&&(f.headRadius=function(n){return arguments.length?(t="function"==typeof n?n:Ba(+n),f):t}),f.radius=function(t){return arguments.length?(r=i="function"==typeof t?t:Ba(+t),f):r},f.sourceRadius=function(t){return arguments.length?(r="function"==typeof t?t:Ba(+t),f):r},f.targetRadius=function(t){return arguments.length?(i="function"==typeof t?t:Ba(+t),f):i},f.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:Ba(+t),f):o},f.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:Ba(+t),f):a},f.padAngle=function(t){return arguments.length?(u="function"==typeof t?t:Ba(+t),f):u},f.source=function(t){return arguments.length?(n=t,f):n},f.target=function(t){return arguments.length?(e=t,f):e},f.context=function(t){return arguments.length?(c=null==t?null:t,f):c},f}var Za=Array.prototype.slice;function Ka(t,n){return t-n}var Qa=t=>()=>t;function Ja(t,n){for(var e,r=-1,i=n.length;++r<i;)if(e=tu(t,n[r]))return e;return 0}function tu(t,n){for(var e=n[0],r=n[1],i=-1,o=0,a=t.length,u=a-1;o<a;u=o++){var c=t[o],f=c[0],s=c[1],l=t[u],h=l[0],d=l[1];if(nu(c,l,n))return 0;s>r!=d>r&&e<(h-f)*(r-s)/(d-s)+f&&(i=-i)}return i}function nu(t,n,e){var r,i,o,a;return function(t,n,e){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],o=e[r],a=n[r],i<=o&&o<=a||a<=o&&o<=i)}function eu(){}var ru=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function iu(){var t=1,n=1,e=K,r=u;function i(t){var n=e(t);if(Array.isArray(n))n=n.slice().sort(Ka);else{const e=M(t,ou);for(n=G(...Z(e[0],e[1],n),n);n[n.length-1]>=e[1];)n.pop();for(;n[1]<e[0];)n.shift()}return n.map((n=>o(t,n)))}function o(e,i){const o=null==i?NaN:+i;if(isNaN(o))throw new Error(`invalid value: ${i}`);var u=[],c=[];return function(e,r,i){var o,u,c,f,s,l,h=new Array,d=new Array;o=u=-1,f=au(e[0],r),ru[f<<1].forEach(p);for(;++o<t-1;)c=f,f=au(e[o+1],r),ru[c|f<<1].forEach(p);ru[f<<0].forEach(p);for(;++u<n-1;){for(o=-1,f=au(e[u*t+t],r),s=au(e[u*t],r),ru[f<<1|s<<2].forEach(p);++o<t-1;)c=f,f=au(e[u*t+t+o+1],r),l=s,s=au(e[u*t+o+1],r),ru[c|f<<1|s<<2|l<<3].forEach(p);ru[f|s<<3].forEach(p)}o=-1,s=e[u*t]>=r,ru[s<<2].forEach(p);for(;++o<t-1;)l=s,s=au(e[u*t+o+1],r),ru[s<<2|l<<3].forEach(p);function p(t){var n,e,r=[t[0][0]+o,t[0][1]+u],c=[t[1][0]+o,t[1][1]+u],f=a(r),s=a(c);(n=d[f])?(e=h[s])?(delete d[n.end],delete h[e.start],n===e?(n.ring.push(c),i(n.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[n.end],n.ring.push(c),d[n.end=s]=n):(n=h[s])?(e=d[f])?(delete h[n.start],delete d[e.end],n===e?(n.ring.push(c),i(n.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete h[n.start],n.ring.unshift(r),h[n.start=f]=n):h[f]=d[s]={start:f,end:s,ring:[r,c]}}ru[s<<3].forEach(p)}(e,o,(function(t){r(t,e,o),function(t){for(var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];++n<e;)r+=t[n-1][1]*t[n][0]-t[n-1][0]*t[n][1];return r}(t)>0?u.push([t]):c.push(t)})),c.forEach((function(t){for(var n,e=0,r=u.length;e<r;++e)if(-1!==Ja((n=u[e])[0],t))return void n.push(t)})),{type:"MultiPolygon",value:i,coordinates:u}}function a(n){return 2*n[0]+n[1]*(t+1)*4}function u(e,r,i){e.forEach((function(e){var o=e[0],a=e[1],u=0|o,c=0|a,f=uu(r[c*t+u]);o>0&&o<t&&u===o&&(e[0]=cu(o,uu(r[c*t+u-1]),f,i)),a>0&&a<n&&c===a&&(e[1]=cu(a,uu(r[(c-1)*t+u]),f,i))}))}return i.contour=o,i.size=function(e){if(!arguments.length)return[t,n];var r=Math.floor(e[0]),o=Math.floor(e[1]);if(!(r>=0&&o>=0))throw new Error("invalid size");return t=r,n=o,i},i.thresholds=function(t){return arguments.length?(e="function"==typeof t?t:Array.isArray(t)?Qa(Za.call(t)):Qa(t),i):e},i.smooth=function(t){return arguments.length?(r=t?u:eu,i):r===u},i}function ou(t){return isFinite(t)?t:NaN}function au(t,n){return null!=t&&+t>=n}function uu(t){return null==t||isNaN(t=+t)?-1/0:t}function cu(t,n,e,r){const i=r-n,o=e-n,a=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(a)?t:t+a-.5}function fu(t){return t[0]}function su(t){return t[1]}function lu(){return 1}const hu=134217729,du=33306690738754706e-32;function pu(t,n,e,r,i){let o,a,u,c,f=n[0],s=r[0],l=0,h=0;s>f==s>-f?(o=f,f=n[++l]):(o=s,s=r[++h]);let d=0;if(l<t&&h<e)for(s>f==s>-f?(a=f+o,u=o-(a-f),f=n[++l]):(a=s+o,u=o-(a-s),s=r[++h]),o=a,0!==u&&(i[d++]=u);l<t&&h<e;)s>f==s>-f?(a=o+f,c=a-o,u=o-(a-c)+(f-c),f=n[++l]):(a=o+s,c=a-o,u=o-(a-c)+(s-c),s=r[++h]),o=a,0!==u&&(i[d++]=u);for(;l<t;)a=o+f,c=a-o,u=o-(a-c)+(f-c),f=n[++l],o=a,0!==u&&(i[d++]=u);for(;h<e;)a=o+s,c=a-o,u=o-(a-c)+(s-c),s=r[++h],o=a,0!==u&&(i[d++]=u);return 0===o&&0!==d||(i[d++]=o),d}function gu(t){return new Float64Array(t)}const yu=22204460492503146e-32,vu=11093356479670487e-47,_u=gu(4),bu=gu(8),mu=gu(12),xu=gu(16),wu=gu(4);function Mu(t,n,e,r,i,o){const a=(n-o)*(e-i),u=(t-i)*(r-o),c=a-u,f=Math.abs(a+u);return Math.abs(c)>=33306690738754716e-32*f?c:-function(t,n,e,r,i,o,a){let u,c,f,s,l,h,d,p,g,y,v,_,b,m,x,w,M,T;const A=t-i,S=e-i,E=n-o,N=r-o;m=A*N,h=hu*A,d=h-(h-A),p=A-d,h=hu*N,g=h-(h-N),y=N-g,x=p*y-(m-d*g-p*g-d*y),w=E*S,h=hu*E,d=h-(h-E),p=E-d,h=hu*S,g=h-(h-S),y=S-g,M=p*y-(w-d*g-p*g-d*y),v=x-M,l=x-v,_u[0]=x-(v+l)+(l-M),_=m+v,l=_-m,b=m-(_-l)+(v-l),v=b-w,l=b-v,_u[1]=b-(v+l)+(l-w),T=_+v,l=T-_,_u[2]=_-(T-l)+(v-l),_u[3]=T;let k=function(t,n){let e=n[0];for(let r=1;r<t;r++)e+=n[r];return e}(4,_u),C=yu*a;if(k>=C||-k>=C)return k;if(l=t-A,u=t-(A+l)+(l-i),l=e-S,f=e-(S+l)+(l-i),l=n-E,c=n-(E+l)+(l-o),l=r-N,s=r-(N+l)+(l-o),0===u&&0===c&&0===f&&0===s)return k;if(C=vu*a+du*Math.abs(k),k+=A*s+N*u-(E*f+S*c),k>=C||-k>=C)return k;m=u*N,h=hu*u,d=h-(h-u),p=u-d,h=hu*N,g=h-(h-N),y=N-g,x=p*y-(m-d*g-p*g-d*y),w=c*S,h=hu*c,d=h-(h-c),p=c-d,h=hu*S,g=h-(h-S),y=S-g,M=p*y-(w-d*g-p*g-d*y),v=x-M,l=x-v,wu[0]=x-(v+l)+(l-M),_=m+v,l=_-m,b=m-(_-l)+(v-l),v=b-w,l=b-v,wu[1]=b-(v+l)+(l-w),T=_+v,l=T-_,wu[2]=_-(T-l)+(v-l),wu[3]=T;const P=pu(4,_u,4,wu,bu);m=A*s,h=hu*A,d=h-(h-A),p=A-d,h=hu*s,g=h-(h-s),y=s-g,x=p*y-(m-d*g-p*g-d*y),w=E*f,h=hu*E,d=h-(h-E),p=E-d,h=hu*f,g=h-(h-f),y=f-g,M=p*y-(w-d*g-p*g-d*y),v=x-M,l=x-v,wu[0]=x-(v+l)+(l-M),_=m+v,l=_-m,b=m-(_-l)+(v-l),v=b-w,l=b-v,wu[1]=b-(v+l)+(l-w),T=_+v,l=T-_,wu[2]=_-(T-l)+(v-l),wu[3]=T;const z=pu(P,bu,4,wu,mu);m=u*s,h=hu*u,d=h-(h-u),p=u-d,h=hu*s,g=h-(h-s),y=s-g,x=p*y-(m-d*g-p*g-d*y),w=c*f,h=hu*c,d=h-(h-c),p=c-d,h=hu*f,g=h-(h-f),y=f-g,M=p*y-(w-d*g-p*g-d*y),v=x-M,l=x-v,wu[0]=x-(v+l)+(l-M),_=m+v,l=_-m,b=m-(_-l)+(v-l),v=b-w,l=b-v,wu[1]=b-(v+l)+(l-w),T=_+v,l=T-_,wu[2]=_-(T-l)+(v-l),wu[3]=T;const $=pu(z,mu,4,wu,xu);return xu[$-1]}(t,n,e,r,i,o,f)}const Tu=Math.pow(2,-52),Au=new Uint32Array(512);class Su{static from(t,n=zu,e=$u){const r=t.length,i=new Float64Array(2*r);for(let o=0;o<r;o++){const r=t[o];i[2*o]=n(r),i[2*o+1]=e(r)}return new Su(i)}constructor(t){const n=t.length>>1;if(n>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const e=Math.max(2*n-5,0);this._triangles=new Uint32Array(3*e),this._halfedges=new Int32Array(3*e),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:e,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,u=1/0,c=-1/0,f=-1/0;for(let n=0;n<o;n++){const e=t[2*n],r=t[2*n+1];e<a&&(a=e),r<u&&(u=r),e>c&&(c=e),r>f&&(f=r),this._ids[n]=n}const s=(a+c)/2,l=(u+f)/2;let h,d,p,g=1/0;for(let n=0;n<o;n++){const e=Eu(s,l,t[2*n],t[2*n+1]);e<g&&(h=n,g=e)}const y=t[2*h],v=t[2*h+1];g=1/0;for(let n=0;n<o;n++){if(n===h)continue;const e=Eu(y,v,t[2*n],t[2*n+1]);e<g&&e>0&&(d=n,g=e)}let _=t[2*d],b=t[2*d+1],m=1/0;for(let n=0;n<o;n++){if(n===h||n===d)continue;const e=ku(y,v,_,b,t[2*n],t[2*n+1]);e<m&&(p=n,m=e)}let x=t[2*p],w=t[2*p+1];if(m===1/0){for(let n=0;n<o;n++)this._dists[n]=t[2*n]-t[0]||t[2*n+1]-t[1];Cu(this._ids,this._dists,0,o-1);const n=new Uint32Array(o);let e=0;for(let t=0,r=-1/0;t<o;t++){const i=this._ids[t];this._dists[i]>r&&(n[e++]=i,r=this._dists[i])}return this.hull=n.subarray(0,e),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(Mu(y,v,_,b,x,w)<0){const t=d,n=_,e=b;d=p,_=x,b=w,p=t,x=n,w=e}const M=function(t,n,e,r,i,o){const a=e-t,u=r-n,c=i-t,f=o-n,s=a*a+u*u,l=c*c+f*f,h=.5/(a*f-u*c),d=t+(f*s-u*l)*h,p=n+(a*l-c*s)*h;return{x:d,y:p}}(y,v,_,b,x,w);this._cx=M.x,this._cy=M.y;for(let n=0;n<o;n++)this._dists[n]=Eu(t[2*n],t[2*n+1],M.x,M.y);Cu(this._ids,this._dists,0,o-1),this._hullStart=h;let T=3;e[h]=n[p]=d,e[d]=n[h]=p,e[p]=n[d]=h,r[h]=0,r[d]=1,r[p]=2,i.fill(-1),i[this._hashKey(y,v)]=h,i[this._hashKey(_,b)]=d,i[this._hashKey(x,w)]=p,this.trianglesLen=0,this._addTriangle(h,d,p,-1,-1,-1);for(let o,a,u=0;u<this._ids.length;u++){const c=this._ids[u],f=t[2*c],s=t[2*c+1];if(u>0&&Math.abs(f-o)<=Tu&&Math.abs(s-a)<=Tu)continue;if(o=f,a=s,c===h||c===d||c===p)continue;let l=0;for(let t=0,n=this._hashKey(f,s);t<this._hashSize&&(l=i[(n+t)%this._hashSize],-1===l||l===e[l]);t++);l=n[l];let g,y=l;for(;g=e[y],Mu(f,s,t[2*y],t[2*y+1],t[2*g],t[2*g+1])>=0;)if(y=g,y===l){y=-1;break}if(-1===y)continue;let v=this._addTriangle(y,c,e[y],-1,-1,r[y]);r[c]=this._legalize(v+2),r[y]=v,T++;let _=e[y];for(;g=e[_],Mu(f,s,t[2*_],t[2*_+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(_,c,g,r[c],-1,r[_]),r[c]=this._legalize(v+2),e[_]=_,T--,_=g;if(y===l)for(;g=n[y],Mu(f,s,t[2*g],t[2*g+1],t[2*y],t[2*y+1])<0;)v=this._addTriangle(g,c,y,-1,r[y],r[g]),this._legalize(v+2),r[g]=v,e[y]=y,T--,y=g;this._hullStart=n[c]=y,e[y]=n[_]=c,e[c]=_,i[this._hashKey(f,s)]=c,i[this._hashKey(t[2*y],t[2*y+1])]=y}this.hull=new Uint32Array(T);for(let t=0,n=this._hullStart;t<T;t++)this.hull[t]=n,n=e[n];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(function(t,n){const e=t/(Math.abs(t)+Math.abs(n));return(n>0?3-e:1+e)/4}(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:e,coords:r}=this;let i=0,o=0;for(;;){const a=e[t],u=t-t%3;if(o=u+(t+2)%3,-1===a){if(0===i)break;t=Au[--i];continue}const c=a-a%3,f=u+(t+1)%3,s=c+(a+2)%3,l=n[o],h=n[t],d=n[f],p=n[s];if(Nu(r[2*l],r[2*l+1],r[2*h],r[2*h+1],r[2*d],r[2*d+1],r[2*p],r[2*p+1])){n[t]=p,n[a]=l;const r=e[s];if(-1===r){let n=this._hullStart;do{if(this._hullTri[n]===s){this._hullTri[n]=t;break}n=this._hullPrev[n]}while(n!==this._hullStart)}this._link(t,r),this._link(a,e[o]),this._link(o,s);const u=c+(a+1)%3;i<Au.length&&(Au[i++]=u)}else{if(0===i)break;t=Au[--i]}}return o}_link(t,n){this._halfedges[t]=n,-1!==n&&(this._halfedges[n]=t)}_addTriangle(t,n,e,r,i,o){const a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=n,this._triangles[a+2]=e,this._link(a,r),this._link(a+1,i),this._link(a+2,o),this.trianglesLen+=3,a}}function Eu(t,n,e,r){const i=t-e,o=n-r;return i*i+o*o}function Nu(t,n,e,r,i,o,a,u){const c=t-a,f=n-u,s=e-a,l=r-u,h=i-a,d=o-u,p=s*s+l*l,g=h*h+d*d;return c*(l*g-p*d)-f*(s*g-p*h)+(c*c+f*f)*(s*d-l*h)<0}function ku(t,n,e,r,i,o){const a=e-t,u=r-n,c=i-t,f=o-n,s=a*a+u*u,l=c*c+f*f,h=.5/(a*f-u*c),d=(f*s-u*l)*h,p=(a*l-c*s)*h;return d*d+p*p}function Cu(t,n,e,r){if(r-e<=20)for(let i=e+1;i<=r;i++){const r=t[i],o=n[r];let a=i-1;for(;a>=e&&n[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=e+1,o=r;Pu(t,e+r>>1,i),n[t[e]]>n[t[r]]&&Pu(t,e,r),n[t[i]]>n[t[r]]&&Pu(t,i,r),n[t[e]]>n[t[i]]&&Pu(t,e,i);const a=t[i],u=n[a];for(;;){do{i++}while(n[t[i]]<u);do{o--}while(n[t[o]]>u);if(o<i)break;Pu(t,i,o)}t[e+1]=t[o],t[o]=a,r-i+1>=o-e?(Cu(t,n,i,r),Cu(t,n,e,o-1)):(Cu(t,n,e,o-1),Cu(t,n,i,r))}}function Pu(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function zu(t){return t[0]}function $u(t){return t[1]}const Du=1e-6;class Ru{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,e){const r=(t=+t)+(e=+e),i=n=+n;if(e<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>Du||Math.abs(this._y1-i)>Du)&&(this._+="L"+r+","+i),e&&(this._+=`A${e},${e},0,1,1,${t-e},${n}A${e},${e},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,n,e,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+e}v${+r}h${-e}Z`}value(){return this._||null}}class Fu{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}class qu{constructor(t,[n,e,r,i]=[0,0,960,500]){if(!((r=+r)>=(n=+n)&&(i=+i)>=(e=+e)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=n,this.ymax=i,this.ymin=e,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:e},vectors:r}=this;let i,o;const a=this.circumcenters=this._circumcenters.subarray(0,e.length/3*2);for(let r,u,c=0,f=0,s=e.length;c<s;c+=3,f+=2){const s=2*e[c],l=2*e[c+1],h=2*e[c+2],d=t[s],p=t[s+1],g=t[l],y=t[l+1],v=t[h],_=t[h+1],b=g-d,m=y-p,x=v-d,w=_-p,M=2*(b*w-m*x);if(Math.abs(M)<1e-9){if(void 0===i){i=o=0;for(const e of n)i+=t[2*e],o+=t[2*e+1];i/=n.length,o/=n.length}const e=1e9*Math.sign((i-d)*w-(o-p)*x);r=(d+v)/2-e*w,u=(p+_)/2+e*x}else{const t=1/M,n=b*b+m*m,e=x*x+w*w;r=d+(w*n-m*e)*t,u=p+(b*e-x*n)*t}a[f]=r,a[f+1]=u}let u,c,f,s=n[n.length-1],l=4*s,h=t[2*s],d=t[2*s+1];r.fill(0);for(let e=0;e<n.length;++e)s=n[e],u=l,c=h,f=d,l=4*s,h=t[2*s],d=t[2*s+1],r[u+2]=r[l]=f-d,r[u+3]=r[l+1]=h-c}render(t){const n=null==t?t=new Ru:void 0,{delaunay:{halfedges:e,inedges:r,hull:i},circumcenters:o,vectors:a}=this;if(i.length<=1)return null;for(let n=0,r=e.length;n<r;++n){const r=e[n];if(r<n)continue;const i=2*Math.floor(n/3),a=2*Math.floor(r/3),u=o[i],c=o[i+1],f=o[a],s=o[a+1];this._renderSegment(u,c,f,s,t)}let u,c=i[i.length-1];for(let n=0;n<i.length;++n){u=c,c=i[n];const e=2*Math.floor(r[c]/3),f=o[e],s=o[e+1],l=4*u,h=this._project(f,s,a[l+2],a[l+3]);h&&this._renderSegment(f,s,h[0],h[1],t)}return n&&n.value()}renderBounds(t){const n=null==t?t=new Ru:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){const e=null==n?n=new Ru:void 0,r=this._clip(t);if(null===r||!r.length)return;n.moveTo(r[0],r[1]);let i=r.length;for(;r[0]===r[i-2]&&r[1]===r[i-1]&&i>1;)i-=2;for(let t=2;t<i;t+=2)r[t]===r[t-2]&&r[t+1]===r[t-1]||n.lineTo(r[t],r[t+1]);return n.closePath(),e&&e.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let n=0,e=t.length/2;n<e;++n){const t=this.cellPolygon(n);t&&(t.index=n,yield t)}}cellPolygon(t){const n=new Fu;return this.renderCell(t,n),n.value()}_renderSegment(t,n,e,r,i){let o;const a=this._regioncode(t,n),u=this._regioncode(e,r);0===a&&0===u?(i.moveTo(t,n),i.lineTo(e,r)):(o=this._clipSegment(t,n,e,r,a,u))&&(i.moveTo(o[0],o[1]),i.lineTo(o[2],o[3]))}contains(t,n,e){return(n=+n)==n&&(e=+e)==e&&this.delaunay._step(t,n,e)===t}*neighbors(t){const n=this._clip(t);if(n)for(const e of this.delaunay.neighbors(t)){const t=this._clip(e);if(t)t:for(let r=0,i=n.length;r<i;r+=2)for(let o=0,a=t.length;o<a;o+=2)if(n[r]===t[o]&&n[r+1]===t[o+1]&&n[(r+2)%i]===t[(o+a-2)%a]&&n[(r+3)%i]===t[(o+a-1)%a]){yield e;break t}}}_cell(t){const{circumcenters:n,delaunay:{inedges:e,halfedges:r,triangles:i}}=this,o=e[t];if(-1===o)return null;const a=[];let u=o;do{const e=Math.floor(u/3);if(a.push(n[2*e],n[2*e+1]),u=u%3==2?u-2:u+1,i[u]!==t)break;u=r[u]}while(u!==o&&-1!==u);return a}_clip(t){if(0===t&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const n=this._cell(t);if(null===n)return null;const{vectors:e}=this,r=4*t;return this._simplify(e[r]||e[r+1]?this._clipInfinite(t,n,e[r],e[r+1],e[r+2],e[r+3]):this._clipFinite(t,n))}_clipFinite(t,n){const e=n.length;let r,i,o,a,u=null,c=n[e-2],f=n[e-1],s=this._regioncode(c,f),l=0;for(let h=0;h<e;h+=2)if(r=c,i=f,c=n[h],f=n[h+1],o=s,s=this._regioncode(c,f),0===o&&0===s)a=l,l=0,u?u.push(c,f):u=[c,f];else{let n,e,h,d,p;if(0===o){if(null===(n=this._clipSegment(r,i,c,f,o,s)))continue;[e,h,d,p]=n}else{if(null===(n=this._clipSegment(c,f,r,i,s,o)))continue;[d,p,e,h]=n,a=l,l=this._edgecode(e,h),a&&l&&this._edge(t,a,l,u,u.length),u?u.push(e,h):u=[e,h]}a=l,l=this._edgecode(d,p),a&&l&&this._edge(t,a,l,u,u.length),u?u.push(d,p):u=[d,p]}if(u)a=l,l=this._edgecode(u[0],u[1]),a&&l&&this._edge(t,a,l,u,u.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return u}_clipSegment(t,n,e,r,i,o){const a=i<o;for(a&&([t,n,e,r,i,o]=[e,r,t,n,o,i]);;){if(0===i&&0===o)return a?[e,r,t,n]:[t,n,e,r];if(i&o)return null;let u,c,f=i||o;8&f?(u=t+(e-t)*(this.ymax-n)/(r-n),c=this.ymax):4&f?(u=t+(e-t)*(this.ymin-n)/(r-n),c=this.ymin):2&f?(c=n+(r-n)*(this.xmax-t)/(e-t),u=this.xmax):(c=n+(r-n)*(this.xmin-t)/(e-t),u=this.xmin),i?(t=u,n=c,i=this._regioncode(t,n)):(e=u,r=c,o=this._regioncode(e,r))}}_clipInfinite(t,n,e,r,i,o){let a,u=Array.from(n);if((a=this._project(u[0],u[1],e,r))&&u.unshift(a[0],a[1]),(a=this._project(u[u.length-2],u[u.length-1],i,o))&&u.push(a[0],a[1]),u=this._clipFinite(t,u))for(let n,e=0,r=u.length,i=this._edgecode(u[r-2],u[r-1]);e<r;e+=2)n=i,i=this._edgecode(u[e],u[e+1]),n&&i&&(e=this._edge(t,n,i,u,e),r=u.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(u=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return u}_edge(t,n,e,r,i){for(;n!==e;){let e,o;switch(n){case 5:n=4;continue;case 4:n=6,e=this.xmax,o=this.ymin;break;case 6:n=2;continue;case 2:n=10,e=this.xmax,o=this.ymax;break;case 10:n=8;continue;case 8:n=9,e=this.xmin,o=this.ymax;break;case 9:n=1;continue;case 1:n=5,e=this.xmin,o=this.ymin}r[i]===e&&r[i+1]===o||!this.contains(t,e,o)||(r.splice(i,0,e,o),i+=2)}return i}_project(t,n,e,r){let i,o,a,u=1/0;if(r<0){if(n<=this.ymin)return null;(i=(this.ymin-n)/r)<u&&(a=this.ymin,o=t+(u=i)*e)}else if(r>0){if(n>=this.ymax)return null;(i=(this.ymax-n)/r)<u&&(a=this.ymax,o=t+(u=i)*e)}if(e>0){if(t>=this.xmax)return null;(i=(this.xmax-t)/e)<u&&(o=this.xmax,a=n+(u=i)*r)}else if(e<0){if(t<=this.xmin)return null;(i=(this.xmin-t)/e)<u&&(o=this.xmin,a=n+(u=i)*r)}return[o,a]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){const e=(n+2)%t.length,r=(n+4)%t.length;(t[n]===t[e]&&t[e]===t[r]||t[n+1]===t[e+1]&&t[e+1]===t[r+1])&&(t.splice(e,2),n-=2)}t.length||(t=null)}return t}}const Uu=2*Math.PI,Iu=Math.pow;function Ou(t){return t[0]}function Bu(t){return t[1]}function Yu(t,n,e){return[t+Math.sin(t+n)*e,n+Math.cos(t-n)*e]}class Lu{static from(t,n=Ou,e=Bu,r){return new Lu("length"in t?function(t,n,e,r){const i=t.length,o=new Float64Array(2*i);for(let a=0;a<i;++a){const i=t[a];o[2*a]=n.call(r,i,a,t),o[2*a+1]=e.call(r,i,a,t)}return o}(t,n,e,r):Float64Array.from(function*(t,n,e,r){let i=0;for(const o of t)yield n.call(r,o,i,t),yield e.call(r,o,i,t),++i}(t,n,e,r)))}constructor(t){this._delaunator=new Su(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&function(t){const{triangles:n,coords:e}=t;for(let t=0;t<n.length;t+=3){const r=2*n[t],i=2*n[t+1],o=2*n[t+2];if((e[o]-e[r])*(e[i+1]-e[r+1])-(e[i]-e[r])*(e[o+1]-e[r+1])>1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:n.length/2},((t,n)=>n)).sort(((t,e)=>n[2*t]-n[2*e]||n[2*t+1]-n[2*e+1]));const t=this.collinear[0],e=this.collinear[this.collinear.length-1],r=[n[2*t],n[2*t+1],n[2*e],n[2*e+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,e=n.length/2;t<e;++t){const e=Yu(n[2*t],n[2*t+1],i);n[2*t]=e[0],n[2*t+1]=e[1]}this._delaunator=new Su(n)}else delete this.collinear;const e=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let t=0,n=e.length;t<n;++t){const n=i[t%3==2?t-2:t+1];-1!==e[t]&&-1!==o[n]||(o[n]=t)}for(let t=0,n=r.length;t<n;++t)a[r[t]]=t;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,2===r.length&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(t){return new qu(this,t)}*neighbors(t){const{inedges:n,hull:e,_hullIndex:r,halfedges:i,triangles:o,collinear:a}=this;if(a){const n=a.indexOf(t);return n>0&&(yield a[n-1]),void(n<a.length-1&&(yield a[n+1]))}const u=n[t];if(-1===u)return;let c=u,f=-1;do{if(yield f=o[c],c=c%3==2?c-2:c+1,o[c]!==t)return;if(c=i[c],-1===c){const n=e[(r[t]+1)%e.length];return void(n!==f&&(yield n))}}while(c!==u)}find(t,n,e=0){if((t=+t)!=t||(n=+n)!=n)return-1;const r=e;let i;for(;(i=this._step(e,t,n))>=0&&i!==e&&i!==r;)e=i;return i}_step(t,n,e){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:u,points:c}=this;if(-1===r[t]||!c.length)return(t+1)%(c.length>>1);let f=t,s=Iu(n-c[2*t],2)+Iu(e-c[2*t+1],2);const l=r[t];let h=l;do{let r=u[h];const l=Iu(n-c[2*r],2)+Iu(e-c[2*r+1],2);if(l<s&&(s=l,f=r),h=h%3==2?h-2:h+1,u[h]!==t)break;if(h=a[h],-1===h){if(h=i[(o[t]+1)%i.length],h!==r&&Iu(n-c[2*h],2)+Iu(e-c[2*h+1],2)<s)return h;break}}while(h!==l);return f}render(t){const n=null==t?t=new Ru:void 0,{points:e,halfedges:r,triangles:i}=this;for(let n=0,o=r.length;n<o;++n){const o=r[n];if(o<n)continue;const a=2*i[n],u=2*i[o];t.moveTo(e[a],e[a+1]),t.lineTo(e[u],e[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){void 0!==n||t&&"function"==typeof t.moveTo||(n=t,t=null),n=null==n?2:+n;const e=null==t?t=new Ru:void 0,{points:r}=this;for(let e=0,i=r.length;e<i;e+=2){const i=r[e],o=r[e+1];t.moveTo(i+n,o),t.arc(i,o,n,0,Uu)}return e&&e.value()}renderHull(t){const n=null==t?t=new Ru:void 0,{hull:e,points:r}=this,i=2*e[0],o=e.length;t.moveTo(r[i],r[i+1]);for(let n=1;n<o;++n){const i=2*e[n];t.lineTo(r[i],r[i+1])}return t.closePath(),n&&n.value()}hullPolygon(){const t=new Fu;return this.renderHull(t),t.value()}renderTriangle(t,n){const e=null==n?n=new Ru:void 0,{points:r,triangles:i}=this,o=2*i[t*=3],a=2*i[t+1],u=2*i[t+2];return n.moveTo(r[o],r[o+1]),n.lineTo(r[a],r[a+1]),n.lineTo(r[u],r[u+1]),n.closePath(),e&&e.value()}*trianglePolygons(){const{triangles:t}=this;for(let n=0,e=t.length/3;n<e;++n)yield this.trianglePolygon(n)}trianglePolygon(t){const n=new Fu;return this.renderTriangle(t,n),n.value()}}var ju={},Hu={},Xu=34,Gu=10,Vu=13;function Wu(t){return new Function("d","return {"+t.map((function(t,n){return JSON.stringify(t)+": d["+n+'] || ""'})).join(",")+"}")}function Zu(t){var n=Object.create(null),e=[];return t.forEach((function(t){for(var r in t)r in n||e.push(n[r]=r)})),e}function Ku(t,n){var e=t+"",r=e.length;return r<n?new Array(n-r+1).join(0)+e:e}function Qu(t){var n,e=t.getUTCHours(),r=t.getUTCMinutes(),i=t.getUTCSeconds(),o=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":((n=t.getUTCFullYear())<0?"-"+Ku(-n,6):n>9999?"+"+Ku(n,6):Ku(n,4))+"-"+Ku(t.getUTCMonth()+1,2)+"-"+Ku(t.getUTCDate(),2)+(o?"T"+Ku(e,2)+":"+Ku(r,2)+":"+Ku(i,2)+"."+Ku(o,3)+"Z":i?"T"+Ku(e,2)+":"+Ku(r,2)+":"+Ku(i,2)+"Z":r||e?"T"+Ku(e,2)+":"+Ku(r,2)+"Z":"")}function Ju(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function r(t,n){var r,i=[],o=t.length,a=0,u=0,c=o<=0,f=!1;function s(){if(c)return Hu;if(f)return f=!1,ju;var n,r,i=a;if(t.charCodeAt(i)===Xu){for(;a++<o&&t.charCodeAt(a)!==Xu||t.charCodeAt(++a)===Xu;);return(n=a)>=o?c=!0:(r=t.charCodeAt(a++))===Gu?f=!0:r===Vu&&(f=!0,t.charCodeAt(a)===Gu&&++a),t.slice(i+1,n-1).replace(/""/g,'"')}for(;a<o;){if((r=t.charCodeAt(n=a++))===Gu)f=!0;else if(r===Vu)f=!0,t.charCodeAt(a)===Gu&&++a;else if(r!==e)continue;return t.slice(i,n)}return c=!0,t.slice(i,o)}for(t.charCodeAt(o-1)===Gu&&--o,t.charCodeAt(o-1)===Vu&&--o;(r=s())!==Hu;){for(var l=[];r!==ju&&r!==Hu;)l.push(r),r=s();n&&null==(l=n(l,u++))||i.push(l)}return i}function i(n,e){return n.map((function(n){return e.map((function(t){return a(n[t])})).join(t)}))}function o(n){return n.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?Qu(t):n.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,n){var e,i,o=r(t,(function(t,r){if(e)return e(t,r-1);i=t,e=n?function(t,n){var e=Wu(t);return function(r,i){return n(e(r),i,t)}}(t,n):Wu(t)}));return o.columns=i||[],o},parseRows:r,format:function(n,e){return null==e&&(e=Zu(n)),[e.map(a).join(t)].concat(i(n,e)).join("\n")},formatBody:function(t,n){return null==n&&(n=Zu(t)),i(t,n).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}var tc=Ju(","),nc=tc.parse,ec=tc.parseRows,rc=tc.format,ic=tc.formatBody,oc=tc.formatRows,ac=tc.formatRow,uc=tc.formatValue,cc=Ju("\t"),fc=cc.parse,sc=cc.parseRows,lc=cc.format,hc=cc.formatBody,dc=cc.formatRows,pc=cc.formatRow,gc=cc.formatValue;const yc=new Date("2019-01-01T00:00").getHours()||new Date("2019-07-01T00:00").getHours();function vc(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.blob()}function _c(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.arrayBuffer()}function bc(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function mc(t,n){return fetch(t,n).then(bc)}function xc(t){return function(n,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=void 0),mc(n,e).then((function(n){return t(n,r)}))}}var wc=xc(nc),Mc=xc(fc);function Tc(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function Ac(t){return(n,e)=>mc(n,e).then((n=>(new DOMParser).parseFromString(n,t)))}var Sc=Ac("application/xml"),Ec=Ac("text/html"),Nc=Ac("image/svg+xml");function kc(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,a,u,c,f,s,l,h,d=t._root,p={data:r},g=t._x0,y=t._y0,v=t._x1,_=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((f=n>=(o=(g+v)/2))?g=o:v=o,(s=e>=(a=(y+_)/2))?y=a:_=a,i=d,!(d=d[l=s<<1|f]))return i[l]=p,t;if(u=+t._x.call(null,d.data),c=+t._y.call(null,d.data),n===u&&e===c)return p.next=d,i?i[l]=p:t._root=p,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(f=n>=(o=(g+v)/2))?g=o:v=o,(s=e>=(a=(y+_)/2))?y=a:_=a}while((l=s<<1|f)==(h=(c>=a)<<1|u>=o));return i[h]=d,i[l]=p,t}function Cc(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function Pc(t){return t[0]}function zc(t){return t[1]}function $c(t,n,e){var r=new Dc(null==n?Pc:n,null==e?zc:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function Dc(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function Rc(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var Fc=$c.prototype=Dc.prototype;function qc(t){return function(){return t}}function Uc(t){return 1e-6*(t()-.5)}function Ic(t){return t.x+t.vx}function Oc(t){return t.y+t.vy}function Bc(t){return t.index}function Yc(t,n){var e=t.get(n);if(!e)throw new Error("node not found: "+n);return e}Fc.copy=function(){var t,n,e=new Dc(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=Rc(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=Rc(n));return e},Fc.add=function(t){const n=+this._x.call(null,t),e=+this._y.call(null,t);return kc(this.cover(n,e),n,e,t)},Fc.addAll=function(t){var n,e,r,i,o=t.length,a=new Array(o),u=new Array(o),c=1/0,f=1/0,s=-1/0,l=-1/0;for(e=0;e<o;++e)isNaN(r=+this._x.call(null,n=t[e]))||isNaN(i=+this._y.call(null,n))||(a[e]=r,u[e]=i,r<c&&(c=r),r>s&&(s=r),i<f&&(f=i),i>l&&(l=i));if(c>s||f>l)return this;for(this.cover(c,f).cover(s,l),e=0;e<o;++e)kc(this,a[e],u[e],t[e]);return this},Fc.cover=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,o=(r=Math.floor(n))+1;else{for(var a,u,c=i-e||1,f=this._root;e>t||t>=i||r>n||n>=o;)switch(u=(n<r)<<1|t<e,(a=new Array(4))[u]=f,f=a,c*=2,u){case 0:i=e+c,o=r+c;break;case 1:e=i-c,o=r+c;break;case 2:i=e+c,r=o-c;break;case 3:e=i-c,r=o-c}this._root&&this._root.length&&(this._root=f)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},Fc.data=function(){var t=[];return this.visit((function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)})),t},Fc.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},Fc.find=function(t,n,e){var r,i,o,a,u,c,f,s=this._x0,l=this._y0,h=this._x1,d=this._y1,p=[],g=this._root;for(g&&p.push(new Cc(g,s,l,h,d)),null==e?e=1/0:(s=t-e,l=n-e,h=t+e,d=n+e,e*=e);c=p.pop();)if(!(!(g=c.node)||(i=c.x0)>h||(o=c.y0)>d||(a=c.x1)<s||(u=c.y1)<l))if(g.length){var y=(i+a)/2,v=(o+u)/2;p.push(new Cc(g[3],y,v,a,u),new Cc(g[2],i,v,y,u),new Cc(g[1],y,o,a,v),new Cc(g[0],i,o,y,v)),(f=(n>=v)<<1|t>=y)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-f],p[p.length-1-f]=c)}else{var _=t-+this._x.call(null,g.data),b=n-+this._y.call(null,g.data),m=_*_+b*b;if(m<e){var x=Math.sqrt(e=m);s=t-x,l=n-x,h=t+x,d=n+x,r=g.data}}return r},Fc.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var n,e,r,i,o,a,u,c,f,s,l,h,d=this._root,p=this._x0,g=this._y0,y=this._x1,v=this._y1;if(!d)return this;if(d.length)for(;;){if((f=o>=(u=(p+y)/2))?p=u:y=u,(s=a>=(c=(g+v)/2))?g=c:v=c,n=d,!(d=d[l=s<<1|f]))return this;if(!d.length)break;(n[l+1&3]||n[l+2&3]||n[l+3&3])&&(e=n,h=l)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):n?(i?n[l]=i:delete n[l],(d=n[0]||n[1]||n[2]||n[3])&&d===(n[3]||n[2]||n[1]||n[0])&&!d.length&&(e?e[h]=d:this._root=d),this):(this._root=i,this)},Fc.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},Fc.root=function(){return this._root},Fc.size=function(){var t=0;return this.visit((function(n){if(!n.length)do{++t}while(n=n.next)})),t},Fc.visit=function(t){var n,e,r,i,o,a,u=[],c=this._root;for(c&&u.push(new Cc(c,this._x0,this._y0,this._x1,this._y1));n=u.pop();)if(!t(c=n.node,r=n.x0,i=n.y0,o=n.x1,a=n.y1)&&c.length){var f=(r+o)/2,s=(i+a)/2;(e=c[3])&&u.push(new Cc(e,f,s,o,a)),(e=c[2])&&u.push(new Cc(e,r,s,f,a)),(e=c[1])&&u.push(new Cc(e,f,i,o,s)),(e=c[0])&&u.push(new Cc(e,r,i,f,s))}return this},Fc.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new Cc(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var o,a=n.x0,u=n.y0,c=n.x1,f=n.y1,s=(a+c)/2,l=(u+f)/2;(o=i[0])&&e.push(new Cc(o,a,u,s,l)),(o=i[1])&&e.push(new Cc(o,s,u,c,l)),(o=i[2])&&e.push(new Cc(o,a,l,s,f)),(o=i[3])&&e.push(new Cc(o,s,l,c,f))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},Fc.x=function(t){return arguments.length?(this._x=t,this):this._x},Fc.y=function(t){return arguments.length?(this._y=t,this):this._y};const Lc=1664525,jc=1013904223,Hc=4294967296;function Xc(t){return t.x}function Gc(t){return t.y}var Vc=Math.PI*(3-Math.sqrt(5));function Wc(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function Zc(t){return(t=Wc(Math.abs(t)))?t[1]:NaN}var Kc,Qc=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Jc(t){if(!(n=Qc.exec(t)))throw new Error("invalid format: "+t);var n;return new tf({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function tf(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function nf(t,n){var e=Wc(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Jc.prototype=tf.prototype,tf.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var ef={"%":(t,n)=>(100*t).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>nf(100*t,n),r:nf,s:function(t,n){var e=Wc(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(Kc=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Wc(t,Math.max(0,n+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function rf(t){return t}var of,af=Array.prototype.map,uf=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function cf(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?rf:(n=af.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=n[0],c=0;i>0&&u>0&&(c+u+1>r&&(u=Math.max(1,r-c)),o.push(t.substring(i-=u,i+u)),!((c+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?rf:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(af.call(t.numerals,String)),c=void 0===t.percent?"%":t.percent+"",f=void 0===t.minus?"−":t.minus+"",s=void 0===t.nan?"NaN":t.nan+"";function l(t){var n=(t=Jc(t)).fill,e=t.align,l=t.sign,h=t.symbol,d=t.zero,p=t.width,g=t.comma,y=t.precision,v=t.trim,_=t.type;"n"===_?(g=!0,_="g"):ef[_]||(void 0===y&&(y=12),v=!0,_="g"),(d||"0"===n&&"="===e)&&(d=!0,n="0",e="=");var b="$"===h?i:"#"===h&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",m="$"===h?o:/[%p]/.test(_)?c:"",x=ef[_],w=/[defgprs%]/.test(_);function M(t){var i,o,c,h=b,M=m;if("c"===_)M=x(t)+M,t="";else{var T=(t=+t)<0||1/t<0;if(t=isNaN(t)?s:x(Math.abs(t),y),v&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),T&&0==+t&&"+"!==l&&(T=!1),h=(T?"("===l?l:f:"-"===l||"("===l?"":l)+h,M=("s"===_?uf[8+Kc/3]:"")+M+(T&&"("===l?")":""),w)for(i=-1,o=t.length;++i<o;)if(48>(c=t.charCodeAt(i))||c>57){M=(46===c?a+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var A=h.length+t.length+M.length,S=A<p?new Array(p-A+1).join(n):"";switch(g&&d&&(t=r(S+t,S.length?p-M.length:1/0),S=""),e){case"<":t=h+t+M+S;break;case"=":t=h+S+t+M;break;case"^":t=S.slice(0,A=S.length>>1)+h+t+M+S.slice(A);break;default:t=S+h+t+M}return u(t)}return y=void 0===y?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y)),M.toString=function(){return t+""},M}return{format:l,formatPrefix:function(t,n){var e=l(((t=Jc(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Zc(n)/3))),i=Math.pow(10,-r),o=uf[8+r/3];return function(t){return e(i*t)+o}}}}function ff(n){return of=cf(n),t.format=of.format,t.formatPrefix=of.formatPrefix,of}function sf(t){return Math.max(0,-Zc(Math.abs(t)))}function lf(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Zc(n)/3)))-Zc(Math.abs(t)))}function hf(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Zc(n)-Zc(t))+1}t.format=void 0,t.formatPrefix=void 0,ff({thousands:",",grouping:[3],currency:["$",""]});var df=1e-6,pf=1e-12,gf=Math.PI,yf=gf/2,vf=gf/4,_f=2*gf,bf=180/gf,mf=gf/180,xf=Math.abs,wf=Math.atan,Mf=Math.atan2,Tf=Math.cos,Af=Math.ceil,Sf=Math.exp,Ef=Math.hypot,Nf=Math.log,kf=Math.pow,Cf=Math.sin,Pf=Math.sign||function(t){return t>0?1:t<0?-1:0},zf=Math.sqrt,$f=Math.tan;function Df(t){return t>1?0:t<-1?gf:Math.acos(t)}function Rf(t){return t>1?yf:t<-1?-yf:Math.asin(t)}function Ff(t){return(t=Cf(t/2))*t}function qf(){}function Uf(t,n){t&&Of.hasOwnProperty(t.type)&&Of[t.type](t,n)}var If={Feature:function(t,n){Uf(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)Uf(e[r].geometry,n)}},Of={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){Bf(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)Bf(e[r],n,0)},Polygon:function(t,n){Yf(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)Yf(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)Uf(e[r],n)}};function Bf(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function Yf(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)Bf(t[e],n,1);n.polygonEnd()}function Lf(t,n){t&&If.hasOwnProperty(t.type)?If[t.type](t,n):Uf(t,n)}var jf,Hf,Xf,Gf,Vf,Wf,Zf,Kf,Qf,Jf,ts,ns,es,rs,is,os,as=new T,us=new T,cs={point:qf,lineStart:qf,lineEnd:qf,polygonStart:function(){as=new T,cs.lineStart=fs,cs.lineEnd=ss},polygonEnd:function(){var t=+as;us.add(t<0?_f+t:t),this.lineStart=this.lineEnd=this.point=qf},sphere:function(){us.add(_f)}};function fs(){cs.point=ls}function ss(){hs(jf,Hf)}function ls(t,n){cs.point=hs,jf=t,Hf=n,Xf=t*=mf,Gf=Tf(n=(n*=mf)/2+vf),Vf=Cf(n)}function hs(t,n){var e=(t*=mf)-Xf,r=e>=0?1:-1,i=r*e,o=Tf(n=(n*=mf)/2+vf),a=Cf(n),u=Vf*a,c=Gf*o+u*Tf(i),f=u*r*Cf(i);as.add(Mf(f,c)),Xf=t,Gf=o,Vf=a}function ds(t){return[Mf(t[1],t[0]),Rf(t[2])]}function ps(t){var n=t[0],e=t[1],r=Tf(e);return[r*Tf(n),r*Cf(n),Cf(e)]}function gs(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function ys(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function vs(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function _s(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function bs(t){var n=zf(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var ms,xs,ws,Ms,Ts,As,Ss,Es,Ns,ks,Cs,Ps,zs,$s,Ds,Rs,Fs={point:qs,lineStart:Is,lineEnd:Os,polygonStart:function(){Fs.point=Bs,Fs.lineStart=Ys,Fs.lineEnd=Ls,rs=new T,cs.polygonStart()},polygonEnd:function(){cs.polygonEnd(),Fs.point=qs,Fs.lineStart=Is,Fs.lineEnd=Os,as<0?(Wf=-(Kf=180),Zf=-(Qf=90)):rs>df?Qf=90:rs<-df&&(Zf=-90),os[0]=Wf,os[1]=Kf},sphere:function(){Wf=-(Kf=180),Zf=-(Qf=90)}};function qs(t,n){is.push(os=[Wf=t,Kf=t]),n<Zf&&(Zf=n),n>Qf&&(Qf=n)}function Us(t,n){var e=ps([t*mf,n*mf]);if(es){var r=ys(es,e),i=ys([r[1],-r[0],0],r);bs(i),i=ds(i);var o,a=t-Jf,u=a>0?1:-1,c=i[0]*bf*u,f=xf(a)>180;f^(u*Jf<c&&c<u*t)?(o=i[1]*bf)>Qf&&(Qf=o):f^(u*Jf<(c=(c+360)%360-180)&&c<u*t)?(o=-i[1]*bf)<Zf&&(Zf=o):(n<Zf&&(Zf=n),n>Qf&&(Qf=n)),f?t<Jf?js(Wf,t)>js(Wf,Kf)&&(Kf=t):js(t,Kf)>js(Wf,Kf)&&(Wf=t):Kf>=Wf?(t<Wf&&(Wf=t),t>Kf&&(Kf=t)):t>Jf?js(Wf,t)>js(Wf,Kf)&&(Kf=t):js(t,Kf)>js(Wf,Kf)&&(Wf=t)}else is.push(os=[Wf=t,Kf=t]);n<Zf&&(Zf=n),n>Qf&&(Qf=n),es=e,Jf=t}function Is(){Fs.point=Us}function Os(){os[0]=Wf,os[1]=Kf,Fs.point=qs,es=null}function Bs(t,n){if(es){var e=t-Jf;rs.add(xf(e)>180?e+(e>0?360:-360):e)}else ts=t,ns=n;cs.point(t,n),Us(t,n)}function Ys(){cs.lineStart()}function Ls(){Bs(ts,ns),cs.lineEnd(),xf(rs)>df&&(Wf=-(Kf=180)),os[0]=Wf,os[1]=Kf,es=null}function js(t,n){return(n-=t)<0?n+360:n}function Hs(t,n){return t[0]-n[0]}function Xs(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var Gs={sphere:qf,point:Vs,lineStart:Zs,lineEnd:Js,polygonStart:function(){Gs.lineStart=tl,Gs.lineEnd=nl},polygonEnd:function(){Gs.lineStart=Zs,Gs.lineEnd=Js}};function Vs(t,n){t*=mf;var e=Tf(n*=mf);Ws(e*Tf(t),e*Cf(t),Cf(n))}function Ws(t,n,e){++ms,ws+=(t-ws)/ms,Ms+=(n-Ms)/ms,Ts+=(e-Ts)/ms}function Zs(){Gs.point=Ks}function Ks(t,n){t*=mf;var e=Tf(n*=mf);$s=e*Tf(t),Ds=e*Cf(t),Rs=Cf(n),Gs.point=Qs,Ws($s,Ds,Rs)}function Qs(t,n){t*=mf;var e=Tf(n*=mf),r=e*Tf(t),i=e*Cf(t),o=Cf(n),a=Mf(zf((a=Ds*o-Rs*i)*a+(a=Rs*r-$s*o)*a+(a=$s*i-Ds*r)*a),$s*r+Ds*i+Rs*o);xs+=a,As+=a*($s+($s=r)),Ss+=a*(Ds+(Ds=i)),Es+=a*(Rs+(Rs=o)),Ws($s,Ds,Rs)}function Js(){Gs.point=Vs}function tl(){Gs.point=el}function nl(){rl(Ps,zs),Gs.point=Vs}function el(t,n){Ps=t,zs=n,t*=mf,n*=mf,Gs.point=rl;var e=Tf(n);$s=e*Tf(t),Ds=e*Cf(t),Rs=Cf(n),Ws($s,Ds,Rs)}function rl(t,n){t*=mf;var e=Tf(n*=mf),r=e*Tf(t),i=e*Cf(t),o=Cf(n),a=Ds*o-Rs*i,u=Rs*r-$s*o,c=$s*i-Ds*r,f=Ef(a,u,c),s=Rf(f),l=f&&-s/f;Ns.add(l*a),ks.add(l*u),Cs.add(l*c),xs+=s,As+=s*($s+($s=r)),Ss+=s*(Ds+(Ds=i)),Es+=s*(Rs+(Rs=o)),Ws($s,Ds,Rs)}function il(t){return function(){return t}}function ol(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return(e=n.invert(e,r))&&t.invert(e[0],e[1])}),e}function al(t,n){return xf(t)>gf&&(t-=Math.round(t/_f)*_f),[t,n]}function ul(t,n,e){return(t%=_f)?n||e?ol(fl(t),sl(n,e)):fl(t):n||e?sl(n,e):al}function cl(t){return function(n,e){return xf(n+=t)>gf&&(n-=Math.round(n/_f)*_f),[n,e]}}function fl(t){var n=cl(t);return n.invert=cl(-t),n}function sl(t,n){var e=Tf(t),r=Cf(t),i=Tf(n),o=Cf(n);function a(t,n){var a=Tf(n),u=Tf(t)*a,c=Cf(t)*a,f=Cf(n),s=f*e+u*r;return[Mf(c*i-s*o,u*e-f*r),Rf(s*i+c*o)]}return a.invert=function(t,n){var a=Tf(n),u=Tf(t)*a,c=Cf(t)*a,f=Cf(n),s=f*i-c*o;return[Mf(c*i+f*o,u*e+s*r),Rf(s*e-u*r)]},a}function ll(t){function n(n){return(n=t(n[0]*mf,n[1]*mf))[0]*=bf,n[1]*=bf,n}return t=ul(t[0]*mf,t[1]*mf,t.length>2?t[2]*mf:0),n.invert=function(n){return(n=t.invert(n[0]*mf,n[1]*mf))[0]*=bf,n[1]*=bf,n},n}function hl(t,n,e,r,i,o){if(e){var a=Tf(n),u=Cf(n),c=r*e;null==i?(i=n+r*_f,o=n-c/2):(i=dl(a,i),o=dl(a,o),(r>0?i<o:i>o)&&(i+=r*_f));for(var f,s=i;r>0?s>o:s<o;s-=c)f=ds([a,-u*Tf(s),-u*Cf(s)]),t.point(f[0],f[1])}}function dl(t,n){(n=ps(n))[0]-=t,bs(n);var e=Df(-n[1]);return((-n[2]<0?-e:e)+_f-df)%_f}function pl(){var t,n=[];return{point:function(n,e,r){t.push([n,e,r])},lineStart:function(){n.push(t=[])},lineEnd:qf,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function gl(t,n){return xf(t[0]-n[0])<df&&xf(t[1]-n[1])<df}function yl(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function vl(t,n,e,r,i){var o,a,u=[],c=[];if(t.forEach((function(t){if(!((n=t.length-1)<=0)){var n,e,r=t[0],a=t[n];if(gl(r,a)){if(!r[2]&&!a[2]){for(i.lineStart(),o=0;o<n;++o)i.point((r=t[o])[0],r[1]);return void i.lineEnd()}a[0]+=2*df}u.push(e=new yl(r,t,null,!0)),c.push(e.o=new yl(r,null,e,!1)),u.push(e=new yl(a,t,null,!1)),c.push(e.o=new yl(a,null,e,!0))}})),u.length){for(c.sort(n),_l(u),_l(c),o=0,a=c.length;o<a;++o)c[o].e=e=!e;for(var f,s,l=u[0];;){for(var h=l,d=!0;h.v;)if((h=h.n)===l)return;f=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(o=0,a=f.length;o<a;++o)i.point((s=f[o])[0],s[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(f=h.p.z,o=f.length-1;o>=0;--o)i.point((s=f[o])[0],s[1]);else r(h.x,h.p.x,-1,i);h=h.p}f=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function _l(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r<n;)i.n=e=t[r],e.p=i,i=e;i.n=e=t[0],e.p=i}}function bl(t){return xf(t[0])<=gf?t[0]:Pf(t[0])*((xf(t[0])+gf)%_f-gf)}function ml(t,n){var e=bl(n),r=n[1],i=Cf(r),o=[Cf(e),-Tf(e),0],a=0,u=0,c=new T;1===i?r=yf+df:-1===i&&(r=-yf-df);for(var f=0,s=t.length;f<s;++f)if(h=(l=t[f]).length)for(var l,h,d=l[h-1],p=bl(d),g=d[1]/2+vf,y=Cf(g),v=Tf(g),_=0;_<h;++_,p=m,y=w,v=M,d=b){var b=l[_],m=bl(b),x=b[1]/2+vf,w=Cf(x),M=Tf(x),A=m-p,S=A>=0?1:-1,E=S*A,N=E>gf,k=y*w;if(c.add(Mf(k*S*Cf(E),v*M+k*Tf(E))),a+=N?A+S*_f:A,N^p>=e^m>=e){var C=ys(ps(d),ps(b));bs(C);var P=ys(o,C);bs(P);var z=(N^A>=0?-1:1)*Rf(P[2]);(r>z||r===z&&(C[0]||C[1]))&&(u+=N^A>=0?1:-1)}}return(a<-df||a<df&&c<-pf)^1&u}function xl(t,n,e,r){return function(i){var o,a,u,c=n(i),f=pl(),s=n(f),l=!1,h={point:d,lineStart:g,lineEnd:y,polygonStart:function(){h.point=v,h.lineStart=_,h.lineEnd=b,a=[],o=[]},polygonEnd:function(){h.point=d,h.lineStart=g,h.lineEnd=y,a=ft(a);var t=ml(o,r);a.length?(l||(i.polygonStart(),l=!0),vl(a,Ml,t,e,i)):t&&(l||(i.polygonStart(),l=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),l&&(i.polygonEnd(),l=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(n,e){t(n,e)&&i.point(n,e)}function p(t,n){c.point(t,n)}function g(){h.point=p,c.lineStart()}function y(){h.point=d,c.lineEnd()}function v(t,n){u.push([t,n]),s.point(t,n)}function _(){s.lineStart(),u=[]}function b(){v(u[0][0],u[0][1]),s.lineEnd();var t,n,e,r,c=s.clean(),h=f.result(),d=h.length;if(u.pop(),o.push(u),u=null,d)if(1&c){if((n=(e=h[0]).length-1)>0){for(l||(i.polygonStart(),l=!0),i.lineStart(),t=0;t<n;++t)i.point((r=e[t])[0],r[1]);i.lineEnd()}}else d>1&&2&c&&h.push(h.pop().concat(h.shift())),a.push(h.filter(wl))}return h}}function wl(t){return t.length>1}function Ml(t,n){return((t=t.x)[0]<0?t[1]-yf-df:yf-t[1])-((n=n.x)[0]<0?n[1]-yf-df:yf-n[1])}al.invert=al;var Tl=xl((function(){return!0}),(function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,a){var u=o>0?gf:-gf,c=xf(o-e);xf(c-gf)<df?(t.point(e,r=(r+a)/2>0?yf:-yf),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),n=0):i!==u&&c>=gf&&(xf(e-i)<df&&(e-=i*df),xf(o-u)<df&&(o-=u*df),r=function(t,n,e,r){var i,o,a=Cf(t-e);return xf(a)>df?wf((Cf(n)*(o=Tf(r))*Cf(e)-Cf(r)*(i=Tf(n))*Cf(t))/(i*o*a)):(n+r)/2}(e,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),n=0),t.point(e=o,r=a),i=u},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}}),(function(t,n,e,r){var i;if(null==t)i=e*yf,r.point(-gf,i),r.point(0,i),r.point(gf,i),r.point(gf,0),r.point(gf,-i),r.point(0,-i),r.point(-gf,-i),r.point(-gf,0),r.point(-gf,i);else if(xf(t[0]-n[0])>df){var o=t[0]<n[0]?gf:-gf;i=e*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(n[0],n[1])}),[-gf,-yf]);function Al(t){var n=Tf(t),e=6*mf,r=n>0,i=xf(n)>df;function o(t,e){return Tf(t)*Tf(e)>n}function a(t,e,r){var i=[1,0,0],o=ys(ps(t),ps(e)),a=gs(o,o),u=o[0],c=a-u*u;if(!c)return!r&&t;var f=n*a/c,s=-n*u/c,l=ys(i,o),h=_s(i,f);vs(h,_s(o,s));var d=l,p=gs(h,d),g=gs(d,d),y=p*p-g*(gs(h,h)-1);if(!(y<0)){var v=zf(y),_=_s(d,(-p-v)/g);if(vs(_,h),_=ds(_),!r)return _;var b,m=t[0],x=e[0],w=t[1],M=e[1];x<m&&(b=m,m=x,x=b);var T=x-m,A=xf(T-gf)<df;if(!A&&M<w&&(b=w,w=M,M=b),A||T<df?A?w+M>0^_[1]<(xf(_[0]-m)<df?w:M):w<=_[1]&&_[1]<=M:T>gf^(m<=_[0]&&_[0]<=x)){var S=_s(d,(-p+v)/g);return vs(S,h),[_,ds(S)]}}}function u(n,e){var i=r?t:gf-t,o=0;return n<-i?o|=1:n>i&&(o|=2),e<-i?o|=4:e>i&&(o|=8),o}return xl(o,(function(t){var n,e,c,f,s;return{lineStart:function(){f=c=!1,s=1},point:function(l,h){var d,p=[l,h],g=o(l,h),y=r?g?0:u(l,h):g?u(l+(l<0?gf:-gf),h):0;if(!n&&(f=c=g)&&t.lineStart(),g!==c&&(!(d=a(n,p))||gl(n,d)||gl(p,d))&&(p[2]=1),g!==c)s=0,g?(t.lineStart(),d=a(p,n),t.point(d[0],d[1])):(d=a(n,p),t.point(d[0],d[1],2),t.lineEnd()),n=d;else if(i&&n&&r^g){var v;y&e||!(v=a(p,n,!0))||(s=0,r?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!g||n&&gl(n,p)||t.point(p[0],p[1]),n=p,c=g,e=y},lineEnd:function(){c&&t.lineEnd(),n=null},clean:function(){return s|(f&&c)<<1}}}),(function(n,r,i,o){hl(o,t,e,i,n,r)}),r?[0,-t]:[-gf,t-gf])}var Sl,El,Nl,kl,Cl=1e9,Pl=-Cl;function zl(t,n,e,r){function i(i,o){return t<=i&&i<=e&&n<=o&&o<=r}function o(i,o,u,f){var s=0,l=0;if(null==i||(s=a(i,u))!==(l=a(o,u))||c(i,o)<0^u>0)do{f.point(0===s||3===s?t:e,s>1?r:n)}while((s=(s+u+4)%4)!==l);else f.point(o[0],o[1])}function a(r,i){return xf(r[0]-t)<df?i>0?0:3:xf(r[0]-e)<df?i>0?2:1:xf(r[1]-n)<df?i>0?1:0:i>0?3:2}function u(t,n){return c(t.x,n.x)}function c(t,n){var e=a(t,1),r=a(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(a){var c,f,s,l,h,d,p,g,y,v,_,b=a,m=pl(),x={point:w,lineStart:function(){x.point=M,f&&f.push(s=[]);v=!0,y=!1,p=g=NaN},lineEnd:function(){c&&(M(l,h),d&&y&&m.rejoin(),c.push(m.result()));x.point=w,y&&b.lineEnd()},polygonStart:function(){b=m,c=[],f=[],_=!0},polygonEnd:function(){var n=function(){for(var n=0,e=0,i=f.length;e<i;++e)for(var o,a,u=f[e],c=1,s=u.length,l=u[0],h=l[0],d=l[1];c<s;++c)o=h,a=d,h=(l=u[c])[0],d=l[1],a<=r?d>r&&(h-o)*(r-a)>(d-a)*(t-o)&&++n:d<=r&&(h-o)*(r-a)<(d-a)*(t-o)&&--n;return n}(),e=_&&n,i=(c=ft(c)).length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&vl(c,u,n,o,a),a.polygonEnd());b=a,c=f=s=null}};function w(t,n){i(t,n)&&b.point(t,n)}function M(o,a){var u=i(o,a);if(f&&s.push([o,a]),v)l=o,h=a,d=u,v=!1,u&&(b.lineStart(),b.point(o,a));else if(u&&y)b.point(o,a);else{var c=[p=Math.max(Pl,Math.min(Cl,p)),g=Math.max(Pl,Math.min(Cl,g))],m=[o=Math.max(Pl,Math.min(Cl,o)),a=Math.max(Pl,Math.min(Cl,a))];!function(t,n,e,r,i,o){var a,u=t[0],c=t[1],f=0,s=1,l=n[0]-u,h=n[1]-c;if(a=e-u,l||!(a>0)){if(a/=l,l<0){if(a<f)return;a<s&&(s=a)}else if(l>0){if(a>s)return;a>f&&(f=a)}if(a=i-u,l||!(a<0)){if(a/=l,l<0){if(a>s)return;a>f&&(f=a)}else if(l>0){if(a<f)return;a<s&&(s=a)}if(a=r-c,h||!(a>0)){if(a/=h,h<0){if(a<f)return;a<s&&(s=a)}else if(h>0){if(a>s)return;a>f&&(f=a)}if(a=o-c,h||!(a<0)){if(a/=h,h<0){if(a>s)return;a>f&&(f=a)}else if(h>0){if(a<f)return;a<s&&(s=a)}return f>0&&(t[0]=u+f*l,t[1]=c+f*h),s<1&&(n[0]=u+s*l,n[1]=c+s*h),!0}}}}}(c,m,t,n,e,r)?u&&(b.lineStart(),b.point(o,a),_=!1):(y||(b.lineStart(),b.point(c[0],c[1])),b.point(m[0],m[1]),u||b.lineEnd(),_=!1)}p=o,g=a,y=u}return x}}var $l={sphere:qf,point:qf,lineStart:function(){$l.point=Rl,$l.lineEnd=Dl},lineEnd:qf,polygonStart:qf,polygonEnd:qf};function Dl(){$l.point=$l.lineEnd=qf}function Rl(t,n){El=t*=mf,Nl=Cf(n*=mf),kl=Tf(n),$l.point=Fl}function Fl(t,n){t*=mf;var e=Cf(n*=mf),r=Tf(n),i=xf(t-El),o=Tf(i),a=r*Cf(i),u=kl*e-Nl*r*o,c=Nl*e+kl*r*o;Sl.add(Mf(zf(a*a+u*u),c)),El=t,Nl=e,kl=r}function ql(t){return Sl=new T,Lf(t,$l),+Sl}var Ul=[null,null],Il={type:"LineString",coordinates:Ul};function Ol(t,n){return Ul[0]=t,Ul[1]=n,ql(Il)}var Bl={Feature:function(t,n){return Ll(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)if(Ll(e[r].geometry,n))return!0;return!1}},Yl={Sphere:function(){return!0},Point:function(t,n){return jl(t.coordinates,n)},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)if(jl(e[r],n))return!0;return!1},LineString:function(t,n){return Hl(t.coordinates,n)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)if(Hl(e[r],n))return!0;return!1},Polygon:function(t,n){return Xl(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)if(Xl(e[r],n))return!0;return!1},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)if(Ll(e[r],n))return!0;return!1}};function Ll(t,n){return!(!t||!Yl.hasOwnProperty(t.type))&&Yl[t.type](t,n)}function jl(t,n){return 0===Ol(t,n)}function Hl(t,n){for(var e,r,i,o=0,a=t.length;o<a;o++){if(0===(r=Ol(t[o],n)))return!0;if(o>0&&(i=Ol(t[o],t[o-1]))>0&&e<=i&&r<=i&&(e+r-i)*(1-Math.pow((e-r)/i,2))<pf*i)return!0;e=r}return!1}function Xl(t,n){return!!ml(t.map(Gl),Vl(n))}function Gl(t){return(t=t.map(Vl)).pop(),t}function Vl(t){return[t[0]*mf,t[1]*mf]}function Wl(t,n,e){var r=lt(t,n-df,e).concat(n);return function(t){return r.map((function(n){return[t,n]}))}}function Zl(t,n,e){var r=lt(t,n-df,e).concat(n);return function(t){return r.map((function(n){return[n,t]}))}}function Kl(){var t,n,e,r,i,o,a,u,c,f,s,l,h=10,d=h,p=90,g=360,y=2.5;function v(){return{type:"MultiLineString",coordinates:_()}}function _(){return lt(Af(r/p)*p,e,p).map(s).concat(lt(Af(u/g)*g,a,g).map(l)).concat(lt(Af(n/h)*h,t,h).filter((function(t){return xf(t%p)>df})).map(c)).concat(lt(Af(o/d)*d,i,d).filter((function(t){return xf(t%g)>df})).map(f))}return v.lines=function(){return _().map((function(t){return{type:"LineString",coordinates:t}}))},v.outline=function(){return{type:"Polygon",coordinates:[s(r).concat(l(a).slice(1),s(e).reverse().slice(1),l(u).reverse().slice(1))]}},v.extent=function(t){return arguments.length?v.extentMajor(t).extentMinor(t):v.extentMinor()},v.extentMajor=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],u=+t[0][1],a=+t[1][1],r>e&&(t=r,r=e,e=t),u>a&&(t=u,u=a,a=t),v.precision(y)):[[r,u],[e,a]]},v.extentMinor=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],o=+e[0][1],i=+e[1][1],n>t&&(e=n,n=t,t=e),o>i&&(e=o,o=i,i=e),v.precision(y)):[[n,o],[t,i]]},v.step=function(t){return arguments.length?v.stepMajor(t).stepMinor(t):v.stepMinor()},v.stepMajor=function(t){return arguments.length?(p=+t[0],g=+t[1],v):[p,g]},v.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],v):[h,d]},v.precision=function(h){return arguments.length?(y=+h,c=Wl(o,i,90),f=Zl(n,t,y),s=Wl(u,a,90),l=Zl(r,e,y),v):y},v.extentMajor([[-180,-90+df],[180,90-df]]).extentMinor([[-180,-80-df],[180,80+df]])}var Ql,Jl,th,nh,eh=t=>t,rh=new T,ih=new T,oh={point:qf,lineStart:qf,lineEnd:qf,polygonStart:function(){oh.lineStart=ah,oh.lineEnd=fh},polygonEnd:function(){oh.lineStart=oh.lineEnd=oh.point=qf,rh.add(xf(ih)),ih=new T},result:function(){var t=rh/2;return rh=new T,t}};function ah(){oh.point=uh}function uh(t,n){oh.point=ch,Ql=th=t,Jl=nh=n}function ch(t,n){ih.add(nh*t-th*n),th=t,nh=n}function fh(){ch(Ql,Jl)}var sh=oh,lh=1/0,hh=lh,dh=-lh,ph=dh,gh={point:function(t,n){t<lh&&(lh=t);t>dh&&(dh=t);n<hh&&(hh=n);n>ph&&(ph=n)},lineStart:qf,lineEnd:qf,polygonStart:qf,polygonEnd:qf,result:function(){var t=[[lh,hh],[dh,ph]];return dh=ph=-(hh=lh=1/0),t}};var yh,vh,_h,bh,mh=gh,xh=0,wh=0,Mh=0,Th=0,Ah=0,Sh=0,Eh=0,Nh=0,kh=0,Ch={point:Ph,lineStart:zh,lineEnd:Rh,polygonStart:function(){Ch.lineStart=Fh,Ch.lineEnd=qh},polygonEnd:function(){Ch.point=Ph,Ch.lineStart=zh,Ch.lineEnd=Rh},result:function(){var t=kh?[Eh/kh,Nh/kh]:Sh?[Th/Sh,Ah/Sh]:Mh?[xh/Mh,wh/Mh]:[NaN,NaN];return xh=wh=Mh=Th=Ah=Sh=Eh=Nh=kh=0,t}};function Ph(t,n){xh+=t,wh+=n,++Mh}function zh(){Ch.point=$h}function $h(t,n){Ch.point=Dh,Ph(_h=t,bh=n)}function Dh(t,n){var e=t-_h,r=n-bh,i=zf(e*e+r*r);Th+=i*(_h+t)/2,Ah+=i*(bh+n)/2,Sh+=i,Ph(_h=t,bh=n)}function Rh(){Ch.point=Ph}function Fh(){Ch.point=Uh}function qh(){Ih(yh,vh)}function Uh(t,n){Ch.point=Ih,Ph(yh=_h=t,vh=bh=n)}function Ih(t,n){var e=t-_h,r=n-bh,i=zf(e*e+r*r);Th+=i*(_h+t)/2,Ah+=i*(bh+n)/2,Sh+=i,Eh+=(i=bh*t-_h*n)*(_h+t),Nh+=i*(bh+n),kh+=3*i,Ph(_h=t,bh=n)}var Oh=Ch;function Bh(t){this._context=t}Bh.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,_f)}},result:qf};var Yh,Lh,jh,Hh,Xh,Gh=new T,Vh={point:qf,lineStart:function(){Vh.point=Wh},lineEnd:function(){Yh&&Zh(Lh,jh),Vh.point=qf},polygonStart:function(){Yh=!0},polygonEnd:function(){Yh=null},result:function(){var t=+Gh;return Gh=new T,t}};function Wh(t,n){Vh.point=Zh,Lh=Hh=t,jh=Xh=n}function Zh(t,n){Hh-=t,Xh-=n,Gh.add(zf(Hh*Hh+Xh*Xh)),Hh=t,Xh=n}var Kh=Vh;let Qh,Jh,td,nd;class ed{constructor(t){this._append=null==t?rd:function(t){const n=Math.floor(t);if(!(n>=0))throw new RangeError(`invalid digits: ${t}`);if(n>15)return rd;if(n!==Qh){const t=10**n;Qh=n,Jh=function(n){let e=1;this._+=n[0];for(const r=n.length;e<r;++e)this._+=Math.round(arguments[e]*t)/t+n[e]}}return Jh}(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:this._append`M${t},${n}`,this._point=1;break;case 1:this._append`L${t},${n}`;break;default:if(this._append`M${t},${n}`,this._radius!==td||this._append!==Jh){const t=this._radius,n=this._;this._="",this._append`m0,${t}a${t},${t} 0 1,1 0,${-2*t}a${t},${t} 0 1,1 0,${2*t}z`,td=t,Jh=this._append,nd=this._,this._=n}this._+=nd}}result(){const t=this._;return this._="",t.length?t:null}}function rd(t){let n=1;this._+=t[0];for(const e=t.length;n<e;++n)this._+=arguments[n]+t[n]}function id(t){return function(n){var e=new od;for(var r in t)e[r]=t[r];return e.stream=n,e}}function od(){}function ad(t,n,e){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Lf(e,t.stream(mh)),n(mh.result()),null!=r&&t.clipExtent(r),t}function ud(t,n,e){return ad(t,(function(e){var r=n[1][0]-n[0][0],i=n[1][1]-n[0][1],o=Math.min(r/(e[1][0]-e[0][0]),i/(e[1][1]-e[0][1])),a=+n[0][0]+(r-o*(e[1][0]+e[0][0]))/2,u=+n[0][1]+(i-o*(e[1][1]+e[0][1]))/2;t.scale(150*o).translate([a,u])}),e)}function cd(t,n,e){return ud(t,[[0,0],n],e)}function fd(t,n,e){return ad(t,(function(e){var r=+n,i=r/(e[1][0]-e[0][0]),o=(r-i*(e[1][0]+e[0][0]))/2,a=-i*e[0][1];t.scale(150*i).translate([o,a])}),e)}function sd(t,n,e){return ad(t,(function(e){var r=+n,i=r/(e[1][1]-e[0][1]),o=-i*e[0][0],a=(r-i*(e[1][1]+e[0][1]))/2;t.scale(150*i).translate([o,a])}),e)}od.prototype={constructor:od,point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var ld=16,hd=Tf(30*mf);function dd(t,n){return+n?function(t,n){function e(r,i,o,a,u,c,f,s,l,h,d,p,g,y){var v=f-r,_=s-i,b=v*v+_*_;if(b>4*n&&g--){var m=a+h,x=u+d,w=c+p,M=zf(m*m+x*x+w*w),T=Rf(w/=M),A=xf(xf(w)-1)<df||xf(o-l)<df?(o+l)/2:Mf(x,m),S=t(A,T),E=S[0],N=S[1],k=E-r,C=N-i,P=_*k-v*C;(P*P/b>n||xf((v*k+_*C)/b-.5)>.3||a*h+u*d+c*p<hd)&&(e(r,i,o,a,u,c,E,N,A,m/=M,x/=M,w,g,y),y.point(E,N),e(E,N,A,m,x,w,f,s,l,h,d,p,g,y))}}return function(n){var r,i,o,a,u,c,f,s,l,h,d,p,g={point:y,lineStart:v,lineEnd:b,polygonStart:function(){n.polygonStart(),g.lineStart=m},polygonEnd:function(){n.polygonEnd(),g.lineStart=v}};function y(e,r){e=t(e,r),n.point(e[0],e[1])}function v(){s=NaN,g.point=_,n.lineStart()}function _(r,i){var o=ps([r,i]),a=t(r,i);e(s,l,f,h,d,p,s=a[0],l=a[1],f=r,h=o[0],d=o[1],p=o[2],ld,n),n.point(s,l)}function b(){g.point=y,n.lineEnd()}function m(){v(),g.point=x,g.lineEnd=w}function x(t,n){_(r=t,n),i=s,o=l,a=h,u=d,c=p,g.point=_}function w(){e(s,l,f,h,d,p,i,o,r,a,u,c,ld,n),g.lineEnd=b,b()}return g}}(t,n):function(t){return id({point:function(n,e){n=t(n,e),this.stream.point(n[0],n[1])}})}(t)}var pd=id({point:function(t,n){this.stream.point(t*mf,n*mf)}});function gd(t,n,e,r,i,o){if(!o)return function(t,n,e,r,i){function o(o,a){return[n+t*(o*=r),e-t*(a*=i)]}return o.invert=function(o,a){return[(o-n)/t*r,(e-a)/t*i]},o}(t,n,e,r,i);var a=Tf(o),u=Cf(o),c=a*t,f=u*t,s=a/t,l=u/t,h=(u*e-a*n)/t,d=(u*n+a*e)/t;function p(t,o){return[c*(t*=r)-f*(o*=i)+n,e-f*t-c*o]}return p.invert=function(t,n){return[r*(s*t-l*n+h),i*(d-l*t-s*n)]},p}function yd(t){return vd((function(){return t}))()}function vd(t){var n,e,r,i,o,a,u,c,f,s,l=150,h=480,d=250,p=0,g=0,y=0,v=0,_=0,b=0,m=1,x=1,w=null,M=Tl,T=null,A=eh,S=.5;function E(t){return c(t[0]*mf,t[1]*mf)}function N(t){return(t=c.invert(t[0],t[1]))&&[t[0]*bf,t[1]*bf]}function k(){var t=gd(l,0,0,m,x,b).apply(null,n(p,g)),r=gd(l,h-t[0],d-t[1],m,x,b);return e=ul(y,v,_),u=ol(n,r),c=ol(e,u),a=dd(u,S),C()}function C(){return f=s=null,E}return E.stream=function(t){return f&&s===t?f:f=pd(function(t){return id({point:function(n,e){var r=t(n,e);return this.stream.point(r[0],r[1])}})}(e)(M(a(A(s=t)))))},E.preclip=function(t){return arguments.length?(M=t,w=void 0,C()):M},E.postclip=function(t){return arguments.length?(A=t,T=r=i=o=null,C()):A},E.clipAngle=function(t){return arguments.length?(M=+t?Al(w=t*mf):(w=null,Tl),C()):w*bf},E.clipExtent=function(t){return arguments.length?(A=null==t?(T=r=i=o=null,eh):zl(T=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),C()):null==T?null:[[T,r],[i,o]]},E.scale=function(t){return arguments.length?(l=+t,k()):l},E.translate=function(t){return arguments.length?(h=+t[0],d=+t[1],k()):[h,d]},E.center=function(t){return arguments.length?(p=t[0]%360*mf,g=t[1]%360*mf,k()):[p*bf,g*bf]},E.rotate=function(t){return arguments.length?(y=t[0]%360*mf,v=t[1]%360*mf,_=t.length>2?t[2]%360*mf:0,k()):[y*bf,v*bf,_*bf]},E.angle=function(t){return arguments.length?(b=t%360*mf,k()):b*bf},E.reflectX=function(t){return arguments.length?(m=t?-1:1,k()):m<0},E.reflectY=function(t){return arguments.length?(x=t?-1:1,k()):x<0},E.precision=function(t){return arguments.length?(a=dd(u,S=t*t),C()):zf(S)},E.fitExtent=function(t,n){return ud(E,t,n)},E.fitSize=function(t,n){return cd(E,t,n)},E.fitWidth=function(t,n){return fd(E,t,n)},E.fitHeight=function(t,n){return sd(E,t,n)},function(){return n=t.apply(this,arguments),E.invert=n.invert&&N,k()}}function _d(t){var n=0,e=gf/3,r=vd(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*mf,e=t[1]*mf):[n*bf,e*bf]},i}function bd(t,n){var e=Cf(t),r=(e+Cf(n))/2;if(xf(r)<df)return function(t){var n=Tf(t);function e(t,e){return[t*n,Cf(e)/n]}return e.invert=function(t,e){return[t/n,Rf(e*n)]},e}(t);var i=1+e*(2*r-e),o=zf(i)/r;function a(t,n){var e=zf(i-2*r*Cf(n))/r;return[e*Cf(t*=r),o-e*Tf(t)]}return a.invert=function(t,n){var e=o-n,a=Mf(t,xf(e))*Pf(e);return e*r<0&&(a-=gf*Pf(t)*Pf(e)),[a/r,Rf((i-(t*t+e*e)*r*r)/(2*r))]},a}function md(){return _d(bd).scale(155.424).center([0,33.6442])}function xd(){return md().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function wd(t){return function(n,e){var r=Tf(n),i=Tf(e),o=t(r*i);return o===1/0?[2,0]:[o*i*Cf(n),o*Cf(e)]}}function Md(t){return function(n,e){var r=zf(n*n+e*e),i=t(r),o=Cf(i),a=Tf(i);return[Mf(n*o,r*a),Rf(r&&e*o/r)]}}var Td=wd((function(t){return zf(2/(1+t))}));Td.invert=Md((function(t){return 2*Rf(t/2)}));var Ad=wd((function(t){return(t=Df(t))&&t/Cf(t)}));function Sd(t,n){return[t,Nf($f((yf+n)/2))]}function Ed(t){var n,e,r,i=yd(t),o=i.center,a=i.scale,u=i.translate,c=i.clipExtent,f=null;function s(){var o=gf*a(),u=i(ll(i.rotate()).invert([0,0]));return c(null==f?[[u[0]-o,u[1]-o],[u[0]+o,u[1]+o]]:t===Sd?[[Math.max(u[0]-o,f),n],[Math.min(u[0]+o,e),r]]:[[f,Math.max(u[1]-o,n)],[e,Math.min(u[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),s()):a()},i.translate=function(t){return arguments.length?(u(t),s()):u()},i.center=function(t){return arguments.length?(o(t),s()):o()},i.clipExtent=function(t){return arguments.length?(null==t?f=n=e=r=null:(f=+t[0][0],n=+t[0][1],e=+t[1][0],r=+t[1][1]),s()):null==f?null:[[f,n],[e,r]]},s()}function Nd(t){return $f((yf+t)/2)}function kd(t,n){var e=Tf(t),r=t===n?Cf(t):Nf(e/Tf(n))/Nf(Nd(n)/Nd(t)),i=e*kf(Nd(t),r)/r;if(!r)return Sd;function o(t,n){i>0?n<-yf+df&&(n=-yf+df):n>yf-df&&(n=yf-df);var e=i/kf(Nd(n),r);return[e*Cf(r*t),i-e*Tf(r*t)]}return o.invert=function(t,n){var e=i-n,o=Pf(r)*zf(t*t+e*e),a=Mf(t,xf(e))*Pf(e);return e*r<0&&(a-=gf*Pf(t)*Pf(e)),[a/r,2*wf(kf(i/o,1/r))-yf]},o}function Cd(t,n){return[t,n]}function Pd(t,n){var e=Tf(t),r=t===n?Cf(t):(e-Tf(n))/(n-t),i=e/r+t;if(xf(r)<df)return Cd;function o(t,n){var e=i-n,o=r*t;return[e*Cf(o),i-e*Tf(o)]}return o.invert=function(t,n){var e=i-n,o=Mf(t,xf(e))*Pf(e);return e*r<0&&(o-=gf*Pf(t)*Pf(e)),[o/r,i-Pf(r)*zf(t*t+e*e)]},o}Ad.invert=Md((function(t){return t})),Sd.invert=function(t,n){return[t,2*wf(Sf(n))-yf]},Cd.invert=Cd;var zd=1.340264,$d=-.081106,Dd=893e-6,Rd=.003796,Fd=zf(3)/2;function qd(t,n){var e=Rf(Fd*Cf(n)),r=e*e,i=r*r*r;return[t*Tf(e)/(Fd*(zd+3*$d*r+i*(7*Dd+9*Rd*r))),e*(zd+$d*r+i*(Dd+Rd*r))]}function Ud(t,n){var e=Tf(n),r=Tf(t)*e;return[e*Cf(t)/r,Cf(n)/r]}function Id(t,n){var e=n*n,r=e*e;return[t*(.8707-.131979*e+r*(r*(.003971*e-.001529*r)-.013791)),n*(1.007226+e*(.015085+r*(.028874*e-.044475-.005916*r)))]}function Od(t,n){return[Tf(n)*Cf(t),Cf(n)]}function Bd(t,n){var e=Tf(n),r=1+Tf(t)*e;return[e*Cf(t)/r,Cf(n)/r]}function Yd(t,n){return[Nf($f((yf+n)/2)),-t]}function Ld(t,n){return t.parent===n.parent?1:2}function jd(t,n){return t+n.x}function Hd(t,n){return Math.max(t,n.y)}function Xd(t){var n=0,e=t.children,r=e&&e.length;if(r)for(;--r>=0;)n+=e[r].value;else n=1;t.value=n}function Gd(t,n){t instanceof Map?(t=[void 0,t],void 0===n&&(n=Wd)):void 0===n&&(n=Vd);for(var e,r,i,o,a,u=new Qd(t),c=[u];e=c.pop();)if((i=n(e.data))&&(a=(i=Array.from(i)).length))for(e.children=i,o=a-1;o>=0;--o)c.push(r=i[o]=new Qd(i[o])),r.parent=e,r.depth=e.depth+1;return u.eachBefore(Kd)}function Vd(t){return t.children}function Wd(t){return Array.isArray(t)?t[1]:null}function Zd(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function Kd(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function Qd(t){this.data=t,this.depth=this.height=0,this.parent=null}function Jd(t){return null==t?null:tp(t)}function tp(t){if("function"!=typeof t)throw new Error;return t}function np(){return 0}function ep(t){return function(){return t}}qd.invert=function(t,n){for(var e,r=n,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=e=(r*(zd+$d*i+o*(Dd+Rd*i))-n)/(zd+3*$d*i+o*(7*Dd+9*Rd*i)))*r)*i*i,!(xf(e)<pf));++a);return[Fd*t*(zd+3*$d*i+o*(7*Dd+9*Rd*i))/Tf(r),Rf(Cf(r)/Fd)]},Ud.invert=Md(wf),Id.invert=function(t,n){var e,r=n,i=25;do{var o=r*r,a=o*o;r-=e=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-n)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(xf(e)>df&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},Od.invert=Md(Rf),Bd.invert=Md((function(t){return 2*wf(t)})),Yd.invert=function(t,n){return[-n,2*wf(Sf(t))-yf]},Qd.prototype=Gd.prototype={constructor:Qd,count:function(){return this.eachAfter(Xd)},each:function(t,n){let e=-1;for(const r of this)t.call(n,r,++e,this);return this},eachAfter:function(t,n){for(var e,r,i,o=this,a=[o],u=[],c=-1;o=a.pop();)if(u.push(o),e=o.children)for(r=0,i=e.length;r<i;++r)a.push(e[r]);for(;o=u.pop();)t.call(n,o,++c,this);return this},eachBefore:function(t,n){for(var e,r,i=this,o=[i],a=-1;i=o.pop();)if(t.call(n,i,++a,this),e=i.children)for(r=e.length-1;r>=0;--r)o.push(e[r]);return this},find:function(t,n){let e=-1;for(const r of this)if(t.call(n,r,++e,this))return r},sum:function(t){return this.eachAfter((function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e}))},sort:function(t){return this.eachBefore((function(n){n.children&&n.children.sort(t)}))},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;t=e.pop(),n=r.pop();for(;t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(n){n.children||t.push(n)})),t},links:function(){var t=this,n=[];return t.each((function(e){e!==t&&n.push({source:e.parent,target:e})})),n},copy:function(){return Gd(this).eachBefore(Zd)},[Symbol.iterator]:function*(){var t,n,e,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,n=i.children)for(e=0,r=n.length;e<r;++e)o.push(n[e])}while(o.length)}};const rp=1664525,ip=1013904223,op=4294967296;function ap(){let t=1;return()=>(t=(rp*t+ip)%op)/op}function up(t,n){for(var e,r,i=0,o=(t=function(t,n){let e,r,i=t.length;for(;i;)r=n()*i--|0,e=t[i],t[i]=t[r],t[r]=e;return t}(Array.from(t),n)).length,a=[];i<o;)e=t[i],r&&sp(r,e)?++i:(r=hp(a=cp(a,e)),i=0);return r}function cp(t,n){var e,r;if(lp(n,t))return[n];for(e=0;e<t.length;++e)if(fp(n,t[e])&&lp(dp(t[e],n),t))return[t[e],n];for(e=0;e<t.length-1;++e)for(r=e+1;r<t.length;++r)if(fp(dp(t[e],t[r]),n)&&fp(dp(t[e],n),t[r])&&fp(dp(t[r],n),t[e])&&lp(pp(t[e],t[r],n),t))return[t[e],t[r],n];throw new Error}function fp(t,n){var e=t.r-n.r,r=n.x-t.x,i=n.y-t.y;return e<0||e*e<r*r+i*i}function sp(t,n){var e=t.r-n.r+1e-9*Math.max(t.r,n.r,1),r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function lp(t,n){for(var e=0;e<n.length;++e)if(!sp(t,n[e]))return!1;return!0}function hp(t){switch(t.length){case 1:return function(t){return{x:t.x,y:t.y,r:t.r}}(t[0]);case 2:return dp(t[0],t[1]);case 3:return pp(t[0],t[1],t[2])}}function dp(t,n){var e=t.x,r=t.y,i=t.r,o=n.x,a=n.y,u=n.r,c=o-e,f=a-r,s=u-i,l=Math.sqrt(c*c+f*f);return{x:(e+o+c/l*s)/2,y:(r+a+f/l*s)/2,r:(l+i+u)/2}}function pp(t,n,e){var r=t.x,i=t.y,o=t.r,a=n.x,u=n.y,c=n.r,f=e.x,s=e.y,l=e.r,h=r-a,d=r-f,p=i-u,g=i-s,y=c-o,v=l-o,_=r*r+i*i-o*o,b=_-a*a-u*u+c*c,m=_-f*f-s*s+l*l,x=d*p-h*g,w=(p*m-g*b)/(2*x)-r,M=(g*y-p*v)/x,T=(d*b-h*m)/(2*x)-i,A=(h*v-d*y)/x,S=M*M+A*A-1,E=2*(o+w*M+T*A),N=w*w+T*T-o*o,k=-(Math.abs(S)>1e-6?(E+Math.sqrt(E*E-4*S*N))/(2*S):N/E);return{x:r+w+M*k,y:i+T+A*k,r:k}}function gp(t,n,e){var r,i,o,a,u=t.x-n.x,c=t.y-n.y,f=u*u+c*c;f?(i=n.r+e.r,i*=i,a=t.r+e.r,i>(a*=a)?(r=(f+a-i)/(2*f),o=Math.sqrt(Math.max(0,a/f-r*r)),e.x=t.x-r*u-o*c,e.y=t.y-r*c+o*u):(r=(f+i-a)/(2*f),o=Math.sqrt(Math.max(0,i/f-r*r)),e.x=n.x+r*u-o*c,e.y=n.y+r*c+o*u)):(e.x=n.x+e.r,e.y=n.y)}function yp(t,n){var e=t.r+n.r-1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function vp(t){var n=t._,e=t.next._,r=n.r+e.r,i=(n.x*e.r+e.x*n.r)/r,o=(n.y*e.r+e.y*n.r)/r;return i*i+o*o}function _p(t){this._=t,this.next=null,this.previous=null}function bp(t,n){if(!(o=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var e,r,i,o,a,u,c,f,s,l,h;if((e=t[0]).x=0,e.y=0,!(o>1))return e.r;if(r=t[1],e.x=-r.r,r.x=e.r,r.y=0,!(o>2))return e.r+r.r;gp(r,e,i=t[2]),e=new _p(e),r=new _p(r),i=new _p(i),e.next=i.previous=r,r.next=e.previous=i,i.next=r.previous=e;t:for(c=3;c<o;++c){gp(e._,r._,i=t[c]),i=new _p(i),f=r.next,s=e.previous,l=r._.r,h=e._.r;do{if(l<=h){if(yp(f._,i._)){r=f,e.next=r,r.previous=e,--c;continue t}l+=f._.r,f=f.next}else{if(yp(s._,i._)){(e=s).next=r,r.previous=e,--c;continue t}h+=s._.r,s=s.previous}}while(f!==s.next);for(i.previous=e,i.next=r,e.next=r.previous=r=i,a=vp(e);(i=i.next)!==r;)(u=vp(i))<a&&(e=i,a=u);r=e.next}for(e=[r._],i=r;(i=i.next)!==r;)e.push(i._);for(i=up(e,n),c=0;c<o;++c)(e=t[c]).x-=i.x,e.y-=i.y;return i.r}function mp(t){return Math.sqrt(t.value)}function xp(t){return function(n){n.children||(n.r=Math.max(0,+t(n)||0))}}function wp(t,n,e){return function(r){if(i=r.children){var i,o,a,u=i.length,c=t(r)*n||0;if(c)for(o=0;o<u;++o)i[o].r+=c;if(a=bp(i,e),c)for(o=0;o<u;++o)i[o].r-=c;r.r=a+c}}}function Mp(t){return function(n){var e=n.parent;n.r*=t,e&&(n.x=e.x+t*n.x,n.y=e.y+t*n.y)}}function Tp(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Ap(t,n,e,r,i){for(var o,a=t.children,u=-1,c=a.length,f=t.value&&(r-n)/t.value;++u<c;)(o=a[u]).y0=e,o.y1=i,o.x0=n,o.x1=n+=o.value*f}var Sp={depth:-1},Ep={},Np={};function kp(t){return t.id}function Cp(t){return t.parentId}function Pp(t){let n=t.length;if(n<2)return"";for(;--n>1&&!zp(t,n););return t.slice(0,n)}function zp(t,n){if("/"===t[n]){let e=0;for(;n>0&&"\\"===t[--n];)++e;if(0==(1&e))return!0}return!1}function $p(t,n){return t.parent===n.parent?1:2}function Dp(t){var n=t.children;return n?n[0]:t.t}function Rp(t){var n=t.children;return n?n[n.length-1]:t.t}function Fp(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function qp(t,n,e){return t.a.parent===n.parent?t.a:e}function Up(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function Ip(t,n,e,r,i){for(var o,a=t.children,u=-1,c=a.length,f=t.value&&(i-e)/t.value;++u<c;)(o=a[u]).x0=n,o.x1=r,o.y0=e,o.y1=e+=o.value*f}Up.prototype=Object.create(Qd.prototype);var Op=(1+Math.sqrt(5))/2;function Bp(t,n,e,r,i,o){for(var a,u,c,f,s,l,h,d,p,g,y,v=[],_=n.children,b=0,m=0,x=_.length,w=n.value;b<x;){c=i-e,f=o-r;do{s=_[m++].value}while(!s&&m<x);for(l=h=s,y=s*s*(g=Math.max(f/c,c/f)/(w*t)),p=Math.max(h/y,y/l);m<x;++m){if(s+=u=_[m].value,u<l&&(l=u),u>h&&(h=u),y=s*s*g,(d=Math.max(h/y,y/l))>p){s-=u;break}p=d}v.push(a={value:s,dice:c<f,children:_.slice(b,m)}),a.dice?Ap(a,e,r,i,w?r+=f*s/w:o):Ip(a,e,r,w?e+=c*s/w:i,o),w-=s,b=m}return v}var Yp=function t(n){function e(t,e,r,i,o){Bp(n,t,e,r,i,o)}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(Op);var Lp=function t(n){function e(t,e,r,i,o){if((a=t._squarify)&&a.ratio===n)for(var a,u,c,f,s,l=-1,h=a.length,d=t.value;++l<h;){for(c=(u=a[l]).children,f=u.value=0,s=c.length;f<s;++f)u.value+=c[f].value;u.dice?Ap(u,e,r,i,d?r+=(o-r)*u.value/d:o):Ip(u,e,r,d?e+=(i-e)*u.value/d:i,o),d-=u.value}else t._squarify=a=Bp(n,t,e,r,i,o),a.ratio=n}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(Op);function jp(t,n,e){return(n[0]-t[0])*(e[1]-t[1])-(n[1]-t[1])*(e[0]-t[0])}function Hp(t,n){return t[0]-n[0]||t[1]-n[1]}function Xp(t){const n=t.length,e=[0,1];let r,i=2;for(r=2;r<n;++r){for(;i>1&&jp(t[e[i-2]],t[e[i-1]],t[r])<=0;)--i;e[i++]=r}return e.slice(0,i)}var Gp=Math.random,Vp=function t(n){function e(t,e){return t=null==t?0:+t,e=null==e?1:+e,1===arguments.length?(e=t,t=0):e-=t,function(){return n()*e+t}}return e.source=t,e}(Gp),Wp=function t(n){function e(t,e){return arguments.length<2&&(e=t,t=0),t=Math.floor(t),e=Math.floor(e)-t,function(){return Math.floor(n()*e+t)}}return e.source=t,e}(Gp),Zp=function t(n){function e(t,e){var r,i;return t=null==t?0:+t,e=null==e?1:+e,function(){var o;if(null!=r)o=r,r=null;else do{r=2*n()-1,o=2*n()-1,i=r*r+o*o}while(!i||i>1);return t+e*o*Math.sqrt(-2*Math.log(i)/i)}}return e.source=t,e}(Gp),Kp=function t(n){var e=Zp.source(n);function r(){var t=e.apply(this,arguments);return function(){return Math.exp(t())}}return r.source=t,r}(Gp),Qp=function t(n){function e(t){return(t=+t)<=0?()=>0:function(){for(var e=0,r=t;r>1;--r)e+=n();return e+r*n()}}return e.source=t,e}(Gp),Jp=function t(n){var e=Qp.source(n);function r(t){if(0==(t=+t))return n;var r=e(t);return function(){return r()/t}}return r.source=t,r}(Gp),tg=function t(n){function e(t){return function(){return-Math.log1p(-n())/t}}return e.source=t,e}(Gp),ng=function t(n){function e(t){if((t=+t)<0)throw new RangeError("invalid alpha");return t=1/-t,function(){return Math.pow(1-n(),t)}}return e.source=t,e}(Gp),eg=function t(n){function e(t){if((t=+t)<0||t>1)throw new RangeError("invalid p");return function(){return Math.floor(n()+t)}}return e.source=t,e}(Gp),rg=function t(n){function e(t){if((t=+t)<0||t>1)throw new RangeError("invalid p");return 0===t?()=>1/0:1===t?()=>1:(t=Math.log1p(-t),function(){return 1+Math.floor(Math.log1p(-n())/t)})}return e.source=t,e}(Gp),ig=function t(n){var e=Zp.source(n)();function r(t,r){if((t=+t)<0)throw new RangeError("invalid k");if(0===t)return()=>0;if(r=null==r?1:+r,1===t)return()=>-Math.log1p(-n())*r;var i=(t<1?t+1:t)-1/3,o=1/(3*Math.sqrt(i)),a=t<1?()=>Math.pow(n(),1/t):()=>1;return function(){do{do{var t=e(),u=1+o*t}while(u<=0);u*=u*u;var c=1-n()}while(c>=1-.0331*t*t*t*t&&Math.log(c)>=.5*t*t+i*(1-u+Math.log(u)));return i*u*a()*r}}return r.source=t,r}(Gp),og=function t(n){var e=ig.source(n);function r(t,n){var r=e(t),i=e(n);return function(){var t=r();return 0===t?0:t/(t+i())}}return r.source=t,r}(Gp),ag=function t(n){var e=rg.source(n),r=og.source(n);function i(t,n){return t=+t,(n=+n)>=1?()=>t:n<=0?()=>0:function(){for(var i=0,o=t,a=n;o*a>16&&o*(1-a)>16;){var u=Math.floor((o+1)*a),c=r(u,o-u+1)();c<=a?(i+=u,o-=u,a=(a-c)/(1-c)):(o=u-1,a/=c)}for(var f=a<.5,s=e(f?a:1-a),l=s(),h=0;l<=o;++h)l+=s();return i+(f?h:o-h)}}return i.source=t,i}(Gp),ug=function t(n){function e(t,e,r){var i;return 0==(t=+t)?i=t=>-Math.log(t):(t=1/t,i=n=>Math.pow(n,t)),e=null==e?0:+e,r=null==r?1:+r,function(){return e+r*i(-Math.log1p(-n()))}}return e.source=t,e}(Gp),cg=function t(n){function e(t,e){return t=null==t?0:+t,e=null==e?1:+e,function(){return t+e*Math.tan(Math.PI*n())}}return e.source=t,e}(Gp),fg=function t(n){function e(t,e){return t=null==t?0:+t,e=null==e?1:+e,function(){var r=n();return t+e*Math.log(r/(1-r))}}return e.source=t,e}(Gp),sg=function t(n){var e=ig.source(n),r=ag.source(n);function i(t){return function(){for(var i=0,o=t;o>16;){var a=Math.floor(.875*o),u=e(a)();if(u>o)return i+r(a-1,o/u)();i+=a,o-=u}for(var c=-Math.log1p(-n()),f=0;c<=o;++f)c-=Math.log1p(-n());return i+f}}return i.source=t,i}(Gp);const lg=1/4294967296;function hg(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function dg(t,n){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof n?this.interpolator(n):this.range(n)}return this}const pg=Symbol("implicit");function gg(){var t=new InternMap,n=[],e=[],r=pg;function i(i){let o=t.get(i);if(void 0===o){if(r!==pg)return r;t.set(i,o=n.push(i)-1)}return e[o%e.length]}return i.domain=function(e){if(!arguments.length)return n.slice();n=[],t=new InternMap;for(const r of e)t.has(r)||t.set(r,n.push(r)-1);return i},i.range=function(t){return arguments.length?(e=Array.from(t),i):e.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return gg(n,e).unknown(r)},hg.apply(i,arguments),i}function yg(){var t,n,e=gg().unknown(void 0),r=e.domain,i=e.range,o=0,a=1,u=!1,c=0,f=0,s=.5;function l(){var e=r().length,l=a<o,h=l?a:o,d=l?o:a;t=(d-h)/Math.max(1,e-c+2*f),u&&(t=Math.floor(t)),h+=(d-h-t*(e-c))*s,n=t*(1-c),u&&(h=Math.round(h),n=Math.round(n));var p=lt(e).map((function(n){return h+t*n}));return i(l?p.reverse():p)}return delete e.unknown,e.domain=function(t){return arguments.length?(r(t),l()):r()},e.range=function(t){return arguments.length?([o,a]=t,o=+o,a=+a,l()):[o,a]},e.rangeRound=function(t){return[o,a]=t,o=+o,a=+a,u=!0,l()},e.bandwidth=function(){return n},e.step=function(){return t},e.round=function(t){return arguments.length?(u=!!t,l()):u},e.padding=function(t){return arguments.length?(c=Math.min(1,f=+t),l()):c},e.paddingInner=function(t){return arguments.length?(c=Math.min(1,t),l()):c},e.paddingOuter=function(t){return arguments.length?(f=+t,l()):f},e.align=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),l()):s},e.copy=function(){return yg(r(),[o,a]).round(u).paddingInner(c).paddingOuter(f).align(s)},hg.apply(l(),arguments)}function vg(t){var n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return vg(n())},t}function _g(t){return+t}var bg=[0,1];function mg(t){return t}function xg(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:function(t){return function(){return t}}(isNaN(n)?NaN:.5)}function wg(t,n,e){var r=t[0],i=t[1],o=n[0],a=n[1];return i<r?(r=xg(i,r),o=e(a,o)):(r=xg(r,i),o=e(o,a)),function(t){return o(r(t))}}function Mg(t,n,e){var r=Math.min(t.length,n.length)-1,i=new Array(r),o=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++a<r;)i[a]=xg(t[a],t[a+1]),o[a]=e(n[a],n[a+1]);return function(n){var e=s(t,n,1,r)-1;return o[e](i[e](n))}}function Tg(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Ag(){var t,n,e,r,i,o,a=bg,u=bg,c=Gr,f=mg;function s(){var t=Math.min(a.length,u.length);return f!==mg&&(f=function(t,n){var e;return t>n&&(e=t,t=n,n=e),function(e){return Math.max(t,Math.min(n,e))}}(a[0],a[t-1])),r=t>2?Mg:wg,i=o=null,l}function l(n){return null==n||isNaN(n=+n)?e:(i||(i=r(a.map(t),u,c)))(t(f(n)))}return l.invert=function(e){return f(n((o||(o=r(u,a.map(t),Yr)))(e)))},l.domain=function(t){return arguments.length?(a=Array.from(t,_g),s()):a.slice()},l.range=function(t){return arguments.length?(u=Array.from(t),s()):u.slice()},l.rangeRound=function(t){return u=Array.from(t),c=Vr,s()},l.clamp=function(t){return arguments.length?(f=!!t||mg,s()):f!==mg},l.interpolate=function(t){return arguments.length?(c=t,s()):c},l.unknown=function(t){return arguments.length?(e=t,l):e},function(e,r){return t=e,n=r,s()}}function Sg(){return Ag()(mg,mg)}function Eg(n,e,r,i){var o,a=W(n,e,r);switch((i=Jc(null==i?",f":i)).type){case"s":var u=Math.max(Math.abs(n),Math.abs(e));return null!=i.precision||isNaN(o=lf(a,u))||(i.precision=o),t.formatPrefix(i,u);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(o=hf(a,Math.max(Math.abs(n),Math.abs(e))))||(i.precision=o-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(o=sf(a))||(i.precision=o-2*("%"===i.type))}return t.format(i)}function Ng(t){var n=t.domain;return t.ticks=function(t){var e=n();return G(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){var r=n();return Eg(r[0],r[r.length-1],null==t?10:t,e)},t.nice=function(e){null==e&&(e=10);var r,i,o=n(),a=0,u=o.length-1,c=o[a],f=o[u],s=10;for(f<c&&(i=c,c=f,f=i,i=a,a=u,u=i);s-- >0;){if((i=V(c,f,e))===r)return o[a]=c,o[u]=f,n(o);if(i>0)c=Math.floor(c/i)*i,f=Math.ceil(f/i)*i;else{if(!(i<0))break;c=Math.ceil(c*i)/i,f=Math.floor(f*i)/i}r=i}return t},t}function kg(t,n){var e,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a<o&&(e=r,r=i,i=e,e=o,o=a,a=e),t[r]=n.floor(o),t[i]=n.ceil(a),t}function Cg(t){return Math.log(t)}function Pg(t){return Math.exp(t)}function zg(t){return-Math.log(-t)}function $g(t){return-Math.exp(-t)}function Dg(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Rg(t){return(n,e)=>-t(-n,e)}function Fg(n){const e=n(Cg,Pg),r=e.domain;let i,o,a=10;function u(){return i=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),n=>Math.log(n)/t)}(a),o=function(t){return 10===t?Dg:t===Math.E?Math.exp:n=>Math.pow(t,n)}(a),r()[0]<0?(i=Rg(i),o=Rg(o),n(zg,$g)):n(Cg,Pg),e}return e.base=function(t){return arguments.length?(a=+t,u()):a},e.domain=function(t){return arguments.length?(r(t),u()):r()},e.ticks=t=>{const n=r();let e=n[0],u=n[n.length-1];const c=u<e;c&&([e,u]=[u,e]);let f,s,l=i(e),h=i(u);const d=null==t?10:+t;let p=[];if(!(a%1)&&h-l<d){if(l=Math.floor(l),h=Math.ceil(h),e>0){for(;l<=h;++l)for(f=1;f<a;++f)if(s=l<0?f/o(-l):f*o(l),!(s<e)){if(s>u)break;p.push(s)}}else for(;l<=h;++l)for(f=a-1;f>=1;--f)if(s=l>0?f/o(-l):f*o(l),!(s<e)){if(s>u)break;p.push(s)}2*p.length<d&&(p=G(e,u,d))}else p=G(l,h,Math.min(h-l,d)).map(o);return c?p.reverse():p},e.tickFormat=(n,r)=>{if(null==n&&(n=10),null==r&&(r=10===a?"s":","),"function"!=typeof r&&(a%1||null!=(r=Jc(r)).precision||(r.trim=!0),r=t.format(r)),n===1/0)return r;const u=Math.max(1,a*n/e.ticks().length);return t=>{let n=t/o(Math.round(i(t)));return n*a<a-.5&&(n*=a),n<=u?r(t):""}},e.nice=()=>r(kg(r(),{floor:t=>o(Math.floor(i(t))),ceil:t=>o(Math.ceil(i(t)))})),e}function qg(t){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/t))}}function Ug(t){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*t}}function Ig(t){var n=1,e=t(qg(n),Ug(n));return e.constant=function(e){return arguments.length?t(qg(n=+e),Ug(n)):n},Ng(e)}function Og(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}function Bg(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Yg(t){return t<0?-t*t:t*t}function Lg(t){var n=t(mg,mg),e=1;return n.exponent=function(n){return arguments.length?1===(e=+n)?t(mg,mg):.5===e?t(Bg,Yg):t(Og(e),Og(1/e)):e},Ng(n)}function jg(){var t=Lg(Ag());return t.copy=function(){return Tg(t,jg()).exponent(t.exponent())},hg.apply(t,arguments),t}function Hg(t){return Math.sign(t)*t*t}const Xg=new Date,Gg=new Date;function Vg(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=n=>(t(n=new Date(+n)),n),i.ceil=e=>(t(e=new Date(e-1)),n(e,1),t(e),e),i.round=t=>{const n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=(t,e)=>(n(t=new Date(+t),null==e?1:Math.floor(e)),t),i.range=(e,r,o)=>{const a=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return a;let u;do{a.push(u=new Date(+e)),n(e,o),t(e)}while(u<e&&e<r);return a},i.filter=e=>Vg((n=>{if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})),e&&(i.count=(n,r)=>(Xg.setTime(+n),Gg.setTime(+r),t(Xg),t(Gg),Math.floor(e(Xg,Gg))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?n=>r(n)%t==0:n=>i.count(0,n)%t==0):i:null)),i}const Wg=Vg((()=>{}),((t,n)=>{t.setTime(+t+n)}),((t,n)=>n-t));Wg.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Vg((n=>{n.setTime(Math.floor(n/t)*t)}),((n,e)=>{n.setTime(+n+e*t)}),((n,e)=>(e-n)/t)):Wg:null);const Zg=Wg.range,Kg=1e3,Qg=6e4,Jg=36e5,ty=864e5,ny=6048e5,ey=2592e6,ry=31536e6,iy=Vg((t=>{t.setTime(t-t.getMilliseconds())}),((t,n)=>{t.setTime(+t+n*Kg)}),((t,n)=>(n-t)/Kg),(t=>t.getUTCSeconds())),oy=iy.range,ay=Vg((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Kg)}),((t,n)=>{t.setTime(+t+n*Qg)}),((t,n)=>(n-t)/Qg),(t=>t.getMinutes())),uy=ay.range,cy=Vg((t=>{t.setUTCSeconds(0,0)}),((t,n)=>{t.setTime(+t+n*Qg)}),((t,n)=>(n-t)/Qg),(t=>t.getUTCMinutes())),fy=cy.range,sy=Vg((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Kg-t.getMinutes()*Qg)}),((t,n)=>{t.setTime(+t+n*Jg)}),((t,n)=>(n-t)/Jg),(t=>t.getHours())),ly=sy.range,hy=Vg((t=>{t.setUTCMinutes(0,0,0)}),((t,n)=>{t.setTime(+t+n*Jg)}),((t,n)=>(n-t)/Jg),(t=>t.getUTCHours())),dy=hy.range,py=Vg((t=>t.setHours(0,0,0,0)),((t,n)=>t.setDate(t.getDate()+n)),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Qg)/ty),(t=>t.getDate()-1)),gy=py.range,yy=Vg((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/ty),(t=>t.getUTCDate()-1)),vy=yy.range,_y=Vg((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/ty),(t=>Math.floor(t/ty))),by=_y.range;function my(t){return Vg((n=>{n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),((t,n)=>{t.setDate(t.getDate()+7*n)}),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Qg)/ny))}const xy=my(0),wy=my(1),My=my(2),Ty=my(3),Ay=my(4),Sy=my(5),Ey=my(6),Ny=xy.range,ky=wy.range,Cy=My.range,Py=Ty.range,zy=Ay.range,$y=Sy.range,Dy=Ey.range;function Ry(t){return Vg((n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+7*n)}),((t,n)=>(n-t)/ny))}const Fy=Ry(0),qy=Ry(1),Uy=Ry(2),Iy=Ry(3),Oy=Ry(4),By=Ry(5),Yy=Ry(6),Ly=Fy.range,jy=qy.range,Hy=Uy.range,Xy=Iy.range,Gy=Oy.range,Vy=By.range,Wy=Yy.range,Zy=Vg((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,n)=>{t.setMonth(t.getMonth()+n)}),((t,n)=>n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())),(t=>t.getMonth())),Ky=Zy.range,Qy=Vg((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCMonth(t.getUTCMonth()+n)}),((t,n)=>n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth())),Jy=Qy.range,tv=Vg((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n)}),((t,n)=>n.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));tv.every=t=>isFinite(t=Math.floor(t))&&t>0?Vg((n=>{n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),((n,e)=>{n.setFullYear(n.getFullYear()+e*t)})):null;const nv=tv.range,ev=Vg((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n)}),((t,n)=>n.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));ev.every=t=>isFinite(t=Math.floor(t))&&t>0?Vg((n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),((n,e)=>{n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null;const rv=ev.range;function iv(t,n,e,i,o,a){const u=[[iy,1,Kg],[iy,5,5e3],[iy,15,15e3],[iy,30,3e4],[a,1,Qg],[a,5,3e5],[a,15,9e5],[a,30,18e5],[o,1,Jg],[o,3,108e5],[o,6,216e5],[o,12,432e5],[i,1,ty],[i,2,1728e5],[e,1,ny],[n,1,ey],[n,3,7776e6],[t,1,ry]];function c(n,e,i){const o=Math.abs(e-n)/i,a=r((([,,t])=>t)).right(u,o);if(a===u.length)return t.every(W(n/ry,e/ry,i));if(0===a)return Wg.every(Math.max(W(n,e,i),1));const[c,f]=u[o/u[a-1][2]<u[a][2]/o?a-1:a];return c.every(f)}return[function(t,n,e){const r=n<t;r&&([t,n]=[n,t]);const i=e&&"function"==typeof e.range?e:c(t,n,e),o=i?i.range(t,+n+1):[];return r?o.reverse():o},c]}const[ov,av]=iv(ev,Qy,Fy,_y,hy,cy),[uv,cv]=iv(tv,Zy,xy,py,sy,ay);function fv(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function sv(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function lv(t,n,e){return{y:t,m:n,d:e,H:0,M:0,S:0,L:0}}function hv(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,c=t.shortMonths,f=mv(i),s=xv(i),l=mv(o),h=xv(o),d=mv(a),p=xv(a),g=mv(u),y=xv(u),v=mv(c),_=xv(c),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:Yv,e:Yv,f:Gv,g:i_,G:a_,H:Lv,I:jv,j:Hv,L:Xv,m:Vv,M:Wv,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:k_,s:C_,S:Zv,u:Kv,U:Qv,V:t_,w:n_,W:e_,x:null,X:null,y:r_,Y:o_,Z:u_,"%":N_},m={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:c_,e:c_,f:d_,g:T_,G:S_,H:f_,I:s_,j:l_,L:h_,m:p_,M:g_,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:k_,s:C_,S:y_,u:v_,U:__,V:m_,w:x_,W:w_,x:null,X:null,y:M_,Y:A_,Z:E_,"%":N_},x={a:function(t,n,e){var r=d.exec(n.slice(e));return r?(t.w=p.get(r[0].toLowerCase()),e+r[0].length):-1},A:function(t,n,e){var r=l.exec(n.slice(e));return r?(t.w=h.get(r[0].toLowerCase()),e+r[0].length):-1},b:function(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=_.get(r[0].toLowerCase()),e+r[0].length):-1},B:function(t,n,e){var r=g.exec(n.slice(e));return r?(t.m=y.get(r[0].toLowerCase()),e+r[0].length):-1},c:function(t,e,r){return T(t,n,e,r)},d:zv,e:zv,f:Uv,g:Nv,G:Ev,H:Dv,I:Dv,j:$v,L:qv,m:Pv,M:Rv,p:function(t,n,e){var r=f.exec(n.slice(e));return r?(t.p=s.get(r[0].toLowerCase()),e+r[0].length):-1},q:Cv,Q:Ov,s:Bv,S:Fv,u:Mv,U:Tv,V:Av,w:wv,W:Sv,x:function(t,n,r){return T(t,e,n,r)},X:function(t,n,e){return T(t,r,n,e)},y:Nv,Y:Ev,Z:kv,"%":Iv};function w(t,n){return function(e){var r,i,o,a=[],u=-1,c=0,f=t.length;for(e instanceof Date||(e=new Date(+e));++u<f;)37===t.charCodeAt(u)&&(a.push(t.slice(c,u)),null!=(i=pv[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=n[r])&&(r=o(e,i)),a.push(r),c=u+1);return a.push(t.slice(c,u)),a.join("")}}function M(t,n){return function(e){var r,i,o=lv(1900,void 0,1);if(T(o,t,e+="",0)!=e.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(n&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=sv(lv(o.y,0,1))).getUTCDay(),r=i>4||0===i?qy.ceil(r):qy(r),r=yy.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=fv(lv(o.y,0,1))).getDay(),r=i>4||0===i?wy.ceil(r):wy(r),r=py.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?sv(lv(o.y,0,1)).getUTCDay():fv(lv(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,sv(o)):fv(o)}}function T(t,n,e,r){for(var i,o,a=0,u=n.length,c=e.length;a<u;){if(r>=c)return-1;if(37===(i=n.charCodeAt(a++))){if(i=n.charAt(a++),!(o=x[i in pv?n.charAt(a++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return b.x=w(e,b),b.X=w(r,b),b.c=w(n,b),m.x=w(e,m),m.X=w(r,m),m.c=w(n,m),{format:function(t){var n=w(t+="",b);return n.toString=function(){return t},n},parse:function(t){var n=M(t+="",!1);return n.toString=function(){return t},n},utcFormat:function(t){var n=w(t+="",m);return n.toString=function(){return t},n},utcParse:function(t){var n=M(t+="",!0);return n.toString=function(){return t},n}}}var dv,pv={"-":"",_:" ",0:"0"},gv=/^\s*\d+/,yv=/^%/,vv=/[\\^$*+?|[\]().{}]/g;function _v(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<e?new Array(e-o+1).join(n)+i:i)}function bv(t){return t.replace(vv,"\\$&")}function mv(t){return new RegExp("^(?:"+t.map(bv).join("|")+")","i")}function xv(t){return new Map(t.map(((t,n)=>[t.toLowerCase(),n])))}function wv(t,n,e){var r=gv.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function Mv(t,n,e){var r=gv.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function Tv(t,n,e){var r=gv.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function Av(t,n,e){var r=gv.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function Sv(t,n,e){var r=gv.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function Ev(t,n,e){var r=gv.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function Nv(t,n,e){var r=gv.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function kv(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function Cv(t,n,e){var r=gv.exec(n.slice(e,e+1));return r?(t.q=3*r[0]-3,e+r[0].length):-1}function Pv(t,n,e){var r=gv.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function zv(t,n,e){var r=gv.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function $v(t,n,e){var r=gv.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function Dv(t,n,e){var r=gv.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function Rv(t,n,e){var r=gv.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function Fv(t,n,e){var r=gv.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function qv(t,n,e){var r=gv.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function Uv(t,n,e){var r=gv.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function Iv(t,n,e){var r=yv.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function Ov(t,n,e){var r=gv.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function Bv(t,n,e){var r=gv.exec(n.slice(e));return r?(t.s=+r[0],e+r[0].length):-1}function Yv(t,n){return _v(t.getDate(),n,2)}function Lv(t,n){return _v(t.getHours(),n,2)}function jv(t,n){return _v(t.getHours()%12||12,n,2)}function Hv(t,n){return _v(1+py.count(tv(t),t),n,3)}function Xv(t,n){return _v(t.getMilliseconds(),n,3)}function Gv(t,n){return Xv(t,n)+"000"}function Vv(t,n){return _v(t.getMonth()+1,n,2)}function Wv(t,n){return _v(t.getMinutes(),n,2)}function Zv(t,n){return _v(t.getSeconds(),n,2)}function Kv(t){var n=t.getDay();return 0===n?7:n}function Qv(t,n){return _v(xy.count(tv(t)-1,t),n,2)}function Jv(t){var n=t.getDay();return n>=4||0===n?Ay(t):Ay.ceil(t)}function t_(t,n){return t=Jv(t),_v(Ay.count(tv(t),t)+(4===tv(t).getDay()),n,2)}function n_(t){return t.getDay()}function e_(t,n){return _v(wy.count(tv(t)-1,t),n,2)}function r_(t,n){return _v(t.getFullYear()%100,n,2)}function i_(t,n){return _v((t=Jv(t)).getFullYear()%100,n,2)}function o_(t,n){return _v(t.getFullYear()%1e4,n,4)}function a_(t,n){var e=t.getDay();return _v((t=e>=4||0===e?Ay(t):Ay.ceil(t)).getFullYear()%1e4,n,4)}function u_(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+_v(n/60|0,"0",2)+_v(n%60,"0",2)}function c_(t,n){return _v(t.getUTCDate(),n,2)}function f_(t,n){return _v(t.getUTCHours(),n,2)}function s_(t,n){return _v(t.getUTCHours()%12||12,n,2)}function l_(t,n){return _v(1+yy.count(ev(t),t),n,3)}function h_(t,n){return _v(t.getUTCMilliseconds(),n,3)}function d_(t,n){return h_(t,n)+"000"}function p_(t,n){return _v(t.getUTCMonth()+1,n,2)}function g_(t,n){return _v(t.getUTCMinutes(),n,2)}function y_(t,n){return _v(t.getUTCSeconds(),n,2)}function v_(t){var n=t.getUTCDay();return 0===n?7:n}function __(t,n){return _v(Fy.count(ev(t)-1,t),n,2)}function b_(t){var n=t.getUTCDay();return n>=4||0===n?Oy(t):Oy.ceil(t)}function m_(t,n){return t=b_(t),_v(Oy.count(ev(t),t)+(4===ev(t).getUTCDay()),n,2)}function x_(t){return t.getUTCDay()}function w_(t,n){return _v(qy.count(ev(t)-1,t),n,2)}function M_(t,n){return _v(t.getUTCFullYear()%100,n,2)}function T_(t,n){return _v((t=b_(t)).getUTCFullYear()%100,n,2)}function A_(t,n){return _v(t.getUTCFullYear()%1e4,n,4)}function S_(t,n){var e=t.getUTCDay();return _v((t=e>=4||0===e?Oy(t):Oy.ceil(t)).getUTCFullYear()%1e4,n,4)}function E_(){return"+0000"}function N_(){return"%"}function k_(t){return+t}function C_(t){return Math.floor(+t/1e3)}function P_(n){return dv=hv(n),t.timeFormat=dv.format,t.timeParse=dv.parse,t.utcFormat=dv.utcFormat,t.utcParse=dv.utcParse,dv}t.timeFormat=void 0,t.timeParse=void 0,t.utcFormat=void 0,t.utcParse=void 0,P_({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var z_="%Y-%m-%dT%H:%M:%S.%LZ";var $_=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat(z_),D_=$_;var R_=+new Date("2000-01-01T00:00:00.000Z")?function(t){var n=new Date(t);return isNaN(n)?null:n}:t.utcParse(z_),F_=R_;function q_(t){return new Date(t)}function U_(t){return t instanceof Date?+t:+new Date(+t)}function I_(t,n,e,r,i,o,a,u,c,f){var s=Sg(),l=s.invert,h=s.domain,d=f(".%L"),p=f(":%S"),g=f("%I:%M"),y=f("%I %p"),v=f("%a %d"),_=f("%b %d"),b=f("%B"),m=f("%Y");function x(t){return(c(t)<t?d:u(t)<t?p:a(t)<t?g:o(t)<t?y:r(t)<t?i(t)<t?v:_:e(t)<t?b:m)(t)}return s.invert=function(t){return new Date(l(t))},s.domain=function(t){return arguments.length?h(Array.from(t,U_)):h().map(q_)},s.ticks=function(n){var e=h();return t(e[0],e[e.length-1],null==n?10:n)},s.tickFormat=function(t,n){return null==n?x:f(n)},s.nice=function(t){var e=h();return t&&"function"==typeof t.range||(t=n(e[0],e[e.length-1],null==t?10:t)),t?h(kg(e,t)):s},s.copy=function(){return Tg(s,I_(t,n,e,r,i,o,a,u,c,f))},s}function O_(){var t,n,e,r,i,o=0,a=1,u=mg,c=!1;function f(n){return null==n||isNaN(n=+n)?i:u(0===e?.5:(n=(r(n)-t)*e,c?Math.max(0,Math.min(1,n)):n))}function s(t){return function(n){var e,r;return arguments.length?([e,r]=n,u=t(e,r),f):[u(0),u(1)]}}return f.domain=function(i){return arguments.length?([o,a]=i,t=r(o=+o),n=r(a=+a),e=t===n?0:1/(n-t),f):[o,a]},f.clamp=function(t){return arguments.length?(c=!!t,f):c},f.interpolator=function(t){return arguments.length?(u=t,f):u},f.range=s(Gr),f.rangeRound=s(Vr),f.unknown=function(t){return arguments.length?(i=t,f):i},function(i){return r=i,t=i(o),n=i(a),e=t===n?0:1/(n-t),f}}function B_(t,n){return n.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Y_(){var t=Lg(O_());return t.copy=function(){return B_(t,Y_()).exponent(t.exponent())},dg.apply(t,arguments)}function L_(){var t,n,e,r,i,o,a,u=0,c=.5,f=1,s=1,l=mg,h=!1;function d(t){return isNaN(t=+t)?a:(t=.5+((t=+o(t))-n)*(s*t<s*n?r:i),l(h?Math.max(0,Math.min(1,t)):t))}function p(t){return function(n){var e,r,i;return arguments.length?([e,r,i]=n,l=di(t,[e,r,i]),d):[l(0),l(.5),l(1)]}}return d.domain=function(a){return arguments.length?([u,c,f]=a,t=o(u=+u),n=o(c=+c),e=o(f=+f),r=t===n?0:.5/(n-t),i=n===e?0:.5/(e-n),s=n<t?-1:1,d):[u,c,f]},d.clamp=function(t){return arguments.length?(h=!!t,d):h},d.interpolator=function(t){return arguments.length?(l=t,d):l},d.range=p(Gr),d.rangeRound=p(Vr),d.unknown=function(t){return arguments.length?(a=t,d):a},function(a){return o=a,t=a(u),n=a(c),e=a(f),r=t===n?0:.5/(n-t),i=n===e?0:.5/(e-n),s=n<t?-1:1,d}}function j_(){var t=Lg(L_());return t.copy=function(){return B_(t,j_()).exponent(t.exponent())},dg.apply(t,arguments)}function H_(t){for(var n=t.length/6|0,e=new Array(n),r=0;r<n;)e[r]="#"+t.slice(6*r,6*++r);return e}var X_=H_("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),G_=H_("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),V_=H_("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),W_=H_("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Z_=H_("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),K_=H_("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),Q_=H_("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),J_=H_("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),tb=H_("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"),nb=H_("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"),eb=t=>Fr(t[t.length-1]),rb=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(H_),ib=eb(rb),ob=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(H_),ab=eb(ob),ub=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(H_),cb=eb(ub),fb=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(H_),sb=eb(fb),lb=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(H_),hb=eb(lb),db=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(H_),pb=eb(db),gb=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(H_),yb=eb(gb),vb=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(H_),_b=eb(vb),bb=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(H_),mb=eb(bb),xb=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(H_),wb=eb(xb),Mb=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(H_),Tb=eb(Mb),Ab=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(H_),Sb=eb(Ab),Eb=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(H_),Nb=eb(Eb),kb=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(H_),Cb=eb(kb),Pb=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(H_),zb=eb(Pb),$b=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(H_),Db=eb($b),Rb=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(H_),Fb=eb(Rb),qb=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(H_),Ub=eb(qb),Ib=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(H_),Ob=eb(Ib),Bb=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(H_),Yb=eb(Bb),Lb=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(H_),jb=eb(Lb),Hb=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(H_),Xb=eb(Hb),Gb=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(H_),Vb=eb(Gb),Wb=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(H_),Zb=eb(Wb),Kb=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(H_),Qb=eb(Kb),Jb=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(H_),tm=eb(Jb),nm=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(H_),em=eb(nm);var rm=hi(Tr(300,.5,0),Tr(-240,.5,1)),im=hi(Tr(-100,.75,.35),Tr(80,1.5,.8)),om=hi(Tr(260,.75,.35),Tr(80,1.5,.8)),am=Tr();var um=Fe(),cm=Math.PI/3,fm=2*Math.PI/3;function sm(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}}var lm=sm(H_("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),hm=sm(H_("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),dm=sm(H_("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),pm=sm(H_("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function gm(t){return function(){return t}}const ym=Math.abs,vm=Math.atan2,_m=Math.cos,bm=Math.max,mm=Math.min,xm=Math.sin,wm=Math.sqrt,Mm=1e-12,Tm=Math.PI,Am=Tm/2,Sm=2*Tm;function Em(t){return t>=1?Am:t<=-1?-Am:Math.asin(t)}function Nm(t){let n=3;return t.digits=function(e){if(!arguments.length)return n;if(null==e)n=null;else{const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);n=t}return t},()=>new Ua(n)}function km(t){return t.innerRadius}function Cm(t){return t.outerRadius}function Pm(t){return t.startAngle}function zm(t){return t.endAngle}function $m(t){return t&&t.padAngle}function Dm(t,n,e,r,i,o,a){var u=t-e,c=n-r,f=(a?o:-o)/wm(u*u+c*c),s=f*c,l=-f*u,h=t+s,d=n+l,p=e+s,g=r+l,y=(h+p)/2,v=(d+g)/2,_=p-h,b=g-d,m=_*_+b*b,x=i-o,w=h*g-p*d,M=(b<0?-1:1)*wm(bm(0,x*x*m-w*w)),T=(w*b-_*M)/m,A=(-w*_-b*M)/m,S=(w*b+_*M)/m,E=(-w*_+b*M)/m,N=T-y,k=A-v,C=S-y,P=E-v;return N*N+k*k>C*C+P*P&&(T=S,A=E),{cx:T,cy:A,x01:-s,y01:-l,x11:T*(i/x-1),y11:A*(i/x-1)}}var Rm=Array.prototype.slice;function Fm(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function qm(t){this._context=t}function Um(t){return new qm(t)}function Im(t){return t[0]}function Om(t){return t[1]}function Bm(t,n){var e=gm(!0),r=null,i=Um,o=null,a=Nm(u);function u(u){var c,f,s,l=(u=Fm(u)).length,h=!1;for(null==r&&(o=i(s=a())),c=0;c<=l;++c)!(c<l&&e(f=u[c],c,u))===h&&((h=!h)?o.lineStart():o.lineEnd()),h&&o.point(+t(f,c,u),+n(f,c,u));if(s)return o=null,s+""||null}return t="function"==typeof t?t:void 0===t?Im:gm(t),n="function"==typeof n?n:void 0===n?Om:gm(n),u.x=function(n){return arguments.length?(t="function"==typeof n?n:gm(+n),u):t},u.y=function(t){return arguments.length?(n="function"==typeof t?t:gm(+t),u):n},u.defined=function(t){return arguments.length?(e="function"==typeof t?t:gm(!!t),u):e},u.curve=function(t){return arguments.length?(i=t,null!=r&&(o=i(r)),u):i},u.context=function(t){return arguments.length?(null==t?r=o=null:o=i(r=t),u):r},u}function Ym(t,n,e){var r=null,i=gm(!0),o=null,a=Um,u=null,c=Nm(f);function f(f){var s,l,h,d,p,g=(f=Fm(f)).length,y=!1,v=new Array(g),_=new Array(g);for(null==o&&(u=a(p=c())),s=0;s<=g;++s){if(!(s<g&&i(d=f[s],s,f))===y)if(y=!y)l=s,u.areaStart(),u.lineStart();else{for(u.lineEnd(),u.lineStart(),h=s-1;h>=l;--h)u.point(v[h],_[h]);u.lineEnd(),u.areaEnd()}y&&(v[s]=+t(d,s,f),_[s]=+n(d,s,f),u.point(r?+r(d,s,f):v[s],e?+e(d,s,f):_[s]))}if(p)return u=null,p+""||null}function s(){return Bm().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?Im:gm(+t),n="function"==typeof n?n:gm(void 0===n?0:+n),e="function"==typeof e?e:void 0===e?Om:gm(+e),f.x=function(n){return arguments.length?(t="function"==typeof n?n:gm(+n),r=null,f):t},f.x0=function(n){return arguments.length?(t="function"==typeof n?n:gm(+n),f):t},f.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:gm(+t),f):r},f.y=function(t){return arguments.length?(n="function"==typeof t?t:gm(+t),e=null,f):n},f.y0=function(t){return arguments.length?(n="function"==typeof t?t:gm(+t),f):n},f.y1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:gm(+t),f):e},f.lineX0=f.lineY0=function(){return s().x(t).y(n)},f.lineY1=function(){return s().x(t).y(e)},f.lineX1=function(){return s().x(r).y(n)},f.defined=function(t){return arguments.length?(i="function"==typeof t?t:gm(!!t),f):i},f.curve=function(t){return arguments.length?(a=t,null!=o&&(u=a(o)),f):a},f.context=function(t){return arguments.length?(null==t?o=u=null:u=a(o=t),f):o},f}function Lm(t,n){return n<t?-1:n>t?1:n>=t?0:NaN}function jm(t){return t}qm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var Hm=Gm(Um);function Xm(t){this._curve=t}function Gm(t){function n(n){return new Xm(t(n))}return n._curve=t,n}function Vm(t){var n=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?n(Gm(t)):n()._curve},t}function Wm(){return Vm(Bm().curve(Hm))}function Zm(){var t=Ym().curve(Hm),n=t.curve,e=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return Vm(e())},delete t.lineX0,t.lineEndAngle=function(){return Vm(r())},delete t.lineX1,t.lineInnerRadius=function(){return Vm(i())},delete t.lineY0,t.lineOuterRadius=function(){return Vm(o())},delete t.lineY1,t.curve=function(t){return arguments.length?n(Gm(t)):n()._curve},t}function Km(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]}Xm.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};class Qm{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n)}this._x0=t,this._y0=n}}class Jm{constructor(t){this._context=t}lineStart(){this._point=0}lineEnd(){}point(t,n){if(t=+t,n=+n,0===this._point)this._point=1;else{const e=Km(this._x0,this._y0),r=Km(this._x0,this._y0=(this._y0+n)/2),i=Km(t,this._y0),o=Km(t,n);this._context.moveTo(...e),this._context.bezierCurveTo(...r,...i,...o)}this._x0=t,this._y0=n}}function tx(t){return new Qm(t,!0)}function nx(t){return new Qm(t,!1)}function ex(t){return new Jm(t)}function rx(t){return t.source}function ix(t){return t.target}function ox(t){let n=rx,e=ix,r=Im,i=Om,o=null,a=null,u=Nm(c);function c(){let c;const f=Rm.call(arguments),s=n.apply(this,f),l=e.apply(this,f);if(null==o&&(a=t(c=u())),a.lineStart(),f[0]=s,a.point(+r.apply(this,f),+i.apply(this,f)),f[0]=l,a.point(+r.apply(this,f),+i.apply(this,f)),a.lineEnd(),c)return a=null,c+""||null}return c.source=function(t){return arguments.length?(n=t,c):n},c.target=function(t){return arguments.length?(e=t,c):e},c.x=function(t){return arguments.length?(r="function"==typeof t?t:gm(+t),c):r},c.y=function(t){return arguments.length?(i="function"==typeof t?t:gm(+t),c):i},c.context=function(n){return arguments.length?(null==n?o=a=null:a=t(o=n),c):o},c}const ax=wm(3);var ux={draw(t,n){const e=.59436*wm(n+mm(n/28,.75)),r=e/2,i=r*ax;t.moveTo(0,e),t.lineTo(0,-e),t.moveTo(-i,-r),t.lineTo(i,r),t.moveTo(-i,r),t.lineTo(i,-r)}},cx={draw(t,n){const e=wm(n/Tm);t.moveTo(e,0),t.arc(0,0,e,0,Sm)}},fx={draw(t,n){const e=wm(n/5)/2;t.moveTo(-3*e,-e),t.lineTo(-e,-e),t.lineTo(-e,-3*e),t.lineTo(e,-3*e),t.lineTo(e,-e),t.lineTo(3*e,-e),t.lineTo(3*e,e),t.lineTo(e,e),t.lineTo(e,3*e),t.lineTo(-e,3*e),t.lineTo(-e,e),t.lineTo(-3*e,e),t.closePath()}};const sx=wm(1/3),lx=2*sx;var hx={draw(t,n){const e=wm(n/lx),r=e*sx;t.moveTo(0,-e),t.lineTo(r,0),t.lineTo(0,e),t.lineTo(-r,0),t.closePath()}},dx={draw(t,n){const e=.62625*wm(n);t.moveTo(0,-e),t.lineTo(e,0),t.lineTo(0,e),t.lineTo(-e,0),t.closePath()}},px={draw(t,n){const e=.87559*wm(n-mm(n/7,2));t.moveTo(-e,0),t.lineTo(e,0),t.moveTo(0,e),t.lineTo(0,-e)}},gx={draw(t,n){const e=wm(n),r=-e/2;t.rect(r,r,e,e)}},yx={draw(t,n){const e=.4431*wm(n);t.moveTo(e,e),t.lineTo(e,-e),t.lineTo(-e,-e),t.lineTo(-e,e),t.closePath()}};const vx=xm(Tm/10)/xm(7*Tm/10),_x=xm(Sm/10)*vx,bx=-_m(Sm/10)*vx;var mx={draw(t,n){const e=wm(.8908130915292852*n),r=_x*e,i=bx*e;t.moveTo(0,-e),t.lineTo(r,i);for(let n=1;n<5;++n){const o=Sm*n/5,a=_m(o),u=xm(o);t.lineTo(u*e,-a*e),t.lineTo(a*r-u*i,u*r+a*i)}t.closePath()}};const xx=wm(3);var wx={draw(t,n){const e=-wm(n/(3*xx));t.moveTo(0,2*e),t.lineTo(-xx*e,-e),t.lineTo(xx*e,-e),t.closePath()}};const Mx=wm(3);var Tx={draw(t,n){const e=.6824*wm(n),r=e/2,i=e*Mx/2;t.moveTo(0,-e),t.lineTo(i,r),t.lineTo(-i,r),t.closePath()}};const Ax=-.5,Sx=wm(3)/2,Ex=1/wm(12),Nx=3*(Ex/2+1);var kx={draw(t,n){const e=wm(n/Nx),r=e/2,i=e*Ex,o=r,a=e*Ex+e,u=-o,c=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(u,c),t.lineTo(Ax*r-Sx*i,Sx*r+Ax*i),t.lineTo(Ax*o-Sx*a,Sx*o+Ax*a),t.lineTo(Ax*u-Sx*c,Sx*u+Ax*c),t.lineTo(Ax*r+Sx*i,Ax*i-Sx*r),t.lineTo(Ax*o+Sx*a,Ax*a-Sx*o),t.lineTo(Ax*u+Sx*c,Ax*c-Sx*u),t.closePath()}},Cx={draw(t,n){const e=.6189*wm(n-mm(n/6,1.7));t.moveTo(-e,-e),t.lineTo(e,e),t.moveTo(-e,e),t.lineTo(e,-e)}};const Px=[cx,fx,hx,gx,mx,wx,kx],zx=[cx,px,Cx,Tx,ux,yx,dx];function $x(){}function Dx(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function Rx(t){this._context=t}function Fx(t){this._context=t}function qx(t){this._context=t}function Ux(t,n){this._basis=new Rx(t),this._beta=n}Rx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Dx(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Dx(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Fx.prototype={areaStart:$x,areaEnd:$x,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:Dx(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},qx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:Dx(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Ux.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],o=n[0],a=t[e]-i,u=n[e]-o,c=-1;++c<=e;)r=c/e,this._basis.point(this._beta*t[c]+(1-this._beta)*(i+r*a),this._beta*n[c]+(1-this._beta)*(o+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var Ix=function t(n){function e(t){return 1===n?new Rx(t):new Ux(t,n)}return e.beta=function(n){return t(+n)},e}(.85);function Ox(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function Bx(t,n){this._context=t,this._k=(1-n)/6}Bx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Ox(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:Ox(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Yx=function t(n){function e(t){return new Bx(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Lx(t,n){this._context=t,this._k=(1-n)/6}Lx.prototype={areaStart:$x,areaEnd:$x,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Ox(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var jx=function t(n){function e(t){return new Lx(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Hx(t,n){this._context=t,this._k=(1-n)/6}Hx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Ox(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Xx=function t(n){function e(t){return new Hx(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Gx(t,n,e){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>Mm){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>Mm){var f=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,s=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*f+t._x1*t._l23_2a-n*t._l12_2a)/s,a=(a*f+t._y1*t._l23_2a-e*t._l12_2a)/s}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function Vx(t,n){this._context=t,this._alpha=n}Vx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Gx(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Wx=function t(n){function e(t){return n?new Vx(t,n):new Bx(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function Zx(t,n){this._context=t,this._alpha=n}Zx.prototype={areaStart:$x,areaEnd:$x,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Gx(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Kx=function t(n){function e(t){return n?new Zx(t,n):new Lx(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function Qx(t,n){this._context=t,this._alpha=n}Qx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Gx(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Jx=function t(n){function e(t){return n?new Qx(t,n):new Hx(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function tw(t){this._context=t}function nw(t){return t<0?-1:1}function ew(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(e-t._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(nw(o)+nw(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function rw(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function iw(t,n,e){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,u=(o-r)/3;t._context.bezierCurveTo(r+u,i+u*n,o-u,a-u*e,o,a)}function ow(t){this._context=t}function aw(t){this._context=new uw(t)}function uw(t){this._context=t}function cw(t){this._context=t}function fw(t){var n,e,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],n=1;n<r-1;++n)i[n]=1,o[n]=4,a[n]=4*t[n]+2*t[n+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*t[r-1]+t[r],n=1;n<r;++n)e=i[n]/o[n-1],o[n]-=e,a[n]-=e*a[n-1];for(i[r-1]=a[r-1]/o[r-1],n=r-2;n>=0;--n)i[n]=(a[n]-i[n+1])/o[n];for(o[r-1]=(t[r]+i[r-1])/2,n=0;n<r-1;++n)o[n]=2*t[n+1]-i[n+1];return[i,o]}function sw(t,n){this._context=t,this._t=n}function lw(t,n){if((i=t.length)>1)for(var e,r,i,o=1,a=t[n[0]],u=a.length;o<i;++o)for(r=a,a=t[n[o]],e=0;e<u;++e)a[e][1]+=a[e][0]=isNaN(r[e][1])?r[e][0]:r[e][1]}function hw(t){for(var n=t.length,e=new Array(n);--n>=0;)e[n]=n;return e}function dw(t,n){return t[n]}function pw(t){const n=[];return n.key=t,n}function gw(t){var n=t.map(yw);return hw(t).sort((function(t,e){return n[t]-n[e]}))}function yw(t){for(var n,e=-1,r=0,i=t.length,o=-1/0;++e<i;)(n=+t[e][1])>o&&(o=n,r=e);return r}function vw(t){var n=t.map(_w);return hw(t).sort((function(t,e){return n[t]-n[e]}))}function _w(t){for(var n,e=0,r=-1,i=t.length;++r<i;)(n=+t[r][1])&&(e+=n);return e}tw.prototype={areaStart:$x,areaEnd:$x,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}},ow.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:iw(this,this._t0,rw(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(n=+n,(t=+t)!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,iw(this,rw(this,e=ew(this,t,n)),e);break;default:iw(this,this._t0,e=ew(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(aw.prototype=Object.create(ow.prototype)).point=function(t,n){ow.prototype.point.call(this,n,t)},uw.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,i,o){this._context.bezierCurveTo(n,t,r,e,o,i)}},cw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,e=t.length;if(e)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===e)this._context.lineTo(t[1],n[1]);else for(var r=fw(t),i=fw(n),o=0,a=1;a<e;++o,++a)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[a],n[a]);(this._line||0!==this._line&&1===e)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,n){this._x.push(+t),this._y.push(+n)}},sw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}};var bw=t=>()=>t;function mw(t,{sourceEvent:n,target:e,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function xw(t,n,e){this.k=t,this.x=n,this.y=e}xw.prototype={constructor:xw,scale:function(t){return 1===t?this:new xw(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new xw(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ww=new xw(1,0,0);function Mw(t){for(;!t.__zoom;)if(!(t=t.parentNode))return ww;return t.__zoom}function Tw(t){t.stopImmediatePropagation()}function Aw(t){t.preventDefault(),t.stopImmediatePropagation()}function Sw(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Ew(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function Nw(){return this.__zoom||ww}function kw(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Cw(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pw(t,n,e){var r=t.invertX(n[0][0])-e[0][0],i=t.invertX(n[1][0])-e[1][0],o=t.invertY(n[0][1])-e[0][1],a=t.invertY(n[1][1])-e[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}Mw.prototype=xw.prototype,t.Adder=T,t.Delaunay=Lu,t.FormatSpecifier=tf,t.InternMap=InternMap,t.InternSet=InternSet,t.Node=Qd,t.Path=Ua,t.Voronoi=qu,t.ZoomTransform=xw,t.active=function(t,n){var e,r,i=t.__transition;if(i)for(r in n=null==n?null:n+"",i)if((e=i[r]).state>qi&&e.name===n)return new po([[t]],Zo,n,+r);return null},t.arc=function(){var t=km,n=Cm,e=gm(0),r=null,i=Pm,o=zm,a=$m,u=null,c=Nm(f);function f(){var f,s,l=+t.apply(this,arguments),h=+n.apply(this,arguments),d=i.apply(this,arguments)-Am,p=o.apply(this,arguments)-Am,g=ym(p-d),y=p>d;if(u||(u=f=c()),h<l&&(s=h,h=l,l=s),h>Mm)if(g>Sm-Mm)u.moveTo(h*_m(d),h*xm(d)),u.arc(0,0,h,d,p,!y),l>Mm&&(u.moveTo(l*_m(p),l*xm(p)),u.arc(0,0,l,p,d,y));else{var v,_,b=d,m=p,x=d,w=p,M=g,T=g,A=a.apply(this,arguments)/2,S=A>Mm&&(r?+r.apply(this,arguments):wm(l*l+h*h)),E=mm(ym(h-l)/2,+e.apply(this,arguments)),N=E,k=E;if(S>Mm){var C=Em(S/l*xm(A)),P=Em(S/h*xm(A));(M-=2*C)>Mm?(x+=C*=y?1:-1,w-=C):(M=0,x=w=(d+p)/2),(T-=2*P)>Mm?(b+=P*=y?1:-1,m-=P):(T=0,b=m=(d+p)/2)}var z=h*_m(b),$=h*xm(b),D=l*_m(w),R=l*xm(w);if(E>Mm){var F,q=h*_m(m),U=h*xm(m),I=l*_m(x),O=l*xm(x);if(g<Tm)if(F=function(t,n,e,r,i,o,a,u){var c=e-t,f=r-n,s=a-i,l=u-o,h=l*c-s*f;if(!(h*h<Mm))return[t+(h=(s*(n-o)-l*(t-i))/h)*c,n+h*f]}(z,$,I,O,q,U,D,R)){var B=z-F[0],Y=$-F[1],L=q-F[0],j=U-F[1],H=1/xm(function(t){return t>1?0:t<-1?Tm:Math.acos(t)}((B*L+Y*j)/(wm(B*B+Y*Y)*wm(L*L+j*j)))/2),X=wm(F[0]*F[0]+F[1]*F[1]);N=mm(E,(l-X)/(H-1)),k=mm(E,(h-X)/(H+1))}else N=k=0}T>Mm?k>Mm?(v=Dm(I,O,z,$,h,k,y),_=Dm(q,U,D,R,h,k,y),u.moveTo(v.cx+v.x01,v.cy+v.y01),k<E?u.arc(v.cx,v.cy,k,vm(v.y01,v.x01),vm(_.y01,_.x01),!y):(u.arc(v.cx,v.cy,k,vm(v.y01,v.x01),vm(v.y11,v.x11),!y),u.arc(0,0,h,vm(v.cy+v.y11,v.cx+v.x11),vm(_.cy+_.y11,_.cx+_.x11),!y),u.arc(_.cx,_.cy,k,vm(_.y11,_.x11),vm(_.y01,_.x01),!y))):(u.moveTo(z,$),u.arc(0,0,h,b,m,!y)):u.moveTo(z,$),l>Mm&&M>Mm?N>Mm?(v=Dm(D,R,q,U,l,-N,y),_=Dm(z,$,I,O,l,-N,y),u.lineTo(v.cx+v.x01,v.cy+v.y01),N<E?u.arc(v.cx,v.cy,N,vm(v.y01,v.x01),vm(_.y01,_.x01),!y):(u.arc(v.cx,v.cy,N,vm(v.y01,v.x01),vm(v.y11,v.x11),!y),u.arc(0,0,l,vm(v.cy+v.y11,v.cx+v.x11),vm(_.cy+_.y11,_.cx+_.x11),y),u.arc(_.cx,_.cy,N,vm(_.y11,_.x11),vm(_.y01,_.x01),!y))):u.arc(0,0,l,w,x,y):u.lineTo(D,R)}else u.moveTo(0,0);if(u.closePath(),f)return u=null,f+""||null}return f.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-Tm/2;return[_m(r)*e,xm(r)*e]},f.innerRadius=function(n){return arguments.length?(t="function"==typeof n?n:gm(+n),f):t},f.outerRadius=function(t){return arguments.length?(n="function"==typeof t?t:gm(+t),f):n},f.cornerRadius=function(t){return arguments.length?(e="function"==typeof t?t:gm(+t),f):e},f.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:gm(+t),f):r},f.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:gm(+t),f):i},f.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:gm(+t),f):o},f.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:gm(+t),f):a},f.context=function(t){return arguments.length?(u=null==t?null:t,f):u},f},t.area=Ym,t.areaRadial=Zm,t.ascending=n,t.autoType=function(t){for(var n in t){var e,r,i=t[n].trim();if(i)if("true"===i)i=!0;else if("false"===i)i=!1;else if("NaN"===i)i=NaN;else if(isNaN(e=+i)){if(!(r=i.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)))continue;yc&&r[4]&&!r[7]&&(i=i.replace(/-/g,"/").replace(/T/," ")),i=new Date(i)}else i=e;else i=null;t[n]=i}return t},t.axisBottom=function(t){return Pt(Mt,t)},t.axisLeft=function(t){return Pt(Tt,t)},t.axisRight=function(t){return Pt(wt,t)},t.axisTop=function(t){return Pt(xt,t)},t.bin=Q,t.bisect=s,t.bisectCenter=f,t.bisectLeft=c,t.bisectRight=u,t.bisector=r,t.blob=function(t,n){return fetch(t,n).then(vc)},t.blur=function(t,n){if(!((n=+n)>=0))throw new RangeError("invalid r");let e=t.length;if(!((e=Math.floor(e))>=0))throw new RangeError("invalid length");if(!e||!n)return t;const r=y(n),i=t.slice();return r(t,i,0,e,1),r(i,t,0,e,1),r(t,i,0,e,1),t},t.blur2=l,t.blurImage=h,t.brush=function(){return wa(la)},t.brushSelection=function(t){var n=t.__brush;return n?n.dim.output(n.selection):null},t.brushX=function(){return wa(fa)},t.brushY=function(){return wa(sa)},t.buffer=function(t,n){return fetch(t,n).then(_c)},t.chord=function(){return za(!1,!1)},t.chordDirected=function(){return za(!0,!1)},t.chordTranspose=function(){return za(!1,!0)},t.cluster=function(){var t=Ld,n=1,e=1,r=!1;function i(i){var o,a=0;i.eachAfter((function(n){var e=n.children;e?(n.x=function(t){return t.reduce(jd,0)/t.length}(e),n.y=function(t){return 1+t.reduce(Hd,0)}(e)):(n.x=o?a+=t(n,o):0,n.y=0,o=n)}));var u=function(t){for(var n;n=t.children;)t=n[0];return t}(i),c=function(t){for(var n;n=t.children;)t=n[n.length-1];return t}(i),f=u.x-t(u,c)/2,s=c.x+t(c,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*n,t.y=(i.y-t.y)*e}:function(t){t.x=(t.x-f)/(s-f)*n,t.y=(1-(i.y?t.y/i.y:1))*e})}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},t.color=ze,t.contourDensity=function(){var t=fu,n=su,e=lu,r=960,i=500,o=20,a=2,u=3*o,c=r+2*u>>a,f=i+2*u>>a,s=Qa(20);function h(r){var i=new Float32Array(c*f),s=Math.pow(2,-a),h=-1;for(const o of r){var d=(t(o,++h,r)+u)*s,p=(n(o,h,r)+u)*s,g=+e(o,h,r);if(g&&d>=0&&d<c&&p>=0&&p<f){var y=Math.floor(d),v=Math.floor(p),_=d-y-.5,b=p-v-.5;i[y+v*c]+=(1-_)*(1-b)*g,i[y+1+v*c]+=_*(1-b)*g,i[y+1+(v+1)*c]+=_*b*g,i[y+(v+1)*c]+=(1-_)*b*g}}return l({data:i,width:c,height:f},o*s),i}function d(t){var n=h(t),e=s(n),r=Math.pow(2,2*a);return Array.isArray(e)||(e=G(Number.MIN_VALUE,J(n)/r,e)),iu().size([c,f]).thresholds(e.map((t=>t*r)))(n).map(((t,n)=>(t.value=+e[n],p(t))))}function p(t){return t.coordinates.forEach(g),t}function g(t){t.forEach(y)}function y(t){t.forEach(v)}function v(t){t[0]=t[0]*Math.pow(2,a)-u,t[1]=t[1]*Math.pow(2,a)-u}function _(){return c=r+2*(u=3*o)>>a,f=i+2*u>>a,d}return d.contours=function(t){var n=h(t),e=iu().size([c,f]),r=Math.pow(2,2*a),i=t=>{t=+t;var i=p(e.contour(n,t*r));return i.value=t,i};return Object.defineProperty(i,"max",{get:()=>J(n)/r}),i},d.x=function(n){return arguments.length?(t="function"==typeof n?n:Qa(+n),d):t},d.y=function(t){return arguments.length?(n="function"==typeof t?t:Qa(+t),d):n},d.weight=function(t){return arguments.length?(e="function"==typeof t?t:Qa(+t),d):e},d.size=function(t){if(!arguments.length)return[r,i];var n=+t[0],e=+t[1];if(!(n>=0&&e>=0))throw new Error("invalid size");return r=n,i=e,_()},d.cellSize=function(t){if(!arguments.length)return 1<<a;if(!((t=+t)>=1))throw new Error("invalid cell size");return a=Math.floor(Math.log(t)/Math.LN2),_()},d.thresholds=function(t){return arguments.length?(s="function"==typeof t?t:Array.isArray(t)?Qa(Za.call(t)):Qa(t),d):s},d.bandwidth=function(t){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*t*t+1)-1)/2,_()},d},t.contours=iu,t.count=v,t.create=function(t){return Zn(Yt(t).call(document.documentElement))},t.creator=Yt,t.cross=function(...t){const n="function"==typeof t[t.length-1]&&function(t){return n=>t(...n)}(t.pop()),e=(t=t.map(m)).map(_),r=t.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||e.some(b))return o;for(;;){o.push(i.map(((n,e)=>t[e][n])));let a=r;for(;++i[a]===e[a];){if(0===a)return n?o.map(n):o;i[a--]=0}}},t.csv=wc,t.csvFormat=rc,t.csvFormatBody=ic,t.csvFormatRow=ac,t.csvFormatRows=oc,t.csvFormatValue=uc,t.csvParse=nc,t.csvParseRows=ec,t.cubehelix=Tr,t.cumsum=function(t,n){var e=0,r=0;return Float64Array.from(t,void 0===n?t=>e+=+t||0:i=>e+=+n(i,r++,t)||0)},t.curveBasis=function(t){return new Rx(t)},t.curveBasisClosed=function(t){return new Fx(t)},t.curveBasisOpen=function(t){return new qx(t)},t.curveBumpX=tx,t.curveBumpY=nx,t.curveBundle=Ix,t.curveCardinal=Yx,t.curveCardinalClosed=jx,t.curveCardinalOpen=Xx,t.curveCatmullRom=Wx,t.curveCatmullRomClosed=Kx,t.curveCatmullRomOpen=Jx,t.curveLinear=Um,t.curveLinearClosed=function(t){return new tw(t)},t.curveMonotoneX=function(t){return new ow(t)},t.curveMonotoneY=function(t){return new aw(t)},t.curveNatural=function(t){return new cw(t)},t.curveStep=function(t){return new sw(t,.5)},t.curveStepAfter=function(t){return new sw(t,1)},t.curveStepBefore=function(t){return new sw(t,0)},t.descending=e,t.deviation=w,t.difference=function(t,...n){t=new InternSet(t);for(const e of n)for(const n of e)t.delete(n);return t},t.disjoint=function(t,n){const e=n[Symbol.iterator](),r=new InternSet;for(const n of t){if(r.has(n))return!1;let t,i;for(;({value:t,done:i}=e.next())&&!i;){if(Object.is(n,t))return!1;r.add(t)}}return!0},t.dispatch=$t,t.drag=function(){var t,n,e,r,i=se,o=le,a=he,u=de,c={},f=$t("start","drag","end"),s=0,l=0;function h(t){t.on("mousedown.drag",d).filter(u).on("touchstart.drag",y).on("touchmove.drag",v,ee).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(a,u){if(!r&&i.call(this,a,u)){var c=b(this,o.call(this,a,u),a,u,"mouse");c&&(Zn(a.view).on("mousemove.drag",p,re).on("mouseup.drag",g,re),ae(a.view),ie(a),e=!1,t=a.clientX,n=a.clientY,c("start",a))}}function p(r){if(oe(r),!e){var i=r.clientX-t,o=r.clientY-n;e=i*i+o*o>l}c.mouse("drag",r)}function g(t){Zn(t.view).on("mousemove.drag mouseup.drag",null),ue(t.view,e),oe(t),c.mouse("end",t)}function y(t,n){if(i.call(this,t,n)){var e,r,a=t.changedTouches,u=o.call(this,t,n),c=a.length;for(e=0;e<c;++e)(r=b(this,u,t,n,a[e].identifier,a[e]))&&(ie(t),r("start",t,a[e]))}}function v(t){var n,e,r=t.changedTouches,i=r.length;for(n=0;n<i;++n)(e=c[r[n].identifier])&&(oe(t),e("drag",t,r[n]))}function _(t){var n,e,i=t.changedTouches,o=i.length;for(r&&clearTimeout(r),r=setTimeout((function(){r=null}),500),n=0;n<o;++n)(e=c[i[n].identifier])&&(ie(t),e("end",t,i[n]))}function b(t,n,e,r,i,o){var u,l,d,p=f.copy(),g=ne(o||e,n);if(null!=(d=a.call(t,new fe("beforestart",{sourceEvent:e,target:h,identifier:i,active:s,x:g[0],y:g[1],dx:0,dy:0,dispatch:p}),r)))return u=d.x-g[0]||0,l=d.y-g[1]||0,function e(o,a,f){var y,v=g;switch(o){case"start":c[i]=e,y=s++;break;case"end":delete c[i],--s;case"drag":g=ne(f||a,n),y=s}p.call(o,t,new fe(o,{sourceEvent:a,subject:d,target:h,identifier:i,active:y,x:g[0]+u,y:g[1]+l,dx:g[0]-v[0],dy:g[1]-v[1],dispatch:p}),r)}}return h.filter=function(t){return arguments.length?(i="function"==typeof t?t:ce(!!t),h):i},h.container=function(t){return arguments.length?(o="function"==typeof t?t:ce(t),h):o},h.subject=function(t){return arguments.length?(a="function"==typeof t?t:ce(t),h):a},h.touchable=function(t){return arguments.length?(u="function"==typeof t?t:ce(!!t),h):u},h.on=function(){var t=f.on.apply(f,arguments);return t===f?h:t},h.clickDistance=function(t){return arguments.length?(l=(t=+t)*t,h):Math.sqrt(l)},h},t.dragDisable=ae,t.dragEnable=ue,t.dsv=function(t,n,e,r){3===arguments.length&&"function"==typeof e&&(r=e,e=void 0);var i=Ju(t);return mc(n,e).then((function(t){return i.parse(t,r)}))},t.dsvFormat=Ju,t.easeBack=Lo,t.easeBackIn=Bo,t.easeBackInOut=Lo,t.easeBackOut=Yo,t.easeBounce=Io,t.easeBounceIn=function(t){return 1-Io(1-t)},t.easeBounceInOut=function(t){return((t*=2)<=1?1-Io(1-t):Io(t-1)+1)/2},t.easeBounceOut=Io,t.easeCircle=No,t.easeCircleIn=function(t){return 1-Math.sqrt(1-t*t)},t.easeCircleInOut=No,t.easeCircleOut=function(t){return Math.sqrt(1- --t*t)},t.easeCubic=bo,t.easeCubicIn=function(t){return t*t*t},t.easeCubicInOut=bo,t.easeCubicOut=function(t){return--t*t*t+1},t.easeElastic=Xo,t.easeElasticIn=Ho,t.easeElasticInOut=Go,t.easeElasticOut=Xo,t.easeExp=Eo,t.easeExpIn=function(t){return So(1-+t)},t.easeExpInOut=Eo,t.easeExpOut=function(t){return 1-So(t)},t.easeLinear=t=>+t,t.easePoly=wo,t.easePolyIn=mo,t.easePolyInOut=wo,t.easePolyOut=xo,t.easeQuad=_o,t.easeQuadIn=function(t){return t*t},t.easeQuadInOut=_o,t.easeQuadOut=function(t){return t*(2-t)},t.easeSin=Ao,t.easeSinIn=function(t){return 1==+t?1:1-Math.cos(t*To)},t.easeSinInOut=Ao,t.easeSinOut=function(t){return Math.sin(t*To)},t.every=function(t,n){if("function"!=typeof n)throw new TypeError("test is not a function");let e=-1;for(const r of t)if(!n(r,++e,t))return!1;return!0},t.extent=M,t.fcumsum=function(t,n){const e=new T;let r=-1;return Float64Array.from(t,void 0===n?t=>e.add(+t||0):i=>e.add(+n(i,++r,t)||0))},t.filter=function(t,n){if("function"!=typeof n)throw new TypeError("test is not a function");const e=[];let r=-1;for(const i of t)n(i,++r,t)&&e.push(i);return e},t.flatGroup=function(t,...n){return z(P(t,...n),n)},t.flatRollup=function(t,n,...e){return z(D(t,n,...e),e)},t.forceCenter=function(t,n){var e,r=1;function i(){var i,o,a=e.length,u=0,c=0;for(i=0;i<a;++i)u+=(o=e[i]).x,c+=o.y;for(u=(u/a-t)*r,c=(c/a-n)*r,i=0;i<a;++i)(o=e[i]).x-=u,o.y-=c}return null==t&&(t=0),null==n&&(n=0),i.initialize=function(t){e=t},i.x=function(n){return arguments.length?(t=+n,i):t},i.y=function(t){return arguments.length?(n=+t,i):n},i.strength=function(t){return arguments.length?(r=+t,i):r},i},t.forceCollide=function(t){var n,e,r,i=1,o=1;function a(){for(var t,a,c,f,s,l,h,d=n.length,p=0;p<o;++p)for(a=$c(n,Ic,Oc).visitAfter(u),t=0;t<d;++t)c=n[t],l=e[c.index],h=l*l,f=c.x+c.vx,s=c.y+c.vy,a.visit(g);function g(t,n,e,o,a){var u=t.data,d=t.r,p=l+d;if(!u)return n>f+p||o<f-p||e>s+p||a<s-p;if(u.index>c.index){var g=f-u.x-u.vx,y=s-u.y-u.vy,v=g*g+y*y;v<p*p&&(0===g&&(v+=(g=Uc(r))*g),0===y&&(v+=(y=Uc(r))*y),v=(p-(v=Math.sqrt(v)))/v*i,c.vx+=(g*=v)*(p=(d*=d)/(h+d)),c.vy+=(y*=v)*p,u.vx-=g*(p=1-p),u.vy-=y*p)}}}function u(t){if(t.data)return t.r=e[t.data.index];for(var n=t.r=0;n<4;++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function c(){if(n){var r,i,o=n.length;for(e=new Array(o),r=0;r<o;++r)i=n[r],e[i.index]=+t(i,r,n)}}return"function"!=typeof t&&(t=qc(null==t?1:+t)),a.initialize=function(t,e){n=t,r=e,c()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(n){return arguments.length?(t="function"==typeof n?n:qc(+n),c(),a):t},a},t.forceLink=function(t){var n,e,r,i,o,a,u=Bc,c=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},f=qc(30),s=1;function l(r){for(var i=0,u=t.length;i<s;++i)for(var c,f,l,h,d,p,g,y=0;y<u;++y)f=(c=t[y]).source,h=(l=c.target).x+l.vx-f.x-f.vx||Uc(a),d=l.y+l.vy-f.y-f.vy||Uc(a),h*=p=((p=Math.sqrt(h*h+d*d))-e[y])/p*r*n[y],d*=p,l.vx-=h*(g=o[y]),l.vy-=d*g,f.vx+=h*(g=1-g),f.vy+=d*g}function h(){if(r){var a,c,f=r.length,s=t.length,l=new Map(r.map(((t,n)=>[u(t,n,r),t])));for(a=0,i=new Array(f);a<s;++a)(c=t[a]).index=a,"object"!=typeof c.source&&(c.source=Yc(l,c.source)),"object"!=typeof c.target&&(c.target=Yc(l,c.target)),i[c.source.index]=(i[c.source.index]||0)+1,i[c.target.index]=(i[c.target.index]||0)+1;for(a=0,o=new Array(s);a<s;++a)c=t[a],o[a]=i[c.source.index]/(i[c.source.index]+i[c.target.index]);n=new Array(s),d(),e=new Array(s),p()}}function d(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+c(t[e],e,t)}function p(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+f(t[n],n,t)}return null==t&&(t=[]),l.initialize=function(t,n){r=t,a=n,h()},l.links=function(n){return arguments.length?(t=n,h(),l):t},l.id=function(t){return arguments.length?(u=t,l):u},l.iterations=function(t){return arguments.length?(s=+t,l):s},l.strength=function(t){return arguments.length?(c="function"==typeof t?t:qc(+t),d(),l):c},l.distance=function(t){return arguments.length?(f="function"==typeof t?t:qc(+t),p(),l):f},l},t.forceManyBody=function(){var t,n,e,r,i,o=qc(-30),a=1,u=1/0,c=.81;function f(e){var i,o=t.length,a=$c(t,Xc,Gc).visitAfter(l);for(r=e,i=0;i<o;++i)n=t[i],a.visit(h)}function s(){if(t){var n,e,r=t.length;for(i=new Array(r),n=0;n<r;++n)e=t[n],i[e.index]=+o(e,n,t)}}function l(t){var n,e,r,o,a,u=0,c=0;if(t.length){for(r=o=a=0;a<4;++a)(n=t[a])&&(e=Math.abs(n.value))&&(u+=n.value,c+=e,r+=e*n.x,o+=e*n.y);t.x=r/c,t.y=o/c}else{(n=t).x=n.data.x,n.y=n.data.y;do{u+=i[n.data.index]}while(n=n.next)}t.value=u}function h(t,o,f,s){if(!t.value)return!0;var l=t.x-n.x,h=t.y-n.y,d=s-o,p=l*l+h*h;if(d*d/c<p)return p<u&&(0===l&&(p+=(l=Uc(e))*l),0===h&&(p+=(h=Uc(e))*h),p<a&&(p=Math.sqrt(a*p)),n.vx+=l*t.value*r/p,n.vy+=h*t.value*r/p),!0;if(!(t.length||p>=u)){(t.data!==n||t.next)&&(0===l&&(p+=(l=Uc(e))*l),0===h&&(p+=(h=Uc(e))*h),p<a&&(p=Math.sqrt(a*p)));do{t.data!==n&&(d=i[t.data.index]*r/p,n.vx+=l*d,n.vy+=h*d)}while(t=t.next)}}return f.initialize=function(n,r){t=n,e=r,s()},f.strength=function(t){return arguments.length?(o="function"==typeof t?t:qc(+t),s(),f):o},f.distanceMin=function(t){return arguments.length?(a=t*t,f):Math.sqrt(a)},f.distanceMax=function(t){return arguments.length?(u=t*t,f):Math.sqrt(u)},f.theta=function(t){return arguments.length?(c=t*t,f):Math.sqrt(c)},f},t.forceRadial=function(t,n,e){var r,i,o,a=qc(.1);function u(t){for(var a=0,u=r.length;a<u;++a){var c=r[a],f=c.x-n||1e-6,s=c.y-e||1e-6,l=Math.sqrt(f*f+s*s),h=(o[a]-l)*i[a]*t/l;c.vx+=f*h,c.vy+=s*h}}function c(){if(r){var n,e=r.length;for(i=new Array(e),o=new Array(e),n=0;n<e;++n)o[n]=+t(r[n],n,r),i[n]=isNaN(o[n])?0:+a(r[n],n,r)}}return"function"!=typeof t&&(t=qc(+t)),null==n&&(n=0),null==e&&(e=0),u.initialize=function(t){r=t,c()},u.strength=function(t){return arguments.length?(a="function"==typeof t?t:qc(+t),c(),u):a},u.radius=function(n){return arguments.length?(t="function"==typeof n?n:qc(+n),c(),u):t},u.x=function(t){return arguments.length?(n=+t,u):n},u.y=function(t){return arguments.length?(e=+t,u):e},u},t.forceSimulation=function(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=new Map,c=Ni(l),f=$t("tick","end"),s=function(){let t=1;return()=>(t=(Lc*t+jc)%Hc)/Hc}();function l(){h(),f.call("tick",n),e<r&&(c.stop(),f.call("end",n))}function h(r){var c,f,s=t.length;void 0===r&&(r=1);for(var l=0;l<r;++l)for(e+=(o-e)*i,u.forEach((function(t){t(e)})),c=0;c<s;++c)null==(f=t[c]).fx?f.x+=f.vx*=a:(f.x=f.fx,f.vx=0),null==f.fy?f.y+=f.vy*=a:(f.y=f.fy,f.vy=0);return n}function d(){for(var n,e=0,r=t.length;e<r;++e){if((n=t[e]).index=e,null!=n.fx&&(n.x=n.fx),null!=n.fy&&(n.y=n.fy),isNaN(n.x)||isNaN(n.y)){var i=10*Math.sqrt(.5+e),o=e*Vc;n.x=i*Math.cos(o),n.y=i*Math.sin(o)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function p(n){return n.initialize&&n.initialize(t,s),n}return null==t&&(t=[]),d(),n={tick:h,restart:function(){return c.restart(l),n},stop:function(){return c.stop(),n},nodes:function(e){return arguments.length?(t=e,d(),u.forEach(p),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(o=+t,n):o},velocityDecay:function(t){return arguments.length?(a=1-t,n):1-a},randomSource:function(t){return arguments.length?(s=t,u.forEach(p),n):s},force:function(t,e){return arguments.length>1?(null==e?u.delete(t):u.set(t,p(e)),n):u.get(t)},find:function(n,e,r){var i,o,a,u,c,f=0,s=t.length;for(null==r?r=1/0:r*=r,f=0;f<s;++f)(a=(i=n-(u=t[f]).x)*i+(o=e-u.y)*o)<r&&(c=u,r=a);return c},on:function(t,e){return arguments.length>1?(f.on(t,e),n):f.on(t)}}},t.forceX=function(t){var n,e,r,i=qc(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vx+=(r[o]-i.x)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=qc(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:qc(+t),a(),o):i},o.x=function(n){return arguments.length?(t="function"==typeof n?n:qc(+n),a(),o):t},o},t.forceY=function(t){var n,e,r,i=qc(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vy+=(r[o]-i.y)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=qc(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:qc(+t),a(),o):i},o.y=function(n){return arguments.length?(t="function"==typeof n?n:qc(+n),a(),o):t},o},t.formatDefaultLocale=ff,t.formatLocale=cf,t.formatSpecifier=Jc,t.fsum=function(t,n){const e=new T;if(void 0===n)for(let n of t)(n=+n)&&e.add(n);else{let r=-1;for(let i of t)(i=+n(i,++r,t))&&e.add(i)}return+e},t.geoAlbers=xd,t.geoAlbersUsa=function(){var t,n,e,r,i,o,a=xd(),u=md().rotate([154,0]).center([-2,58.5]).parallels([55,65]),c=md().rotate([157,0]).center([-3,19.9]).parallels([8,18]),f={point:function(t,n){o=[t,n]}};function s(t){var n=t[0],a=t[1];return o=null,e.point(n,a),o||(r.point(n,a),o)||(i.point(n,a),o)}function l(){return t=n=null,s}return s.invert=function(t){var n=a.scale(),e=a.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?c:a).invert(t)},s.stream=function(e){return t&&n===e?t:(r=[a.stream(n=e),u.stream(e),c.stream(e)],i=r.length,t={point:function(t,n){for(var e=-1;++e<i;)r[e].point(t,n)},sphere:function(){for(var t=-1;++t<i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t<i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t<i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<i;)r[t].polygonEnd()}});var r,i},s.precision=function(t){return arguments.length?(a.precision(t),u.precision(t),c.precision(t),l()):a.precision()},s.scale=function(t){return arguments.length?(a.scale(t),u.scale(.35*t),c.scale(t),s.translate(a.translate())):a.scale()},s.translate=function(t){if(!arguments.length)return a.translate();var n=a.scale(),o=+t[0],s=+t[1];return e=a.translate(t).clipExtent([[o-.455*n,s-.238*n],[o+.455*n,s+.238*n]]).stream(f),r=u.translate([o-.307*n,s+.201*n]).clipExtent([[o-.425*n+df,s+.12*n+df],[o-.214*n-df,s+.234*n-df]]).stream(f),i=c.translate([o-.205*n,s+.212*n]).clipExtent([[o-.214*n+df,s+.166*n+df],[o-.115*n-df,s+.234*n-df]]).stream(f),l()},s.fitExtent=function(t,n){return ud(s,t,n)},s.fitSize=function(t,n){return cd(s,t,n)},s.fitWidth=function(t,n){return fd(s,t,n)},s.fitHeight=function(t,n){return sd(s,t,n)},s.scale(1070)},t.geoArea=function(t){return us=new T,Lf(t,cs),2*us},t.geoAzimuthalEqualArea=function(){return yd(Td).scale(124.75).clipAngle(179.999)},t.geoAzimuthalEqualAreaRaw=Td,t.geoAzimuthalEquidistant=function(){return yd(Ad).scale(79.4188).clipAngle(179.999)},t.geoAzimuthalEquidistantRaw=Ad,t.geoBounds=function(t){var n,e,r,i,o,a,u;if(Qf=Kf=-(Wf=Zf=1/0),is=[],Lf(t,Fs),e=is.length){for(is.sort(Hs),n=1,o=[r=is[0]];n<e;++n)Xs(r,(i=is[n])[0])||Xs(r,i[1])?(js(r[0],i[1])>js(r[0],r[1])&&(r[1]=i[1]),js(i[0],r[1])>js(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,n=0,r=o[e=o.length-1];n<=e;r=i,++n)i=o[n],(u=js(r[1],i[0]))>a&&(a=u,Wf=i[0],Kf=r[1])}return is=os=null,Wf===1/0||Zf===1/0?[[NaN,NaN],[NaN,NaN]]:[[Wf,Zf],[Kf,Qf]]},t.geoCentroid=function(t){ms=xs=ws=Ms=Ts=As=Ss=Es=0,Ns=new T,ks=new T,Cs=new T,Lf(t,Gs);var n=+Ns,e=+ks,r=+Cs,i=Ef(n,e,r);return i<pf&&(n=As,e=Ss,r=Es,xs<df&&(n=ws,e=Ms,r=Ts),(i=Ef(n,e,r))<pf)?[NaN,NaN]:[Mf(e,n)*bf,Rf(r/i)*bf]},t.geoCircle=function(){var t,n,e=il([0,0]),r=il(90),i=il(6),o={point:function(e,r){t.push(e=n(e,r)),e[0]*=bf,e[1]*=bf}};function a(){var a=e.apply(this,arguments),u=r.apply(this,arguments)*mf,c=i.apply(this,arguments)*mf;return t=[],n=ul(-a[0]*mf,-a[1]*mf,0).invert,hl(o,u,c,1),a={type:"Polygon",coordinates:[t]},t=n=null,a}return a.center=function(t){return arguments.length?(e="function"==typeof t?t:il([+t[0],+t[1]]),a):e},a.radius=function(t){return arguments.length?(r="function"==typeof t?t:il(+t),a):r},a.precision=function(t){return arguments.length?(i="function"==typeof t?t:il(+t),a):i},a},t.geoClipAntimeridian=Tl,t.geoClipCircle=Al,t.geoClipExtent=function(){var t,n,e,r=0,i=0,o=960,a=500;return e={stream:function(e){return t&&n===e?t:t=zl(r,i,o,a)(n=e)},extent:function(u){return arguments.length?(r=+u[0][0],i=+u[0][1],o=+u[1][0],a=+u[1][1],t=n=null,e):[[r,i],[o,a]]}}},t.geoClipRectangle=zl,t.geoConicConformal=function(){return _d(kd).scale(109.5).parallels([30,30])},t.geoConicConformalRaw=kd,t.geoConicEqualArea=md,t.geoConicEqualAreaRaw=bd,t.geoConicEquidistant=function(){return _d(Pd).scale(131.154).center([0,13.9389])},t.geoConicEquidistantRaw=Pd,t.geoContains=function(t,n){return(t&&Bl.hasOwnProperty(t.type)?Bl[t.type]:Ll)(t,n)},t.geoDistance=Ol,t.geoEqualEarth=function(){return yd(qd).scale(177.158)},t.geoEqualEarthRaw=qd,t.geoEquirectangular=function(){return yd(Cd).scale(152.63)},t.geoEquirectangularRaw=Cd,t.geoGnomonic=function(){return yd(Ud).scale(144.049).clipAngle(60)},t.geoGnomonicRaw=Ud,t.geoGraticule=Kl,t.geoGraticule10=function(){return Kl()()},t.geoIdentity=function(){var t,n,e,r,i,o,a,u=1,c=0,f=0,s=1,l=1,h=0,d=null,p=1,g=1,y=id({point:function(t,n){var e=b([t,n]);this.stream.point(e[0],e[1])}}),v=eh;function _(){return p=u*s,g=u*l,o=a=null,b}function b(e){var r=e[0]*p,i=e[1]*g;if(h){var o=i*t-r*n;r=r*t+i*n,i=o}return[r+c,i+f]}return b.invert=function(e){var r=e[0]-c,i=e[1]-f;if(h){var o=i*t+r*n;r=r*t-i*n,i=o}return[r/p,i/g]},b.stream=function(t){return o&&a===t?o:o=y(v(a=t))},b.postclip=function(t){return arguments.length?(v=t,d=e=r=i=null,_()):v},b.clipExtent=function(t){return arguments.length?(v=null==t?(d=e=r=i=null,eh):zl(d=+t[0][0],e=+t[0][1],r=+t[1][0],i=+t[1][1]),_()):null==d?null:[[d,e],[r,i]]},b.scale=function(t){return arguments.length?(u=+t,_()):u},b.translate=function(t){return arguments.length?(c=+t[0],f=+t[1],_()):[c,f]},b.angle=function(e){return arguments.length?(n=Cf(h=e%360*mf),t=Tf(h),_()):h*bf},b.reflectX=function(t){return arguments.length?(s=t?-1:1,_()):s<0},b.reflectY=function(t){return arguments.length?(l=t?-1:1,_()):l<0},b.fitExtent=function(t,n){return ud(b,t,n)},b.fitSize=function(t,n){return cd(b,t,n)},b.fitWidth=function(t,n){return fd(b,t,n)},b.fitHeight=function(t,n){return sd(b,t,n)},b},t.geoInterpolate=function(t,n){var e=t[0]*mf,r=t[1]*mf,i=n[0]*mf,o=n[1]*mf,a=Tf(r),u=Cf(r),c=Tf(o),f=Cf(o),s=a*Tf(e),l=a*Cf(e),h=c*Tf(i),d=c*Cf(i),p=2*Rf(zf(Ff(o-r)+a*c*Ff(i-e))),g=Cf(p),y=p?function(t){var n=Cf(t*=p)/g,e=Cf(p-t)/g,r=e*s+n*h,i=e*l+n*d,o=e*u+n*f;return[Mf(i,r)*bf,Mf(o,zf(r*r+i*i))*bf]}:function(){return[e*bf,r*bf]};return y.distance=p,y},t.geoLength=ql,t.geoMercator=function(){return Ed(Sd).scale(961/_f)},t.geoMercatorRaw=Sd,t.geoNaturalEarth1=function(){return yd(Id).scale(175.295)},t.geoNaturalEarth1Raw=Id,t.geoOrthographic=function(){return yd(Od).scale(249.5).clipAngle(90+df)},t.geoOrthographicRaw=Od,t.geoPath=function(t,n){let e,r,i=3,o=4.5;function a(t){return t&&("function"==typeof o&&r.pointRadius(+o.apply(this,arguments)),Lf(t,e(r))),r.result()}return a.area=function(t){return Lf(t,e(sh)),sh.result()},a.measure=function(t){return Lf(t,e(Kh)),Kh.result()},a.bounds=function(t){return Lf(t,e(mh)),mh.result()},a.centroid=function(t){return Lf(t,e(Oh)),Oh.result()},a.projection=function(n){return arguments.length?(e=null==n?(t=null,eh):(t=n).stream,a):t},a.context=function(t){return arguments.length?(r=null==t?(n=null,new ed(i)):new Bh(n=t),"function"!=typeof o&&r.pointRadius(o),a):n},a.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(r.pointRadius(+t),+t),a):o},a.digits=function(t){if(!arguments.length)return i;if(null==t)i=null;else{const n=Math.floor(t);if(!(n>=0))throw new RangeError(`invalid digits: ${t}`);i=n}return null===n&&(r=new ed(i)),a},a.projection(t).digits(i).context(n)},t.geoProjection=yd,t.geoProjectionMutator=vd,t.geoRotation=ll,t.geoStereographic=function(){return yd(Bd).scale(250).clipAngle(142)},t.geoStereographicRaw=Bd,t.geoStream=Lf,t.geoTransform=function(t){return{stream:id(t)}},t.geoTransverseMercator=function(){var t=Ed(Yd),n=t.center,e=t.rotate;return t.center=function(t){return arguments.length?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return arguments.length?e([t[0],t[1],t.length>2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90]).scale(159.155)},t.geoTransverseMercatorRaw=Yd,t.gray=function(t,n){return new ur(t,0,0,null==n?1:n)},t.greatest=ot,t.greatestIndex=function(t,e=n){if(1===e.length)return tt(t,e);let r,i=-1,o=-1;for(const n of t)++o,(i<0?0===e(n,n):e(n,r)>0)&&(r=n,i=o);return i},t.group=C,t.groupSort=function(t,e,r){return(2!==e.length?U($(t,e,r),(([t,e],[r,i])=>n(e,i)||n(t,r))):U(C(t,r),(([t,r],[i,o])=>e(r,o)||n(t,i)))).map((([t])=>t))},t.groups=P,t.hcl=dr,t.hierarchy=Gd,t.histogram=Q,t.hsl=He,t.html=Ec,t.image=function(t,n){return new Promise((function(e,r){var i=new Image;for(var o in n)i[o]=n[o];i.onerror=r,i.onload=function(){e(i)},i.src=t}))},t.index=function(t,...n){return F(t,k,R,n)},t.indexes=function(t,...n){return F(t,Array.from,R,n)},t.interpolate=Gr,t.interpolateArray=function(t,n){return(Ir(n)?Ur:Or)(t,n)},t.interpolateBasis=Er,t.interpolateBasisClosed=Nr,t.interpolateBlues=Xb,t.interpolateBrBG=ib,t.interpolateBuGn=wb,t.interpolateBuPu=Tb,t.interpolateCividis=function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-t*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-2710.57*t)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-67.37*t)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-2475.67*t)))))))+")"},t.interpolateCool=om,t.interpolateCubehelix=li,t.interpolateCubehelixDefault=rm,t.interpolateCubehelixLong=hi,t.interpolateDate=Br,t.interpolateDiscrete=function(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}},t.interpolateGnBu=Sb,t.interpolateGreens=Vb,t.interpolateGreys=Zb,t.interpolateHcl=ci,t.interpolateHclLong=fi,t.interpolateHsl=oi,t.interpolateHslLong=ai,t.interpolateHue=function(t,n){var e=Pr(+t,+n);return function(t){var n=e(t);return n-360*Math.floor(n/360)}},t.interpolateInferno=dm,t.interpolateLab=function(t,n){var e=$r((t=ar(t)).l,(n=ar(n)).l),r=$r(t.a,n.a),i=$r(t.b,n.b),o=$r(t.opacity,n.opacity);return function(n){return t.l=e(n),t.a=r(n),t.b=i(n),t.opacity=o(n),t+""}},t.interpolateMagma=hm,t.interpolateNumber=Yr,t.interpolateNumberArray=Ur,t.interpolateObject=Lr,t.interpolateOrRd=Nb,t.interpolateOranges=em,t.interpolatePRGn=ab,t.interpolatePiYG=cb,t.interpolatePlasma=pm,t.interpolatePuBu=zb,t.interpolatePuBuGn=Cb,t.interpolatePuOr=sb,t.interpolatePuRd=Db,t.interpolatePurples=Qb,t.interpolateRainbow=function(t){(t<0||t>1)&&(t-=Math.floor(t));var n=Math.abs(t-.5);return am.h=360*t-100,am.s=1.5-1.5*n,am.l=.8-.9*n,am+""},t.interpolateRdBu=hb,t.interpolateRdGy=pb,t.interpolateRdPu=Fb,t.interpolateRdYlBu=yb,t.interpolateRdYlGn=_b,t.interpolateReds=tm,t.interpolateRgb=Dr,t.interpolateRgbBasis=Fr,t.interpolateRgbBasisClosed=qr,t.interpolateRound=Vr,t.interpolateSinebow=function(t){var n;return t=(.5-t)*Math.PI,um.r=255*(n=Math.sin(t))*n,um.g=255*(n=Math.sin(t+cm))*n,um.b=255*(n=Math.sin(t+fm))*n,um+""},t.interpolateSpectral=mb,t.interpolateString=Xr,t.interpolateTransformCss=ti,t.interpolateTransformSvg=ni,t.interpolateTurbo=function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-14825.05*t)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+707.56*t)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-6838.66*t)))))))+")"},t.interpolateViridis=lm,t.interpolateWarm=im,t.interpolateYlGn=Ob,t.interpolateYlGnBu=Ub,t.interpolateYlOrBr=Yb,t.interpolateYlOrRd=jb,t.interpolateZoom=ri,t.interrupt=Gi,t.intersection=function(t,...n){t=new InternSet(t),n=n.map(vt);t:for(const e of t)for(const r of n)if(!r.has(e)){t.delete(e);continue t}return t},t.interval=function(t,n,e){var r=new Ei,i=n;return null==n?(r.restart(t,n,e),r):(r._restart=r.restart,r.restart=function(t,n,e){n=+n,e=null==e?Ai():+e,r._restart((function o(a){a+=i,r._restart(o,i+=n,e),t(a)}),n,e)},r.restart(t,n,e),r)},t.isoFormat=D_,t.isoParse=F_,t.json=function(t,n){return fetch(t,n).then(Tc)},t.lab=ar,t.lch=function(t,n,e,r){return 1===arguments.length?hr(t):new pr(e,n,t,null==r?1:r)},t.least=function(t,e=n){let r,i=!1;if(1===e.length){let o;for(const a of t){const t=e(a);(i?n(t,o)<0:0===n(t,t))&&(r=a,o=t,i=!0)}}else for(const n of t)(i?e(n,r)<0:0===e(n,n))&&(r=n,i=!0);return r},t.leastIndex=ht,t.line=Bm,t.lineRadial=Wm,t.link=ox,t.linkHorizontal=function(){return ox(tx)},t.linkRadial=function(){const t=ox(ex);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t},t.linkVertical=function(){return ox(nx)},t.local=Qn,t.map=function(t,n){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");if("function"!=typeof n)throw new TypeError("mapper is not a function");return Array.from(t,((e,r)=>n(e,r,t)))},t.matcher=Vt,t.max=J,t.maxIndex=tt,t.mean=function(t,n){let e=0,r=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(++e,r+=n);else{let i=-1;for(let o of t)null!=(o=n(o,++i,t))&&(o=+o)>=o&&(++e,r+=o)}if(e)return r/e},t.median=function(t,n){return at(t,.5,n)},t.medianIndex=function(t,n){return ct(t,.5,n)},t.merge=ft,t.min=nt,t.minIndex=et,t.mode=function(t,n){const e=new InternMap;if(void 0===n)for(let n of t)null!=n&&n>=n&&e.set(n,(e.get(n)||0)+1);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&i>=i&&e.set(i,(e.get(i)||0)+1)}let r,i=0;for(const[t,n]of e)n>i&&(i=n,r=t);return r},t.namespace=It,t.namespaces=Ut,t.nice=Z,t.now=Ai,t.pack=function(){var t=null,n=1,e=1,r=np;function i(i){const o=ap();return i.x=n/2,i.y=e/2,t?i.eachBefore(xp(t)).eachAfter(wp(r,.5,o)).eachBefore(Mp(1)):i.eachBefore(xp(mp)).eachAfter(wp(np,1,o)).eachAfter(wp(r,i.r/Math.min(n,e),o)).eachBefore(Mp(Math.min(n,e)/(2*i.r))),i}return i.radius=function(n){return arguments.length?(t=Jd(n),i):t},i.size=function(t){return arguments.length?(n=+t[0],e=+t[1],i):[n,e]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:ep(+t),i):r},i},t.packEnclose=function(t){return up(t,ap())},t.packSiblings=function(t){return bp(t,ap()),t},t.pairs=function(t,n=st){const e=[];let r,i=!1;for(const o of t)i&&e.push(n(r,o)),r=o,i=!0;return e},t.partition=function(){var t=1,n=1,e=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=e,i.x1=t,i.y1=n/o,i.eachBefore(function(t,n){return function(r){r.children&&Ap(r,r.x0,t*(r.depth+1)/n,r.x1,t*(r.depth+2)/n);var i=r.x0,o=r.y0,a=r.x1-e,u=r.y1-e;a<i&&(i=a=(i+a)/2),u<o&&(o=u=(o+u)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=u}}(n,o)),r&&i.eachBefore(Tp),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.padding=function(t){return arguments.length?(e=+t,i):e},i},t.path=Ia,t.pathRound=function(t=3){return new Ua(+t)},t.permute=q,t.pie=function(){var t=jm,n=Lm,e=null,r=gm(0),i=gm(Sm),o=gm(0);function a(a){var u,c,f,s,l,h=(a=Fm(a)).length,d=0,p=new Array(h),g=new Array(h),y=+r.apply(this,arguments),v=Math.min(Sm,Math.max(-Sm,i.apply(this,arguments)-y)),_=Math.min(Math.abs(v)/h,o.apply(this,arguments)),b=_*(v<0?-1:1);for(u=0;u<h;++u)(l=g[p[u]=u]=+t(a[u],u,a))>0&&(d+=l);for(null!=n?p.sort((function(t,e){return n(g[t],g[e])})):null!=e&&p.sort((function(t,n){return e(a[t],a[n])})),u=0,f=d?(v-h*b)/d:0;u<h;++u,y=s)c=p[u],s=y+((l=g[c])>0?l*f:0)+b,g[c]={data:a[c],index:u,value:l,startAngle:y,endAngle:s,padAngle:_};return g}return a.value=function(n){return arguments.length?(t="function"==typeof n?n:gm(+n),a):t},a.sortValues=function(t){return arguments.length?(n=t,e=null,a):n},a.sort=function(t){return arguments.length?(e=t,n=null,a):e},a.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:gm(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:gm(+t),a):i},a.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:gm(+t),a):o},a},t.piecewise=di,t.pointRadial=Km,t.pointer=ne,t.pointers=function(t,n){return t.target&&(t=te(t),void 0===n&&(n=t.currentTarget),t=t.touches||[t]),Array.from(t,(t=>ne(t,n)))},t.polygonArea=function(t){for(var n,e=-1,r=t.length,i=t[r-1],o=0;++e<r;)n=i,i=t[e],o+=n[1]*i[0]-n[0]*i[1];return o/2},t.polygonCentroid=function(t){for(var n,e,r=-1,i=t.length,o=0,a=0,u=t[i-1],c=0;++r<i;)n=u,u=t[r],c+=e=n[0]*u[1]-u[0]*n[1],o+=(n[0]+u[0])*e,a+=(n[1]+u[1])*e;return[o/(c*=3),a/c]},t.polygonContains=function(t,n){for(var e,r,i=t.length,o=t[i-1],a=n[0],u=n[1],c=o[0],f=o[1],s=!1,l=0;l<i;++l)e=(o=t[l])[0],(r=o[1])>u!=f>u&&a<(c-e)*(u-r)/(f-r)+e&&(s=!s),c=e,f=r;return s},t.polygonHull=function(t){if((e=t.length)<3)return null;var n,e,r=new Array(e),i=new Array(e);for(n=0;n<e;++n)r[n]=[+t[n][0],+t[n][1],n];for(r.sort(Hp),n=0;n<e;++n)i[n]=[r[n][0],-r[n][1]];var o=Xp(r),a=Xp(i),u=a[0]===o[0],c=a[a.length-1]===o[o.length-1],f=[];for(n=o.length-1;n>=0;--n)f.push(t[r[o[n]][2]]);for(n=+u;n<a.length-c;++n)f.push(t[r[a[n]][2]]);return f},t.polygonLength=function(t){for(var n,e,r=-1,i=t.length,o=t[i-1],a=o[0],u=o[1],c=0;++r<i;)n=a,e=u,n-=a=(o=t[r])[0],e-=u=o[1],c+=Math.hypot(n,e);return c},t.precisionFixed=sf,t.precisionPrefix=lf,t.precisionRound=hf,t.quadtree=$c,t.quantile=at,t.quantileIndex=ct,t.quantileSorted=ut,t.quantize=function(t,n){for(var e=new Array(n),r=0;r<n;++r)e[r]=t(r/(n-1));return e},t.quickselect=rt,t.radialArea=Zm,t.radialLine=Wm,t.randomBates=Jp,t.randomBernoulli=eg,t.randomBeta=og,t.randomBinomial=ag,t.randomCauchy=cg,t.randomExponential=tg,t.randomGamma=ig,t.randomGeometric=rg,t.randomInt=Wp,t.randomIrwinHall=Qp,t.randomLcg=function(t=Math.random()){let n=0|(0<=t&&t<1?t/lg:Math.abs(t));return()=>(n=1664525*n+1013904223|0,lg*(n>>>0))},t.randomLogNormal=Kp,t.randomLogistic=fg,t.randomNormal=Zp,t.randomPareto=ng,t.randomPoisson=sg,t.randomUniform=Vp,t.randomWeibull=ug,t.range=lt,t.rank=function(t,e=n){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");let r=Array.from(t);const i=new Float64Array(r.length);2!==e.length&&(r=r.map(e),e=n);const o=(t,n)=>e(r[t],r[n]);let a,u;return(t=Uint32Array.from(r,((t,n)=>n))).sort(e===n?(t,n)=>O(r[t],r[n]):I(o)),t.forEach(((t,n)=>{const e=o(t,void 0===a?t:a);e>=0?((void 0===a||e>0)&&(a=t,u=n),i[t]=u):i[t]=NaN})),i},t.reduce=function(t,n,e){if("function"!=typeof n)throw new TypeError("reducer is not a function");const r=t[Symbol.iterator]();let i,o,a=-1;if(arguments.length<3){if(({done:i,value:e}=r.next()),i)return;++a}for(;({done:i,value:o}=r.next()),!i;)e=n(e,o,++a,t);return e},t.reverse=function(t){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");return Array.from(t).reverse()},t.rgb=Fe,t.ribbon=function(){return Wa()},t.ribbonArrow=function(){return Wa(Va)},t.rollup=$,t.rollups=D,t.scaleBand=yg,t.scaleDiverging=function t(){var n=Ng(L_()(mg));return n.copy=function(){return B_(n,t())},dg.apply(n,arguments)},t.scaleDivergingLog=function t(){var n=Fg(L_()).domain([.1,1,10]);return n.copy=function(){return B_(n,t()).base(n.base())},dg.apply(n,arguments)},t.scaleDivergingPow=j_,t.scaleDivergingSqrt=function(){return j_.apply(null,arguments).exponent(.5)},t.scaleDivergingSymlog=function t(){var n=Ig(L_());return n.copy=function(){return B_(n,t()).constant(n.constant())},dg.apply(n,arguments)},t.scaleIdentity=function t(n){var e;function r(t){return null==t||isNaN(t=+t)?e:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(n=Array.from(t,_g),r):n.slice()},r.unknown=function(t){return arguments.length?(e=t,r):e},r.copy=function(){return t(n).unknown(e)},n=arguments.length?Array.from(n,_g):[0,1],Ng(r)},t.scaleImplicit=pg,t.scaleLinear=function t(){var n=Sg();return n.copy=function(){return Tg(n,t())},hg.apply(n,arguments),Ng(n)},t.scaleLog=function t(){const n=Fg(Ag()).domain([1,10]);return n.copy=()=>Tg(n,t()).base(n.base()),hg.apply(n,arguments),n},t.scaleOrdinal=gg,t.scalePoint=function(){return vg(yg.apply(null,arguments).paddingInner(1))},t.scalePow=jg,t.scaleQuantile=function t(){var e,r=[],i=[],o=[];function a(){var t=0,n=Math.max(1,i.length);for(o=new Array(n-1);++t<n;)o[t-1]=ut(r,t/n);return u}function u(t){return null==t||isNaN(t=+t)?e:i[s(o,t)]}return u.invertExtent=function(t){var n=i.indexOf(t);return n<0?[NaN,NaN]:[n>0?o[n-1]:r[0],n<o.length?o[n]:r[r.length-1]]},u.domain=function(t){if(!arguments.length)return r.slice();r=[];for(let n of t)null==n||isNaN(n=+n)||r.push(n);return r.sort(n),a()},u.range=function(t){return arguments.length?(i=Array.from(t),a()):i.slice()},u.unknown=function(t){return arguments.length?(e=t,u):e},u.quantiles=function(){return o.slice()},u.copy=function(){return t().domain(r).range(i).unknown(e)},hg.apply(u,arguments)},t.scaleQuantize=function t(){var n,e=0,r=1,i=1,o=[.5],a=[0,1];function u(t){return null!=t&&t<=t?a[s(o,t,0,i)]:n}function c(){var t=-1;for(o=new Array(i);++t<i;)o[t]=((t+1)*r-(t-i)*e)/(i+1);return u}return u.domain=function(t){return arguments.length?([e,r]=t,e=+e,r=+r,c()):[e,r]},u.range=function(t){return arguments.length?(i=(a=Array.from(t)).length-1,c()):a.slice()},u.invertExtent=function(t){var n=a.indexOf(t);return n<0?[NaN,NaN]:n<1?[e,o[0]]:n>=i?[o[i-1],r]:[o[n-1],o[n]]},u.unknown=function(t){return arguments.length?(n=t,u):u},u.thresholds=function(){return o.slice()},u.copy=function(){return t().domain([e,r]).range(a).unknown(n)},hg.apply(Ng(u),arguments)},t.scaleRadial=function t(){var n,e=Sg(),r=[0,1],i=!1;function o(t){var r=function(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}(e(t));return isNaN(r)?n:i?Math.round(r):r}return o.invert=function(t){return e.invert(Hg(t))},o.domain=function(t){return arguments.length?(e.domain(t),o):e.domain()},o.range=function(t){return arguments.length?(e.range((r=Array.from(t,_g)).map(Hg)),o):r.slice()},o.rangeRound=function(t){return o.range(t).round(!0)},o.round=function(t){return arguments.length?(i=!!t,o):i},o.clamp=function(t){return arguments.length?(e.clamp(t),o):e.clamp()},o.unknown=function(t){return arguments.length?(n=t,o):n},o.copy=function(){return t(e.domain(),r).round(i).clamp(e.clamp()).unknown(n)},hg.apply(o,arguments),Ng(o)},t.scaleSequential=function t(){var n=Ng(O_()(mg));return n.copy=function(){return B_(n,t())},dg.apply(n,arguments)},t.scaleSequentialLog=function t(){var n=Fg(O_()).domain([1,10]);return n.copy=function(){return B_(n,t()).base(n.base())},dg.apply(n,arguments)},t.scaleSequentialPow=Y_,t.scaleSequentialQuantile=function t(){var e=[],r=mg;function i(t){if(null!=t&&!isNaN(t=+t))return r((s(e,t,1)-1)/(e.length-1))}return i.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)null==n||isNaN(n=+n)||e.push(n);return e.sort(n),i},i.interpolator=function(t){return arguments.length?(r=t,i):r},i.range=function(){return e.map(((t,n)=>r(n/(e.length-1))))},i.quantiles=function(t){return Array.from({length:t+1},((n,r)=>at(e,r/t)))},i.copy=function(){return t(r).domain(e)},dg.apply(i,arguments)},t.scaleSequentialSqrt=function(){return Y_.apply(null,arguments).exponent(.5)},t.scaleSequentialSymlog=function t(){var n=Ig(O_());return n.copy=function(){return B_(n,t()).constant(n.constant())},dg.apply(n,arguments)},t.scaleSqrt=function(){return jg.apply(null,arguments).exponent(.5)},t.scaleSymlog=function t(){var n=Ig(Ag());return n.copy=function(){return Tg(n,t()).constant(n.constant())},hg.apply(n,arguments)},t.scaleThreshold=function t(){var n,e=[.5],r=[0,1],i=1;function o(t){return null!=t&&t<=t?r[s(e,t,0,i)]:n}return o.domain=function(t){return arguments.length?(e=Array.from(t),i=Math.min(e.length,r.length-1),o):e.slice()},o.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(e.length,r.length-1),o):r.slice()},o.invertExtent=function(t){var n=r.indexOf(t);return[e[n-1],e[n]]},o.unknown=function(t){return arguments.length?(n=t,o):n},o.copy=function(){return t().domain(e).range(r).unknown(n)},hg.apply(o,arguments)},t.scaleTime=function(){return hg.apply(I_(uv,cv,tv,Zy,xy,py,sy,ay,iy,t.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},t.scaleUtc=function(){return hg.apply(I_(ov,av,ev,Qy,Fy,yy,hy,cy,iy,t.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},t.scan=function(t,n){const e=ht(t,n);return e<0?void 0:e},t.schemeAccent=G_,t.schemeBlues=Hb,t.schemeBrBG=rb,t.schemeBuGn=xb,t.schemeBuPu=Mb,t.schemeCategory10=X_,t.schemeDark2=V_,t.schemeGnBu=Ab,t.schemeGreens=Gb,t.schemeGreys=Wb,t.schemeOrRd=Eb,t.schemeOranges=nm,t.schemePRGn=ob,t.schemePaired=W_,t.schemePastel1=Z_,t.schemePastel2=K_,t.schemePiYG=ub,t.schemePuBu=Pb,t.schemePuBuGn=kb,t.schemePuOr=fb,t.schemePuRd=$b,t.schemePurples=Kb,t.schemeRdBu=lb,t.schemeRdGy=db,t.schemeRdPu=Rb,t.schemeRdYlBu=gb,t.schemeRdYlGn=vb,t.schemeReds=Jb,t.schemeSet1=Q_,t.schemeSet2=J_,t.schemeSet3=tb,t.schemeSpectral=bb,t.schemeTableau10=nb,t.schemeYlGn=Ib,t.schemeYlGnBu=qb,t.schemeYlOrBr=Bb,t.schemeYlOrRd=Lb,t.select=Zn,t.selectAll=function(t){return"string"==typeof t?new Vn([document.querySelectorAll(t)],[document.documentElement]):new Vn([Ht(t)],Gn)},t.selection=Wn,t.selector=jt,t.selectorAll=Gt,t.shuffle=dt,t.shuffler=pt,t.some=function(t,n){if("function"!=typeof n)throw new TypeError("test is not a function");let e=-1;for(const r of t)if(n(r,++e,t))return!0;return!1},t.sort=U,t.stack=function(){var t=gm([]),n=hw,e=lw,r=dw;function i(i){var o,a,u=Array.from(t.apply(this,arguments),pw),c=u.length,f=-1;for(const t of i)for(o=0,++f;o<c;++o)(u[o][f]=[0,+r(t,u[o].key,f,i)]).data=t;for(o=0,a=Fm(n(u));o<c;++o)u[a[o]].index=o;return e(u,a),u}return i.keys=function(n){return arguments.length?(t="function"==typeof n?n:gm(Array.from(n)),i):t},i.value=function(t){return arguments.length?(r="function"==typeof t?t:gm(+t),i):r},i.order=function(t){return arguments.length?(n=null==t?hw:"function"==typeof t?t:gm(Array.from(t)),i):n},i.offset=function(t){return arguments.length?(e=null==t?lw:t,i):e},i},t.stackOffsetDiverging=function(t,n){if((u=t.length)>0)for(var e,r,i,o,a,u,c=0,f=t[n[0]].length;c<f;++c)for(o=a=0,e=0;e<u;++e)(i=(r=t[n[e]][c])[1]-r[0])>0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=a,r[0]=a+=i):(r[0]=0,r[1]=i)},t.stackOffsetExpand=function(t,n){if((r=t.length)>0){for(var e,r,i,o=0,a=t[0].length;o<a;++o){for(i=e=0;e<r;++e)i+=t[e][o][1]||0;if(i)for(e=0;e<r;++e)t[e][o][1]/=i}lw(t,n)}},t.stackOffsetNone=lw,t.stackOffsetSilhouette=function(t,n){if((e=t.length)>0){for(var e,r=0,i=t[n[0]],o=i.length;r<o;++r){for(var a=0,u=0;a<e;++a)u+=t[a][r][1]||0;i[r][1]+=i[r][0]=-u/2}lw(t,n)}},t.stackOffsetWiggle=function(t,n){if((i=t.length)>0&&(r=(e=t[n[0]]).length)>0){for(var e,r,i,o=0,a=1;a<r;++a){for(var u=0,c=0,f=0;u<i;++u){for(var s=t[n[u]],l=s[a][1]||0,h=(l-(s[a-1][1]||0))/2,d=0;d<u;++d){var p=t[n[d]];h+=(p[a][1]||0)-(p[a-1][1]||0)}c+=l,f+=h*l}e[a-1][1]+=e[a-1][0]=o,c&&(o-=f/c)}e[a-1][1]+=e[a-1][0]=o,lw(t,n)}},t.stackOrderAppearance=gw,t.stackOrderAscending=vw,t.stackOrderDescending=function(t){return vw(t).reverse()},t.stackOrderInsideOut=function(t){var n,e,r=t.length,i=t.map(_w),o=gw(t),a=0,u=0,c=[],f=[];for(n=0;n<r;++n)e=o[n],a<u?(a+=i[e],c.push(e)):(u+=i[e],f.push(e));return f.reverse().concat(c)},t.stackOrderNone=hw,t.stackOrderReverse=function(t){return hw(t).reverse()},t.stratify=function(){var t,n=kp,e=Cp;function r(r){var i,o,a,u,c,f,s,l,h=Array.from(r),d=n,p=e,g=new Map;if(null!=t){const n=h.map(((n,e)=>function(t){t=`${t}`;let n=t.length;zp(t,n-1)&&!zp(t,n-2)&&(t=t.slice(0,-1));return"/"===t[0]?t:`/${t}`}(t(n,e,r)))),e=n.map(Pp),i=new Set(n).add("");for(const t of e)i.has(t)||(i.add(t),n.push(t),e.push(Pp(t)),h.push(Np));d=(t,e)=>n[e],p=(t,n)=>e[n]}for(a=0,i=h.length;a<i;++a)o=h[a],f=h[a]=new Qd(o),null!=(s=d(o,a,r))&&(s+="")&&(l=f.id=s,g.set(l,g.has(l)?Ep:f)),null!=(s=p(o,a,r))&&(s+="")&&(f.parent=s);for(a=0;a<i;++a)if(s=(f=h[a]).parent){if(!(c=g.get(s)))throw new Error("missing: "+s);if(c===Ep)throw new Error("ambiguous: "+s);c.children?c.children.push(f):c.children=[f],f.parent=c}else{if(u)throw new Error("multiple roots");u=f}if(!u)throw new Error("no root");if(null!=t){for(;u.data===Np&&1===u.children.length;)u=u.children[0],--i;for(let t=h.length-1;t>=0&&(f=h[t]).data===Np;--t)f.data=null}if(u.parent=Sp,u.eachBefore((function(t){t.depth=t.parent.depth+1,--i})).eachBefore(Kd),u.parent=null,i>0)throw new Error("cycle");return u}return r.id=function(t){return arguments.length?(n=Jd(t),r):n},r.parentId=function(t){return arguments.length?(e=Jd(t),r):e},r.path=function(n){return arguments.length?(t=Jd(n),r):t},r},t.style=_n,t.subset=function(t,n){return _t(n,t)},t.sum=function(t,n){let e=0;if(void 0===n)for(let n of t)(n=+n)&&(e+=n);else{let r=-1;for(let i of t)(i=+n(i,++r,t))&&(e+=i)}return e},t.superset=_t,t.svg=Nc,t.symbol=function(t,n){let e=null,r=Nm(i);function i(){let i;if(e||(e=i=r()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),i)return e=null,i+""||null}return t="function"==typeof t?t:gm(t||cx),n="function"==typeof n?n:gm(void 0===n?64:+n),i.type=function(n){return arguments.length?(t="function"==typeof n?n:gm(n),i):t},i.size=function(t){return arguments.length?(n="function"==typeof t?t:gm(+t),i):n},i.context=function(t){return arguments.length?(e=null==t?null:t,i):e},i},t.symbolAsterisk=ux,t.symbolCircle=cx,t.symbolCross=fx,t.symbolDiamond=hx,t.symbolDiamond2=dx,t.symbolPlus=px,t.symbolSquare=gx,t.symbolSquare2=yx,t.symbolStar=mx,t.symbolTimes=Cx,t.symbolTriangle=wx,t.symbolTriangle2=Tx,t.symbolWye=kx,t.symbolX=Cx,t.symbols=Px,t.symbolsFill=Px,t.symbolsStroke=zx,t.text=mc,t.thresholdFreedmanDiaconis=function(t,n,e){const r=v(t),i=at(t,.75)-at(t,.25);return r&&i?Math.ceil((e-n)/(2*i*Math.pow(r,-1/3))):1},t.thresholdScott=function(t,n,e){const r=v(t),i=w(t);return r&&i?Math.ceil((e-n)*Math.cbrt(r)/(3.49*i)):1},t.thresholdSturges=K,t.tickFormat=Eg,t.tickIncrement=V,t.tickStep=W,t.ticks=G,t.timeDay=py,t.timeDays=gy,t.timeFormatDefaultLocale=P_,t.timeFormatLocale=hv,t.timeFriday=Sy,t.timeFridays=$y,t.timeHour=sy,t.timeHours=ly,t.timeInterval=Vg,t.timeMillisecond=Wg,t.timeMilliseconds=Zg,t.timeMinute=ay,t.timeMinutes=uy,t.timeMonday=wy,t.timeMondays=ky,t.timeMonth=Zy,t.timeMonths=Ky,t.timeSaturday=Ey,t.timeSaturdays=Dy,t.timeSecond=iy,t.timeSeconds=oy,t.timeSunday=xy,t.timeSundays=Ny,t.timeThursday=Ay,t.timeThursdays=zy,t.timeTickInterval=cv,t.timeTicks=uv,t.timeTuesday=My,t.timeTuesdays=Cy,t.timeWednesday=Ty,t.timeWednesdays=Py,t.timeWeek=xy,t.timeWeeks=Ny,t.timeYear=tv,t.timeYears=nv,t.timeout=$i,t.timer=Ni,t.timerFlush=ki,t.transition=go,t.transpose=gt,t.tree=function(){var t=$p,n=1,e=1,r=null;function i(i){var c=function(t){for(var n,e,r,i,o,a=new Up(t,0),u=[a];n=u.pop();)if(r=n._.children)for(n.children=new Array(o=r.length),i=o-1;i>=0;--i)u.push(e=n.children[i]=new Up(r[i],i)),e.parent=n;return(a.parent=new Up(null,0)).children=[a],a}(i);if(c.eachAfter(o),c.parent.m=-c.z,c.eachBefore(a),r)i.eachBefore(u);else{var f=i,s=i,l=i;i.eachBefore((function(t){t.x<f.x&&(f=t),t.x>s.x&&(s=t),t.depth>l.depth&&(l=t)}));var h=f===s?1:t(f,s)/2,d=h-f.x,p=n/(s.x+h+d),g=e/(l.depth||1);i.eachBefore((function(t){t.x=(t.x+d)*p,t.y=t.depth*g}))}return i}function o(n){var e=n.children,r=n.parent.children,i=n.i?r[n.i-1]:null;if(e){!function(t){for(var n,e=0,r=0,i=t.children,o=i.length;--o>=0;)(n=i[o]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(n);var o=(e[0].z+e[e.length-1].z)/2;i?(n.z=i.z+t(n._,i._),n.m=n.z-o):n.z=o}else i&&(n.z=i.z+t(n._,i._));n.parent.A=function(n,e,r){if(e){for(var i,o=n,a=n,u=e,c=o.parent.children[0],f=o.m,s=a.m,l=u.m,h=c.m;u=Rp(u),o=Dp(o),u&&o;)c=Dp(c),(a=Rp(a)).a=n,(i=u.z+l-o.z-f+t(u._,o._))>0&&(Fp(qp(u,n,r),n,i),f+=i,s+=i),l+=u.m,f+=o.m,h+=c.m,s+=a.m;u&&!Rp(a)&&(a.t=u,a.m+=l-s),o&&!Dp(c)&&(c.t=o,c.m+=f-h,r=n)}return r}(n,i,n.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(t){t.x*=n,t.y=t.depth*e}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},t.treemap=function(){var t=Yp,n=!1,e=1,r=1,i=[0],o=np,a=np,u=np,c=np,f=np;function s(t){return t.x0=t.y0=0,t.x1=e,t.y1=r,t.eachBefore(l),i=[0],n&&t.eachBefore(Tp),t}function l(n){var e=i[n.depth],r=n.x0+e,s=n.y0+e,l=n.x1-e,h=n.y1-e;l<r&&(r=l=(r+l)/2),h<s&&(s=h=(s+h)/2),n.x0=r,n.y0=s,n.x1=l,n.y1=h,n.children&&(e=i[n.depth+1]=o(n)/2,r+=f(n)-e,s+=a(n)-e,(l-=u(n)-e)<r&&(r=l=(r+l)/2),(h-=c(n)-e)<s&&(s=h=(s+h)/2),t(n,r,s,l,h))}return s.round=function(t){return arguments.length?(n=!!t,s):n},s.size=function(t){return arguments.length?(e=+t[0],r=+t[1],s):[e,r]},s.tile=function(n){return arguments.length?(t=tp(n),s):t},s.padding=function(t){return arguments.length?s.paddingInner(t).paddingOuter(t):s.paddingInner()},s.paddingInner=function(t){return arguments.length?(o="function"==typeof t?t:ep(+t),s):o},s.paddingOuter=function(t){return arguments.length?s.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):s.paddingTop()},s.paddingTop=function(t){return arguments.length?(a="function"==typeof t?t:ep(+t),s):a},s.paddingRight=function(t){return arguments.length?(u="function"==typeof t?t:ep(+t),s):u},s.paddingBottom=function(t){return arguments.length?(c="function"==typeof t?t:ep(+t),s):c},s.paddingLeft=function(t){return arguments.length?(f="function"==typeof t?t:ep(+t),s):f},s},t.treemapBinary=function(t,n,e,r,i){var o,a,u=t.children,c=u.length,f=new Array(c+1);for(f[0]=a=o=0;o<c;++o)f[o+1]=a+=u[o].value;!function t(n,e,r,i,o,a,c){if(n>=e-1){var s=u[n];return s.x0=i,s.y0=o,s.x1=a,void(s.y1=c)}var l=f[n],h=r/2+l,d=n+1,p=e-1;for(;d<p;){var g=d+p>>>1;f[g]<h?d=g+1:p=g}h-f[d-1]<f[d]-h&&n+1<d&&--d;var y=f[d]-l,v=r-y;if(a-i>c-o){var _=r?(i*v+a*y)/r:a;t(n,d,y,i,o,_,c),t(d,e,v,_,o,a,c)}else{var b=r?(o*v+c*y)/r:c;t(n,d,y,i,o,a,b),t(d,e,v,i,b,a,c)}}(0,c,t.value,n,e,r,i)},t.treemapDice=Ap,t.treemapResquarify=Lp,t.treemapSlice=Ip,t.treemapSliceDice=function(t,n,e,r,i){(1&t.depth?Ip:Ap)(t,n,e,r,i)},t.treemapSquarify=Yp,t.tsv=Mc,t.tsvFormat=lc,t.tsvFormatBody=hc,t.tsvFormatRow=pc,t.tsvFormatRows=dc,t.tsvFormatValue=gc,t.tsvParse=fc,t.tsvParseRows=sc,t.union=function(...t){const n=new InternSet;for(const e of t)for(const t of e)n.add(t);return n},t.unixDay=_y,t.unixDays=by,t.utcDay=yy,t.utcDays=vy,t.utcFriday=By,t.utcFridays=Vy,t.utcHour=hy,t.utcHours=dy,t.utcMillisecond=Wg,t.utcMilliseconds=Zg,t.utcMinute=cy,t.utcMinutes=fy,t.utcMonday=qy,t.utcMondays=jy,t.utcMonth=Qy,t.utcMonths=Jy,t.utcSaturday=Yy,t.utcSaturdays=Wy,t.utcSecond=iy,t.utcSeconds=oy,t.utcSunday=Fy,t.utcSundays=Ly,t.utcThursday=Oy,t.utcThursdays=Gy,t.utcTickInterval=av,t.utcTicks=ov,t.utcTuesday=Uy,t.utcTuesdays=Hy,t.utcWednesday=Iy,t.utcWednesdays=Xy,t.utcWeek=Fy,t.utcWeeks=Ly,t.utcYear=ev,t.utcYears=rv,t.variance=x,t.version="7.8.5",t.window=pn,t.xml=Sc,t.zip=function(){return gt(arguments)},t.zoom=function(){var t,n,e,r=Sw,i=Ew,o=Pw,a=kw,u=Cw,c=[0,1/0],f=[[-1/0,-1/0],[1/0,1/0]],s=250,l=ri,h=$t("start","zoom","end"),d=500,p=150,g=0,y=10;function v(t){t.property("__zoom",Nw).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",S).filter(u).on("touchstart.zoom",E).on("touchmove.zoom",N).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(t,n){return(n=Math.max(c[0],Math.min(c[1],n)))===t.k?t:new xw(n,t.x,t.y)}function b(t,n,e){var r=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return r===t.x&&i===t.y?t:new xw(t.k,r,i)}function m(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function x(t,n,e,r){t.on("start.zoom",(function(){w(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){w(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,o=arguments,a=w(t,o).event(r),u=i.apply(t,o),c=null==e?m(u):"function"==typeof e?e.apply(t,o):e,f=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),s=t.__zoom,h="function"==typeof n?n.apply(t,o):n,d=l(s.invert(c).concat(f/s.k),h.invert(c).concat(f/h.k));return function(t){if(1===t)t=h;else{var n=d(t),e=f/n[2];t=new xw(e,c[0]-n[0]*e,c[1]-n[1]*e)}a.zoom(null,t)}}))}function w(t,n,e){return!e&&t.__zooming||new M(t,n)}function M(t,n){this.that=t,this.args=n,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,n),this.taps=0}function T(t,...n){if(r.apply(this,arguments)){var e=w(this,n).event(t),i=this.__zoom,u=Math.max(c[0],Math.min(c[1],i.k*Math.pow(2,a.apply(this,arguments)))),s=ne(t);if(e.wheel)e.mouse[0][0]===s[0]&&e.mouse[0][1]===s[1]||(e.mouse[1]=i.invert(e.mouse[0]=s)),clearTimeout(e.wheel);else{if(i.k===u)return;e.mouse=[s,i.invert(s)],Gi(this),e.start()}Aw(t),e.wheel=setTimeout((function(){e.wheel=null,e.end()}),p),e.zoom("mouse",o(b(_(i,u),e.mouse[0],e.mouse[1]),e.extent,f))}}function A(t,...n){if(!e&&r.apply(this,arguments)){var i=t.currentTarget,a=w(this,n,!0).event(t),u=Zn(t.view).on("mousemove.zoom",(function(t){if(Aw(t),!a.moved){var n=t.clientX-s,e=t.clientY-l;a.moved=n*n+e*e>g}a.event(t).zoom("mouse",o(b(a.that.__zoom,a.mouse[0]=ne(t,i),a.mouse[1]),a.extent,f))}),!0).on("mouseup.zoom",(function(t){u.on("mousemove.zoom mouseup.zoom",null),ue(t.view,a.moved),Aw(t),a.event(t).end()}),!0),c=ne(t,i),s=t.clientX,l=t.clientY;ae(t.view),Tw(t),a.mouse=[c,this.__zoom.invert(c)],Gi(this),a.start()}}function S(t,...n){if(r.apply(this,arguments)){var e=this.__zoom,a=ne(t.changedTouches?t.changedTouches[0]:t,this),u=e.invert(a),c=e.k*(t.shiftKey?.5:2),l=o(b(_(e,c),a,u),i.apply(this,n),f);Aw(t),s>0?Zn(this).transition().duration(s).call(x,l,a,t):Zn(this).call(v.transform,l,a,t)}}function E(e,...i){if(r.apply(this,arguments)){var o,a,u,c,f=e.touches,s=f.length,l=w(this,i,e.changedTouches.length===s).event(e);for(Tw(e),a=0;a<s;++a)c=[c=ne(u=f[a],this),this.__zoom.invert(c),u.identifier],l.touch0?l.touch1||l.touch0[2]===c[2]||(l.touch1=c,l.taps=0):(l.touch0=c,o=!0,l.taps=1+!!t);t&&(t=clearTimeout(t)),o&&(l.taps<2&&(n=c[0],t=setTimeout((function(){t=null}),d)),Gi(this),l.start())}}function N(t,...n){if(this.__zooming){var e,r,i,a,u=w(this,n).event(t),c=t.changedTouches,s=c.length;for(Aw(t),e=0;e<s;++e)i=ne(r=c[e],this),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=i:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=i);if(r=u.that.__zoom,u.touch1){var l=u.touch0[0],h=u.touch0[1],d=u.touch1[0],p=u.touch1[1],g=(g=d[0]-l[0])*g+(g=d[1]-l[1])*g,y=(y=p[0]-h[0])*y+(y=p[1]-h[1])*y;r=_(r,Math.sqrt(g/y)),i=[(l[0]+d[0])/2,(l[1]+d[1])/2],a=[(h[0]+p[0])/2,(h[1]+p[1])/2]}else{if(!u.touch0)return;i=u.touch0[0],a=u.touch0[1]}u.zoom("touch",o(b(r,i,a),u.extent,f))}}function k(t,...r){if(this.__zooming){var i,o,a=w(this,r).event(t),u=t.changedTouches,c=u.length;for(Tw(t),e&&clearTimeout(e),e=setTimeout((function(){e=null}),d),i=0;i<c;++i)o=u[i],a.touch0&&a.touch0[2]===o.identifier?delete a.touch0:a.touch1&&a.touch1[2]===o.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(o=ne(o,this),Math.hypot(n[0]-o[0],n[1]-o[1])<y)){var f=Zn(this).on("dblclick.zoom");f&&f.apply(this,arguments)}}}return v.transform=function(t,n,e,r){var i=t.selection?t.selection():t;i.property("__zoom",Nw),t!==i?x(t,n,e,r):i.interrupt().each((function(){w(this,arguments).event(r).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()}))},v.scaleBy=function(t,n,e,r){v.scaleTo(t,(function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)}),e,r)},v.scaleTo=function(t,n,e,r){v.transform(t,(function(){var t=i.apply(this,arguments),r=this.__zoom,a=null==e?m(t):"function"==typeof e?e.apply(this,arguments):e,u=r.invert(a),c="function"==typeof n?n.apply(this,arguments):n;return o(b(_(r,c),a,u),t,f)}),e,r)},v.translateBy=function(t,n,e,r){v.transform(t,(function(){return o(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof e?e.apply(this,arguments):e),i.apply(this,arguments),f)}),null,r)},v.translateTo=function(t,n,e,r,a){v.transform(t,(function(){var t=i.apply(this,arguments),a=this.__zoom,u=null==r?m(t):"function"==typeof r?r.apply(this,arguments):r;return o(ww.translate(u[0],u[1]).scale(a.k).translate("function"==typeof n?-n.apply(this,arguments):-n,"function"==typeof e?-e.apply(this,arguments):-e),t,f)}),r,a)},M.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,n){return this.mouse&&"mouse"!==t&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var n=Zn(this.that).datum();h.call(t,this.that,new mw(t,{sourceEvent:this.sourceEvent,target:v,type:t,transform:this.that.__zoom,dispatch:h}),n)}},v.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:bw(+t),v):a},v.filter=function(t){return arguments.length?(r="function"==typeof t?t:bw(!!t),v):r},v.touchable=function(t){return arguments.length?(u="function"==typeof t?t:bw(!!t),v):u},v.extent=function(t){return arguments.length?(i="function"==typeof t?t:bw([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),v):i},v.scaleExtent=function(t){return arguments.length?(c[0]=+t[0],c[1]=+t[1],v):[c[0],c[1]]},v.translateExtent=function(t){return arguments.length?(f[0][0]=+t[0][0],f[1][0]=+t[1][0],f[0][1]=+t[0][1],f[1][1]=+t[1][1],v):[[f[0][0],f[0][1]],[f[1][0],f[1][1]]]},v.constrain=function(t){return arguments.length?(o=t,v):o},v.duration=function(t){return arguments.length?(s=+t,v):s},v.interpolate=function(t){return arguments.length?(l=t,v):l},v.on=function(){var t=h.on.apply(h,arguments);return t===h?v:t},v.clickDistance=function(t){return arguments.length?(g=(t=+t)*t,v):Math.sqrt(g)},v.tapDistance=function(t){return arguments.length?(y=+t,v):y},v},t.zoomIdentity=ww,t.zoomTransform=Mw})); |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html> |
| | | <head> |
| | | <title>家族关系思维导图</title> |
| | | <script src="https://d3js.org/d3.v7.min.js"></script> |
| | | <style> |
| | | .node circle { |
| | | fill: #fff; |
| | | stroke: steelblue; |
| | | stroke-width: 1.5px; |
| | | } |
| | | .node image { |
| | | width: 40px; |
| | | height: 40px; |
| | | clip-path: circle(20px at center); |
| | | } |
| | | .node text { |
| | | font-size: 14px; |
| | | text-anchor: middle; |
| | | fill: black; |
| | | } |
| | | .link { |
| | | fill: none; |
| | | stroke: #ccc; |
| | | stroke-width: 1.5px; |
| | | } |
| | | </style> |
| | | </head> |
| | | <body> |
| | | <div id="mindmap"></div> |
| | | <script> |
| | | |
| | | function drawMindMap(data) { |
| | | |
| | | } |
| | | var svg = d3.select("#mindmap"), |
| | | width = svg.attr("width"), |
| | | height = svg.attr("height"), |
| | | tree = d3.tree().size([width, height]), |
| | | root = d3.hierarchy(data); |
| | | |
| | | var link = svg.selectAll(".link") |
| | | .data(tree(root).links()) |
| | | .enter().append("path") |
| | | .attr("class", "link") |
| | | .attr("d", d3.linkHorizontal() |
| | | .x(function(d) { return d.y; }) |
| | | .y(function(d) { return d.x; })); |
| | | |
| | | var node = svg.selectAll(".node") |
| | | .data(root.descendants()) |
| | | .enter().append("g") |
| | | .attr("class", "node") |
| | | .attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; }); |
| | | |
| | | // 添加头像图像 |
| | | node.append("circle") |
| | | .attr("r", 20); |
| | | |
| | | node.append("image") |
| | | .attr("xlink:href", function(d) { return d.data.avatarUrl; }) // 头像图片 URL 从 JSON 数据中获取 |
| | | .attr("x", -20) |
| | | .attr("y", -20) |
| | | .attr("width", 40) |
| | | .attr("height", 40); |
| | | |
| | | node.append("text") |
| | | .attr("dy", ".31em") |
| | | .attr("y", 35) |
| | | .style("text-anchor", "middle") |
| | | .text(function(d) { return d.data.name; }); |
| | | } |
| | | </script> |
| | | </body> |
| | | </html> |
| | |
| | | package com.application.zhangshi_app_android; |
| | | |
| | | import com.android.app_base.base.BaseApplication; |
| | | import com.android.app_base.base.BaseConfig; |
| | | import com.android.app_base.http.OkHttpHelper; |
| | | import com.application.zhangshi_app_android.other.MyTitleBarStyle; |
| | | import com.github.gzuliyujiang.dialog.DialogColor; |
| | | import com.github.gzuliyujiang.dialog.DialogConfig; |
| | | import com.github.gzuliyujiang.dialog.DialogStyle; |
| | | import com.hjq.bar.TitleBar; |
| | | import com.hjq.http.EasyConfig; |
| | | import com.hjq.http.config.IRequestHandler; |
| | | import com.hjq.http.config.RequestServer; |
| | | |
| | | //import me.jessyan.autosize.AutoSizeConfig; |
| | | |
| | |
| | | // 初始化 TitleBar 默认样式 |
| | | TitleBar.setDefaultStyle(new MyTitleBarStyle()); |
| | | |
| | | // 滚轮选择器初始化样式 |
| | | DialogConfig.setDialogStyle(DialogStyle.Three); |
| | | DialogConfig.setDialogColor(new DialogColor() |
| | | .cancelTextColor(0xFF999999) |
| | | .okTextColor(0xFF2B83DD)); |
| | | |
| | | } |
| | | } |
| | |
| | | }); |
| | | holder.getBinding().layoutContent.setOnClickListener(v -> { |
| | | AppManager.getAppManager().startActivity( |
| | | new Intent(getRecyclerView().getContext(), FamilyAssetsDetailActivity.class) |
| | | new Intent(getRecyclerView().getContext(), CertificateOfHonorDetailActivity.class) |
| | | .putExtra("bean",mDataList.get(position))); |
| | | }); |
| | | ElectronicFileAdapter adapter = new ElectronicFileAdapter(mContext); |
New file |
| | |
| | | package com.application.zhangshi_app_android.adapter; |
| | | |
| | | import android.content.Context; |
| | | import android.content.pm.ActivityInfo; |
| | | import android.view.View; |
| | | |
| | | import androidx.annotation.Nullable; |
| | | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.databinding.ItemElectronicFileAddBinding; |
| | | import com.application.zhangshi_app_android.ui.ImagePreviewActivity; |
| | | import com.application.zhangshi_app_android.ui.VideoPlayActivity; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.08.18. 23:54 |
| | | * @desc 详情页里 可添加的电子文件 适配器 |
| | | */ |
| | | public class ElectronicFileAddAdapter extends BaseRVAdapter<String, ItemElectronicFileAddBinding, BaseRVAdapter.BaseViewHolder<ItemElectronicFileAddBinding>> { |
| | | |
| | | public static final String TAG = "ElectronicFileAddAdapter"; |
| | | |
| | | public static final int TYPE_NORMAL = 1; |
| | | public static final int TYPE_Add = 2; |
| | | public static final int TYPE_Add_INVISIBLE = 3; |
| | | |
| | | private boolean isShowAddItem;//是否显示添加按钮,即是否为编辑状态 true 为显示,false 为隐藏 |
| | | private boolean isShowDeleteIcon;//是否显示右上角图标 true 为显示,false 为隐藏 |
| | | private boolean isShowSelectIcon = false;//是否显示左上角选中图标 true 为显示,false 为隐藏 |
| | | private boolean isPreview = true;//是否开启长按预览 true 为开启,false 为不开启 |
| | | private final Set<String> selectedItems = new HashSet<>();//被选中的item |
| | | private OnItemAndAddClickListener mItemAndAddClickListener; |
| | | |
| | | |
| | | public ElectronicFileAddAdapter(Context context) { |
| | | super(context); |
| | | } |
| | | |
| | | @Override |
| | | protected int getLayoutId() { |
| | | return R.layout.item_electronic_file_add; |
| | | } |
| | | |
| | | @Override |
| | | public int getItemCount() { |
| | | int dataSize = mDataList == null ? 0 : mDataList.size(); |
| | | if (isShowAddItem){ |
| | | return dataSize + 1; |
| | | }else { |
| | | if (dataSize == 0) { |
| | | return dataSize + 1;//没有数据时,需要多出一个item给添加按钮占位 |
| | | } |
| | | return dataSize; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public int getItemViewType(int position) { |
| | | int dataSize = mDataList == null ? 0 : mDataList.size(); |
| | | if (dataSize == 0){ //没有数据时,需要添加按钮占位 |
| | | if (isShowAddItem) { |
| | | return TYPE_Add; |
| | | } else { |
| | | return TYPE_Add_INVISIBLE; |
| | | } |
| | | }else { |
| | | if (isShowAddItem) { |
| | | if (position == dataSize) { |
| | | return TYPE_Add; |
| | | } else { |
| | | return TYPE_NORMAL; |
| | | } |
| | | } else { |
| | | return TYPE_NORMAL; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void onBind(BaseViewHolder<ItemElectronicFileAddBinding> holder, int position) { |
| | | if (getItemViewType(position) == TYPE_Add) { |
| | | holder.getBinding().flAdd.setVisibility(View.VISIBLE); |
| | | holder.getBinding().flImage.setVisibility(View.GONE); |
| | | |
| | | holder.itemView.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (mItemAndAddClickListener != null) { |
| | | mItemAndAddClickListener.onAddClick(); |
| | | } |
| | | } |
| | | }); |
| | | } else if (getItemViewType(position) == TYPE_Add_INVISIBLE){ |
| | | holder.getBinding().flAdd.setVisibility(View.INVISIBLE); |
| | | holder.getBinding().flImage.setVisibility(View.GONE); |
| | | } else if (getItemViewType(position) == TYPE_NORMAL){ |
| | | holder.getBinding().flAdd.setVisibility(View.GONE); |
| | | holder.getBinding().flImage.setVisibility(View.VISIBLE); |
| | | |
| | | //非预览状态下,点击item 调用 mItemAndAddClickListener.onItemClick |
| | | //预览状态下,点击item 调用 相应的 文件预览 |
| | | if (!isPreview){ |
| | | holder.itemView.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (mItemAndAddClickListener != null) { |
| | | mItemAndAddClickListener.onItemClick(holder.itemView,position); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | String item = mDataList.get(position); |
| | | if (item != null) { |
| | | if (item.endsWith(".pdf")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_others); |
| | | } else if (item.endsWith(".doc") || item.endsWith(".docx")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_others); |
| | | } else if (item.endsWith(".xls") || item.endsWith(".xlsx")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_others); |
| | | } else if (item.endsWith(".ppt") || item.endsWith(".pptx")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_others); |
| | | } else if (item.endsWith(".txt")) { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_txt); |
| | | } else if (item.endsWith(".jpg") || item.endsWith(".jpeg") || item.endsWith(".png") || item.endsWith(".gif")) { |
| | | holder.getBinding().setUrl(item); |
| | | if (isPreview) { |
| | | holder.itemView.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | ImagePreviewActivity.start(mContext, item); |
| | | } |
| | | }); |
| | | } |
| | | } else if (item.endsWith(".mp4")) { |
| | | holder.getBinding().flPlay.setVisibility(View.VISIBLE); |
| | | holder.getBinding().setUrl(item); |
| | | if (isPreview) { |
| | | holder.itemView.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | new VideoPlayActivity.Builder() |
| | | .setVideoSource(item) |
| | | .setActivityOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) |
| | | .start(mContext); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } else if (item.endsWith(".mp3") || item.endsWith(".m4a")) { |
| | | // holder.getBinding().flPlay.setVisibility(View.VISIBLE); |
| | | |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_audio); |
| | | } else { |
| | | holder.getBinding().ivImage.setImageResource(R.drawable.ic_others); |
| | | } |
| | | } |
| | | |
| | | if (isShowAddItem) { |
| | | holder.getBinding().ivDelete.setVisibility(View.VISIBLE); |
| | | } else { |
| | | holder.getBinding().ivDelete.setVisibility(View.GONE); |
| | | } |
| | | |
| | | if (isShowDeleteIcon) { |
| | | holder.getBinding().ivDelete.setVisibility(View.VISIBLE); |
| | | } else { |
| | | holder.getBinding().ivDelete.setVisibility(View.GONE); |
| | | } |
| | | |
| | | if (isShowSelectIcon) { |
| | | if (selectedItems.contains(item)){ |
| | | holder.getBinding().ivSelect.setVisibility(View.VISIBLE); |
| | | } else { |
| | | holder.getBinding().ivSelect.setVisibility(View.GONE); |
| | | } |
| | | } else { |
| | | holder.getBinding().ivSelect.setVisibility(View.GONE); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected BaseViewHolder<ItemElectronicFileAddBinding> getViewHolder(ItemElectronicFileAddBinding itemBind, int viewType) { |
| | | return new BaseViewHolder<>(itemBind); |
| | | } |
| | | |
| | | public void setItemAndAddClickListener(OnItemAndAddClickListener itemAndAddClickListener) { |
| | | mItemAndAddClickListener = itemAndAddClickListener; |
| | | } |
| | | |
| | | public interface OnItemAndAddClickListener { |
| | | /** |
| | | * item点击事件 |
| | | */ |
| | | void onItemClick(View itemView, int position); |
| | | |
| | | /** |
| | | * 添加电子文件 |
| | | */ |
| | | void onAddClick(); |
| | | } |
| | | |
| | | public void setShowAddItem(boolean showAddItem) { |
| | | isShowAddItem = showAddItem; |
| | | notifyItemRangeChanged(0, getItemCount()); |
| | | } |
| | | |
| | | public void setShowDeleteIcon(boolean showDeleteIcon) { |
| | | isShowDeleteIcon = showDeleteIcon; |
| | | notifyItemRangeChanged(0, getItemCount()); |
| | | } |
| | | public void setShowSelectIcon(boolean showSelectIcon) { |
| | | isShowSelectIcon = showSelectIcon; |
| | | notifyItemRangeChanged(0, getItemCount()); |
| | | } |
| | | |
| | | public void setIsEdited(boolean isEdit) { |
| | | setShowAddItem(isEdit); |
| | | setShowDeleteIcon(isEdit); |
| | | } |
| | | |
| | | |
| | | public void addSelectedItem(String item) { |
| | | selectedItems.add(item); |
| | | notifyItemRangeChanged(0, getItemCount()); |
| | | } |
| | | |
| | | public void addSelectedItems(List<String> items) { |
| | | selectedItems.addAll(items); |
| | | notifyItemRangeChanged(0, getItemCount()); |
| | | } |
| | | |
| | | public void removeSelectedItem(String item) { |
| | | selectedItems.remove(item); |
| | | notifyItemRangeChanged(0, getItemCount()); |
| | | } |
| | | |
| | | public void changeSelectedItem(String item) { |
| | | if (selectedItems.contains(item)) { |
| | | selectedItems.remove(item); |
| | | } else { |
| | | selectedItems.add(item); |
| | | } |
| | | notifyItemRangeChanged(0, getItemCount()); |
| | | } |
| | | |
| | | @Override |
| | | public void setData(@Nullable List<String> data) { |
| | | selectedItems.clear(); |
| | | super.setData(data); |
| | | } |
| | | |
| | | public void clearSelectedItems() { |
| | | selectedItems.clear(); |
| | | notifyItemRangeChanged(0, getItemCount()); |
| | | } |
| | | |
| | | public Set<String> getSelectedItems() { |
| | | return selectedItems; |
| | | } |
| | | |
| | | public void changeSingleSelected(String item) { |
| | | if (selectedItems.contains(item)) { |
| | | selectedItems.remove(item); |
| | | } else { |
| | | selectedItems.clear(); |
| | | selectedItems.add(item); |
| | | } |
| | | notifyItemRangeChanged(0, getItemCount()); |
| | | } |
| | | |
| | | public void setPreview(boolean preview) { |
| | | isPreview = preview; |
| | | notifyItemRangeChanged(0, getItemCount()); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.application.zhangshi_app_android.adapter; |
| | | |
| | | import android.content.Context; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.databinding.ViewDataBinding; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.databinding.ItemImagePreviewBinding; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.08.19. 17:25 |
| | | * @desc |
| | | */ |
| | | public class ImagePreviewAdapter extends BaseRVAdapter<String, ItemImagePreviewBinding, BaseRVAdapter.BaseViewHolder<ItemImagePreviewBinding>> { |
| | | public ImagePreviewAdapter(Context context) { |
| | | super(context); |
| | | } |
| | | |
| | | @Override |
| | | protected int getLayoutId() { |
| | | return R.layout.item_image_preview; |
| | | } |
| | | |
| | | @Override |
| | | protected void onBind(BaseViewHolder<ItemImagePreviewBinding> holder, int position) { |
| | | holder.getBinding().setBean(mDataList.get(position)); |
| | | } |
| | | |
| | | @Override |
| | | protected BaseViewHolder<ItemImagePreviewBinding> getViewHolder(ItemImagePreviewBinding itemBind, int viewType) { |
| | | return new BaseViewHolder<>(itemBind); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | }); |
| | | |
| | | ImageRvAdapter adapter = new ImageRvAdapter(mContext); |
| | | ElectronicFileAdapter adapter = new ElectronicFileAdapter(mContext); |
| | | holder.getBinding().rvImage.setLayoutManager(new GridLayoutManager(mContext, 3)); |
| | | holder.getBinding().rvImage.setAdapter(adapter); |
| | | adapter.setData(Utils.splitString2List(mDataList.get(position).getUrl(),",")); |
| | |
| | | package com.application.zhangshi_app_android.bean; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.07.17. 22:03 |
| | | * @desc 轮播图 bean |
| | | */ |
| | | public class BannerBean { |
| | | public class BannerBean implements Serializable { |
| | | //id |
| | | private int id; |
| | | //个人id |
| | |
| | | private String url; |
| | | //文件类型 1 视频 0 图片 |
| | | private int flag; |
| | | //是否被选中 1 选中 0 未选中 |
| | | private int choose; |
| | | |
| | | public int getId() { |
| | | return id; |
| | |
| | | public void setFlag(int flag) { |
| | | this.flag = flag; |
| | | } |
| | | |
| | | public int getChoose() { |
| | | return choose; |
| | | } |
| | | |
| | | public void setChoose(int choose) { |
| | | this.choose = choose; |
| | | } |
| | | } |
| | |
| | | //用户id |
| | | private String userId; |
| | | //类别 0.证件 1.荣誉 2.资质 |
| | | private int type; |
| | | private String type; |
| | | //名称 |
| | | private String name; |
| | | //证号/专业 |
| | |
| | | } |
| | | |
| | | public String getType() { |
| | | if (type == 0){ |
| | | return "证件"; |
| | | }else if (type == 1){ |
| | | return "荣誉"; |
| | | }else if (type == 2){ |
| | | return "资质"; |
| | | } |
| | | return ""; |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | switch (type) { |
| | | case "证件": |
| | | this.type = 0; |
| | | break; |
| | | case "荣誉": |
| | | this.type = 1; |
| | | break; |
| | | case "资质": |
| | | this.type = 2; |
| | | break; |
| | | } |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getName() { |
| | |
| | | //电子文件 |
| | | private String url; |
| | | |
| | | //从本地通讯录获取的头像,用于将头像上传到服务器(本地通讯录获取的头像只有Uri,无法获取实际文件路径) |
| | | private transient byte[] photoData; |
| | | |
| | | public int getId() { |
| | | return id; |
| | | } |
| | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public byte[] getPhotoData() { |
| | | return photoData; |
| | | } |
| | | |
| | | public void setPhotoData(byte[] photoData) { |
| | | this.photoData = photoData; |
| | | } |
| | | } |
| | |
| | | package com.application.zhangshi_app_android.bean; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public void setChildList(List<HomeRootBean> childList) { |
| | | this.childList = childList; |
| | | } |
| | | public void addChild(HomeRootBean child) { |
| | | if (childList == null) { |
| | | childList = new ArrayList<>(); |
| | | } |
| | | childList.add(child); |
| | | } |
| | | |
| | | public HomeRootBean getSpouse() { |
| | | return spouse; |
| | |
| | | private String workAddress; |
| | | //本人婚姻状态 0未婚 1初婚 2离婚 3再婚 |
| | | private int marryStatus; |
| | | //本人性别 0女 1男 |
| | | private int sex; |
| | | //本人性别 |
| | | private String sex; |
| | | //本人民族 |
| | | private String nation; |
| | | //本人电话号码 |
| | |
| | | private String spouseWorkAddress; |
| | | //配偶婚姻状态 0未婚 1初婚 2离婚 3再婚 |
| | | private int spouseMarryStatus; |
| | | //配偶性别 0女 1男 |
| | | private int spouseSex; |
| | | //配偶性别 |
| | | private String spouseSex; |
| | | //配偶民族 |
| | | private String spouseNation; |
| | | //配偶电话号码 |
| | |
| | | //领取独生子女证时间 |
| | | private String oneBornTime; |
| | | //需要声明的情况 |
| | | private String content; |
| | | private String notion; |
| | | private String contentTime; |
| | | //备注 |
| | | private String remark; |
| | |
| | | public String getBirthday() { return birthday; } |
| | | public void setBirthday(String value) { this.birthday = value; } |
| | | |
| | | public String getContent() { return content; } |
| | | public void setContent(String value) { this.content = value; } |
| | | public String getNotion() { return notion; } |
| | | public void setNotion(String value) { this.notion = value; } |
| | | |
| | | public String getHandbookStatus() { |
| | | return handbookStatus == 0 ? "否" : "是"; |
| | |
| | | public void setRemark(String value) { this.remark = value; } |
| | | |
| | | public String getSex() { |
| | | return sex == 0 ? "女" : "男"; |
| | | return sex; |
| | | } |
| | | public void setSex(String value) { |
| | | this.sex = value.equals("女") ? 0 : 1; |
| | | this.sex = value; |
| | | } |
| | | |
| | | public String getSpouseAddress() { return spouseAddress; } |
| | |
| | | public String getSpousePhone() { return spousePhone; } |
| | | public void setSpousePhone(String value) { this.spousePhone = value; } |
| | | |
| | | public int getSpouseSex() { return spouseSex; } |
| | | public void setSpouseSex(int value) { this.spouseSex = value; } |
| | | public String getSpouseSex() { return spouseSex; } |
| | | public void setSpouseSex(String value) { this.spouseSex = value; } |
| | | |
| | | public String getSpouseWorkAddress() { return spouseWorkAddress; } |
| | | public void setSpouseWorkAddress(String value) { this.spouseWorkAddress = value; } |
| | |
| | | private Object myId; |
| | | private String nation; |
| | | private String phone; |
| | | private int sex; |
| | | private String sex; |
| | | private String workAddress; |
| | | |
| | | public String getAddress() { return address; } |
| | |
| | | public String getPhone() { return phone; } |
| | | public void setPhone(String value) { this.phone = value; } |
| | | |
| | | public int getSex() { return sex; } |
| | | public void setSex(int value) { this.sex = value; } |
| | | public String getSex() { return sex; } |
| | | public void setSex(String value) { this.sex = value; } |
| | | |
| | | public String getWorkAddress() { return workAddress; } |
| | | public void setWorkAddress(String value) { this.workAddress = value; } |
| | |
| | | private String happenStartTime; |
| | | //出生日期结束时间 |
| | | private String happenEndTime; |
| | | //犬种 |
| | | private String type; |
| | | //性别 0 雌 1 雄 |
| | | private int sex = -1; |
| | | private String sexStr; |
| | | //毛色 |
| | | private String color; |
| | | //犬证号码 |
| | | private String idNum; |
| | | //防伪码 |
| | | private String securityCode; |
| | | //饮食习惯(喜) |
| | | private String eatHabit; |
| | | //饮食习惯(忌) |
| | | private String disEatHabit; |
| | | //生活习惯(喜) |
| | | private String lifeHabit; |
| | | //生活习惯(嗜好) |
| | | private String disLifeHabit; |
| | | //居住地址 |
| | | private String address; |
| | | //能听懂的方言 |
| | | private String dialect; |
| | | |
| | | public String getName() { |
| | | return name; |
| | |
| | | this.happenEndTime = happenEndTime; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public int getSex() { |
| | | return sex; |
| | | } |
| | | |
| | | public String getSexStr() { |
| | | if (sex == 1){ |
| | | sexStr = "雄"; |
| | | }else if (sex == 0){ |
| | | sexStr = "雌"; |
| | | }else { |
| | | sexStr = ""; |
| | | } |
| | | return sexStr; |
| | | } |
| | | |
| | | public void setSexStr(String sexStr) { |
| | | this.sexStr = sexStr; |
| | | if ("雌".equals(sexStr)) { |
| | | setSex(0); |
| | | } else if ("雄".equals(sexStr)) { |
| | | setSex(1); |
| | | } else { |
| | | setSex(-1); |
| | | } |
| | | } |
| | | |
| | | public void setSex(int sex) { |
| | | this.sex = sex; |
| | | } |
| | | |
| | | public String getColor() { |
| | | return color; |
| | | } |
| | | |
| | | public void setColor(String color) { |
| | | this.color = color; |
| | | } |
| | | |
| | | public String getIdNum() { |
| | | return idNum; |
| | | } |
| | | |
| | | public void setIdNum(String idNum) { |
| | | this.idNum = idNum; |
| | | } |
| | | |
| | | public String getSecurityCode() { |
| | | return securityCode; |
| | | } |
| | | |
| | | public void setSecurityCode(String securityCode) { |
| | | this.securityCode = securityCode; |
| | | } |
| | | |
| | | public String getEatHabit() { |
| | | return eatHabit; |
| | | } |
| | | |
| | | public void setEatHabit(String eatHabit) { |
| | | this.eatHabit = eatHabit; |
| | | } |
| | | |
| | | public String getDisEatHabit() { |
| | | return disEatHabit; |
| | | } |
| | | |
| | | public void setDisEatHabit(String disEatHabit) { |
| | | this.disEatHabit = disEatHabit; |
| | | } |
| | | |
| | | public String getLifeHabit() { |
| | | return lifeHabit; |
| | | } |
| | | |
| | | public void setLifeHabit(String lifeHabit) { |
| | | this.lifeHabit = lifeHabit; |
| | | } |
| | | |
| | | public String getDisLifeHabit() { |
| | | return disLifeHabit; |
| | | } |
| | | |
| | | public void setDisLifeHabit(String disLifeHabit) { |
| | | this.disLifeHabit = disLifeHabit; |
| | | } |
| | | |
| | | public String getAddress() { |
| | | return address; |
| | | } |
| | | |
| | | public void setAddress(String address) { |
| | | this.address = address; |
| | | } |
| | | |
| | | public String getDialect() { |
| | | return dialect; |
| | | } |
| | | |
| | | public void setDialect(String dialect) { |
| | | this.dialect = dialect; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> toMap() { |
| | | Map<String, Object> map = super.toMap(); |
| | | map.put("name",name==null?"":name); |
| | | map.put("happenStartTime",happenStartTime==null?"":happenStartTime); |
| | | map.put("happenEndTime",happenEndTime==null?"":happenEndTime); |
| | | map.put("type",type==null?"":type); |
| | | if (sex != -1){ |
| | | map.put("sex",sex); |
| | | } |
| | | map.put("color",color==null?"":color); |
| | | map.put("idNum",idNum==null?"":idNum); |
| | | map.put("securityCode",securityCode==null?"":securityCode); |
| | | map.put("eatHabit",eatHabit==null?"":eatHabit); |
| | | map.put("disEatHabit",disEatHabit==null?"":disEatHabit); |
| | | map.put("lifeHabit",lifeHabit==null?"":lifeHabit); |
| | | map.put("disLifeHabit",disLifeHabit==null?"":disLifeHabit); |
| | | map.put("address",address==null?"":address); |
| | | map.put("dialect",dialect==null?"":dialect); |
| | | return map; |
| | | } |
| | | } |
| | |
| | | * @desc |
| | | */ |
| | | public class UpdateVersionBean implements Serializable { |
| | | // 版本号 |
| | | private int versionCode; |
| | | // 版本名称 |
| | | private String versionName; |
| | | // 下载地址 |
| | | private String appUrl; |
| | | // 更新内容 |
| | | private String content; |
| | | // 发布时间 |
| | | private String publishTime; |
| | | private boolean forceUpdate; |
| | | // 是否强制更新 1是 0否 |
| | | private int forceUpdate; |
| | | |
| | | public int getVersionCode() { |
| | | return versionCode; |
| | |
| | | this.publishTime = publishTime; |
| | | } |
| | | |
| | | public boolean isForceUpdate() { |
| | | public String getVersionName() { |
| | | return versionName; |
| | | } |
| | | |
| | | public void setVersionName(String versionName) { |
| | | this.versionName = versionName; |
| | | } |
| | | |
| | | public int getForceUpdate() { |
| | | return forceUpdate; |
| | | } |
| | | |
| | | public void setForceUpdate(boolean forceUpdate) { |
| | | public void setForceUpdate(int forceUpdate) { |
| | | this.forceUpdate = forceUpdate; |
| | | } |
| | | } |
| | |
| | | |
| | | import io.reactivex.Completable; |
| | | import io.reactivex.Observable; |
| | | import io.reactivex.ObservableSource; |
| | | import okhttp3.MultipartBody; |
| | | |
| | | /** |
| | |
| | | public Observable<ResultData<PageResponseBean<ContactsDetailBean>>> getContacts(Map<String, Object> paramsMap) { |
| | | return mHttpDataSource.getContacts(paramsMap); |
| | | } |
| | | |
| | | /** |
| | | * 添加通讯录 |
| | | */ |
| | | public Observable<ResultData<String>> addContacts(ContactsDetailBean contactsDetailBean) { |
| | | return mHttpDataSource.addContacts(contactsDetailBean); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取家庭荣誉 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 添加轮播图数据 |
| | | */ |
| | | public Observable<ResultData<String>> addBannerData(BannerBean bannerBean) { |
| | | return mHttpDataSource.addBannerData(bannerBean); |
| | | } |
| | | |
| | | /** |
| | | * 删除轮播图数据 |
| | | */ |
| | | public Observable<ResultData<String>> deleteBannerData(String ids) { |
| | | return mHttpDataSource.deleteBannerData(ids); |
| | | } |
| | | |
| | | /** |
| | | * 修改轮播图数据 |
| | | */ |
| | | public Observable<ResultData<String>> updateBannerData(BannerBean bannerBean) { |
| | | return mHttpDataSource.updateBannerData(bannerBean); |
| | | } |
| | | |
| | | /** |
| | | * 获取健康保健基本信息 |
| | | */ |
| | | public Observable<ResultData<HealthCareBaseInfoBean>> getHealthCareBaseInfo() { |
| | |
| | | */ |
| | | Observable<ResultData<PageResponseBean<ContactsDetailBean>>> getContacts(Map<String, Object> paramsMap); |
| | | |
| | | /** |
| | | * 增加通讯录 |
| | | */ |
| | | Observable<ResultData<String>> addContacts(ContactsDetailBean contactsDetailBean); |
| | | |
| | | /** |
| | | * 获取保洁收纳 |
| | |
| | | Observable<ResultData<List<BannerBean>>> getBannerData(); |
| | | |
| | | /** |
| | | * 添加功能主页轮播图数据 |
| | | */ |
| | | Observable<ResultData<String>> addBannerData(BannerBean bannerBean); |
| | | |
| | | /** |
| | | * 删除功能主页轮播图数据 |
| | | */ |
| | | Observable<ResultData<String>> deleteBannerData(String ids); |
| | | |
| | | /** |
| | | * 修改功能主页轮播图数据 |
| | | */ |
| | | Observable<ResultData<String>> updateBannerData(BannerBean bannerBean); |
| | | |
| | | /** |
| | | * 获取健康保健基本信息 |
| | | */ |
| | | Observable<ResultData<HealthCareBaseInfoBean>> getHealthCareBaseInfo(); |
| | |
| | | * 获取版本更新 |
| | | */ |
| | | Observable<ResultData<UpdateVersionBean>> getUpdateVersion(); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | * 修改成长经历个人信息 |
| | | */ |
| | | @PUT("/self/user") |
| | | Observable<ResultData<String>> updateGrowthExperienceInformation(@Body GrowthExperienceInformationBean growthExperienceInformationBean); |
| | | Observable<ResultData<String>> updateGrowthExperienceInformation(@Body GrowthExperienceInformationBean growthExperienceInformationBean); |
| | | |
| | | /** |
| | | * 获取成长经历(主要学习及工作经历) |
| | |
| | | Observable<ResultData<PageResponseBean<ContactsDetailBean>>> getContacts(@QueryMap Map<String, Object> paramsMap); |
| | | |
| | | /** |
| | | * 添加通讯录 |
| | | */ |
| | | @POST("/zfContact") |
| | | Observable<ResultData<String>> addContacts(@Body ContactsDetailBean contactsDetailBean); |
| | | |
| | | /** |
| | | * 获取保洁收纳 |
| | | */ |
| | | @GET("/zfClean/all") |
| | |
| | | /** |
| | | * 获取个人婚姻信息 |
| | | */ |
| | | @GET("/zMarry/list") |
| | | @GET("/marrySelf") |
| | | Observable<ResultData<MarriageInfoBean>> getMarriageInfo(); |
| | | |
| | | /** |
| | |
| | | @GET("/rotation/all") |
| | | Observable<ResultData<List<BannerBean>>> getBannerData(); |
| | | |
| | | /** |
| | | * 添加轮播图数据 |
| | | */ |
| | | @POST("/rotation/add") |
| | | Observable<ResultData<String>> addBannerData(@Body BannerBean bannerBean); |
| | | |
| | | /** |
| | | * 删除轮播图数据 |
| | | */ |
| | | @DELETE("/rotation/delete/{ids}") |
| | | Observable<ResultData<String>> deleteBannerData(@Path("ids") String ids); |
| | | |
| | | /** |
| | | * 修改轮播图数据 |
| | | */ |
| | | @PUT("/rotation") |
| | | Observable<ResultData<String>> updateBannerData(@Body BannerBean bannerBean); |
| | | |
| | | /** |
| | | * 获取健康保健基本信息 |
| | |
| | | */ |
| | | @GET("/version") |
| | | Observable<ResultData<UpdateVersionBean>> getUpdateVersion(); |
| | | |
| | | } |
| | |
| | | return apiService.getContacts(paramsMap); |
| | | } |
| | | |
| | | @Override |
| | | public Observable<ResultData<String>> addContacts(ContactsDetailBean contactsDetailBean) { |
| | | return apiService.addContacts(contactsDetailBean); |
| | | } |
| | | |
| | | /** |
| | | * 获取保洁收纳 |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 新增轮播图数据 |
| | | */ |
| | | @Override |
| | | public Observable<ResultData<String>> addBannerData(BannerBean bannerBean) { |
| | | return apiService.addBannerData(bannerBean); |
| | | } |
| | | |
| | | /** |
| | | * 删除轮播图数据 |
| | | */ |
| | | @Override |
| | | public Observable<ResultData<String>> deleteBannerData(String ids) { |
| | | return apiService.deleteBannerData(ids); |
| | | } |
| | | |
| | | /** |
| | | * 修改轮播图数据 |
| | | */ |
| | | @Override |
| | | public Observable<ResultData<String>> updateBannerData(BannerBean bannerBean) { |
| | | return apiService.updateBannerData(bannerBean); |
| | | } |
| | | |
| | | /** |
| | | * 获取健康保健基本信息 |
| | | */ |
| | | @Override |
| | |
| | | import com.android.app_base.base.view.BaseActivity; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.GlideUtil; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.ui.function.CertificateOfHonorActivity; |
| | |
| | | } |
| | | } |
| | | mDrawerLayout.setScrimColor(getResources().getColor(R.color.color_shadow)); |
| | | |
| | | } |
| | | } |
| | | |
| | | public void setNameAndAvatar(String name,String avatar){ |
| | | if (mDrawerLayout != null){ |
| | | GlideUtil.loadImage(UserManager.getInstance().getUserAvatar(), findViewById(R.id.dl_home_user_avatar)); |
| | | TextView userNameTv = findViewById(R.id.dl_home_user_name); |
| | | userNameTv.setText(UserManager.getInstance().getUserName()); |
| | | } |
| | | } |
| | | private void setSelectItem(LinearLayout linearLayout) { |
| | |
| | | import android.widget.PopupWindow; |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.databinding.DataBindingUtil; |
| | | import androidx.databinding.ViewDataBinding; |
| | |
| | | import com.android.app_base.base.view.BaseFragment; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.GlideUtil; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.ui.function.CertificateOfHonorActivity; |
| | | import com.application.zhangshi_app_android.ui.function.CleanStorageActivity; |
| | |
| | | import com.application.zhangshi_app_android.ui.function.PrivacyActivity; |
| | | import com.application.zhangshi_app_android.ui.function.PropertyActivity; |
| | | import com.application.zhangshi_app_android.ui.function.TourismActivity; |
| | | import com.application.zhangshi_app_android.ui.home.HomeFragment; |
| | | import com.hjq.bar.TitleBar; |
| | | |
| | | import java.util.HashMap; |
| | |
| | | mDrawerLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); |
| | | VDB mBinding = DataBindingUtil.inflate(inflater, getLayoutId(), mDrawerLayout, true); |
| | | if (getDrawerLayoutId() > 0){ |
| | | getLayoutInflater().inflate(getDrawerLayoutId(), mDrawerLayout, true); |
| | | inflater.inflate(getDrawerLayoutId(), mDrawerLayout, true); |
| | | }else { |
| | | throw new IllegalArgumentException("没给侧拉栏布局就不要开启侧拉栏啦"); |
| | | } |
| | |
| | | return super.initViewBinding(inflater, container); |
| | | } |
| | | |
| | | @Nullable |
| | | @Override |
| | | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| | | isLoaded = false; |
| | | if (getLayoutId() > 0){ |
| | | binding = initViewBinding(inflater, container); |
| | | if (isDrawerLayoutEnabled()) { |
| | | //如果开启了侧拉栏,就把布局放到侧拉栏里面 |
| | | mRootView = mDrawerLayout; |
| | | }else { |
| | | mRootView = binding.getRoot(); |
| | | } |
| | | return mRootView; |
| | | } |
| | | return null; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 是否开启侧拉栏 |
| | |
| | | */ |
| | | protected int getDrawerLayoutId(){ |
| | | return R.layout.layout_drawer; |
| | | }; |
| | | } |
| | | |
| | | @Override |
| | | public void onCreate(@Nullable Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | |
| | | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |
| | | super.onViewCreated(view, savedInstanceState); |
| | | if (mDrawerLayout != null) { |
| | | classMap.put(null,(LinearLayout) findViewById(R.id.dl_home_root_net)); |
| | | classMap.put(HomeFragment.class,(LinearLayout) findViewById(R.id.dl_home_root_net)); |
| | | classMap.put(FamilyMemorabiliaActivity.class,(LinearLayout) findViewById(R.id.dl_family_memorabilia)); |
| | | classMap.put(FamilyAssetsActivity.class,(LinearLayout) findViewById(R.id.dl_family_assets)); |
| | | classMap.put(HomeDevicesActivity.class,(LinearLayout) findViewById(R.id.dl_home_devices)); |
| | |
| | | } |
| | | } |
| | | mDrawerLayout.setScrimColor(getResources().getColor(R.color.color_shadow)); |
| | | GlideUtil.loadImage(UserManager.getInstance().getUserAvatar(), findViewById(R.id.dl_home_user_avatar)); |
| | | TextView userNameTv = findViewById(R.id.dl_home_user_name); |
| | | userNameTv.setText(UserManager.getInstance().getUserName()); |
| | | } |
| | | } |
| | | private void setSelectItem(LinearLayout linearLayout) { |
| | |
| | | mDrawerLayout.open(); |
| | | } |
| | | |
| | | |
| | | |
| | | public PopupWindow initPopUpWindow(View view){ |
| | | PopupWindow popupWindow = new PopupWindow(getSelfActivity()); |
| | | // 设置布局文件 |
New file |
| | |
| | | package com.application.zhangshi_app_android.ui; |
| | | |
| | | import android.annotation.SuppressLint; |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.view.View; |
| | | import android.widget.BaseAdapter; |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | import androidx.viewpager.widget.ViewPager; |
| | | import androidx.viewpager2.widget.ViewPager2; |
| | | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.android.app_base.base.view.BaseActivity; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImagePreviewAdapter; |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | | import com.application.zhangshi_app_android.databinding.ImagePreviewActivityBinding; |
| | | import com.gyf.immersionbar.BarHide; |
| | | import com.gyf.immersionbar.ImmersionBar; |
| | | import com.youth.banner.indicator.CircleIndicator; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.08.19. 16:53 |
| | | * @desc |
| | | */ |
| | | public final class ImagePreviewActivity extends BaseActivity<ImagePreviewActivityBinding, SimpleViewModel> { |
| | | |
| | | private static final String INTENT_KEY_IN_IMAGE_LIST = "imageList"; |
| | | private static final String INTENT_KEY_IN_IMAGE_INDEX = "imageIndex"; |
| | | |
| | | public static void start(Context context, String url) { |
| | | ArrayList<String> images = new ArrayList<>(1); |
| | | images.add(url); |
| | | start(context, images); |
| | | } |
| | | |
| | | public static void start(Context context, List<String> urls) { |
| | | start(context, urls, 0); |
| | | } |
| | | |
| | | public static void start(Context context, List<String> urls, int index) { |
| | | if (urls == null || urls.isEmpty()) { |
| | | return; |
| | | } |
| | | Intent intent = new Intent(context, ImagePreviewActivity.class); |
| | | if (urls.size() > 2000) { |
| | | // 请注意:如果传输的数据量过大,会抛出此异常,并且这种异常是不能被捕获的 |
| | | // 所以当图片数量过多的时候,我们应当只显示一张,这种一般是手机图片过多导致的 |
| | | // 经过测试,传入 3121 张图片集合的时候会抛出此异常,所以保险值应当是 2000 |
| | | // android.os.TransactionTooLargeException: data parcel size 521984 bytes |
| | | urls = Collections.singletonList(urls.get(index)); |
| | | } |
| | | |
| | | if (urls instanceof ArrayList) { |
| | | intent.putExtra(INTENT_KEY_IN_IMAGE_LIST, (ArrayList<String>) urls); |
| | | } else { |
| | | intent.putExtra(INTENT_KEY_IN_IMAGE_LIST, new ArrayList<>(urls)); |
| | | } |
| | | intent.putExtra(INTENT_KEY_IN_IMAGE_INDEX, index); |
| | | if (!(context instanceof Activity)) { |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | } |
| | | context.startActivity(intent); |
| | | } |
| | | |
| | | private ImagePreviewAdapter mAdapter; |
| | | |
| | | |
| | | @Override |
| | | public int getLayoutId() { |
| | | return R.layout.image_preview_activity; |
| | | } |
| | | |
| | | @Override |
| | | public int getVariableId() { |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public void initParam() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void initView() { |
| | | mAdapter = new ImagePreviewAdapter(this); |
| | | mAdapter.setOnItemClickListener(new BaseRVAdapter.OnItemClickListener() { |
| | | @Override |
| | | public void onItemClick(RecyclerView recyclerView, View itemView, int position) { |
| | | if (isFinishing() || isDestroyed()) { |
| | | return; |
| | | } |
| | | // 单击图片退出当前的 Activity |
| | | finish(); |
| | | } |
| | | }); |
| | | binding.viewPager.setAdapter(mAdapter); |
| | | binding.viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { |
| | | @Override |
| | | public void onPageSelected(int position) { |
| | | super.onPageSelected(position); |
| | | binding.tvImagePreviewIndicator.setText((position + 1) + "/" + mAdapter.getItemCount()); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void initData() { |
| | | ArrayList<String> images = getIntent().getStringArrayListExtra(INTENT_KEY_IN_IMAGE_LIST); |
| | | if (images == null || images.isEmpty()) { |
| | | finish(); |
| | | return; |
| | | } |
| | | mAdapter.setData(images); |
| | | |
| | | if (images.size() != 1) { |
| | | binding.tvImagePreviewIndicator.setVisibility(View.VISIBLE); |
| | | int index = getIntent().getIntExtra(INTENT_KEY_IN_IMAGE_INDEX,0); |
| | | if (index < images.size()) { |
| | | binding.viewPager.setCurrentItem(index); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void initLiveDataObserve() { |
| | | |
| | | } |
| | | |
| | | @NonNull |
| | | @Override |
| | | protected ImmersionBar createStatusBarConfig() { |
| | | return super.createStatusBarConfig() |
| | | // 隐藏状态栏和导航栏 |
| | | .hideBar(BarHide.FLAG_HIDE_BAR); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isStatusBarDarkFont() { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | protected void onDestroy() { |
| | | super.onDestroy(); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.application.zhangshi_app_android.ui; |
| | | |
| | | import android.app.Application; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.08.19. 18:29 |
| | | * @desc 简单的ViewModel |
| | | */ |
| | | public class SimpleViewModel extends BaseViewModel<DataRepository>{ |
| | | public SimpleViewModel(@NonNull Application application) { |
| | | super(application); |
| | | } |
| | | |
| | | @Override |
| | | protected DataRepository initModel() { |
| | | return DataRepository.getInstance(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.application.zhangshi_app_android.ui; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.pm.ActivityInfo; |
| | | import android.os.Bundle; |
| | | import android.os.Parcel; |
| | | import android.os.Parcelable; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | |
| | | import com.android.app_base.base.view.BaseActivity; |
| | | import com.android.app_base.widget.VideoPlayerView; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.databinding.ActivityVideoPlayBinding; |
| | | import com.gyf.immersionbar.BarHide; |
| | | import com.gyf.immersionbar.ImmersionBar; |
| | | |
| | | import java.io.File; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.08.19. 20:14 |
| | | * @desc 视频播放 Activity |
| | | */ |
| | | public class VideoPlayActivity extends BaseActivity<ActivityVideoPlayBinding,SimpleViewModel> |
| | | implements VideoPlayerView.OnPlayListener { |
| | | |
| | | public static final String INTENT_KEY_PARAMETERS = "parameters"; |
| | | |
| | | private VideoPlayActivity.Builder mBuilder; |
| | | |
| | | @Override |
| | | public int getLayoutId() { |
| | | return R.layout.activity_video_play; |
| | | } |
| | | |
| | | @Override |
| | | public int getVariableId() { |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public void initParam() { |
| | | mBuilder = getIntent().getParcelableExtra(INTENT_KEY_PARAMETERS); |
| | | if (mBuilder == null) { |
| | | throw new IllegalArgumentException("are you ok?"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void initView() { |
| | | binding.videoplayerView.setLifecycleOwner(this); |
| | | binding.videoplayerView.setOnPlayListener(this); |
| | | |
| | | binding.videoplayerView.setVideoTitle(mBuilder.getVideoTitle()); |
| | | binding.videoplayerView.setVideoSource(mBuilder.getVideoSource()); |
| | | binding.videoplayerView.setGestureEnabled(mBuilder.isGestureEnabled()); |
| | | |
| | | if (mBuilder.isAutoPlay()) { |
| | | binding.videoplayerView.start(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void initData() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void initLiveDataObserve() { |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onClickBack(VideoPlayerView view) { |
| | | onBackPressed(); |
| | | } |
| | | |
| | | @Override |
| | | public void onPlayStart(VideoPlayerView view) { |
| | | int progress = mBuilder.getPlayProgress(); |
| | | if (progress > 0) { |
| | | binding.videoplayerView.setProgress(progress); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onPlayProgress(VideoPlayerView view) { |
| | | // 记录播放进度 |
| | | mBuilder.setPlayProgress(view.getProgress()); |
| | | } |
| | | |
| | | @Override |
| | | public void onPlayEnd(VideoPlayerView view) { |
| | | if (mBuilder.isLoopPlay()) { |
| | | binding.videoplayerView.setProgress(0); |
| | | binding.videoplayerView.start(); |
| | | return; |
| | | } |
| | | |
| | | if (mBuilder.isAutoOver()) { |
| | | finish(); |
| | | } |
| | | } |
| | | |
| | | @NonNull |
| | | @Override |
| | | protected ImmersionBar createStatusBarConfig() { |
| | | return super.createStatusBarConfig() |
| | | // 隐藏状态栏和导航栏 |
| | | .hideBar(BarHide.FLAG_HIDE_BAR); |
| | | } |
| | | |
| | | @Override |
| | | protected void onSaveInstanceState(@NonNull Bundle outState) { |
| | | super.onSaveInstanceState(outState); |
| | | // 保存播放进度 |
| | | outState.putParcelable(INTENT_KEY_PARAMETERS, mBuilder); |
| | | } |
| | | |
| | | @Override |
| | | protected void onRestoreInstanceState(@NonNull Bundle savedInstanceState) { |
| | | super.onRestoreInstanceState(savedInstanceState); |
| | | // 读取播放进度 |
| | | mBuilder = savedInstanceState.getParcelable(INTENT_KEY_PARAMETERS); |
| | | } |
| | | |
| | | /** 竖屏播放 */ |
| | | public static final class Portrait extends VideoPlayActivity {} |
| | | |
| | | /** 横屏播放 */ |
| | | public static final class Landscape extends VideoPlayActivity {} |
| | | |
| | | /** |
| | | * 播放参数构建 |
| | | */ |
| | | public static final class Builder implements Parcelable { |
| | | |
| | | /** 视频源 */ |
| | | private String videoSource; |
| | | /** 视频标题 */ |
| | | private String videoTitle; |
| | | |
| | | /** 播放进度 */ |
| | | private int playProgress; |
| | | /** 手势开关 */ |
| | | private boolean gestureEnabled = true; |
| | | /** 循环播放 */ |
| | | private boolean loopPlay = false; |
| | | /** 自动播放 */ |
| | | private boolean autoPlay = true; |
| | | /** 播放完关闭 */ |
| | | private boolean autoOver = true; |
| | | |
| | | /** 播放方向 */ |
| | | private int activityOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; |
| | | |
| | | public Builder() {} |
| | | |
| | | protected Builder(Parcel in) { |
| | | videoSource = in.readString(); |
| | | videoTitle = in.readString(); |
| | | activityOrientation = in.readInt(); |
| | | |
| | | playProgress = in.readInt(); |
| | | gestureEnabled = in.readByte() != 0; |
| | | loopPlay = in.readByte() != 0; |
| | | autoPlay = in.readByte() != 0; |
| | | autoOver = in.readByte() != 0; |
| | | } |
| | | |
| | | public Builder setVideoSource(File file) { |
| | | videoSource = file.getPath(); |
| | | if (videoTitle == null) { |
| | | videoTitle = file.getName(); |
| | | } |
| | | return this; |
| | | } |
| | | |
| | | public Builder setVideoSource(String url) { |
| | | videoSource = url; |
| | | return this; |
| | | } |
| | | |
| | | private String getVideoSource() { |
| | | return videoSource; |
| | | } |
| | | |
| | | public Builder setVideoTitle(String title) { |
| | | videoTitle = title; |
| | | return this; |
| | | } |
| | | |
| | | private String getVideoTitle() { |
| | | return videoTitle; |
| | | } |
| | | |
| | | public Builder setPlayProgress(int progress) { |
| | | playProgress = progress; |
| | | return this; |
| | | } |
| | | |
| | | private int getPlayProgress() { |
| | | return playProgress; |
| | | } |
| | | |
| | | public Builder setGestureEnabled(boolean enabled) { |
| | | gestureEnabled = enabled; |
| | | return this; |
| | | } |
| | | |
| | | private boolean isGestureEnabled() { |
| | | return gestureEnabled; |
| | | } |
| | | |
| | | public Builder setLoopPlay(boolean enabled) { |
| | | loopPlay = enabled; |
| | | return this; |
| | | } |
| | | |
| | | private boolean isLoopPlay() { |
| | | return loopPlay; |
| | | } |
| | | |
| | | public Builder setAutoPlay(boolean enabled) { |
| | | autoPlay = enabled; |
| | | return this; |
| | | } |
| | | |
| | | public boolean isAutoPlay() { |
| | | return autoPlay; |
| | | } |
| | | |
| | | public Builder setAutoOver(boolean enabled) { |
| | | autoOver = enabled; |
| | | return this; |
| | | } |
| | | |
| | | private boolean isAutoOver() { |
| | | return autoOver; |
| | | } |
| | | |
| | | public Builder setActivityOrientation(int orientation) { |
| | | activityOrientation = orientation; |
| | | return this; |
| | | } |
| | | |
| | | public void start(Context context) { |
| | | Intent intent = new Intent(); |
| | | switch (activityOrientation) { |
| | | case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE: |
| | | intent.setClass(context, VideoPlayActivity.Landscape.class); |
| | | break; |
| | | case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT: |
| | | intent.setClass(context, VideoPlayActivity.Portrait.class); |
| | | break; |
| | | default: |
| | | intent.setClass(context, VideoPlayActivity.class); |
| | | break; |
| | | } |
| | | |
| | | intent.putExtra(INTENT_KEY_PARAMETERS, this); |
| | | if (!(context instanceof Activity)) { |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | } |
| | | context.startActivity(intent); |
| | | } |
| | | |
| | | @Override |
| | | public int describeContents() { |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public void writeToParcel(Parcel dest, int flags) { |
| | | dest.writeString(videoSource); |
| | | dest.writeString(videoTitle); |
| | | dest.writeInt(activityOrientation); |
| | | dest.writeInt(playProgress); |
| | | dest.writeByte(gestureEnabled ? (byte) 1 : (byte) 0); |
| | | dest.writeByte(loopPlay ? (byte) 1 : (byte) 0); |
| | | dest.writeByte(autoPlay ? (byte) 1 : (byte) 0); |
| | | dest.writeByte(autoOver ? (byte) 1 : (byte) 0); |
| | | } |
| | | |
| | | public static final Parcelable.Creator<Builder> CREATOR = new Parcelable.Creator<Builder>() { |
| | | @Override |
| | | public Builder createFromParcel(Parcel source) { |
| | | return new Builder(source); |
| | | } |
| | | |
| | | @Override |
| | | public Builder[] newArray(int size) { |
| | | return new Builder[size]; |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.application.zhangshi_app_android.ui.dialog; |
| | | |
| | | import android.Manifest; |
| | | import android.animation.ValueAnimator; |
| | | import android.app.DownloadManager; |
| | | import android.app.NotificationChannel; |
| | | import android.app.NotificationManager; |
| | | import android.app.PendingIntent; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.database.Cursor; |
| | | import android.graphics.BitmapFactory; |
| | | import android.net.Uri; |
| | | import android.os.Build; |
| | | import android.os.Environment; |
| | | import android.text.method.ScrollingMovementMethod; |
| | | import android.util.Log; |
| | | import android.view.View; |
| | | import android.widget.ProgressBar; |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.core.app.NotificationCompat; |
| | | import androidx.core.content.ContextCompat; |
| | | import androidx.core.content.FileProvider; |
| | | |
| | | |
| | | import com.android.app_base.base.dialog.BaseDialog; |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.ToastUtils; |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.MyApplication; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.blankj.utilcode.util.NetworkUtils; |
| | | import com.blankj.utilcode.util.PermissionUtils; |
| | | import com.hjq.http.EasyHttp; |
| | | import com.hjq.http.listener.OnDownloadListener; |
| | | import com.hjq.http.model.HttpMethod; |
| | | |
| | | import java.io.File; |
| | | import java.util.Locale; |
| | | import java.util.Timer; |
| | | import java.util.TimerTask; |
| | | |
| | | |
| | | public final class UpdateDialog { |
| | | |
| | | public static final class Builder |
| | | extends BaseDialog.Builder<Builder> { |
| | | |
| | | private final TextView mNameView; |
| | | private final TextView mContentView; |
| | | private final ProgressBar mProgressView; |
| | | |
| | | private final TextView mUpdateView; |
| | | private final TextView mCloseView; |
| | | |
| | | /** Apk 文件 */ |
| | | private File mApkFile; |
| | | /** 文件名 */ |
| | | private String fileName; |
| | | /** 下载地址 */ |
| | | private String mDownloadUrl; |
| | | /** 文件 MD5 */ |
| | | private String mFileMd5; |
| | | /** 是否强制更新 */ |
| | | private boolean mForceUpdate; |
| | | |
| | | /** 当前是否下载中 */ |
| | | private boolean mDownloading; |
| | | /** 当前是否下载完毕 */ |
| | | private boolean mDownloadComplete; |
| | | |
| | | public Builder(Context context) { |
| | | super(context); |
| | | |
| | | setContentView(R.layout.dialog_update); |
| | | setAnimStyle(BaseDialog.ANIM_BOTTOM); |
| | | setCancelable(false); |
| | | |
| | | mNameView = findViewById(R.id.tv_update_name); |
| | | mContentView = findViewById(R.id.tv_update_content); |
| | | mProgressView = findViewById(R.id.pb_update_progress); |
| | | mUpdateView = findViewById(R.id.tv_update_update); |
| | | mCloseView = findViewById(R.id.tv_update_close); |
| | | setOnClickListener(mUpdateView, mCloseView); |
| | | |
| | | // 让 TextView 支持滚动 |
| | | mContentView.setMovementMethod(new ScrollingMovementMethod()); |
| | | } |
| | | |
| | | /** |
| | | * 设置版本名 |
| | | */ |
| | | public Builder setVersionName(CharSequence name) { |
| | | mNameView.setText(name); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * 设置更新日志 |
| | | */ |
| | | public Builder setUpdateLog(CharSequence text) { |
| | | mContentView.setText(text); |
| | | mContentView.setVisibility(text == null ? View.GONE : View.VISIBLE); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * 设置强制更新 |
| | | */ |
| | | public Builder setForceUpdate(boolean force) { |
| | | mForceUpdate = force; |
| | | mCloseView.setVisibility(force ? View.GONE : View.VISIBLE); |
| | | setCancelable(!force); |
| | | setCanceledOnTouchOutside(!force); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * 设置下载 url |
| | | */ |
| | | public Builder setDownloadUrl(String url) { |
| | | mDownloadUrl = url; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * 设置文件 md5 |
| | | */ |
| | | public Builder setFileMd5(String md5) { |
| | | mFileMd5 = md5; |
| | | return this; |
| | | } |
| | | |
| | | @Override |
| | | public void onClick(View view) { |
| | | if (view == mCloseView) { |
| | | dismiss(); |
| | | } else if (view == mUpdateView) { |
| | | fileName = getContext().getString(R.string.app_name) + "_v" + mNameView.getText().toString() + ".apk"; |
| | | // 创建要下载的文件对象 |
| | | // mApkFile = new File(getContext().getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS), fileName); |
| | | String pathname = Environment.getExternalStorageDirectory().getPath() + "/" + Environment.DIRECTORY_DOWNLOADS + "/" + fileName; |
| | | mApkFile = new File(pathname); |
| | | |
| | | if (mApkFile.isFile()) { |
| | | // 下载完毕,安装 Apk |
| | | Utils.installAPK(getContext(),fileName); |
| | | } else { |
| | | // 判断下载状态 |
| | | if (mDownloadComplete) { |
| | | // 下载完毕,安装 Apk |
| | | // installApk(); |
| | | Utils.installAPK(getContext(),fileName); |
| | | } else if (!mDownloading) { |
| | | // 没有下载,开启下载 |
| | | downloadApk(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 下载 Apk |
| | | */ |
| | | private void downloadApk() { |
| | | if (!Utils.checkNetwork()){ |
| | | ToastUtils.showShort("当前没有网络连接,请检查网络设置"); |
| | | return; |
| | | } |
| | | |
| | | // 设置对话框不能被取消 |
| | | setCancelable(false); |
| | | |
| | | // NotificationManager notificationManager = ContextCompat.getSystemService(getContext(), NotificationManager.class); |
| | | // int notificationId = getContext().getApplicationInfo().uid; |
| | | // String channelId = ""; |
| | | // // 适配 Android 8.0 通知渠道新特性 |
| | | // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
| | | // NotificationChannel channel = new NotificationChannel("update", "升级通知", NotificationManager.IMPORTANCE_LOW); |
| | | // channel.enableLights(false); |
| | | // channel.enableVibration(false); |
| | | // channel.setVibrationPattern(new long[]{0}); |
| | | // channel.setSound(null, null); |
| | | // if (notificationManager != null) { |
| | | // notificationManager.createNotificationChannel(channel); |
| | | // } |
| | | // channelId = channel.getId(); |
| | | // } |
| | | // |
| | | // NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getContext(), channelId) |
| | | // // 设置通知时间 |
| | | // .setWhen(System.currentTimeMillis()) |
| | | // // 设置通知标题 |
| | | // .setContentTitle(getContext().getString(R.string.app_name)) |
| | | // // 设置通知小图标 |
| | | // .setSmallIcon(R.mipmap.ic_logo) |
| | | // // 设置通知大图标 |
| | | // .setLargeIcon(BitmapFactory.decodeResource(getContext().getResources(), R.mipmap.ic_logo)) |
| | | // // 设置通知静音 |
| | | // .setDefaults(NotificationCompat.FLAG_ONLY_ALERT_ONCE) |
| | | // // 设置震动频率 |
| | | // .setVibrate(new long[]{0}) |
| | | // // 设置声音文件 |
| | | // .setSound(null) |
| | | // // 设置通知的优先级 |
| | | // .setPriority(NotificationCompat.PRIORITY_DEFAULT); |
| | | |
| | | |
| | | //创建下载任务,downloadUrl就是下载链接 |
| | | DownloadManager.Request request = new DownloadManager.Request(Uri.parse(mDownloadUrl)); |
| | | request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE);//下载进行中和下载完成的通知栏是否显示 |
| | | request.allowScanningByMediaScanner();//设置允许被扫描到 |
| | | request.setVisibleInDownloadsUi(true);//下载的文件可以被系统的Downloads应用扫描到并管理 |
| | | |
| | | request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName); //指定下载路径和下载文件名 |
| | | final DownloadManager downloadManager = (DownloadManager) MyApplication.getInstance().getSystemService(Context.DOWNLOAD_SERVICE);//获取下载管理器 |
| | | final long downloadID = downloadManager.enqueue(request);//将下载任务加入下载队列,否则不会进行下载 |
| | | |
| | | final DownloadManager.Query query = new DownloadManager.Query(); |
| | | query.setFilterById(downloadID);//筛选下载任务,传入任务ID,可变参数 |
| | | |
| | | // 标记为下载中 |
| | | mDownloading = true; |
| | | // 标记成未下载完成 |
| | | mDownloadComplete = false; |
| | | // 后台更新 |
| | | mCloseView.setVisibility(View.GONE); |
| | | // 显示进度条 |
| | | mProgressView.setVisibility(View.VISIBLE); |
| | | mUpdateView.setText("正在下载.."); |
| | | |
| | | final Timer mTimer = new Timer(); |
| | | mTimer.schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Cursor c = null; |
| | | try { |
| | | c = downloadManager.query(query); |
| | | if (c != null) { |
| | | if (c.moveToFirst()) { |
| | | // 下载状态 |
| | | int status = c.getInt(c.getColumnIndexOrThrow(DownloadManager.COLUMN_STATUS)); |
| | | // 已下载的字节大小 |
| | | final long downloadedSoFar = c.getLong(c.getColumnIndexOrThrow(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR)); |
| | | // 下载文件的总字节大小 |
| | | final long totalSize = c.getLong(c.getColumnIndexOrThrow(DownloadManager.COLUMN_TOTAL_SIZE_BYTES)); |
| | | int progress = (int) (downloadedSoFar * 100 / totalSize); |
| | | switch (status) { |
| | | case DownloadManager.STATUS_PAUSED: |
| | | Log.d("APPUpdate", "下载暂停:" + fileName); |
| | | case DownloadManager.STATUS_PENDING: |
| | | Log.d("APPUpdate", "下载延迟:" + fileName); |
| | | case DownloadManager.STATUS_RUNNING: |
| | | Log.d("APPUpdate", "正在下载:" + fileName); |
| | | // ValueAnimator animator = ValueAnimator.ofInt(mProgressView.getProgress(), progress); |
| | | // animator.setDuration(100); |
| | | // animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { |
| | | // @Override |
| | | // public void onAnimationUpdate(ValueAnimator animation) { |
| | | // int currentValue = (int) animation.getAnimatedValue(); |
| | | // |
| | | // } |
| | | // }); |
| | | // animator.start(); |
| | | mUpdateView.setText(String.format(Locale.CHINA,"下载中 %d%%", progress)); |
| | | mProgressView.setProgress(progress); |
| | | // 更新下载通知 |
| | | // notificationManager.notify(notificationId, notificationBuilder |
| | | // // 设置通知的文本 |
| | | // .setContentText(String.format(Locale.CHINA,"下载中 %d%%", progress)) |
| | | // // 设置下载的进度 |
| | | // .setProgress(100, progress, false) |
| | | // // 设置点击通知后是否自动消失 |
| | | // .setAutoCancel(false) |
| | | // // 是否正在交互中 |
| | | // .setOngoing(true) |
| | | // // 重新创建新的通知对象 |
| | | // .build()); |
| | | break; |
| | | case DownloadManager.STATUS_SUCCESSFUL: |
| | | Log.d("APPUpdate", "下载完成:" + fileName); |
| | | mTimer.cancel(); |
| | | dismiss(); |
| | | |
| | | |
| | | // if (notificationManager != null) { |
| | | //// // 显示下载成功通知 |
| | | // notificationManager.notify(notificationId, notificationBuilder |
| | | // // 设置通知的文本 |
| | | // .setContentText(String.format(Locale.CHINA,"下载中 %d%%",100)) |
| | | // // 设置下载的进度 |
| | | // .setProgress(100, 100, false) |
| | | // // 设置通知点击之后的意图 |
| | | // .setContentIntent(PendingIntent.getActivity(getContext(), 1, getInstallIntent(), PendingIntent.FLAG_IMMUTABLE)) |
| | | // // 设置点击通知后是否自动消失 |
| | | // .setAutoCancel(true) |
| | | // // 是否正在交互中 |
| | | // .setOngoing(false) |
| | | // .build()); |
| | | // } |
| | | mUpdateView.setText("下载完成,点击安装"); |
| | | // 标记成下载完成 |
| | | mDownloadComplete = true; |
| | | // 标记当前不是下载中 |
| | | mDownloading = false; |
| | | // 如果当前不是强制更新,对话框就恢复成可取消状态 |
| | | if (!mForceUpdate) { |
| | | setCancelable(true); |
| | | } |
| | | // 安装 Apk |
| | | // installApk(); |
| | | Utils.installAPK(getContext(), fileName); |
| | | break; |
| | | case DownloadManager.STATUS_FAILED: |
| | | Log.d("APPUpdate", "下载失败:" + fileName); |
| | | // if (notificationManager != null) { |
| | | // // 清除通知 |
| | | // notificationManager.cancel(notificationId); |
| | | // } |
| | | mUpdateView.setText("下载失败,点击重试"); |
| | | // 删除下载的文件 |
| | | mApkFile.delete(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } finally { |
| | | if (c != null) { |
| | | c.close(); |
| | | } |
| | | } |
| | | } |
| | | }, 0, 1000); |
| | | } |
| | | |
| | | /** |
| | | * 安装 Apk |
| | | */ |
| | | private void installApk() { |
| | | getContext().startActivity(getInstallIntent()); |
| | | } |
| | | |
| | | /** |
| | | * 获取安装意图 |
| | | */ |
| | | private Intent getInstallIntent() { |
| | | Intent intent = new Intent(); |
| | | intent.setAction(Intent.ACTION_VIEW); |
| | | Uri uri; |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
| | | uri = FileProvider.getUriForFile(getContext(), getContext().getApplicationContext().getPackageName() + ".fileprovider", mApkFile); |
| | | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); |
| | | } else { |
| | | uri = Uri.fromFile(mApkFile); |
| | | } |
| | | intent.setDataAndType(uri, "application/vnd.android.package-archive"); |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | return intent; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import static com.blankj.utilcode.util.StringUtils.getString; |
| | | |
| | | import android.animation.Animator; |
| | | import android.animation.ValueAnimator; |
| | | import android.annotation.SuppressLint; |
| | | import android.app.DownloadManager; |
| | | import android.content.Context; |
| | |
| | | public void run() { |
| | | // TODO Auto-generated method stub |
| | | progressBar.setProgress(dl_progress); |
| | | tv_pro.setText((downloadBytes * 100 / totalBytes) + "%"); |
| | | tv_pro_percent.setText((downloadBytes * 100 / totalBytes) + "/100"); |
| | | ValueAnimator animator = ValueAnimator.ofInt(progressBar.getProgress(), dl_progress); |
| | | animator.setDuration(100); |
| | | animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { |
| | | @Override |
| | | public void onAnimationUpdate(ValueAnimator animation) { |
| | | int currentValue = (int) animation.getAnimatedValue(); |
| | | progressBar.setProgress(currentValue); |
| | | tv_pro.setText(currentValue + "%"); |
| | | tv_pro_percent.setText(currentValue + "/100"); |
| | | } |
| | | }); |
| | | animator.start(); |
| | | // tv_pro.setText((downloadBytes * 100 / totalBytes) + "%"); |
| | | // tv_pro_percent.setText((downloadBytes * 100 / totalBytes) + "/100"); |
| | | } |
| | | }; |
| | | |
| | |
| | | DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); |
| | | request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);//下载进行中和下载完成的通知栏是否显示 |
| | | //用于设置下载时时候在状态栏显示通知信息 |
| | | request.setNotificationVisibility(request.VISIBILITY_VISIBLE); |
| | | request.allowScanningByMediaScanner();//设置允许被扫描到 |
| | | request.setVisibleInDownloadsUi(true);//下载的文件可以被系统的Downloads应用扫描到并管理 |
| | | |
| | |
| | | package com.application.zhangshi_app_android.ui.function; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.ClipData; |
| | | import android.content.Intent; |
| | | import android.net.Uri; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.EditText; |
| | | import android.widget.PopupWindow; |
| | | |
| | | import androidx.activity.result.ActivityResult; |
| | | import androidx.activity.result.ActivityResultCallback; |
| | | import androidx.activity.result.ActivityResultLauncher; |
| | | import androidx.activity.result.contract.ActivityResultContracts; |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.android.app_base.base.dialog.BaseDialog; |
| | | import com.android.app_base.base.dialog.UIDialog; |
| | | import com.android.app_base.base.dialog.WaitDialog; |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.GetFilePathFromUri; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.bean.AnnualHealthStatusBean; |
| | | import com.application.zhangshi_app_android.bean.CertificateOfHonorBean; |
| | | import com.application.zhangshi_app_android.bean.PersonalNotepadBean; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityAnnualHealthStatusDetailBinding; |
| | | import com.application.zhangshi_app_android.databinding.ActivityCertificateOfHonorDetailBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | import com.github.gzuliyujiang.wheelpicker.DatePicker; |
| | | import com.github.gzuliyujiang.wheelpicker.OptionPicker; |
| | | import com.github.gzuliyujiang.wheelpicker.contract.OnDatePickedListener; |
| | | import com.github.gzuliyujiang.wheelpicker.contract.OnOptionPickedListener; |
| | | import com.hjq.bar.TitleBar; |
| | | import com.luck.picture.lib.entity.LocalMedia; |
| | | import com.luck.picture.lib.interfaces.OnResultCallbackListener; |
| | |
| | | */ |
| | | public class AnnualHealthStatusDetailActivity extends DLBaseActivity<ActivityAnnualHealthStatusDetailBinding,AnnualHealthStatusDetailActivityViewModel> { |
| | | |
| | | private ImageRvAdapter adapter; |
| | | private ElectronicFileAddAdapter adapter; |
| | | private BaseDialog mWaitDialog; |
| | | private ActivityResultLauncher<Intent> activityResultLauncher; |
| | | |
| | | private int type;// 0 查看可修改删除 1 新增 2 直接修改 |
| | | private PopupWindow popupWindow; |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | | View footerView = View.inflate(this,R.layout.item_image_footer,null); |
| | | binding.rvImage.addFooterView(footerView); |
| | | binding.rvImage.requestLayout(); |
| | | footerView.setOnClickListener(new View.OnClickListener() { |
| | | adapter.setItemAndAddClickListener(new ElectronicFileAddAdapter.OnItemAndAddClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 9, new OnResultCallbackListener<LocalMedia>() { |
| | | public void onItemClick(View v, int position) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onAddClick() { |
| | | OptionPicker picker = getOptionPicker(Arrays.asList("图片视频","其他文件")); |
| | | picker.setTitle("选择文件类型"); |
| | | picker.setOnOptionPickedListener(new OnOptionPickedListener() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | String path = media.getRealPath(); |
| | | File file = new File(path); |
| | | if (file.exists()) { |
| | | viewModel.uploadFile(file); |
| | | } |
| | | public void onOptionPicked(int position, Object item) { |
| | | if (item.equals("图片视频")) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 0,9, new OnResultCallbackListener<LocalMedia>() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | String path = media.getRealPath(); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | AnnualHealthStatusBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | Intent intent = new Intent(Intent.ACTION_GET_CONTENT); |
| | | // Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); |
| | | intent.setType("*/*"); // 限制文件类型 |
| | | intent.addCategory(Intent.CATEGORY_OPENABLE); // 添加 CATEGORY_OPENABLE 分类,告诉系统要选择的内容可以被打开,这样系统会过滤掉不能被应用打开的文件,以提供更好的用户体验。 |
| | | intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); // 允许多选 |
| | | activityResultLauncher.launch(intent); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | picker.show(); |
| | | |
| | | } |
| | | }); |
| | | |
| | | adapter.setOnChildClickListener(R.id.iv_delete, new BaseRVAdapter.OnChildClickListener() { |
| | | @Override |
| | | public void onChildClick(RecyclerView recyclerView, View childView, int position) { |
| | |
| | | picker.show(); |
| | | } |
| | | }); |
| | | activityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() { |
| | | @Override |
| | | public void onActivityResult(ActivityResult result) { |
| | | if (result.getResultCode() == Activity.RESULT_OK) { |
| | | if (result.getData() == null){ |
| | | return; |
| | | } |
| | | // 获取选中的多个文件的 URI |
| | | ClipData clipData = result.getData().getClipData(); |
| | | if (clipData != null) { |
| | | int itemCount = clipData.getItemCount(); |
| | | for (int i = 0; i < itemCount; i++) { |
| | | Uri uri = clipData.getItemAt(i).getUri(); |
| | | // 使用选中的文件 URI 进行后续操作,比如读取文件内容等 |
| | | String path = GetFilePathFromUri.getFileAbsolutePath(getSelfActivity(),uri); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | AnnualHealthStatusBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | }else { |
| | | // 获取选中的单个文件的 URI |
| | | Uri selectedFileUri = result.getData().getData(); |
| | | String path = GetFilePathFromUri.getFileAbsolutePath(getSelfActivity(),selectedFileUri); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | AnnualHealthStatusBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | |
| | | viewModel.update(); |
| | | }); |
| | | } |
| | | binding.rvImage.getFooterViews().forEach(new Consumer<View>() { |
| | | @Override |
| | | public void accept(View view) { |
| | | view.setVisibility(View.VISIBLE); |
| | | } |
| | | }); |
| | | setIsEdited(true); |
| | | }else { |
| | | binding.ivOperate.setOnClickListener(v -> { |
| | | popupWindow.showAsDropDown(binding.ivOperate,-ScreenSizeUtils.dip2px(this,85) +binding.ivOperate.getWidth(),0); |
| | | }); |
| | | binding.rvImage.getFooterViews().forEach(new Consumer<View>() { |
| | | @Override |
| | | public void accept(View view) { |
| | | view.setVisibility(View.GONE); |
| | | } |
| | | }); |
| | | setIsEdited(false); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogLoading() { |
| | | if (mWaitDialog == null) { |
| | | mWaitDialog = new WaitDialog.Builder(this) |
| | | // 消息文本可以不用填写 |
| | | .setMessage("正在上传") |
| | | .create(); |
| | | } |
| | | if (!mWaitDialog.isShowing()) { |
| | | mWaitDialog.show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogDismiss() { |
| | | if (mWaitDialog != null && mWaitDialog.isShowing()) { |
| | | mWaitDialog.dismiss(); |
| | | mWaitDialog = null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onLeftClick(TitleBar titleBar) { |
| | | finish(); |
| | | } |
| | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.lifecycle.MutableLiveData; |
| | | |
| | | import com.android.app_base.base.StateViewEnum; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.android.app_base.utils.rxbus.RxBus; |
| | | import com.application.zhangshi_app_android.bean.AnnualHealthStatusBean; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.UploadFileResponseBean; |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import io.reactivex.Observable; |
| | | import io.reactivex.ObservableSource; |
| | | import io.reactivex.Observer; |
| | | import io.reactivex.disposables.Disposable; |
| | | import io.reactivex.functions.Action; |
| | | import io.reactivex.functions.Consumer; |
| | | import io.reactivex.functions.Function; |
| | | import okhttp3.MediaType; |
| | | import okhttp3.MultipartBody; |
| | | import okhttp3.RequestBody; |
| | |
| | | |
| | | private MutableLiveData<AnnualHealthStatusBean> beanLiveData; |
| | | private MutableLiveData<Boolean> typeLiveData;//true 编辑状态 false 展示状态 |
| | | private final List<String> uploadFileList = new ArrayList<>();//需要上传的文件列表 |
| | | |
| | | |
| | | public AnnualHealthStatusDetailActivityViewModel(@NonNull Application application) { |
| | | super(application); |
| | |
| | | * 添加 |
| | | */ |
| | | public void add() { |
| | | System.out.println(beanLiveData.getValue()); |
| | | model.addAnnualHealthStatus(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | if (uploadFileList.size() > 0) { |
| | | List<Observable<String>> observables = new ArrayList<>(); |
| | | for (String path : uploadFileList) { |
| | | File file = new File(path); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | Observable<String> uploadObservable = model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<String>>() { |
| | | @Override |
| | | public ObservableSource<String> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | if (resultData.getCode() == CODE_SUCCESS) { |
| | | AnnualHealthStatusBean bean = getBeanLiveData().getValue(); |
| | | if (bean != null) { |
| | | String urls = bean.getUrl(); |
| | | //替换图片地址 |
| | | urls = urls.replace(path, resultData.getData().getUrl()); |
| | | bean.setUrl(urls); |
| | | beanLiveData.postValue(bean); |
| | | } |
| | | return Observable.just(path); |
| | | } else { |
| | | return Observable.error(new Exception(resultData.getMsg())); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | observables.add(uploadObservable); |
| | | } |
| | | Observable.zip(observables, result -> result) |
| | | .flatMap(new Function<Object[], Observable<ResultData<String>>>() { |
| | | @Override |
| | | public Observable<ResultData<String>> apply(Object[] objects) throws Exception { |
| | | //移除已经上传的文件 |
| | | //把objects数组转换成list,然后移除 |
| | | for (Object object : objects) { |
| | | uploadFileList.remove((String) object); |
| | | } |
| | | return model.addAnnualHealthStatus(beanLiveData.getValue()); |
| | | } |
| | | } |
| | | }) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS) { |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | } else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | model.addAnnualHealthStatus(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | /** |
| | | * 删除 |
| | |
| | | * 修改 |
| | | */ |
| | | public void update() { |
| | | model.updateAnnualHealthStatus(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 上传电子文件 |
| | | */ |
| | | public void uploadFile(File file) { |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | model.uploadFile(body) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<UploadFileResponseBean>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<UploadFileResponseBean> resultData) { |
| | | if (resultData.getCode() == CODE_SUCCESS){ |
| | | AnnualHealthStatusBean bean = beanLiveData.getValue(); |
| | | String url; |
| | | if (bean != null){ |
| | | url = bean.getUrl(); |
| | | if (url == null){ |
| | | url = resultData.getData().getUrl(); |
| | | if (uploadFileList.size() > 0){ |
| | | List<Observable<String>> observables = new ArrayList<>(); |
| | | for (String path : uploadFileList) { |
| | | File file = new File(path); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | Observable<String> uploadObservable = model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<String>>() { |
| | | @Override |
| | | public ObservableSource<String> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | if (resultData.getCode() == CODE_SUCCESS){ |
| | | AnnualHealthStatusBean bean = getBeanLiveData().getValue(); |
| | | if (bean != null){ |
| | | String urls = bean.getUrl(); |
| | | //替换图片地址 |
| | | urls = urls.replace(path,resultData.getData().getUrl()); |
| | | bean.setUrl(urls); |
| | | beanLiveData.postValue(bean); |
| | | } |
| | | return Observable.just(path); |
| | | }else { |
| | | url = url + "," + resultData.getData().getUrl(); |
| | | return Observable.error(new Exception(resultData.getMsg())); |
| | | } |
| | | bean.setUrl(url); |
| | | beanLiveData.postValue(bean); |
| | | } |
| | | }else { |
| | | messageLiveData.postValue(resultData.getMsg()); |
| | | }); |
| | | |
| | | observables.add(uploadObservable); |
| | | } |
| | | Observable.zip(observables,result -> result) |
| | | .flatMap(new Function<Object[], Observable<ResultData<String>>>() { |
| | | @Override |
| | | public Observable<ResultData<String>> apply(Object[] objects) throws Exception { |
| | | //移除已经上传的文件 |
| | | //把objects数组转换成list,然后移除 |
| | | for (Object object : objects) { |
| | | uploadFileList.remove((String) object); |
| | | } |
| | | return model.updateAnnualHealthStatus(beanLiveData.getValue()); |
| | | } |
| | | } |
| | | }) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | model.updateAnnualHealthStatus(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | public MutableLiveData<Boolean> getTypeLiveData() { |
| | | if (typeLiveData == null){ |
| | | typeLiveData = new MutableLiveData<>(); |
| | |
| | | public void setBeanLiveData(MutableLiveData<AnnualHealthStatusBean> beanLiveData) { |
| | | this.beanLiveData = beanLiveData; |
| | | } |
| | | |
| | | public List<String> getUploadFileList() { |
| | | return uploadFileList; |
| | | } |
| | | |
| | | public void addUploadFile(String url) { |
| | | uploadFileList.add(url); |
| | | } |
| | | } |
| | |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.bean.CertificateOfHonorBean; |
| | | import com.application.zhangshi_app_android.bean.HundredWishBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityCertificateOfHonorDetailBinding; |
| | | import com.application.zhangshi_app_android.databinding.ActivityHundredWishDetailBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | |
| | | */ |
| | | public class CertificateOfHonorDetailActivity extends DLBaseActivity<ActivityCertificateOfHonorDetailBinding,CertificateOfHonorDetailActivityViewModel> { |
| | | |
| | | private ImageRvAdapter adapter; |
| | | private ElectronicFileAddAdapter adapter; |
| | | |
| | | @Override |
| | | public int getLayoutId() { |
| | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | |
| | | package com.application.zhangshi_app_android.ui.function; |
| | | |
| | | import androidx.appcompat.app.AppCompatActivity; |
| | | import androidx.activity.result.ActivityResult; |
| | | import androidx.activity.result.ActivityResultCallback; |
| | | import androidx.activity.result.ActivityResultLauncher; |
| | | import androidx.activity.result.contract.ActivityResultContracts; |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import android.os.Bundle; |
| | | import android.app.Activity; |
| | | import android.content.ClipData; |
| | | import android.content.Intent; |
| | | import android.net.Uri; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.EditText; |
| | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.android.app_base.base.dialog.BaseDialog; |
| | | import com.android.app_base.base.dialog.UIDialog; |
| | | import com.android.app_base.base.dialog.WaitDialog; |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.GetFilePathFromUri; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.bean.CleanStorageBean; |
| | | import com.application.zhangshi_app_android.bean.LittleDoctorBean; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityCleanStorageDetailBinding; |
| | | import com.application.zhangshi_app_android.databinding.ActivityLittleDoctorDetailBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | import com.github.gzuliyujiang.wheelpicker.OptionPicker; |
| | | import com.github.gzuliyujiang.wheelpicker.contract.OnOptionPickedListener; |
| | | import com.luck.picture.lib.entity.LocalMedia; |
| | | import com.luck.picture.lib.interfaces.OnResultCallbackListener; |
| | | |
| | |
| | | import java.util.function.Consumer; |
| | | |
| | | public class CleanStorageDetailActivity extends DLBaseActivity<ActivityCleanStorageDetailBinding,CleanStorageDetailActivityViewModel> { |
| | | private ImageRvAdapter adapter; |
| | | private ElectronicFileAddAdapter adapter; |
| | | private BaseDialog mWaitDialog; |
| | | private ActivityResultLauncher<Intent> activityResultLauncher; |
| | | private int type;// 0 查看可修改删除 1 新增 2 直接修改 |
| | | private PopupWindow popupWindow; |
| | | |
| | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | | View footerView = View.inflate(this,R.layout.item_image_footer,null); |
| | | binding.rvImage.addFooterView(footerView); |
| | | binding.rvImage.requestLayout(); |
| | | footerView.setOnClickListener(new View.OnClickListener() { |
| | | adapter.setItemAndAddClickListener(new ElectronicFileAddAdapter.OnItemAndAddClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 9, new OnResultCallbackListener<LocalMedia>() { |
| | | public void onItemClick(View v, int position) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onAddClick() { |
| | | OptionPicker picker = getOptionPicker(Arrays.asList("图片视频","其他文件")); |
| | | picker.setTitle("选择文件类型"); |
| | | picker.setOnOptionPickedListener(new OnOptionPickedListener() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | String path = media.getRealPath(); |
| | | File file = new File(path); |
| | | if (file.exists()) { |
| | | viewModel.uploadFile(file); |
| | | } |
| | | public void onOptionPicked(int position, Object item) { |
| | | if (item.equals("图片视频")) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 0,9, new OnResultCallbackListener<LocalMedia>() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | String path = media.getRealPath(); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | CleanStorageBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | Intent intent = new Intent(Intent.ACTION_GET_CONTENT); |
| | | // Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); |
| | | intent.setType("*/*"); // 限制文件类型 |
| | | intent.addCategory(Intent.CATEGORY_OPENABLE); // 添加 CATEGORY_OPENABLE 分类,告诉系统要选择的内容可以被打开,这样系统会过滤掉不能被应用打开的文件,以提供更好的用户体验。 |
| | | intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); // 允许多选 |
| | | activityResultLauncher.launch(intent); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | picker.show(); |
| | | |
| | | } |
| | | }); |
| | | adapter.setOnChildClickListener(R.id.iv_delete, new BaseRVAdapter.OnChildClickListener() { |
| | |
| | | viewModel.getTypeLiveData().postValue(false); |
| | | }else if (type == 2){ |
| | | viewModel.getTypeLiveData().postValue(true); |
| | | |
| | | } |
| | | activityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() { |
| | | @Override |
| | | public void onActivityResult(ActivityResult result) { |
| | | if (result.getResultCode() == Activity.RESULT_OK) { |
| | | if (result.getData() == null){ |
| | | return; |
| | | } |
| | | // 获取选中的多个文件的 URI |
| | | ClipData clipData = result.getData().getClipData(); |
| | | if (clipData != null) { |
| | | int itemCount = clipData.getItemCount(); |
| | | for (int i = 0; i < itemCount; i++) { |
| | | Uri uri = clipData.getItemAt(i).getUri(); |
| | | // 使用选中的文件 URI 进行后续操作,比如读取文件内容等 |
| | | String path = GetFilePathFromUri.getFileAbsolutePath(getSelfActivity(),uri); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | CleanStorageBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | }else { |
| | | // 获取选中的单个文件的 URI |
| | | Uri selectedFileUri = result.getData().getData(); |
| | | String path = GetFilePathFromUri.getFileAbsolutePath(getSelfActivity(),selectedFileUri); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | CleanStorageBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | |
| | | viewModel.update(); |
| | | }); |
| | | } |
| | | binding.rvImage.getFooterViews().forEach(new Consumer<View>() { |
| | | @Override |
| | | public void accept(View view) { |
| | | view.setVisibility(View.VISIBLE); |
| | | } |
| | | }); |
| | | setIsEdited(true); |
| | | }else { |
| | | binding.ivOperate.setOnClickListener(v -> { |
| | | popupWindow.showAsDropDown(binding.ivOperate,-ScreenSizeUtils.dip2px(this,85) +binding.ivOperate.getWidth(),0); |
| | | }); |
| | | binding.rvImage.getFooterViews().forEach(new Consumer<View>() { |
| | | @Override |
| | | public void accept(View view) { |
| | | view.setVisibility(View.GONE); |
| | | } |
| | | }); |
| | | setIsEdited(false); |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | protected void dialogLoading() { |
| | | if (mWaitDialog == null) { |
| | | mWaitDialog = new WaitDialog.Builder(this) |
| | | // 消息文本可以不用填写 |
| | | .setMessage("正在上传") |
| | | .create(); |
| | | } |
| | | if (!mWaitDialog.isShowing()) { |
| | | mWaitDialog.show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogDismiss() { |
| | | if (mWaitDialog != null && mWaitDialog.isShowing()) { |
| | | mWaitDialog.dismiss(); |
| | | mWaitDialog = null; |
| | | } |
| | | } |
| | | } |
| | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.lifecycle.MutableLiveData; |
| | | |
| | | import com.android.app_base.base.StateViewEnum; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.android.app_base.utils.rxbus.RxBus; |
| | | import com.application.zhangshi_app_android.bean.CleanStorageBean; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.LittleDoctorBean; |
| | | import com.application.zhangshi_app_android.bean.UploadFileResponseBean; |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import io.reactivex.Observable; |
| | | import io.reactivex.ObservableSource; |
| | | import io.reactivex.Observer; |
| | | import io.reactivex.disposables.Disposable; |
| | | import io.reactivex.functions.Action; |
| | | import io.reactivex.functions.Consumer; |
| | | import io.reactivex.functions.Function; |
| | | import okhttp3.MediaType; |
| | | import okhttp3.MultipartBody; |
| | | import okhttp3.RequestBody; |
| | |
| | | |
| | | private MutableLiveData<CleanStorageBean> beanLiveData; |
| | | private MutableLiveData<Boolean> typeLiveData;//true 编辑状态 false 展示状态 |
| | | private final List<String> uploadFileList = new ArrayList<>();//需要上传的文件列表 |
| | | |
| | | public CleanStorageDetailActivityViewModel(@NonNull Application application) { |
| | | super(application); |
| | |
| | | * 增加保洁收纳 |
| | | */ |
| | | public void add() { |
| | | model.addCleanStorage(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | if (uploadFileList.size() > 0) { |
| | | List<Observable<String>> observables = new ArrayList<>(); |
| | | for (String path : uploadFileList) { |
| | | File file = new File(path); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | Observable<String> uploadObservable = model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<String>>() { |
| | | @Override |
| | | public ObservableSource<String> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | if (resultData.getCode() == CODE_SUCCESS) { |
| | | CleanStorageBean bean = getBeanLiveData().getValue(); |
| | | if (bean != null) { |
| | | String urls = bean.getUrl(); |
| | | //替换图片地址 |
| | | urls = urls.replace(path, resultData.getData().getUrl()); |
| | | bean.setUrl(urls); |
| | | getBeanLiveData().postValue(bean); |
| | | } |
| | | return Observable.just(path); |
| | | } else { |
| | | return Observable.error(new Exception(resultData.getMsg())); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | observables.add(uploadObservable); |
| | | } |
| | | Observable.zip(observables, result -> result) |
| | | .flatMap(new Function<Object[], Observable<ResultData<String>>>() { |
| | | @Override |
| | | public Observable<ResultData<String>> apply(Object[] objects) throws Exception { |
| | | //移除已经上传的文件 |
| | | //把objects数组转换成list,然后移除 |
| | | for (Object object : objects) { |
| | | uploadFileList.remove((String) object); |
| | | } |
| | | return model.addCleanStorage(beanLiveData.getValue()); |
| | | } |
| | | } |
| | | }) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS) { |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | } else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | model.addCleanStorage(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | /** |
| | | * 删除保洁收纳 |
| | |
| | | * 修改小医生 |
| | | */ |
| | | public void update() { |
| | | model.updateCleanStorage(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 上传电子文件 |
| | | */ |
| | | public void uploadFile(File file) { |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | model.uploadFile(body) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<UploadFileResponseBean>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<UploadFileResponseBean> resultData) { |
| | | if (resultData.getCode() == CODE_SUCCESS){ |
| | | CleanStorageBean bean = beanLiveData.getValue(); |
| | | String url; |
| | | if (bean != null){ |
| | | url = bean.getUrl(); |
| | | if (url == null){ |
| | | url = resultData.getData().getUrl(); |
| | | if (uploadFileList.size() > 0){ |
| | | List<Observable<String>> observables = new ArrayList<>(); |
| | | for (String path : uploadFileList) { |
| | | File file = new File(path); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | Observable<String> uploadObservable = model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<String>>() { |
| | | @Override |
| | | public ObservableSource<String> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | if (resultData.getCode() == CODE_SUCCESS){ |
| | | CleanStorageBean bean = getBeanLiveData().getValue(); |
| | | if (bean != null){ |
| | | String urls = bean.getUrl(); |
| | | //替换图片地址 |
| | | urls = urls.replace(path,resultData.getData().getUrl()); |
| | | bean.setUrl(urls); |
| | | getBeanLiveData().postValue(bean); |
| | | } |
| | | return Observable.just(path); |
| | | }else { |
| | | url = url + "," + resultData.getData().getUrl(); |
| | | return Observable.error(new Exception(resultData.getMsg())); |
| | | } |
| | | bean.setUrl(url); |
| | | beanLiveData.postValue(bean); |
| | | } |
| | | }else { |
| | | messageLiveData.postValue(resultData.getMsg()); |
| | | }); |
| | | |
| | | observables.add(uploadObservable); |
| | | } |
| | | Observable.zip(observables,result -> result) |
| | | .flatMap(new Function<Object[], Observable<ResultData<String>>>() { |
| | | @Override |
| | | public Observable<ResultData<String>> apply(Object[] objects) throws Exception { |
| | | //移除已经上传的文件 |
| | | //把objects数组转换成list,然后移除 |
| | | for (Object object : objects) { |
| | | uploadFileList.remove((String) object); |
| | | } |
| | | return model.updateCleanStorage(beanLiveData.getValue()); |
| | | } |
| | | } |
| | | }) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | model.updateCleanStorage(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | public MutableLiveData<Boolean> getTypeLiveData() { |
| | | if (typeLiveData == null){ |
| | | typeLiveData = new MutableLiveData<>(); |
| | |
| | | public void setBeanLiveData(MutableLiveData<CleanStorageBean> beanLiveData) { |
| | | this.beanLiveData = beanLiveData; |
| | | } |
| | | |
| | | public List<String> getUploadFileList() { |
| | | return uploadFileList; |
| | | } |
| | | |
| | | public void addUploadFile(String url) { |
| | | uploadFileList.add(url); |
| | | } |
| | | } |
| | |
| | | import androidx.databinding.library.baseAdapters.BR; |
| | | import androidx.lifecycle.Observer; |
| | | |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.android.app_base.utils.Utils; |
| | | import com.android.app_base.utils.rxbus.MessageEvent; |
| | | import com.android.app_base.utils.rxbus.RxBus; |
| | | import com.android.app_base.widget.LinearItemDecoration; |
| | | import com.application.zhangshi_app_android.R; |
| | | |
| | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import io.reactivex.functions.Consumer; |
| | | |
| | | /** |
| | | * @author Gss |
| | |
| | | mOperatePopupWindow = initPopUpWindow(View.inflate(this,R.layout.pop_contacts_import,null)); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.layout_contacts_import).setOnClickListener(v -> { |
| | | mOperatePopupWindow.dismiss(); |
| | | //TODO 导入通讯录 |
| | | AppManager.getAppManager().startActivity(ContactsImportActivity.class); |
| | | }); |
| | | //点击弹出操作弹窗 |
| | | binding.ivOperate.setOnClickListener(v -> { |
| | |
| | | adapter.addItem(bean); |
| | | } |
| | | }); |
| | | RxBus.getInstance().toObservable(this, MessageEvent.class) |
| | | .subscribe(new Consumer<MessageEvent>() { |
| | | @Override |
| | | public void accept(MessageEvent event) throws Exception { |
| | | if (event.getMessageEventCode() == MessageEvent.EVENT_REFRESH_DATA){ |
| | | viewModel.getContacts(); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
New file |
| | |
| | | package com.application.zhangshi_app_android.ui.function; |
| | | |
| | | import android.Manifest; |
| | | import android.content.ContentResolver; |
| | | import android.content.ContentUris; |
| | | import android.database.Cursor; |
| | | import android.net.Uri; |
| | | import android.provider.ContactsContract; |
| | | import android.view.View; |
| | | |
| | | import com.android.app_base.base.dialog.BaseDialog; |
| | | import com.android.app_base.base.dialog.TipsDialog; |
| | | import com.android.app_base.base.dialog.UIDialog; |
| | | import com.android.app_base.base.dialog.WaitDialog; |
| | | import com.android.app_base.base.view.BaseActivity; |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.ToastUtils; |
| | | import com.android.app_base.utils.rxbus.MessageEvent; |
| | | import com.android.app_base.utils.rxbus.RxBus; |
| | | import com.android.app_base.widget.LinearItemDecoration; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ContactsRvAdapter; |
| | | import com.application.zhangshi_app_android.bean.ContactsBean; |
| | | import com.application.zhangshi_app_android.bean.ContactsDetailBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityContactsImportBinding; |
| | | import com.blankj.utilcode.util.PermissionUtils; |
| | | import com.hjq.bar.TitleBar; |
| | | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.File; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.net.URI; |
| | | import java.net.URISyntaxException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.08.01. 13:44 |
| | | * @desc 通讯录导入 Activity |
| | | */ |
| | | public class ContactsImportActivity extends BaseActivity<ActivityContactsImportBinding,ContactsImportActivityViewModel> { |
| | | private ContactsRvAdapter adapter; |
| | | private BaseDialog mWaitDialog; |
| | | @Override |
| | | public int getLayoutId() { |
| | | return R.layout.activity_contacts_import; |
| | | } |
| | | |
| | | @Override |
| | | public int getVariableId() { |
| | | return BR.viewModel; |
| | | } |
| | | |
| | | @Override |
| | | public void initParam() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void initView() { |
| | | //下拉刷新布局 |
| | | binding.refreshLayout.setEnableRefresh(false); |
| | | binding.refreshLayout.setEnableLoadMore(false); |
| | | binding.refreshLayout.setEnableOverScrollDrag(true); |
| | | binding.refreshLayout.setOnLoadMoreListener(refreshLayout -> { |
| | | }); |
| | | //recyclerView适配器 |
| | | adapter = new ContactsRvAdapter(this); |
| | | LinearItemDecoration itemDecoration = new LinearItemDecoration(); |
| | | itemDecoration.setBottomSpace((int) getResources().getDimension(com.android.app_base.R.dimen.dp_12)); |
| | | itemDecoration.setHorizontalSpace((int) getResources().getDimension(com.android.app_base.R.dimen.dp_20)); |
| | | itemDecoration.setFirstTop((int) getResources().getDimension(com.android.app_base.R.dimen.dp_20)); |
| | | binding.recyclerView.addItemDecoration(itemDecoration); |
| | | binding.recyclerView.setAdapter(adapter); |
| | | |
| | | binding.ivOperate.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | List<ContactsBean> list = adapter.getData(); |
| | | if (list == null || list.size() == 0) { |
| | | return; |
| | | } |
| | | UIDialog.Builder builder = new UIDialog.Builder(ContactsImportActivity.this); |
| | | builder.setTitle("提示"); |
| | | builder.setContent("是否导入所有通讯录数据?"); |
| | | builder.setCancel("取消"); |
| | | builder.setConfirm("导入"); |
| | | builder.setListener(new UIDialog.OnListener() { |
| | | @Override |
| | | public void onConfirm(BaseDialog dialog) { |
| | | viewModel.addContacts(list.get(0).getContactsDetailBeans()); |
| | | } |
| | | }); |
| | | builder.show(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void initData() { |
| | | UserManager.getInstance().getPermissions(new PermissionUtils.SimpleCallback() { |
| | | @Override |
| | | public void onGranted() { |
| | | List<ContactsDetailBean> list = new ArrayList<>(); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | dataLoading(); |
| | | } |
| | | }); |
| | | // 获取ContentResolver对象 |
| | | ContentResolver contentResolver = getContentResolver(); |
| | | // 查询联系人数据,返回一个Cursor对象 |
| | | Cursor cursor = contentResolver.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); |
| | | |
| | | if (cursor == null || cursor.getCount() == 0) { |
| | | return; |
| | | } |
| | | // 遍历Cursor对象,获取联系人信息 |
| | | while (cursor.moveToNext()) { |
| | | ContactsDetailBean contactsDetailBean = new ContactsDetailBean(); |
| | | contactsDetailBean.setMyName(UserManager.getInstance().getUserName()); |
| | | // 获取联系人ID |
| | | String id = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts._ID)); |
| | | |
| | | // 获取联系人姓名 |
| | | String name = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME)); |
| | | contactsDetailBean.setName(name); |
| | | |
| | | // 查询昵称信息 |
| | | Cursor nicknameCursor = contentResolver.query( |
| | | ContactsContract.Data.CONTENT_URI, |
| | | null, |
| | | ContactsContract.Data.CONTACT_ID + " = ? AND " + ContactsContract.Data.MIMETYPE + " = ?", |
| | | new String[]{id, ContactsContract.CommonDataKinds.Nickname.CONTENT_ITEM_TYPE}, |
| | | null |
| | | ); |
| | | if (nicknameCursor != null && nicknameCursor.moveToNext()) { |
| | | String nickname = nicknameCursor.getString(nicknameCursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Nickname.NAME)); |
| | | contactsDetailBean.setNickName(nickname); |
| | | nicknameCursor.close(); |
| | | } |
| | | |
| | | // 查询工作单位 |
| | | Cursor organizationCursor = contentResolver.query( |
| | | ContactsContract.Data.CONTENT_URI, |
| | | null, |
| | | ContactsContract.Data.CONTACT_ID + " = ? AND " + ContactsContract.Data.MIMETYPE + " = ?", |
| | | new String[]{id, ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE}, |
| | | null |
| | | ); |
| | | String company = null; |
| | | if (organizationCursor != null && organizationCursor.moveToNext()) { |
| | | company = organizationCursor.getString(organizationCursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Organization.COMPANY)); |
| | | contactsDetailBean.setWork(company); |
| | | organizationCursor.close(); |
| | | } |
| | | |
| | | // 获取联系人电话号码 |
| | | Cursor phoneCursor = contentResolver.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, |
| | | null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + id, null, null); |
| | | while (phoneCursor.moveToNext()) { |
| | | String phoneNumber = phoneCursor.getString(phoneCursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Phone.NUMBER)); |
| | | contactsDetailBean.setPhone(phoneNumber); |
| | | } |
| | | phoneCursor.close(); |
| | | |
| | | // 查询联系人的IM(即时通讯)账号信息 |
| | | Cursor imCursor = contentResolver.query( |
| | | ContactsContract.Data.CONTENT_URI, |
| | | null, |
| | | ContactsContract.Data.CONTACT_ID + " = ? AND " + ContactsContract.Data.MIMETYPE + " = ?", |
| | | new String[]{id, ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE}, |
| | | null |
| | | ); |
| | | if (imCursor != null && imCursor.getCount() > 0) { |
| | | while (imCursor.moveToNext()) { |
| | | String imAccount = imCursor.getString(imCursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Im.DATA)); |
| | | int imProtocol = imCursor.getInt(imCursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Im.PROTOCOL)); |
| | | // 获取IM账号类型标签 |
| | | String imLabel = imCursor.getString(imCursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Im.LABEL)); |
| | | if (imProtocol == ContactsContract.CommonDataKinds.Im.PROTOCOL_QQ) { |
| | | contactsDetailBean.setQq(imAccount); |
| | | } |
| | | if (imLabel != null) { |
| | | if (imLabel.contains("QQ") || imLabel.contains("qq")){ |
| | | contactsDetailBean.setQq(imAccount); |
| | | }else if (imLabel.contains("微信") || imLabel.contains("wechat") || imLabel.contains("WeChat") || imLabel.contains("wx")){ |
| | | contactsDetailBean.setWx(imAccount); |
| | | }else if (imLabel.contains("推特") || imLabel.contains("Twitter") || imLabel.contains("twitter")){ |
| | | contactsDetailBean.setTwitter(imAccount); |
| | | } |
| | | } |
| | | |
| | | } |
| | | imCursor.close(); |
| | | } |
| | | |
| | | // 查询联系人的备注信息 |
| | | Cursor noteCursor = getContentResolver().query( |
| | | ContactsContract.Data.CONTENT_URI, |
| | | null, |
| | | ContactsContract.Data.CONTACT_ID + " = ? AND " + ContactsContract.Data.MIMETYPE + " = ?", |
| | | new String[]{id, ContactsContract.CommonDataKinds.Note.CONTENT_ITEM_TYPE}, |
| | | null |
| | | ); |
| | | if (noteCursor != null && noteCursor.moveToFirst()) { |
| | | String note = noteCursor.getString(noteCursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Note.NOTE)); |
| | | contactsDetailBean.setRemark(note); |
| | | noteCursor.close(); |
| | | } |
| | | |
| | | // 获取联系人头像 |
| | | String photoId = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.PHOTO_ID)); |
| | | if (photoId != null) { |
| | | Uri photoUri = ContentUris.withAppendedId(ContactsContract.Data.CONTENT_URI, Long.parseLong(photoId)); |
| | | String mimeType = getContentResolver().getType(photoUri); |
| | | contactsDetailBean.setUrl(photoUri.toString()); |
| | | // 获取联系人头像 的字节数据,用于将图片上传服务器 |
| | | // 打开头像 Uri,获取输入流 |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = contentResolver.openInputStream(photoUri); |
| | | // 将输入流转换成字节数组 |
| | | ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); |
| | | byte[] buffer = new byte[1024]; |
| | | int bytesRead; |
| | | while ((bytesRead = inputStream.read(buffer)) != -1) { |
| | | byteArrayOutputStream.write(buffer, 0, bytesRead); |
| | | } |
| | | byte[] photoData = byteArrayOutputStream.toByteArray(); |
| | | contactsDetailBean.setPhotoData(photoData); |
| | | // 关闭输入流和字节数组输出流 |
| | | inputStream.close(); |
| | | byteArrayOutputStream.close(); |
| | | |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | // 获取联系人邮箱 |
| | | Cursor emailCursor = contentResolver.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI, |
| | | null, ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = " + id, null, null); |
| | | while (emailCursor.moveToNext()) { |
| | | String email = emailCursor.getString(emailCursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Email.DATA)); |
| | | } |
| | | emailCursor.close(); |
| | | list.add(contactsDetailBean); |
| | | } |
| | | cursor.close(); |
| | | |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (list.size() > 0){ |
| | | dataFinish(); |
| | | ContactsBean contactsBean = new ContactsBean(); |
| | | contactsBean.setContactsDetailBeans(list); |
| | | contactsBean.setMyName("手机本地"); |
| | | adapter.addItem(contactsBean); |
| | | }else{ |
| | | dataNull(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | }).start(); |
| | | } |
| | | |
| | | @Override |
| | | public void onDenied() { |
| | | ToastUtils.showShort("请开启获取通讯录权限"); |
| | | } |
| | | }, Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void initLiveDataObserve() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void dataNull() { |
| | | super.dataNull(); |
| | | binding.layoutDataNull.setVisibility(View.VISIBLE); |
| | | binding.refreshLayout.setVisibility(View.GONE); |
| | | } |
| | | |
| | | @Override |
| | | protected void dataError() { |
| | | super.dataError(); |
| | | binding.layoutDataNull.setVisibility(View.VISIBLE); |
| | | binding.tvDataNull.setText("没有权限,请开启获取通讯录权限"); |
| | | binding.refreshLayout.setVisibility(View.GONE); |
| | | } |
| | | |
| | | @Override |
| | | protected void dataLoading() { |
| | | if (mWaitDialog == null) { |
| | | mWaitDialog = new WaitDialog.Builder(this) |
| | | // 消息文本可以不用填写 |
| | | .setMessage("加载数据中...") |
| | | .create(); |
| | | } |
| | | if (!mWaitDialog.isShowing()) { |
| | | mWaitDialog.show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void dataFinish() { |
| | | if (mWaitDialog != null && mWaitDialog.isShowing()) { |
| | | mWaitDialog.dismiss(); |
| | | mWaitDialog = null; |
| | | } |
| | | binding.ivOperate.setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogLoading() { |
| | | if (mWaitDialog == null) { |
| | | mWaitDialog = new WaitDialog.Builder(this) |
| | | // 消息文本可以不用填写 |
| | | .setMessage("导入中...") |
| | | .create(); |
| | | } |
| | | if (!mWaitDialog.isShowing()) { |
| | | mWaitDialog.show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogDismiss() { |
| | | if (mWaitDialog != null && mWaitDialog.isShowing()) { |
| | | mWaitDialog.dismiss(); |
| | | mWaitDialog = null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onLeftClick(TitleBar titleBar) { |
| | | finish(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.application.zhangshi_app_android.ui.function; |
| | | |
| | | import static com.android.app_base.base.BaseConfig.CODE_SUCCESS; |
| | | |
| | | import android.app.Application; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.lifecycle.MutableLiveData; |
| | | |
| | | import com.android.app_base.base.StateViewEnum; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.android.app_base.utils.ToastUtils; |
| | | import com.android.app_base.utils.rxbus.MessageEvent; |
| | | import com.android.app_base.utils.rxbus.RxBus; |
| | | import com.application.zhangshi_app_android.bean.ContactsDetailBean; |
| | | import com.application.zhangshi_app_android.bean.GrowthExperienceInformationBean; |
| | | import com.application.zhangshi_app_android.bean.UploadFileResponseBean; |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | | import com.blankj.utilcode.util.ImageUtils; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.net.URI; |
| | | import java.net.URISyntaxException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import io.reactivex.Observable; |
| | | import io.reactivex.ObservableSource; |
| | | import io.reactivex.Observer; |
| | | import io.reactivex.disposables.Disposable; |
| | | import io.reactivex.functions.Action; |
| | | import io.reactivex.functions.Consumer; |
| | | import io.reactivex.functions.Function; |
| | | import okhttp3.MediaType; |
| | | import okhttp3.MultipartBody; |
| | | import okhttp3.RequestBody; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.08.01. 13:45 |
| | | * @desc 通讯录导入 Activity ViewModel |
| | | */ |
| | | public class ContactsImportActivityViewModel extends BaseViewModel<DataRepository> { |
| | | |
| | | public ContactsImportActivityViewModel(@NonNull Application application) { |
| | | super(application); |
| | | } |
| | | |
| | | @Override |
| | | protected DataRepository initModel() { |
| | | return DataRepository.getInstance(); |
| | | } |
| | | |
| | | //添加联系人 |
| | | public void addContacts(List<ContactsDetailBean> data) { |
| | | // 创建一个集合,用于保存所有接口请求的 Observable |
| | | List<Observable<ResultData<String>>> observables = new ArrayList<>(); |
| | | |
| | | for (ContactsDetailBean bean : data) { |
| | | Observable<ResultData<String>> addObservable; |
| | | if (bean.getUrl() == null || bean.getUrl().isEmpty()) { |
| | | addObservable = model.addContacts(bean); |
| | | }else { |
| | | if (bean.getPhotoData() == null || bean.getPhotoData().length == 0) { |
| | | addObservable = model.addContacts(bean); |
| | | }else { |
| | | //将图片字节数组bean.getPhotoData()转换为文件 |
| | | File file; |
| | | try { |
| | | file = new File(AppManager.getAppManager().currentActivity().getCacheDir(), "head_photo"); |
| | | // 将头像字节数组写入文件 |
| | | FileOutputStream fos = new FileOutputStream(file); |
| | | fos.write(bean.getPhotoData()); |
| | | fos.flush(); |
| | | fos.close(); |
| | | |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | ImageUtils.ImageType type = ImageUtils.getImageType(file); |
| | | File newFile = new File(file.getAbsolutePath()+"."+type.getValue()); |
| | | file.renameTo(newFile); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), newFile); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", newFile.getName(), requestBody); |
| | | // 将每个接口请求添加到 observables 集合中 |
| | | Observable<ResultData<UploadFileResponseBean>> uploadObservable = model.uploadFile(body); |
| | | addObservable = uploadObservable.flatMap(resultData -> { |
| | | bean.setUrl(resultData.getData().getUrl()); |
| | | return model.addContacts(bean); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | observables.add(addObservable); |
| | | } |
| | | |
| | | // 使用 Observable.zip 将所有接口请求合并为一个 Observable |
| | | Observable.zip(observables, results -> results) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .doOnSubscribe(disposable -> { |
| | | // 在订阅时展示加载对话框 |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | }) |
| | | .doFinally(() -> { |
| | | // 在所有接口请求完成后关闭加载对话框 |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | }).subscribe(new Observer<Object[]>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(Object[] objects) { |
| | | for (Object result : objects) { |
| | | if (result instanceof ResultData) { |
| | | ResultData<String> data = (ResultData<String>) result; |
| | | if (data.getCode() == CODE_SUCCESS) { |
| | | ToastUtils.showShort("导入成功"); |
| | | RxBus.getInstance().post(new MessageEvent(MessageEvent.EVENT_REFRESH_DATA)); |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | } else { |
| | | messageLiveData.postValue(data.getMsg()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.android.app_base.widget.LinearItemDecoration; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.adapter.MemoRvAdapter; |
| | | import com.application.zhangshi_app_android.bean.FamilyAssetsBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityFamilyAssetsDetailBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.04.03. 21:46 |
| | | * @desc |
| | | * @desc 家庭资产详情 |
| | | */ |
| | | public class FamilyAssetsDetailActivity extends DLBaseActivity<ActivityFamilyAssetsDetailBinding,FamilyAssetsDetailActivityViewModel> { |
| | | private ImageRvAdapter adapter; |
| | | private ElectronicFileAddAdapter adapter; |
| | | private MemoRvAdapter memoRvAdapter; |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | |
| | | package com.application.zhangshi_app_android.ui.function; |
| | | |
| | | import android.graphics.drawable.ColorDrawable; |
| | | import android.view.LayoutInflater; |
| | | import android.app.Activity; |
| | | import android.content.ClipData; |
| | | import android.content.Intent; |
| | | import android.net.Uri; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.EditText; |
| | | import android.widget.PopupWindow; |
| | | |
| | | import androidx.activity.result.ActivityResult; |
| | | import androidx.activity.result.ActivityResultCallback; |
| | | import androidx.activity.result.ActivityResultLauncher; |
| | | import androidx.activity.result.contract.ActivityResultContracts; |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.android.app_base.base.dialog.BaseDialog; |
| | | import com.android.app_base.base.dialog.UIDialog; |
| | | import com.android.app_base.base.view.BaseActivity; |
| | | import com.android.app_base.base.dialog.WaitDialog; |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.GetFilePathFromUri; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.LittleDoctorBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityFamilyMemorabiliaDetailBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | import com.github.gzuliyujiang.wheelpicker.DatePicker; |
| | | import com.github.gzuliyujiang.wheelpicker.OptionPicker; |
| | | import com.github.gzuliyujiang.wheelpicker.contract.OnDatePickedListener; |
| | | import com.github.gzuliyujiang.wheelpicker.contract.OnOptionPickedListener; |
| | | import com.luck.picture.lib.entity.LocalMedia; |
| | | import com.luck.picture.lib.interfaces.OnResultCallbackListener; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Locale; |
| | | import java.util.function.Consumer; |
| | | |
| | | |
| | | /** |
| | |
| | | public class FamilyMemorabiliaDetailActivity extends DLBaseActivity<ActivityFamilyMemorabiliaDetailBinding, FamilyMemorabiliaDetailActivityViewModel> { |
| | | private int type;// 0 查看可修改删除 1 新增 2 直接修改 |
| | | private PopupWindow popupWindow; |
| | | private ImageRvAdapter adapter; |
| | | |
| | | private ElectronicFileAddAdapter adapter; |
| | | private BaseDialog mWaitDialog; |
| | | private ActivityResultLauncher<Intent> activityResultLauncher; |
| | | @Override |
| | | public int getLayoutId() { |
| | | return R.layout.activity_family_memorabilia_detail; |
| | |
| | | if (type == 0 || type == 2){ |
| | | FamilyMemorabiliaBean bean = (FamilyMemorabiliaBean) getIntent().getSerializableExtra("bean"); |
| | | if (bean !=null){ |
| | | viewModel.getBeanMutableLiveData().setValue(bean); |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | | View footerView = View.inflate(this,R.layout.item_image_footer,null); |
| | | binding.rvImage.addFooterView(footerView); |
| | | binding.rvImage.requestLayout(); |
| | | footerView.setOnClickListener(new View.OnClickListener() { |
| | | adapter.setItemAndAddClickListener(new ElectronicFileAddAdapter.OnItemAndAddClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 9, new OnResultCallbackListener<LocalMedia>() { |
| | | public void onItemClick(View v, int position) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onAddClick() { |
| | | OptionPicker picker = getOptionPicker(Arrays.asList("图片视频","其他文件")); |
| | | picker.setTitle("选择文件类型"); |
| | | picker.setOnOptionPickedListener(new OnOptionPickedListener() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | String path = media.getRealPath(); |
| | | File file = new File(path); |
| | | if (file.exists()) { |
| | | viewModel.uploadFile(file); |
| | | } |
| | | public void onOptionPicked(int position, Object item) { |
| | | if (item.equals("图片视频")) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 0,9, new OnResultCallbackListener<LocalMedia>() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | String path = media.getRealPath(); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | FamilyMemorabiliaBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | Intent intent = new Intent(Intent.ACTION_GET_CONTENT); |
| | | // Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); |
| | | intent.setType("*/*"); // 限制文件类型 |
| | | intent.addCategory(Intent.CATEGORY_OPENABLE); // 添加 CATEGORY_OPENABLE 分类,告诉系统要选择的内容可以被打开,这样系统会过滤掉不能被应用打开的文件,以提供更好的用户体验。 |
| | | intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); // 允许多选 |
| | | activityResultLauncher.launch(intent); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | picker.show(); |
| | | |
| | | } |
| | | }); |
| | | adapter.setOnChildClickListener(R.id.iv_delete, new BaseRVAdapter.OnChildClickListener() { |
| | | @Override |
| | | public void onChildClick(RecyclerView recyclerView, View childView, int position) { |
| | | FamilyMemorabiliaBean bean = viewModel.getBeanMutableLiveData().getValue(); |
| | | FamilyMemorabiliaBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.remove(adapter.getItem(position)); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | adapter.removeItem(position); |
| | | viewModel.getBeanMutableLiveData().setValue(bean); |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | }); |
| | | binding.rvImage.setAdapter(adapter); |
| | |
| | | } |
| | | }); |
| | | |
| | | activityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() { |
| | | @Override |
| | | public void onActivityResult(ActivityResult result) { |
| | | if (result.getResultCode() == Activity.RESULT_OK) { |
| | | if (result.getData() == null){ |
| | | return; |
| | | } |
| | | // 获取选中的多个文件的 URI |
| | | ClipData clipData = result.getData().getClipData(); |
| | | if (clipData != null) { |
| | | int itemCount = clipData.getItemCount(); |
| | | for (int i = 0; i < itemCount; i++) { |
| | | Uri uri = clipData.getItemAt(i).getUri(); |
| | | // 使用选中的文件 URI 进行后续操作,比如读取文件内容等 |
| | | String path = GetFilePathFromUri.getFileAbsolutePath(getSelfActivity(),uri); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | FamilyMemorabiliaBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | }else { |
| | | // 获取选中的单个文件的 URI |
| | | Uri selectedFileUri = result.getData().getData(); |
| | | String path = GetFilePathFromUri.getFileAbsolutePath(getSelfActivity(),selectedFileUri); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | FamilyMemorabiliaBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void initLiveDataObserve() { |
| | | viewModel.getBeanMutableLiveData().observe(this,bean -> { |
| | | viewModel.getBeanLiveData().observe(this, bean -> { |
| | | if (bean!=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | adapter.setData(urlList); |
| | |
| | | viewModel.update(); |
| | | }); |
| | | } |
| | | binding.rvImage.getFooterViews().forEach(new Consumer<View>() { |
| | | @Override |
| | | public void accept(View view) { |
| | | view.setVisibility(View.VISIBLE); |
| | | } |
| | | }); |
| | | setIsEdited(true); |
| | | }else { |
| | | binding.ivOperate.setOnClickListener(v -> { |
| | | popupWindow.showAsDropDown(binding.ivOperate,-ScreenSizeUtils.dip2px(this,85) +binding.ivOperate.getWidth(),0); |
| | | }); |
| | | binding.rvImage.getFooterViews().forEach(new Consumer<View>() { |
| | | @Override |
| | | public void accept(View view) { |
| | | view.setVisibility(View.GONE); |
| | | } |
| | | }); |
| | | setIsEdited(false); |
| | | } |
| | |
| | | public void setIsEdited(boolean isEdited){ |
| | | adapter.setIsEdited(isEdited); |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogLoading() { |
| | | if (mWaitDialog == null) { |
| | | mWaitDialog = new WaitDialog.Builder(this) |
| | | // 消息文本可以不用填写 |
| | | .setMessage("正在上传") |
| | | .create(); |
| | | } |
| | | if (!mWaitDialog.isShowing()) { |
| | | mWaitDialog.show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogDismiss() { |
| | | if (mWaitDialog != null && mWaitDialog.isShowing()) { |
| | | mWaitDialog.dismiss(); |
| | | mWaitDialog = null; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.lifecycle.MutableLiveData; |
| | | |
| | | import com.android.app_base.base.StateViewEnum; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.manager.AppManager; |
| | |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import io.reactivex.Observable; |
| | | import io.reactivex.ObservableSource; |
| | | import io.reactivex.Observer; |
| | | import io.reactivex.disposables.Disposable; |
| | | import io.reactivex.functions.Action; |
| | | import io.reactivex.functions.Consumer; |
| | | import io.reactivex.functions.Function; |
| | | import okhttp3.MediaType; |
| | | import okhttp3.MultipartBody; |
| | | import okhttp3.RequestBody; |
| | | |
| | | public class FamilyMemorabiliaDetailActivityViewModel extends BaseViewModel<DataRepository> { |
| | | |
| | | private MutableLiveData<FamilyMemorabiliaBean> beanMutableLiveData; |
| | | private MutableLiveData<FamilyMemorabiliaBean> beanLiveData; |
| | | private MutableLiveData<Boolean> typeLiveData;//true 编辑状态 false 展示状态 |
| | | private final List<String> uploadFileList = new ArrayList<>();//需要上传的文件列表 |
| | | public FamilyMemorabiliaDetailActivityViewModel(@NonNull Application application) { |
| | | super(application); |
| | | } |
| | |
| | | * 增加家大事记 |
| | | */ |
| | | public void add() { |
| | | model.addFamilyMemorabilia(beanMutableLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | if (uploadFileList.size() > 0) { |
| | | List<Observable<String>> observables = new ArrayList<>(); |
| | | for (String path : uploadFileList) { |
| | | File file = new File(path); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | Observable<String> uploadObservable = model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<String>>() { |
| | | @Override |
| | | public ObservableSource<String> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | if (resultData.getCode() == CODE_SUCCESS) { |
| | | FamilyMemorabiliaBean bean = getBeanLiveData().getValue(); |
| | | if (bean != null) { |
| | | String urls = bean.getUrl(); |
| | | //替换图片地址 |
| | | urls = urls.replace(path, resultData.getData().getUrl()); |
| | | bean.setUrl(urls); |
| | | getBeanLiveData().postValue(bean); |
| | | } |
| | | return Observable.just(path); |
| | | } else { |
| | | return Observable.error(new Exception(resultData.getMsg())); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanMutableLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | observables.add(uploadObservable); |
| | | } |
| | | Observable.zip(observables, result -> result) |
| | | .flatMap(new Function<Object[], Observable<ResultData<String>>>() { |
| | | @Override |
| | | public Observable<ResultData<String>> apply(Object[] objects) throws Exception { |
| | | //移除已经上传的文件 |
| | | //把objects数组转换成list,然后移除 |
| | | for (Object object : objects) { |
| | | uploadFileList.remove((String) object); |
| | | } |
| | | return model.addFamilyMemorabilia(beanLiveData.getValue()); |
| | | } |
| | | } |
| | | }) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS) { |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | } else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | model.addFamilyMemorabilia(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS) { |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | } else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | /** |
| | | * 删除家大事记 |
| | | */ |
| | | public void delete() { |
| | | model.deleteFamilyMemorabilia(String.valueOf(beanMutableLiveData.getValue().getId())) |
| | | model.deleteFamilyMemorabilia(String.valueOf(beanLiveData.getValue().getId())) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanMutableLiveData.getValue()); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("删除成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | |
| | | * 编辑家大事记 |
| | | */ |
| | | public void update() { |
| | | model.updateFamilyMemorabilia(beanMutableLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | if (uploadFileList.size() > 0){ |
| | | List<Observable<String>> observables = new ArrayList<>(); |
| | | for (String path : uploadFileList) { |
| | | File file = new File(path); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | Observable<String> uploadObservable = model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<String>>() { |
| | | @Override |
| | | public ObservableSource<String> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | if (resultData.getCode() == CODE_SUCCESS){ |
| | | FamilyMemorabiliaBean bean = getBeanLiveData().getValue(); |
| | | if (bean != null){ |
| | | String urls = bean.getUrl(); |
| | | //替换图片地址 |
| | | urls = urls.replace(path,resultData.getData().getUrl()); |
| | | bean.setUrl(urls); |
| | | getBeanLiveData().postValue(bean); |
| | | } |
| | | return Observable.just(path); |
| | | }else { |
| | | return Observable.error(new Exception(resultData.getMsg())); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanMutableLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | observables.add(uploadObservable); |
| | | } |
| | | Observable.zip(observables,result -> result) |
| | | .flatMap(new Function<Object[], Observable<ResultData<String>>>() { |
| | | @Override |
| | | public Observable<ResultData<String>> apply(Object[] objects) throws Exception { |
| | | //移除已经上传的文件 |
| | | //把objects数组转换成list,然后移除 |
| | | for (Object object : objects) { |
| | | uploadFileList.remove((String) object); |
| | | } |
| | | return model.updateFamilyMemorabilia(beanLiveData.getValue()); |
| | | } |
| | | } |
| | | }) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | model.updateFamilyMemorabilia(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | public MutableLiveData<FamilyMemorabiliaBean> getBeanMutableLiveData() { |
| | | if (beanMutableLiveData == null){ |
| | | beanMutableLiveData = new MutableLiveData<>(); |
| | | public MutableLiveData<FamilyMemorabiliaBean> getBeanLiveData() { |
| | | if (beanLiveData == null){ |
| | | beanLiveData = new MutableLiveData<>(); |
| | | } |
| | | if (beanMutableLiveData.getValue() == null){ |
| | | beanMutableLiveData.setValue(new FamilyMemorabiliaBean()); |
| | | if (beanLiveData.getValue() == null){ |
| | | beanLiveData.setValue(new FamilyMemorabiliaBean()); |
| | | } |
| | | return beanMutableLiveData; |
| | | return beanLiveData; |
| | | } |
| | | |
| | | public void setBeanMutableLiveData(MutableLiveData<FamilyMemorabiliaBean> beanMutableLiveData) { |
| | | this.beanMutableLiveData = beanMutableLiveData; |
| | | public void setBeanLiveData(MutableLiveData<FamilyMemorabiliaBean> beanLiveData) { |
| | | this.beanLiveData = beanLiveData; |
| | | } |
| | | |
| | | public MutableLiveData<Boolean> getTypeLiveData() { |
| | |
| | | this.typeLiveData = typeLiveData; |
| | | } |
| | | |
| | | /** |
| | | * 上传电子文件 |
| | | */ |
| | | public void uploadFile(File file) { |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | model.uploadFile(body) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<UploadFileResponseBean>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | public List<String> getUploadFileList() { |
| | | return uploadFileList; |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<UploadFileResponseBean> resultData) { |
| | | if (resultData.getCode() == CODE_SUCCESS){ |
| | | FamilyMemorabiliaBean bean = getBeanMutableLiveData().getValue(); |
| | | String url; |
| | | if (bean != null){ |
| | | url = bean.getUrl(); |
| | | if (url == null){ |
| | | url = resultData.getData().getUrl(); |
| | | }else { |
| | | url = url + "," + resultData.getData().getUrl(); |
| | | } |
| | | bean.setUrl(url); |
| | | beanMutableLiveData.postValue(bean); |
| | | } |
| | | }else { |
| | | messageLiveData.postValue(resultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | public void addUploadFile(String url) { |
| | | uploadFileList.add(url); |
| | | } |
| | | |
| | | |
| | |
| | | package com.application.zhangshi_app_android.ui.function; |
| | | |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.utils.GlideUtil; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.android.app_base.utils.rxbus.MessageEvent; |
| | | import com.android.app_base.utils.rxbus.RxBus; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.bean.BannerBean; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.databinding.FragmentFunctionBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseFragment; |
| | | import com.application.zhangshi_app_android.ui.TestActivity; |
| | | import com.application.zhangshi_app_android.ui.home.HomeFragment; |
| | | import com.application.zhangshi_app_android.ui.main.MainActivity; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import io.reactivex.functions.Consumer; |
| | | |
| | | /** |
| | | * @author Ljj |
| | |
| | | imageCarouselFragment = ImageCarouselFragment.newInstance(); |
| | | videoFragment = VideoFragment.newInstance(); |
| | | replaceFragment(imageCarouselFragment); |
| | | binding.ivOperateSelect.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | AppManager.getAppManager().startActivity(new Intent(getSelfActivity(),ImageSelectActivity.class).putExtra("flag",0).putExtra("list", (Serializable) imageCarouselFragment.getImageList())); |
| | | } |
| | | }); |
| | | |
| | | //右上角操作弹窗 |
| | | mOperatePopupWindow = initPopUpWindow(View.inflate(getSelfActivity(),R.layout.pop_switch_video_or_image,null)); |
| | |
| | | imageCarouselFragment = ImageCarouselFragment.newInstance(); |
| | | } |
| | | replaceFragment(imageCarouselFragment); |
| | | |
| | | binding.ivOperateSelect.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | AppManager.getAppManager().startActivity(new Intent(getSelfActivity(),ImageSelectActivity.class).putExtra("flag",0).putExtra("list", (Serializable) imageCarouselFragment.getImageList())); |
| | | } |
| | | }); |
| | | }); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_video).setOnClickListener(v -> { |
| | | mOperatePopupWindow.dismiss(); |
| | |
| | | videoFragment = VideoFragment.newInstance(); |
| | | } |
| | | replaceFragment(videoFragment); |
| | | binding.ivOperateSelect.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | AppManager.getAppManager().startActivity(new Intent(getSelfActivity(),ImageSelectActivity.class).putExtra("flag",1).putExtra("list", (Serializable) videoFragment.getVideoList())); |
| | | } |
| | | |
| | | }); |
| | | }); |
| | | //点击弹出操作弹窗 |
| | | binding.ivOperate.setOnClickListener(v -> { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | initData(); |
| | | } |
| | | |
| | | @Override |
| | | protected void initLiveDataObserve() { |
| | | viewModel.getBannerListLiveData().observe(this, new Observer<List<BannerBean>>() { |
| | | @Override |
| | | public void onChanged(List<BannerBean> bannerBeans) { |
| | | List<String> imageList = new ArrayList<>(); |
| | | List<String> videoList = new ArrayList<>(); |
| | | List<BannerBean> imageList = new ArrayList<>(); |
| | | List<BannerBean> videoList = new ArrayList<>(); |
| | | for (BannerBean bannerBean : bannerBeans) { |
| | | if (bannerBean.getFlag() == 0){ |
| | | //图片 |
| | | imageList.add(bannerBean.getUrl()); |
| | | imageList.add(bannerBean); |
| | | }else if (bannerBean.getFlag() == 1){ |
| | | //视频 |
| | | videoList.add(bannerBean.getUrl()); |
| | | videoList.add(bannerBean); |
| | | } |
| | | } |
| | | imageCarouselFragment.setImageList(imageList); |
| | | videoFragment.setVideoList(videoList); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected boolean isStatusBarImmersionEnabled() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected void dataNull() { |
| | | super.dataNull(); |
| | | binding.layoutFrame.setVisibility(View.GONE); |
| | | binding.layoutDataNull.setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | @Override |
| | | protected void hide() { |
| | | super.hide(); |
| | | binding.layoutFrame.setVisibility(View.VISIBLE); |
| | | binding.layoutDataNull.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | |
| | |
| | | public class HealthCareActivity extends DLBaseActivity<ActivityHealthCareBinding,HealthCareActivityViewModel> { |
| | | |
| | | private PopupWindow popupWindow; |
| | | private int popWidth; |
| | | @Override |
| | | public int getLayoutId() { |
| | | return R.layout.activity_health_care; |
| | |
| | | return DataRepository.getInstance(); |
| | | } |
| | | |
| | | public <T> Observer<ResultData<T>> getObserver(MutableLiveData<T> resultData) { |
| | | public <T> Observer<ResultData<T>> getObserver(MutableLiveData<T> resultData,T newBean) { |
| | | return new Observer<ResultData<T>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | |
| | | changeStateView(StateViewEnum.HIDE); |
| | | resultData.postValue(data.getData()); |
| | | } |
| | | } else if (data.getCode() == 500) {//用户还没有填写健康保健信息,直接给个新的对象展示供用户修改 |
| | | resultData.postValue(newBean); |
| | | } else { |
| | | messageLiveData.postValue(data.getMsg()); |
| | | } |
| | |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .doOnSubscribe(disposable -> changeStateView(StateViewEnum.DATA_LOADING)) |
| | | .doFinally(() -> changeStateView(StateViewEnum.DATA_FINISH)) |
| | | .subscribe(getObserver(getHealthCareBaseInfoBeanLiveData())); |
| | | .subscribe(getObserver(getHealthCareBaseInfoBeanLiveData(),new HealthCareBaseInfoBean())); |
| | | } |
| | | |
| | | /** |
| | |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .doOnSubscribe(disposable -> changeStateView(StateViewEnum.DATA_LOADING)) |
| | | .doFinally(() -> changeStateView(StateViewEnum.DATA_FINISH)) |
| | | .subscribe(getObserver(getHealthCareLifeHabitsBeanLiveData())); |
| | | .subscribe(getObserver(getHealthCareLifeHabitsBeanLiveData(),new HealthCareLifeHabitsBean())); |
| | | } |
| | | |
| | | /** |
| | |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .doOnSubscribe(disposable -> changeStateView(StateViewEnum.DATA_LOADING)) |
| | | .doFinally(() -> changeStateView(StateViewEnum.DATA_FINISH)) |
| | | .subscribe(getObserver(getHealthCareNursingExaminationBeanLiveData())); |
| | | .subscribe(getObserver(getHealthCareNursingExaminationBeanLiveData(),new HealthCareNursingExaminationBean())); |
| | | } |
| | | |
| | | /** |
| | |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .doOnSubscribe(disposable -> changeStateView(StateViewEnum.DATA_LOADING)) |
| | | .doFinally(() -> changeStateView(StateViewEnum.DATA_FINISH)) |
| | | .subscribe(getObserver(getHealthCareExistingProblemsBeanLiveData())); |
| | | .subscribe(getObserver(getHealthCareExistingProblemsBeanLiveData(),new HealthCareExistingProblemsBean())); |
| | | } |
| | | |
| | | /** |
| | |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .doOnSubscribe(disposable -> changeStateView(StateViewEnum.DATA_LOADING)) |
| | | .doFinally(() -> changeStateView(StateViewEnum.DATA_FINISH)) |
| | | .subscribe(getObserver(getHealthCareNotesContentBeanLiveData())); |
| | | .subscribe(getObserver(getHealthCareNotesContentBeanLiveData(),new HealthCareNotesContentBean())); |
| | | } |
| | | |
| | | /** |
| | |
| | | package com.application.zhangshi_app_android.ui.function; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.ClipData; |
| | | import android.content.Intent; |
| | | import android.net.Uri; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.EditText; |
| | | import android.widget.PopupWindow; |
| | | |
| | | import androidx.activity.result.ActivityResult; |
| | | import androidx.activity.result.ActivityResultCallback; |
| | | import androidx.activity.result.ActivityResultLauncher; |
| | | import androidx.activity.result.contract.ActivityResultContracts; |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.android.app_base.base.dialog.BaseDialog; |
| | | import com.android.app_base.base.dialog.UIDialog; |
| | | import com.android.app_base.base.dialog.WaitDialog; |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.GetFilePathFromUri; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.android.app_base.utils.Utils; |
| | | import com.android.app_base.widget.LinearItemDecoration; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.adapter.MemoRvAdapter; |
| | | import com.application.zhangshi_app_android.bean.FamilyAssetsBean; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.HomeDevicesBean; |
| | | import com.application.zhangshi_app_android.bean.LittleDoctorBean; |
| | | import com.application.zhangshi_app_android.bean.MemoBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityHomeDevicesDetailBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | import com.github.gzuliyujiang.wheelpicker.DatePicker; |
| | | import com.github.gzuliyujiang.wheelpicker.OptionPicker; |
| | | import com.github.gzuliyujiang.wheelpicker.contract.OnDatePickedListener; |
| | | import com.github.gzuliyujiang.wheelpicker.contract.OnOptionPickedListener; |
| | | import com.luck.picture.lib.entity.LocalMedia; |
| | | import com.luck.picture.lib.interfaces.OnResultCallbackListener; |
| | | |
| | |
| | | |
| | | private int type;// 0 查看可修改删除 1 新增 2 直接修改 |
| | | private PopupWindow popupWindow; |
| | | private ImageRvAdapter adapter; |
| | | private ElectronicFileAddAdapter adapter; |
| | | private BaseDialog mWaitDialog; |
| | | private ActivityResultLauncher<Intent> activityResultLauncher; |
| | | private MemoRvAdapter memoRvAdapter; |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | | View footerView = View.inflate(this,R.layout.item_image_footer,null); |
| | | binding.rvImage.addFooterView(footerView); |
| | | binding.rvImage.requestLayout(); |
| | | footerView.setOnClickListener(new View.OnClickListener() { |
| | | adapter.setItemAndAddClickListener(new ElectronicFileAddAdapter.OnItemAndAddClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 9, new OnResultCallbackListener<LocalMedia>() { |
| | | public void onItemClick(View v, int position) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onAddClick() { |
| | | OptionPicker picker = getOptionPicker(Arrays.asList("图片视频","其他文件")); |
| | | picker.setTitle("选择文件类型"); |
| | | picker.setOnOptionPickedListener(new OnOptionPickedListener() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | String path = media.getRealPath(); |
| | | File file = new File(path); |
| | | if (file.exists()) { |
| | | viewModel.uploadFile(file); |
| | | } |
| | | public void onOptionPicked(int position, Object item) { |
| | | if (item.equals("图片视频")) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 0,9, new OnResultCallbackListener<LocalMedia>() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | String path = media.getRealPath(); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | HomeDevicesBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | Intent intent = new Intent(Intent.ACTION_GET_CONTENT); |
| | | // Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); |
| | | intent.setType("*/*"); // 限制文件类型 |
| | | intent.addCategory(Intent.CATEGORY_OPENABLE); // 添加 CATEGORY_OPENABLE 分类,告诉系统要选择的内容可以被打开,这样系统会过滤掉不能被应用打开的文件,以提供更好的用户体验。 |
| | | intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); // 允许多选 |
| | | activityResultLauncher.launch(intent); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | picker.show(); |
| | | |
| | | } |
| | | }); |
| | | adapter.setOnChildClickListener(R.id.iv_delete, new BaseRVAdapter.OnChildClickListener() { |
| | |
| | | }); |
| | | picker.show(); |
| | | }); |
| | | |
| | | activityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() { |
| | | @Override |
| | | public void onActivityResult(ActivityResult result) { |
| | | if (result.getResultCode() == Activity.RESULT_OK) { |
| | | if (result.getData() == null){ |
| | | return; |
| | | } |
| | | // 获取选中的多个文件的 URI |
| | | ClipData clipData = result.getData().getClipData(); |
| | | if (clipData != null) { |
| | | int itemCount = clipData.getItemCount(); |
| | | for (int i = 0; i < itemCount; i++) { |
| | | Uri uri = clipData.getItemAt(i).getUri(); |
| | | // 使用选中的文件 URI 进行后续操作,比如读取文件内容等 |
| | | String path = GetFilePathFromUri.getFileAbsolutePath(getSelfActivity(),uri); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | HomeDevicesBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | }else { |
| | | // 获取选中的单个文件的 URI |
| | | Uri selectedFileUri = result.getData().getData(); |
| | | String path = GetFilePathFromUri.getFileAbsolutePath(getSelfActivity(),selectedFileUri); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | HomeDevicesBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | |
| | | adapter.setIsEdited(isEdited); |
| | | memoRvAdapter.setEdited(isEdited); |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogLoading() { |
| | | if (mWaitDialog == null) { |
| | | mWaitDialog = new WaitDialog.Builder(this) |
| | | // 消息文本可以不用填写 |
| | | .setMessage("正在上传") |
| | | .create(); |
| | | } |
| | | if (!mWaitDialog.isShowing()) { |
| | | mWaitDialog.show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogDismiss() { |
| | | if (mWaitDialog != null && mWaitDialog.isShowing()) { |
| | | mWaitDialog.dismiss(); |
| | | mWaitDialog = null; |
| | | } |
| | | } |
| | | } |
| | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.lifecycle.MutableLiveData; |
| | | |
| | | import com.android.app_base.base.StateViewEnum; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.android.app_base.utils.rxbus.RxBus; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.HomeDevicesBean; |
| | | import com.application.zhangshi_app_android.bean.MemoBean; |
| | | import com.application.zhangshi_app_android.bean.UploadFileResponseBean; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import io.reactivex.Observable; |
| | | import io.reactivex.ObservableSource; |
| | | import io.reactivex.Observer; |
| | | import io.reactivex.disposables.Disposable; |
| | | import io.reactivex.functions.Action; |
| | | import io.reactivex.functions.Consumer; |
| | | import io.reactivex.functions.Function; |
| | | import okhttp3.MediaType; |
| | | import okhttp3.MultipartBody; |
| | |
| | | private MutableLiveData<List<MemoBean>> memoListLiveData; |
| | | |
| | | private MutableLiveData<Boolean> typeLiveData;//true 编辑状态 false 展示状态 |
| | | private final List<String> uploadFileList = new ArrayList<>();//需要上传的文件列表 |
| | | |
| | | public HomeDevicesDetailActivityViewModel(@NonNull Application application) { |
| | | super(application); |
| | |
| | | * 增加家庭设备 |
| | | */ |
| | | public void add() { |
| | | model.addHomeDevices(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | if (uploadFileList.size() > 0) { |
| | | List<Observable<String>> observables = new ArrayList<>(); |
| | | for (String path : uploadFileList) { |
| | | File file = new File(path); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | Observable<String> uploadObservable = model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<String>>() { |
| | | @Override |
| | | public ObservableSource<String> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | if (resultData.getCode() == CODE_SUCCESS) { |
| | | HomeDevicesBean bean = getBeanLiveData().getValue(); |
| | | if (bean != null) { |
| | | String urls = bean.getUrl(); |
| | | //替换图片地址 |
| | | urls = urls.replace(path, resultData.getData().getUrl()); |
| | | bean.setUrl(urls); |
| | | getBeanLiveData().postValue(bean); |
| | | } |
| | | return Observable.just(path); |
| | | } else { |
| | | return Observable.error(new Exception(resultData.getMsg())); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | observables.add(uploadObservable); |
| | | } |
| | | Observable.zip(observables, result -> result) |
| | | .flatMap(new Function<Object[], Observable<ResultData<String>>>() { |
| | | @Override |
| | | public Observable<ResultData<String>> apply(Object[] objects) throws Exception { |
| | | //移除已经上传的文件 |
| | | //把objects数组转换成list,然后移除 |
| | | for (Object object : objects) { |
| | | uploadFileList.remove((String) object); |
| | | } |
| | | return model.addHomeDevices(beanLiveData.getValue()); |
| | | } |
| | | } |
| | | }) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS) { |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | } else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | model.addHomeDevices(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | /** |
| | | * 删除家庭设备 |
| | |
| | | * 修改家庭设备 |
| | | */ |
| | | public void update() { |
| | | model.updateHomeDevices(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 上传电子文件 |
| | | */ |
| | | public void uploadFile(File file) { |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | model.uploadFile(body) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<UploadFileResponseBean>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<UploadFileResponseBean> resultData) { |
| | | if (resultData.getCode() == CODE_SUCCESS){ |
| | | HomeDevicesBean bean = beanLiveData.getValue(); |
| | | String url; |
| | | if (bean != null){ |
| | | url = bean.getUrl(); |
| | | if (url == null){ |
| | | url = resultData.getData().getUrl(); |
| | | if (uploadFileList.size() > 0){ |
| | | List<Observable<String>> observables = new ArrayList<>(); |
| | | for (String path : uploadFileList) { |
| | | File file = new File(path); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | Observable<String> uploadObservable = model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<String>>() { |
| | | @Override |
| | | public ObservableSource<String> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | if (resultData.getCode() == CODE_SUCCESS){ |
| | | HomeDevicesBean bean = getBeanLiveData().getValue(); |
| | | if (bean != null){ |
| | | String urls = bean.getUrl(); |
| | | //替换图片地址 |
| | | urls = urls.replace(path,resultData.getData().getUrl()); |
| | | bean.setUrl(urls); |
| | | getBeanLiveData().postValue(bean); |
| | | } |
| | | return Observable.just(path); |
| | | }else { |
| | | url = url + "," + resultData.getData().getUrl(); |
| | | return Observable.error(new Exception(resultData.getMsg())); |
| | | } |
| | | bean.setUrl(url); |
| | | beanLiveData.postValue(bean); |
| | | } |
| | | }else { |
| | | messageLiveData.postValue(resultData.getMsg()); |
| | | }); |
| | | |
| | | observables.add(uploadObservable); |
| | | } |
| | | Observable.zip(observables,result -> result) |
| | | .flatMap(new Function<Object[], Observable<ResultData<String>>>() { |
| | | @Override |
| | | public Observable<ResultData<String>> apply(Object[] objects) throws Exception { |
| | | //移除已经上传的文件 |
| | | //把objects数组转换成list,然后移除 |
| | | for (Object object : objects) { |
| | | uploadFileList.remove((String) object); |
| | | } |
| | | return model.updateHomeDevices(beanLiveData.getValue()); |
| | | } |
| | | } |
| | | }) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | model.updateHomeDevices(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取备忘录 |
| | |
| | | public void setMemoListLiveData(MutableLiveData<List<MemoBean>> memoListLiveData) { |
| | | this.memoListLiveData = memoListLiveData; |
| | | } |
| | | public List<String> getUploadFileList() { |
| | | return uploadFileList; |
| | | } |
| | | |
| | | public void addUploadFile(String url) { |
| | | uploadFileList.add(url); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.bean.HonorCollectionBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityHonorCollectionDetailBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | import com.luck.picture.lib.entity.LocalMedia; |
| | | import com.luck.picture.lib.interfaces.OnResultCallbackListener; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.04.14. 22:21 |
| | | * @desc |
| | | * @desc 荣誉收藏详情 |
| | | */ |
| | | public class HonorCollectionDetailActivity extends DLBaseActivity<ActivityHonorCollectionDetailBinding, HonorCollectionDetailActivityViewModel> { |
| | | private ImageRvAdapter adapter; |
| | | private ElectronicFileAddAdapter adapter; |
| | | |
| | | @Override |
| | | public int getLayoutId() { |
| | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.bean.HundredWishBean; |
| | | import com.application.zhangshi_app_android.bean.PropertyBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityHundredWishDetailBinding; |
| | | import com.application.zhangshi_app_android.databinding.ActivityPropertyDetailBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.04.23. 20:18 |
| | | * @desc |
| | | * @desc 百人许愿详情 (仅供查看) |
| | | */ |
| | | public class HundredWishDetailActivity extends DLBaseActivity<ActivityHundredWishDetailBinding,HundredWishDetailActivityViewModel> { |
| | | |
| | | private ImageRvAdapter adapter; |
| | | private ElectronicFileAddAdapter adapter; |
| | | |
| | | @Override |
| | | public int getLayoutId() { |
| | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.utils.GlideUtil; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.bean.BannerBean; |
| | | import com.application.zhangshi_app_android.databinding.FragmentImageCarouselBinding; |
| | | import com.youth.banner.adapter.BannerImageAdapter; |
| | | import com.youth.banner.holder.BannerImageHolder; |
| | |
| | | */ |
| | | public class ImageCarouselFragment extends BaseFragment<FragmentImageCarouselBinding, ImageCarouselFragmentViewModel> { |
| | | |
| | | private List<String> imageList; |
| | | private BannerImageAdapter<String> adapter; |
| | | private List<BannerBean> imageList; |
| | | private List<BannerBean> chooseList = new ArrayList<>(); |
| | | private BannerImageAdapter<BannerBean> adapter; |
| | | private ImageCarouselFragment() { |
| | | } |
| | | |
| | |
| | | return fragment; |
| | | } |
| | | |
| | | public void setImageList(List<String> imageList) { |
| | | public void setImageList(List<BannerBean> imageList) { |
| | | this.imageList = imageList; |
| | | Bundle args = new Bundle(); |
| | | args.putSerializable("imgList", (Serializable) imageList); |
| | | setArguments(args); |
| | | if (imageList == null || imageList.size() == 0) { |
| | | chooseList = new ArrayList<>(); |
| | | //选出被选中的图片 |
| | | for (BannerBean bean : imageList) { |
| | | if (bean.getChoose() == 1) { |
| | | chooseList.add(bean); |
| | | } |
| | | } |
| | | if (chooseList == null || chooseList.size() == 0) { |
| | | binding.layoutDataNull.setVisibility(View.VISIBLE); |
| | | binding.banner.setVisibility(View.GONE); |
| | | } else { |
| | | binding.layoutDataNull.setVisibility(View.GONE); |
| | | binding.banner.setVisibility(View.VISIBLE); |
| | | if (adapter != null) { |
| | | adapter.setDatas(imageList); |
| | | adapter.setDatas(chooseList); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public List<BannerBean> getImageList() { |
| | | return imageList; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | protected void initParam() { |
| | | if (getArguments() != null) { |
| | | imageList = (List<String>) getArguments().getSerializable("imgList"); |
| | | imageList = (List<BannerBean>) getArguments().getSerializable("imgList"); |
| | | if (imageList != null){ |
| | | chooseList = new ArrayList<>(); |
| | | for (BannerBean bannerBean : imageList) { |
| | | if (bannerBean.getChoose() == 1){ |
| | | chooseList.add(bannerBean); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void initView() { |
| | | adapter = new BannerImageAdapter<String>(imageList) { |
| | | if (imageList != null) { |
| | | chooseList = new ArrayList<>(); |
| | | for (BannerBean bannerBean : imageList) { |
| | | if (bannerBean.getChoose() == 1){ |
| | | chooseList.add(bannerBean); |
| | | } |
| | | } |
| | | } |
| | | adapter = new BannerImageAdapter<BannerBean>(chooseList) { |
| | | @Override |
| | | public void onBindView(BannerImageHolder holder, String data, int position, int size) { |
| | | GlideUtil.loadImage(data, holder.imageView); |
| | | public void onBindView(BannerImageHolder holder, BannerBean data, int position, int size) { |
| | | GlideUtil.loadImage(data.getUrl(), holder.imageView); |
| | | } |
| | | |
| | | @Override |
| | |
| | | ViewGroup.LayoutParams.MATCH_PARENT, |
| | | ViewGroup.LayoutParams.MATCH_PARENT); |
| | | imageView.setLayoutParams(params); |
| | | return new BannerImageHolder(imageView); } |
| | | imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); |
| | | return new BannerImageHolder(imageView); |
| | | } |
| | | }; |
| | | binding.banner.setAdapter(adapter) |
| | | .addBannerLifecycleObserver(this)//添加生命周期观察者 |
| | | .setIndicator(new CircleIndicator(getSelfActivity())); |
| | | |
| | | if (imageList == null || imageList.size() == 0) { |
| | | if (chooseList == null || chooseList.size() == 0) { |
| | | binding.layoutDataNull.setVisibility(View.VISIBLE); |
| | | binding.banner.setVisibility(View.GONE); |
| | | } else { |
| | | binding.layoutDataNull.setVisibility(View.GONE); |
| | | binding.banner.setVisibility(View.VISIBLE); |
| | | if (adapter != null) { |
| | | adapter.setDatas(imageList); |
| | | adapter.setDatas(chooseList); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
New file |
| | |
| | | package com.application.zhangshi_app_android.ui.function; |
| | | |
| | | import android.content.Context; |
| | | import android.graphics.Bitmap; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.net.Uri; |
| | | import android.util.Log; |
| | | import android.view.View; |
| | | import android.widget.ImageView; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.core.content.ContextCompat; |
| | | import androidx.fragment.app.Fragment; |
| | | import androidx.lifecycle.Observer; |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.android.app_base.base.dialog.BaseDialog; |
| | | import com.android.app_base.base.dialog.WaitDialog; |
| | | import com.android.app_base.base.view.BaseActivity; |
| | | import com.android.app_base.utils.GlideEngine; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.bean.BannerBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityImageSelectBinding; |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.request.target.CustomTarget; |
| | | import com.bumptech.glide.request.transition.Transition; |
| | | import com.hjq.bar.TitleBar; |
| | | import com.luck.picture.lib.basic.PictureSelector; |
| | | import com.luck.picture.lib.config.SelectMimeType; |
| | | import com.luck.picture.lib.engine.CropFileEngine; |
| | | import com.luck.picture.lib.entity.LocalMedia; |
| | | import com.luck.picture.lib.interfaces.OnResultCallbackListener; |
| | | import com.luck.picture.lib.style.PictureSelectorStyle; |
| | | import com.luck.picture.lib.style.SelectMainStyle; |
| | | import com.luck.picture.lib.style.TitleBarStyle; |
| | | import com.luck.picture.lib.utils.PictureFileUtils; |
| | | import com.luck.picture.lib.utils.StyleUtils; |
| | | import com.yalantis.ucrop.UCrop; |
| | | import com.yalantis.ucrop.UCropImageEngine; |
| | | import com.yalantis.ucrop.model.AspectRatio; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.07.30. 8:50 |
| | | * @desc 轮播图 图片选择 Activity |
| | | */ |
| | | public class ImageSelectActivity extends BaseActivity<ActivityImageSelectBinding, ImageSelectActivityViewModel> { |
| | | |
| | | private static final String TAG = "ImageSelectActivity"; |
| | | private BaseDialog mWaitDialog; |
| | | private ElectronicFileAddAdapter adapter; |
| | | |
| | | @Override |
| | | public int getLayoutId() { |
| | | return R.layout.activity_image_select; |
| | | } |
| | | |
| | | @Override |
| | | public int getVariableId() { |
| | | return BR.viewModel; |
| | | } |
| | | |
| | | @Override |
| | | public void initParam() { |
| | | if (getIntent() != null) { |
| | | viewModel.setFlag(getIntent().getIntExtra("flag", 0)); |
| | | viewModel.setList((List<BannerBean>) getIntent().getSerializableExtra("list")); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | | adapter.setShowSelectIcon(true); |
| | | adapter.setItemAndAddClickListener(new ElectronicFileAddAdapter.OnItemAndAddClickListener() { |
| | | @Override |
| | | public void onItemClick(View itemView, int position) { |
| | | //编辑状态下,点击图片才能修改是否被选中 |
| | | if (viewModel.getType()) { |
| | | List<BannerBean> beans = viewModel.getListLiveData().getValue(); |
| | | BannerBean updateBean = null; |
| | | if (beans != null) { |
| | | for (BannerBean bean : beans) { |
| | | if (bean.getUrl().equals(adapter.getItem(position))) { |
| | | updateBean = bean; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if (updateBean != null) { |
| | | updateBean.setChoose(updateBean.getChoose()==0?1:0); |
| | | viewModel.update(updateBean); |
| | | |
| | | if (updateBean.getChoose() == 1) { |
| | | if (viewModel.getFlag() == 1) {//如果是视频,只能有一个选中,需要把其他的选中的取消 |
| | | for (BannerBean bean : beans) { |
| | | if (bean != updateBean && bean.getChoose() == 1) { |
| | | bean.setChoose(0); |
| | | viewModel.update(bean); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onAddClick() { |
| | | int chooseMode = 0; |
| | | ImageFileCropEngine cropEngine = null; |
| | | if (viewModel.getFlag() == 0) { |
| | | chooseMode = SelectMimeType.ofImage(); |
| | | cropEngine = new ImageFileCropEngine(); |
| | | } else if (viewModel.getFlag() == 1) { |
| | | chooseMode = SelectMimeType.ofVideo(); |
| | | } |
| | | |
| | | PictureSelector.create(getSelfActivity()) |
| | | .openGallery(chooseMode) |
| | | .setImageEngine(GlideEngine.createGlideEngine()) |
| | | .setCropEngine(cropEngine)// 设置裁剪引擎 |
| | | .isMaxSelectEnabledMask(true)// 达到最大选择数是否开启禁选蒙层 |
| | | .forResult(new OnResultCallbackListener<LocalMedia>() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | if (media.isCut()){ |
| | | viewModel.add(media.getCutPath()); |
| | | }else { |
| | | viewModel.add(media.getRealPath()); |
| | | } |
| | | |
| | | Log.i(TAG, "文件名: " + media.getFileName()); |
| | | Log.i(TAG, "是否压缩:" + media.isCompressed()); |
| | | Log.i(TAG, "压缩:" + media.getCompressPath()); |
| | | Log.i(TAG, "初始路径:" + media.getPath()); |
| | | Log.i(TAG, "绝对路径:" + media.getRealPath()); |
| | | Log.i(TAG, "是否裁剪:" + media.isCut()); |
| | | Log.i(TAG, "裁剪路径:" + media.getCutPath()); |
| | | Log.i(TAG, "是否开启原图:" + media.isOriginal()); |
| | | Log.i(TAG, "原图路径:" + media.getOriginalPath()); |
| | | Log.i(TAG, "沙盒路径:" + media.getSandboxPath()); |
| | | Log.i(TAG, "水印路径:" + media.getWatermarkPath()); |
| | | Log.i(TAG, "视频缩略图:" + media.getVideoThumbnailPath()); |
| | | Log.i(TAG, "原始宽高: " + media.getWidth() + "x" + media.getHeight()); |
| | | Log.i(TAG, "裁剪宽高: " + media.getCropImageWidth() + "x" + media.getCropImageHeight()); |
| | | Log.i(TAG, "文件大小: " + PictureFileUtils.formatAccurateUnitFileSize(media.getSize())); |
| | | Log.i(TAG, "文件时长: " + media.getDuration()); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | adapter.setOnChildClickListener(R.id.iv_delete, new BaseRVAdapter.OnChildClickListener() { |
| | | @Override |
| | | public void onChildClick(RecyclerView recyclerView, View childView, int position) { |
| | | if (viewModel.getListLiveData().getValue()!=null){ |
| | | for (BannerBean bannerBean : viewModel.getListLiveData().getValue()) { |
| | | if (bannerBean.getUrl().equals(adapter.getItem(position))){ |
| | | viewModel.delete(bannerBean.getId()+""); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | binding.rvImage.setAdapter(adapter); |
| | | |
| | | binding.ivOperate.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | viewModel.setType(Boolean.FALSE.equals(viewModel.getTypeLiveData().getValue())); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void initData() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void initLiveDataObserve() { |
| | | viewModel.getListLiveData().observe(this, new Observer<List<BannerBean>>() { |
| | | @Override |
| | | public void onChanged(List<BannerBean> bannerBeans) { |
| | | if (bannerBeans == null) return; |
| | | List<String> list = new ArrayList<>(); |
| | | List<String> chooseList = new ArrayList<>(); |
| | | for (BannerBean bean : bannerBeans) { |
| | | list.add(bean.getUrl()); |
| | | if (bean.getChoose() == 1) { |
| | | chooseList.add(bean.getUrl()); |
| | | } |
| | | } |
| | | adapter.setData(list); |
| | | adapter.addSelectedItems(chooseList); |
| | | } |
| | | }); |
| | | |
| | | viewModel.getTypeLiveData().observe(this, new Observer<Boolean>() { |
| | | @Override |
| | | public void onChanged(Boolean aBoolean) { |
| | | adapter.setShowAddItem(aBoolean); |
| | | adapter.setShowDeleteIcon(aBoolean); |
| | | adapter.setPreview(!aBoolean); |
| | | binding.ivOperate.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | viewModel.setType(!aBoolean); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogLoading() { |
| | | if (mWaitDialog == null) { |
| | | mWaitDialog = new WaitDialog.Builder(this) |
| | | // 消息文本可以不用填写 |
| | | .setMessage("正在上传") |
| | | .create(); |
| | | } |
| | | if (!mWaitDialog.isShowing()) { |
| | | mWaitDialog.show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogDismiss() { |
| | | if (mWaitDialog != null && mWaitDialog.isShowing()) { |
| | | mWaitDialog.dismiss(); |
| | | mWaitDialog = null; |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onLeftClick(TitleBar titleBar) { |
| | | finish(); |
| | | } |
| | | |
| | | /** |
| | | * 自定义裁剪 |
| | | */ |
| | | private class ImageFileCropEngine implements CropFileEngine { |
| | | |
| | | @Override |
| | | public void onStartCrop(Fragment fragment, Uri srcUri, Uri destinationUri, ArrayList<String> dataSource, int requestCode) { |
| | | UCrop.Options options = buildOptions(); |
| | | UCrop uCrop = UCrop.of(srcUri, destinationUri, dataSource); |
| | | uCrop.withOptions(options); |
| | | uCrop.setImageEngine(new UCropImageEngine() { |
| | | @Override |
| | | public void loadImage(Context context, String url, ImageView imageView) { |
| | | Glide.with(context).load(url).override(180, 180).into(imageView); |
| | | } |
| | | |
| | | @Override |
| | | public void loadImage(Context context, Uri url, int maxWidth, int maxHeight, OnCallbackListener<Bitmap> call) { |
| | | Glide.with(context).asBitmap().load(url).override(maxWidth, maxHeight).into(new CustomTarget<Bitmap>() { |
| | | @Override |
| | | public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { |
| | | if (call != null) { |
| | | call.onCall(resource); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onLoadCleared(@Nullable Drawable placeholder) { |
| | | if (call != null) { |
| | | call.onCall(null); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | uCrop.start(fragment.requireActivity(), fragment, requestCode); |
| | | } |
| | | } |
| | | /** |
| | | * 配制UCrop,可根据需求自我扩展 |
| | | * |
| | | * @return |
| | | */ |
| | | private UCrop.Options buildOptions() { |
| | | PictureSelectorStyle selectorStyle = new PictureSelectorStyle(); |
| | | |
| | | UCrop.Options options = new UCrop.Options(); |
| | | options.setHideBottomControls(true);//是否显示底部裁剪菜单栏 |
| | | options.setFreeStyleCropEnabled(false);//裁剪框or图片拖动 |
| | | options.setShowCropFrame(true);//是否显示裁剪边框 |
| | | options.setShowCropGrid(true);//是否显示裁剪网格线 |
| | | options.setCircleDimmedLayer(false);//是否圆形裁剪 |
| | | options.withAspectRatio(16, 9);//裁剪比例 |
| | | options.setAspectRatioOptions(0, |
| | | new AspectRatio("16:9", 16, 9), |
| | | new AspectRatio("3:2", 3, 2), |
| | | new AspectRatio("4:3", 4, 3), |
| | | new AspectRatio("1:1", 1, 1));//自选裁剪比例,受setHideBottomControls影响可见 |
| | | options.setCropOutputPathDir(getSandboxPath());//裁剪输出路径 |
| | | options.isCropDragSmoothToCenter(false);//裁剪拖动是否自动居中 |
| | | options.isForbidSkipMultipleCrop(true);//是否多图裁剪时禁止跳过 |
| | | options.setMaxScaleMultiplier(100);//设置最大缩放比例 |
| | | if (selectorStyle != null && selectorStyle.getSelectMainStyle().getStatusBarColor() != 0) { |
| | | SelectMainStyle mainStyle = selectorStyle.getSelectMainStyle(); |
| | | boolean isDarkStatusBarBlack = mainStyle.isDarkStatusBarBlack(); |
| | | int statusBarColor = mainStyle.getStatusBarColor(); |
| | | options.isDarkStatusBarBlack(isDarkStatusBarBlack); |
| | | if (StyleUtils.checkStyleValidity(statusBarColor)) { |
| | | options.setStatusBarColor(statusBarColor); |
| | | options.setToolbarColor(statusBarColor); |
| | | } else { |
| | | options.setStatusBarColor(ContextCompat.getColor(getSelfActivity(), com.luck.picture.lib.R.color.ps_color_grey)); |
| | | options.setToolbarColor(ContextCompat.getColor(getSelfActivity(), com.luck.picture.lib.R.color.ps_color_grey)); |
| | | } |
| | | TitleBarStyle titleBarStyle = selectorStyle.getTitleBarStyle(); |
| | | if (StyleUtils.checkStyleValidity(titleBarStyle.getTitleTextColor())) { |
| | | options.setToolbarWidgetColor(titleBarStyle.getTitleTextColor()); |
| | | } else { |
| | | options.setToolbarWidgetColor(ContextCompat.getColor(getSelfActivity(), com.luck.picture.lib.R.color.ps_color_white)); |
| | | } |
| | | } else { |
| | | options.setStatusBarColor(ContextCompat.getColor(getSelfActivity(), com.luck.picture.lib.R.color.ps_color_grey)); |
| | | options.setToolbarColor(ContextCompat.getColor(getSelfActivity(), com.luck.picture.lib.R.color.ps_color_grey)); |
| | | options.setToolbarWidgetColor(ContextCompat.getColor(getSelfActivity(), com.luck.picture.lib.R.color.ps_color_white)); |
| | | } |
| | | return options; |
| | | } |
| | | |
| | | /** |
| | | * 创建自定义输出目录 |
| | | * |
| | | * @return |
| | | */ |
| | | private String getSandboxPath() { |
| | | File externalFilesDir = getSelfActivity().getExternalFilesDir(""); |
| | | File customFile = new File(externalFilesDir.getAbsolutePath(), "Sandbox"); |
| | | if (!customFile.exists()) { |
| | | customFile.mkdirs(); |
| | | } |
| | | return customFile.getAbsolutePath() + File.separator; |
| | | } |
| | | } |
New file |
| | |
| | | package com.application.zhangshi_app_android.ui.function; |
| | | |
| | | import static com.android.app_base.base.BaseConfig.CODE_SUCCESS; |
| | | |
| | | import android.app.Application; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.lifecycle.MutableLiveData; |
| | | |
| | | import com.android.app_base.base.StateViewEnum; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.application.zhangshi_app_android.bean.BannerBean; |
| | | import com.application.zhangshi_app_android.bean.UploadFileResponseBean; |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import io.reactivex.ObservableSource; |
| | | import io.reactivex.Observer; |
| | | import io.reactivex.disposables.Disposable; |
| | | import io.reactivex.functions.Action; |
| | | import io.reactivex.functions.Consumer; |
| | | import io.reactivex.functions.Function; |
| | | import okhttp3.MediaType; |
| | | import okhttp3.MultipartBody; |
| | | import okhttp3.RequestBody; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.07.30. 8:52 |
| | | * @desc |
| | | */ |
| | | public class ImageSelectActivityViewModel extends BaseViewModel<DataRepository> { |
| | | private MutableLiveData<Integer> flagLiveData;//0 图片选择 1 视频选择 |
| | | private MutableLiveData<Boolean> typeLiveData;//true 编辑 false 查看 |
| | | private MutableLiveData<List<BannerBean>> dataListLiveData = new MutableLiveData<>(); |
| | | public ImageSelectActivityViewModel(@NonNull Application application) { |
| | | super(application); |
| | | } |
| | | |
| | | @Override |
| | | protected DataRepository initModel() { |
| | | return DataRepository.getInstance(); |
| | | } |
| | | |
| | | public MutableLiveData<Boolean> getTypeLiveData() { |
| | | if (typeLiveData == null){ |
| | | typeLiveData = new MutableLiveData<>(); |
| | | typeLiveData.setValue(false); |
| | | } |
| | | return typeLiveData; |
| | | } |
| | | |
| | | public void setTypeLiveData(MutableLiveData<Boolean> typeLiveData) { |
| | | this.typeLiveData = typeLiveData; |
| | | } |
| | | |
| | | public void setType(boolean type) { |
| | | if (typeLiveData == null){ |
| | | typeLiveData = new MutableLiveData<>(); |
| | | } |
| | | typeLiveData.setValue(type); |
| | | } |
| | | public boolean getType(){ |
| | | if (typeLiveData == null){ |
| | | typeLiveData = new MutableLiveData<>(); |
| | | typeLiveData.setValue(false); |
| | | } |
| | | return Boolean.TRUE.equals(typeLiveData.getValue()); |
| | | } |
| | | |
| | | public MutableLiveData<Integer> getFlagLiveData() { |
| | | if (flagLiveData == null){ |
| | | flagLiveData = new MutableLiveData<>(); |
| | | flagLiveData.setValue(0); |
| | | } |
| | | return flagLiveData; |
| | | } |
| | | public int getFlag() { |
| | | if (flagLiveData.getValue()!=null){ |
| | | return flagLiveData.getValue(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | public void setFlagLiveData(MutableLiveData<Integer> flagLiveData) { |
| | | this.flagLiveData = flagLiveData; |
| | | } |
| | | |
| | | public void setFlag(int flag) { |
| | | if (flagLiveData == null){ |
| | | flagLiveData = new MutableLiveData<>(); |
| | | } |
| | | flagLiveData.setValue(flag); |
| | | } |
| | | |
| | | public MutableLiveData<List<BannerBean>> getListLiveData() { |
| | | if (dataListLiveData == null){ |
| | | dataListLiveData = new MutableLiveData<>(); |
| | | } |
| | | return dataListLiveData; |
| | | } |
| | | |
| | | public void setList(List<BannerBean> listMutableLiveData) { |
| | | if (this.dataListLiveData == null){ |
| | | this.dataListLiveData = new MutableLiveData<>(); |
| | | } |
| | | this.dataListLiveData.setValue(listMutableLiveData); |
| | | } |
| | | |
| | | /** |
| | | * 添加 Banner 图片 或 视频 |
| | | */ |
| | | public void add(String realPath) { |
| | | File file = new File(realPath); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<ResultData<String>>>() { |
| | | @Override |
| | | public ObservableSource<ResultData<String>> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | BannerBean bannerBean = new BannerBean(); |
| | | bannerBean.setUrl(resultData.getData().getUrl()); |
| | | if (flagLiveData.getValue()!=null){ |
| | | bannerBean.setFlag(flagLiveData.getValue()); |
| | | } |
| | | return model.addBannerData(bannerBean); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> data) { |
| | | if (data.getCode() == CODE_SUCCESS){ |
| | | messageLiveData.postValue("添加成功"); |
| | | getBannerData(); |
| | | }else { |
| | | messageLiveData.postValue(data.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 删除 Banner 图片 或 视频 |
| | | */ |
| | | public void delete(String ids) { |
| | | model.deleteBannerData(ids) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> data) { |
| | | if (data.getCode() == CODE_SUCCESS) { |
| | | messageLiveData.postValue("删除成功"); |
| | | getBannerData(); |
| | | } else { |
| | | messageLiveData.postValue(data.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 修改 Banner 图片 或 视频 |
| | | */ |
| | | public void update(BannerBean bannerBean) { |
| | | model.updateBannerData(bannerBean) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> data) { |
| | | if (data.getCode() == CODE_SUCCESS){ |
| | | getBannerData(); |
| | | }else { |
| | | messageLiveData.postValue(data.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 获取banner 轮播图数据 |
| | | */ |
| | | public void getBannerData() { |
| | | model.getBannerData() |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<List<BannerBean>>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<List<BannerBean>> data) { |
| | | if (data.getCode() == CODE_SUCCESS){ |
| | | if (data.getData()!=null && data.getData().size()>0){ |
| | | List<BannerBean> list = new ArrayList<>(); |
| | | for (BannerBean datum : data.getData()) { |
| | | if (flagLiveData.getValue()!=null){ |
| | | if (datum.getFlag() == flagLiveData.getValue()){ |
| | | list.add(datum); |
| | | } |
| | | } |
| | | } |
| | | dataListLiveData.postValue(list); |
| | | } |
| | | }else { |
| | | messageLiveData.postValue(data.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.application.zhangshi_app_android.ui.function; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.ClipData; |
| | | import android.content.Intent; |
| | | import android.net.Uri; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.EditText; |
| | | import android.widget.PopupWindow; |
| | | |
| | | import androidx.activity.result.ActivityResult; |
| | | import androidx.activity.result.ActivityResultCallback; |
| | | import androidx.activity.result.ActivityResultLauncher; |
| | | import androidx.activity.result.contract.ActivityResultContracts; |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.android.app_base.base.dialog.BaseDialog; |
| | | import com.android.app_base.base.dialog.UIDialog; |
| | | import com.android.app_base.base.dialog.WaitDialog; |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.GetFilePathFromUri; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.IncomeAndExpensesBean; |
| | | import com.application.zhangshi_app_android.bean.LittleDoctorBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityIncomeAndExpensesBinding; |
| | | import com.application.zhangshi_app_android.databinding.ActivityIncomeAndExpensesDetailBinding; |
| | | import com.application.zhangshi_app_android.databinding.ActivityLittleDoctorDetailBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | import com.github.gzuliyujiang.wheelpicker.DatePicker; |
| | | import com.github.gzuliyujiang.wheelpicker.OptionPicker; |
| | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.04.20. 22:56 |
| | | * @desc |
| | | * @desc 收支台账 |
| | | */ |
| | | public class IncomeAndExpensesDetailActivity extends DLBaseActivity<ActivityIncomeAndExpensesDetailBinding, IncomeAndExpensesDetailActivityViewModel> { |
| | | |
| | | private int type;// 0 查看可修改删除 1 新增 2 直接修改 |
| | | private PopupWindow popupWindow; |
| | | private ImageRvAdapter adapter; |
| | | |
| | | private ElectronicFileAddAdapter adapter; |
| | | private BaseDialog mWaitDialog; |
| | | private ActivityResultLauncher<Intent> activityResultLauncher; |
| | | @Override |
| | | public int getLayoutId() { |
| | | return R.layout.activity_income_and_expenses_detail; |
| | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | | View footerView = View.inflate(this,R.layout.item_image_footer,null); |
| | | binding.rvImage.addFooterView(footerView); |
| | | binding.rvImage.requestLayout(); |
| | | footerView.setOnClickListener(new View.OnClickListener() { |
| | | adapter.setItemAndAddClickListener(new ElectronicFileAddAdapter.OnItemAndAddClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 9, new OnResultCallbackListener<LocalMedia>() { |
| | | public void onItemClick(View v, int position) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onAddClick() { |
| | | OptionPicker picker = getOptionPicker(Arrays.asList("图片视频","其他文件")); |
| | | picker.setTitle("选择文件类型"); |
| | | picker.setOnOptionPickedListener(new OnOptionPickedListener() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | String path = media.getRealPath(); |
| | | File file = new File(path); |
| | | if (file.exists()) { |
| | | viewModel.uploadFile(file); |
| | | } |
| | | public void onOptionPicked(int position, Object item) { |
| | | if (item.equals("图片视频")) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 0,9, new OnResultCallbackListener<LocalMedia>() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | String path = media.getRealPath(); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | IncomeAndExpensesBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | Intent intent = new Intent(Intent.ACTION_GET_CONTENT); |
| | | // Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); |
| | | intent.setType("*/*"); // 限制文件类型 |
| | | intent.addCategory(Intent.CATEGORY_OPENABLE); // 添加 CATEGORY_OPENABLE 分类,告诉系统要选择的内容可以被打开,这样系统会过滤掉不能被应用打开的文件,以提供更好的用户体验。 |
| | | intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); // 允许多选 |
| | | activityResultLauncher.launch(intent); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | picker.show(); |
| | | |
| | | } |
| | | }); |
| | | adapter.setOnChildClickListener(R.id.iv_delete, new BaseRVAdapter.OnChildClickListener() { |
| | |
| | | }); |
| | | picker.show(); |
| | | }); |
| | | |
| | | activityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() { |
| | | @Override |
| | | public void onActivityResult(ActivityResult result) { |
| | | if (result.getResultCode() == Activity.RESULT_OK) { |
| | | if (result.getData() == null){ |
| | | return; |
| | | } |
| | | // 获取选中的多个文件的 URI |
| | | ClipData clipData = result.getData().getClipData(); |
| | | if (clipData != null) { |
| | | int itemCount = clipData.getItemCount(); |
| | | for (int i = 0; i < itemCount; i++) { |
| | | Uri uri = clipData.getItemAt(i).getUri(); |
| | | // 使用选中的文件 URI 进行后续操作,比如读取文件内容等 |
| | | String path = GetFilePathFromUri.getFileAbsolutePath(getSelfActivity(),uri); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | IncomeAndExpensesBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | }else { |
| | | // 获取选中的单个文件的 URI |
| | | Uri selectedFileUri = result.getData().getData(); |
| | | String path = GetFilePathFromUri.getFileAbsolutePath(getSelfActivity(),selectedFileUri); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | IncomeAndExpensesBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogLoading() { |
| | | if (mWaitDialog == null) { |
| | | mWaitDialog = new WaitDialog.Builder(this) |
| | | // 消息文本可以不用填写 |
| | | .setMessage("正在上传") |
| | | .create(); |
| | | } |
| | | if (!mWaitDialog.isShowing()) { |
| | | mWaitDialog.show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogDismiss() { |
| | | if (mWaitDialog != null && mWaitDialog.isShowing()) { |
| | | mWaitDialog.dismiss(); |
| | | mWaitDialog = null; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.lifecycle.MutableLiveData; |
| | | |
| | | import com.android.app_base.base.StateViewEnum; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.android.app_base.utils.rxbus.RxBus; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.IncomeAndExpensesBean; |
| | | import com.application.zhangshi_app_android.bean.UploadFileResponseBean; |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import io.reactivex.Observable; |
| | | import io.reactivex.ObservableSource; |
| | | import io.reactivex.Observer; |
| | | import io.reactivex.disposables.Disposable; |
| | | import io.reactivex.functions.Action; |
| | | import io.reactivex.functions.Consumer; |
| | | import io.reactivex.functions.Function; |
| | | import okhttp3.MediaType; |
| | | import okhttp3.MultipartBody; |
| | | import okhttp3.RequestBody; |
| | |
| | | |
| | | private MutableLiveData<IncomeAndExpensesBean> beanLiveData; |
| | | private MutableLiveData<Boolean> typeLiveData;//true 编辑状态 false 展示状态 |
| | | private final List<String> uploadFileList = new ArrayList<>();//需要上传的文件列表 |
| | | |
| | | public IncomeAndExpensesDetailActivityViewModel(@NonNull Application application) { |
| | | super(application); |
| | |
| | | * 添加 收支台账 |
| | | */ |
| | | public void add() { |
| | | System.out.println(beanLiveData.getValue()); |
| | | model.addIncomeAndExpenses(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | if (uploadFileList.size() > 0) { |
| | | List<Observable<String>> observables = new ArrayList<>(); |
| | | for (String path : uploadFileList) { |
| | | File file = new File(path); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | Observable<String> uploadObservable = model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<String>>() { |
| | | @Override |
| | | public ObservableSource<String> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | if (resultData.getCode() == CODE_SUCCESS) { |
| | | IncomeAndExpensesBean bean = getBeanLiveData().getValue(); |
| | | if (bean != null) { |
| | | String urls = bean.getUrl(); |
| | | //替换图片地址 |
| | | urls = urls.replace(path, resultData.getData().getUrl()); |
| | | bean.setUrl(urls); |
| | | getBeanLiveData().postValue(bean); |
| | | } |
| | | return Observable.just(path); |
| | | } else { |
| | | return Observable.error(new Exception(resultData.getMsg())); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | observables.add(uploadObservable); |
| | | } |
| | | Observable.zip(observables, result -> result) |
| | | .flatMap(new Function<Object[], Observable<ResultData<String>>>() { |
| | | @Override |
| | | public Observable<ResultData<String>> apply(Object[] objects) throws Exception { |
| | | //移除已经上传的文件 |
| | | //把objects数组转换成list,然后移除 |
| | | for (Object object : objects) { |
| | | uploadFileList.remove((String) object); |
| | | } |
| | | return model.addIncomeAndExpenses(beanLiveData.getValue()); |
| | | } |
| | | } |
| | | }) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS) { |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | } else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | model.addIncomeAndExpenses(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | /** |
| | | * 删除 收支台账 |
| | |
| | | }); |
| | | } |
| | | /** |
| | | * 修改小医生 |
| | | * 修改 收支台账 |
| | | */ |
| | | public void update() { |
| | | model.updateIncomeAndExpenses(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | if (uploadFileList.size() > 0){ |
| | | List<Observable<String>> observables = new ArrayList<>(); |
| | | for (String path : uploadFileList) { |
| | | File file = new File(path); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | Observable<String> uploadObservable = model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<String>>() { |
| | | @Override |
| | | public ObservableSource<String> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | if (resultData.getCode() == CODE_SUCCESS){ |
| | | IncomeAndExpensesBean bean = getBeanLiveData().getValue(); |
| | | if (bean != null){ |
| | | String urls = bean.getUrl(); |
| | | //替换图片地址 |
| | | urls = urls.replace(path,resultData.getData().getUrl()); |
| | | bean.setUrl(urls); |
| | | getBeanLiveData().postValue(bean); |
| | | } |
| | | return Observable.just(path); |
| | | }else { |
| | | return Observable.error(new Exception(resultData.getMsg())); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | observables.add(uploadObservable); |
| | | } |
| | | Observable.zip(observables,result -> result) |
| | | .flatMap(new Function<Object[], Observable<ResultData<String>>>() { |
| | | @Override |
| | | public Observable<ResultData<String>> apply(Object[] objects) throws Exception { |
| | | //移除已经上传的文件 |
| | | //把objects数组转换成list,然后移除 |
| | | for (Object object : objects) { |
| | | uploadFileList.remove((String) object); |
| | | } |
| | | return model.updateIncomeAndExpenses(beanLiveData.getValue()); |
| | | } |
| | | } |
| | | }) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | } |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | model.updateIncomeAndExpenses(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 上传电子文件 |
| | |
| | | } |
| | | return beanLiveData; |
| | | } |
| | | } |
| | | |
| | | public List<String> getUploadFileList() { |
| | | return uploadFileList; |
| | | } |
| | | |
| | | public void addUploadFile(String url) { |
| | | uploadFileList.add(url); |
| | | } |
| | | } |
| | |
| | | package com.application.zhangshi_app_android.ui.function; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.ClipData; |
| | | import android.content.Intent; |
| | | import android.net.Uri; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.EditText; |
| | | import android.widget.PopupWindow; |
| | | |
| | | import androidx.activity.result.ActivityResult; |
| | | import androidx.activity.result.ActivityResultCallback; |
| | | import androidx.activity.result.ActivityResultLauncher; |
| | | import androidx.activity.result.contract.ActivityResultContracts; |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.android.app_base.base.dialog.BaseDialog; |
| | | import com.android.app_base.base.dialog.UIDialog; |
| | | import com.android.app_base.base.dialog.WaitDialog; |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.GetFilePathFromUri; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.LittleDoctorBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityLittleDoctorDetailBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | import com.github.gzuliyujiang.wheelpicker.OptionPicker; |
| | | import com.github.gzuliyujiang.wheelpicker.contract.OnOptionPickedListener; |
| | | import com.luck.picture.lib.entity.LocalMedia; |
| | | import com.luck.picture.lib.interfaces.OnResultCallbackListener; |
| | | |
| | |
| | | import java.util.List; |
| | | import java.util.function.Consumer; |
| | | |
| | | |
| | | public class LittleDoctorDetailActivity extends DLBaseActivity<ActivityLittleDoctorDetailBinding, LittleDoctorDetailActivityViewModel> { |
| | | |
| | | private int type;// 0 查看可修改删除 1 新增 2 直接修改 |
| | | private PopupWindow popupWindow; |
| | | private ImageRvAdapter adapter; |
| | | private ElectronicFileAddAdapter adapter; |
| | | private BaseDialog mWaitDialog; |
| | | private ActivityResultLauncher<Intent> activityResultLauncher; |
| | | @Override |
| | | public int getLayoutId() { |
| | | return R.layout.activity_little_doctor_detail; |
| | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | | View footerView = View.inflate(this,R.layout.item_image_footer,null); |
| | | binding.rvImage.addFooterView(footerView); |
| | | binding.rvImage.requestLayout(); |
| | | footerView.setOnClickListener(new View.OnClickListener() { |
| | | adapter.setItemAndAddClickListener(new ElectronicFileAddAdapter.OnItemAndAddClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 9, new OnResultCallbackListener<LocalMedia>() { |
| | | public void onItemClick(View v, int position) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onAddClick() { |
| | | OptionPicker picker = getOptionPicker(Arrays.asList("图片视频","其他文件")); |
| | | picker.setTitle("选择文件类型"); |
| | | picker.setOnOptionPickedListener(new OnOptionPickedListener() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | String path = media.getRealPath(); |
| | | File file = new File(path); |
| | | if (file.exists()) { |
| | | viewModel.uploadFile(file); |
| | | } |
| | | public void onOptionPicked(int position, Object item) { |
| | | if (item.equals("图片视频")) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 0,9, new OnResultCallbackListener<LocalMedia>() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | String path = media.getRealPath(); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | LittleDoctorBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | Intent intent = new Intent(Intent.ACTION_GET_CONTENT); |
| | | // Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); |
| | | intent.setType("*/*"); // 限制文件类型 |
| | | intent.addCategory(Intent.CATEGORY_OPENABLE); // 添加 CATEGORY_OPENABLE 分类,告诉系统要选择的内容可以被打开,这样系统会过滤掉不能被应用打开的文件,以提供更好的用户体验。 |
| | | intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); // 允许多选 |
| | | activityResultLauncher.launch(intent); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | picker.show(); |
| | | |
| | | } |
| | | }); |
| | | adapter.setOnChildClickListener(R.id.iv_delete, new BaseRVAdapter.OnChildClickListener() { |
| | |
| | | |
| | | } |
| | | |
| | | activityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() { |
| | | @Override |
| | | public void onActivityResult(ActivityResult result) { |
| | | if (result.getResultCode() == Activity.RESULT_OK) { |
| | | if (result.getData() == null){ |
| | | return; |
| | | } |
| | | // 获取选中的多个文件的 URI |
| | | ClipData clipData = result.getData().getClipData(); |
| | | if (clipData != null) { |
| | | int itemCount = clipData.getItemCount(); |
| | | for (int i = 0; i < itemCount; i++) { |
| | | Uri uri = clipData.getItemAt(i).getUri(); |
| | | // 使用选中的文件 URI 进行后续操作,比如读取文件内容等 |
| | | String path = GetFilePathFromUri.getFileAbsolutePath(getSelfActivity(),uri); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | LittleDoctorBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | }else { |
| | | // 获取选中的单个文件的 URI |
| | | Uri selectedFileUri = result.getData().getData(); |
| | | String path = GetFilePathFromUri.getFileAbsolutePath(getSelfActivity(),selectedFileUri); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | LittleDoctorBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogLoading() { |
| | | if (mWaitDialog == null) { |
| | | mWaitDialog = new WaitDialog.Builder(this) |
| | | // 消息文本可以不用填写 |
| | | .setMessage("正在上传") |
| | | .create(); |
| | | } |
| | | if (!mWaitDialog.isShowing()) { |
| | | mWaitDialog.show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogDismiss() { |
| | | if (mWaitDialog != null && mWaitDialog.isShowing()) { |
| | | mWaitDialog.dismiss(); |
| | | mWaitDialog = null; |
| | | } |
| | | } |
| | | } |
| | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.lifecycle.MutableLiveData; |
| | | |
| | | import com.android.app_base.base.StateViewEnum; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.manager.AppManager; |
| | |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import io.reactivex.Observable; |
| | | import io.reactivex.ObservableSource; |
| | | import io.reactivex.Observer; |
| | | import io.reactivex.disposables.Disposable; |
| | | import io.reactivex.functions.Action; |
| | | import io.reactivex.functions.Consumer; |
| | | import io.reactivex.functions.Function; |
| | | import okhttp3.MediaType; |
| | | import okhttp3.MultipartBody; |
| | | import okhttp3.RequestBody; |
| | |
| | | |
| | | private MutableLiveData<LittleDoctorBean> beanLiveData; |
| | | private MutableLiveData<Boolean> typeLiveData;//true 编辑状态 false 展示状态 |
| | | private final List<String> uploadFileList = new ArrayList<>();//需要上传的文件列表 |
| | | |
| | | public LittleDoctorDetailActivityViewModel(@NonNull Application application) { |
| | | super(application); |
| | |
| | | * 增加小医生 |
| | | */ |
| | | public void add() { |
| | | model.addLittleDoctor(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | if (uploadFileList.size() > 0) { |
| | | List<Observable<String>> observables = new ArrayList<>(); |
| | | for (String path : uploadFileList) { |
| | | File file = new File(path); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | Observable<String> uploadObservable = model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<String>>() { |
| | | @Override |
| | | public ObservableSource<String> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | if (resultData.getCode() == CODE_SUCCESS) { |
| | | LittleDoctorBean bean = getBeanLiveData().getValue(); |
| | | if (bean != null) { |
| | | String urls = bean.getUrl(); |
| | | //替换图片地址 |
| | | urls = urls.replace(path, resultData.getData().getUrl()); |
| | | bean.setUrl(urls); |
| | | getBeanLiveData().postValue(bean); |
| | | } |
| | | return Observable.just(path); |
| | | } else { |
| | | return Observable.error(new Exception(resultData.getMsg())); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | observables.add(uploadObservable); |
| | | } |
| | | Observable.zip(observables, result -> result) |
| | | .flatMap(new Function<Object[], Observable<ResultData<String>>>() { |
| | | @Override |
| | | public Observable<ResultData<String>> apply(Object[] objects) throws Exception { |
| | | //移除已经上传的文件 |
| | | //把objects数组转换成list,然后移除 |
| | | for (Object object : objects) { |
| | | uploadFileList.remove((String) object); |
| | | } |
| | | return model.addLittleDoctor(beanLiveData.getValue()); |
| | | } |
| | | } |
| | | }) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS) { |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | } else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | model.addLittleDoctor(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | /** |
| | | * 删除小医生 |
| | |
| | | * 修改小医生 |
| | | */ |
| | | public void update() { |
| | | model.updateLittleDoctor(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 上传电子文件 |
| | | */ |
| | | public void uploadFile(File file) { |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | model.uploadFile(body) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<UploadFileResponseBean>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<UploadFileResponseBean> resultData) { |
| | | if (resultData.getCode() == CODE_SUCCESS){ |
| | | LittleDoctorBean bean = beanLiveData.getValue(); |
| | | String url; |
| | | if (bean != null){ |
| | | url = bean.getUrl(); |
| | | if (url == null){ |
| | | url = resultData.getData().getUrl(); |
| | | if (uploadFileList.size() > 0){ |
| | | List<Observable<String>> observables = new ArrayList<>(); |
| | | for (String path : uploadFileList) { |
| | | File file = new File(path); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | Observable<String> uploadObservable = model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<String>>() { |
| | | @Override |
| | | public ObservableSource<String> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | if (resultData.getCode() == CODE_SUCCESS){ |
| | | LittleDoctorBean bean = getBeanLiveData().getValue(); |
| | | if (bean != null){ |
| | | String urls = bean.getUrl(); |
| | | //替换图片地址 |
| | | urls = urls.replace(path,resultData.getData().getUrl()); |
| | | bean.setUrl(urls); |
| | | getBeanLiveData().postValue(bean); |
| | | } |
| | | return Observable.just(path); |
| | | }else { |
| | | url = url + "," + resultData.getData().getUrl(); |
| | | return Observable.error(new Exception(resultData.getMsg())); |
| | | } |
| | | bean.setUrl(url); |
| | | beanLiveData.postValue(bean); |
| | | } |
| | | }else { |
| | | messageLiveData.postValue(resultData.getMsg()); |
| | | }); |
| | | |
| | | observables.add(uploadObservable); |
| | | } |
| | | Observable.zip(observables,result -> result) |
| | | .flatMap(new Function<Object[], Observable<ResultData<String>>>() { |
| | | @Override |
| | | public Observable<ResultData<String>> apply(Object[] objects) throws Exception { |
| | | //移除已经上传的文件 |
| | | //把objects数组转换成list,然后移除 |
| | | for (Object object : objects) { |
| | | uploadFileList.remove((String) object); |
| | | } |
| | | return model.updateLittleDoctor(beanLiveData.getValue()); |
| | | } |
| | | } |
| | | }) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | model.updateLittleDoctor(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | public MutableLiveData<Boolean> getTypeLiveData() { |
| | |
| | | } |
| | | return beanLiveData; |
| | | } |
| | | public List<String> getUploadFileList() { |
| | | return uploadFileList; |
| | | } |
| | | |
| | | public void addUploadFile(String url) { |
| | | uploadFileList.add(url); |
| | | } |
| | | } |
| | |
| | | package com.application.zhangshi_app_android.ui.function; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.ClipData; |
| | | import android.content.Intent; |
| | | import android.net.Uri; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.EditText; |
| | | import android.widget.PopupWindow; |
| | | |
| | | import androidx.activity.result.ActivityResult; |
| | | import androidx.activity.result.ActivityResultCallback; |
| | | import androidx.activity.result.ActivityResultLauncher; |
| | | import androidx.activity.result.contract.ActivityResultContracts; |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.android.app_base.base.dialog.BaseDialog; |
| | | import com.android.app_base.base.dialog.UIDialog; |
| | | import com.android.app_base.base.dialog.WaitDialog; |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.GetFilePathFromUri; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.PersonalNotepadBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityPersonalNotepadDetailBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | import com.github.gzuliyujiang.wheelpicker.DatePicker; |
| | | import com.github.gzuliyujiang.wheelpicker.OptionPicker; |
| | | import com.github.gzuliyujiang.wheelpicker.contract.OnDatePickedListener; |
| | | import com.github.gzuliyujiang.wheelpicker.contract.OnOptionPickedListener; |
| | | import com.hjq.bar.TitleBar; |
| | | import com.luck.picture.lib.entity.LocalMedia; |
| | | import com.luck.picture.lib.interfaces.OnResultCallbackListener; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Locale; |
| | | import java.util.function.Consumer; |
| | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.05.14. 20:37 |
| | | * @desc |
| | | * @desc 个人记事本详情 |
| | | */ |
| | | public class PersonalNotepadDetailActivity extends DLBaseActivity<ActivityPersonalNotepadDetailBinding,PersonalNotepadDetailActivityViewModel> { |
| | | |
| | | private ImageRvAdapter adapter; |
| | | private ElectronicFileAddAdapter adapter; |
| | | private BaseDialog mWaitDialog; |
| | | private ActivityResultLauncher<Intent> activityResultLauncher; |
| | | private int type;// 0 查看可修改删除 1 新增 2 直接修改 |
| | | private PopupWindow popupWindow; |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | | View footerView = View.inflate(this,R.layout.item_image_footer,null); |
| | | binding.rvImage.addFooterView(footerView); |
| | | binding.rvImage.requestLayout(); |
| | | footerView.setOnClickListener(new View.OnClickListener() { |
| | | adapter.setItemAndAddClickListener(new ElectronicFileAddAdapter.OnItemAndAddClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 9, new OnResultCallbackListener<LocalMedia>() { |
| | | public void onItemClick(View v, int position) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onAddClick() { |
| | | OptionPicker picker = getOptionPicker(Arrays.asList("图片视频","其他文件")); |
| | | picker.setTitle("选择文件类型"); |
| | | picker.setOnOptionPickedListener(new OnOptionPickedListener() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | String path = media.getRealPath(); |
| | | File file = new File(path); |
| | | if (file.exists()) { |
| | | viewModel.uploadFile(file); |
| | | } |
| | | public void onOptionPicked(int position, Object item) { |
| | | if (item.equals("图片视频")) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 0,9, new OnResultCallbackListener<LocalMedia>() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | String path = media.getRealPath(); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | PersonalNotepadBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | Intent intent = new Intent(Intent.ACTION_GET_CONTENT); |
| | | // Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); |
| | | intent.setType("*/*"); // 限制文件类型 |
| | | intent.addCategory(Intent.CATEGORY_OPENABLE); // 添加 CATEGORY_OPENABLE 分类,告诉系统要选择的内容可以被打开,这样系统会过滤掉不能被应用打开的文件,以提供更好的用户体验。 |
| | | intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); // 允许多选 |
| | | activityResultLauncher.launch(intent); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | picker.show(); |
| | | |
| | | } |
| | | }); |
| | | adapter.setOnChildClickListener(R.id.iv_delete, new BaseRVAdapter.OnChildClickListener() { |
| | |
| | | picker.show(); |
| | | } |
| | | }); |
| | | |
| | | activityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() { |
| | | @Override |
| | | public void onActivityResult(ActivityResult result) { |
| | | if (result.getResultCode() == Activity.RESULT_OK) { |
| | | if (result.getData() == null){ |
| | | return; |
| | | } |
| | | // 获取选中的多个文件的 URI |
| | | ClipData clipData = result.getData().getClipData(); |
| | | if (clipData != null) { |
| | | int itemCount = clipData.getItemCount(); |
| | | for (int i = 0; i < itemCount; i++) { |
| | | Uri uri = clipData.getItemAt(i).getUri(); |
| | | // 使用选中的文件 URI 进行后续操作,比如读取文件内容等 |
| | | String path = GetFilePathFromUri.getFileAbsolutePath(getSelfActivity(),uri); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | PersonalNotepadBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | }else { |
| | | // 获取选中的单个文件的 URI |
| | | Uri selectedFileUri = result.getData().getData(); |
| | | String path = GetFilePathFromUri.getFileAbsolutePath(getSelfActivity(),selectedFileUri); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | PersonalNotepadBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public void onLeftClick(TitleBar titleBar) { |
| | | finish(); |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogLoading() { |
| | | if (mWaitDialog == null) { |
| | | mWaitDialog = new WaitDialog.Builder(this) |
| | | // 消息文本可以不用填写 |
| | | .setMessage("正在上传") |
| | | .create(); |
| | | } |
| | | if (!mWaitDialog.isShowing()) { |
| | | mWaitDialog.show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogDismiss() { |
| | | if (mWaitDialog != null && mWaitDialog.isShowing()) { |
| | | mWaitDialog.dismiss(); |
| | | mWaitDialog = null; |
| | | } |
| | | } |
| | | } |
| | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.lifecycle.MutableLiveData; |
| | | |
| | | import com.android.app_base.base.StateViewEnum; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.android.app_base.utils.rxbus.RxBus; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.PersonalNotepadBean; |
| | | import com.application.zhangshi_app_android.bean.UploadFileResponseBean; |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import io.reactivex.Observable; |
| | | import io.reactivex.ObservableSource; |
| | | import io.reactivex.Observer; |
| | | import io.reactivex.disposables.Disposable; |
| | | import io.reactivex.functions.Action; |
| | | import io.reactivex.functions.Consumer; |
| | | import io.reactivex.functions.Function; |
| | | import okhttp3.MediaType; |
| | | import okhttp3.MultipartBody; |
| | | import okhttp3.RequestBody; |
| | |
| | | |
| | | private MutableLiveData<PersonalNotepadBean> beanLiveData; |
| | | private MutableLiveData<Boolean> typeLiveData;//true 编辑状态 false 展示状态 |
| | | private final List<String> uploadFileList = new ArrayList<>();//需要上传的文件列表 |
| | | |
| | | public PersonalNotepadDetailActivityViewModel(@NonNull Application application) { |
| | | super(application); |
| | |
| | | * 添加 |
| | | */ |
| | | public void add() { |
| | | System.out.println(beanLiveData.getValue()); |
| | | model.addPersonalNotepad(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | if (uploadFileList.size() > 0) { |
| | | List<Observable<String>> observables = new ArrayList<>(); |
| | | for (String path : uploadFileList) { |
| | | File file = new File(path); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | Observable<String> uploadObservable = model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<String>>() { |
| | | @Override |
| | | public ObservableSource<String> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | if (resultData.getCode() == CODE_SUCCESS) { |
| | | PersonalNotepadBean bean = getBeanLiveData().getValue(); |
| | | if (bean != null) { |
| | | String urls = bean.getUrl(); |
| | | //替换图片地址 |
| | | urls = urls.replace(path, resultData.getData().getUrl()); |
| | | bean.setUrl(urls); |
| | | getBeanLiveData().postValue(bean); |
| | | } |
| | | return Observable.just(path); |
| | | } else { |
| | | return Observable.error(new Exception(resultData.getMsg())); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | observables.add(uploadObservable); |
| | | } |
| | | Observable.zip(observables, result -> result) |
| | | .flatMap(new Function<Object[], Observable<ResultData<String>>>() { |
| | | @Override |
| | | public Observable<ResultData<String>> apply(Object[] objects) throws Exception { |
| | | //移除已经上传的文件 |
| | | //把objects数组转换成list,然后移除 |
| | | for (Object object : objects) { |
| | | uploadFileList.remove((String) object); |
| | | } |
| | | return model.addPersonalNotepad(beanLiveData.getValue()); |
| | | } |
| | | } |
| | | }) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS) { |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | } else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | model.addPersonalNotepad(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | /** |
| | | * 删除 |
| | |
| | | * 修改 |
| | | */ |
| | | public void update() { |
| | | model.updatePersonalNotepad(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 上传电子文件 |
| | | */ |
| | | public void uploadFile(File file) { |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | model.uploadFile(body) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<UploadFileResponseBean>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<UploadFileResponseBean> resultData) { |
| | | if (resultData.getCode() == CODE_SUCCESS){ |
| | | PersonalNotepadBean bean = beanLiveData.getValue(); |
| | | String url; |
| | | if (bean != null){ |
| | | url = bean.getUrl(); |
| | | if (url == null){ |
| | | url = resultData.getData().getUrl(); |
| | | if (uploadFileList.size() > 0){ |
| | | List<Observable<String>> observables = new ArrayList<>(); |
| | | for (String path : uploadFileList) { |
| | | File file = new File(path); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | Observable<String> uploadObservable = model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<String>>() { |
| | | @Override |
| | | public ObservableSource<String> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | if (resultData.getCode() == CODE_SUCCESS){ |
| | | PersonalNotepadBean bean = getBeanLiveData().getValue(); |
| | | if (bean != null){ |
| | | String urls = bean.getUrl(); |
| | | //替换图片地址 |
| | | urls = urls.replace(path,resultData.getData().getUrl()); |
| | | bean.setUrl(urls); |
| | | getBeanLiveData().postValue(bean); |
| | | } |
| | | return Observable.just(path); |
| | | }else { |
| | | url = url + "," + resultData.getData().getUrl(); |
| | | return Observable.error(new Exception(resultData.getMsg())); |
| | | } |
| | | bean.setUrl(url); |
| | | beanLiveData.postValue(bean); |
| | | } |
| | | }else { |
| | | messageLiveData.postValue(resultData.getMsg()); |
| | | }); |
| | | |
| | | observables.add(uploadObservable); |
| | | } |
| | | Observable.zip(observables,result -> result) |
| | | .flatMap(new Function<Object[], Observable<ResultData<String>>>() { |
| | | @Override |
| | | public Observable<ResultData<String>> apply(Object[] objects) throws Exception { |
| | | //移除已经上传的文件 |
| | | //把objects数组转换成list,然后移除 |
| | | for (Object object : objects) { |
| | | uploadFileList.remove((String) object); |
| | | } |
| | | return model.updatePersonalNotepad(beanLiveData.getValue()); |
| | | } |
| | | } |
| | | }) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | model.updatePersonalNotepad(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | public MutableLiveData<Boolean> getTypeLiveData() { |
| | | if (typeLiveData == null){ |
| | |
| | | } |
| | | return beanLiveData; |
| | | } |
| | | |
| | | public List<String> getUploadFileList() { |
| | | return uploadFileList; |
| | | } |
| | | |
| | | public void addUploadFile(String url) { |
| | | uploadFileList.add(url); |
| | | } |
| | | } |
| | |
| | | import com.application.zhangshi_app_android.databinding.ActivityPropertyBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | import com.github.gzuliyujiang.wheelpicker.DatePicker; |
| | | import com.github.gzuliyujiang.wheelpicker.OptionPicker; |
| | | import com.github.gzuliyujiang.wheelpicker.contract.OnDatePickedListener; |
| | | import com.github.gzuliyujiang.wheelpicker.contract.OnOptionPickedListener; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | |
| | | binding.etStartTime.setText(""); |
| | | binding.etEndTime.setText(""); |
| | | }); |
| | | binding.etSex.setOnClickListener(v -> { |
| | | List<String> list = Arrays.asList("雌","雄"); |
| | | OptionPicker picker = getOptionPicker(list); |
| | | picker.setTitle("性别"); |
| | | picker.setOnOptionPickedListener(new OnOptionPickedListener() { |
| | | @Override |
| | | public void onOptionPicked(int position, Object item) { |
| | | binding.etSex.setText(item.toString()); |
| | | } |
| | | }); |
| | | picker.show(); |
| | | }); |
| | | } |
| | | @Override |
| | | public boolean dispatchTouchEvent(MotionEvent event) { |
| | |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.bean.CertificateOfHonorBean; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.bean.PetMemoBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityCertificateOfHonorDetailBinding; |
| | | import com.application.zhangshi_app_android.databinding.ActivityPetMemoDetailBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | import com.hjq.bar.TitleBar; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.04.25. 21:36 |
| | | * @desc |
| | | * @desc 宠物备忘录详情 (仅供查看) |
| | | */ |
| | | public class PetMemoDetailActivity extends DLBaseActivity<ActivityPetMemoDetailBinding,PetMemoDetailActivityViewModel> { |
| | | |
| | | private ImageRvAdapter adapter; |
| | | private ElectronicFileAddAdapter adapter; |
| | | |
| | | @Override |
| | | public int getLayoutId() { |
| | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | |
| | | import com.android.app_base.widget.LinearItemDecoration; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.adapter.MemoRvAdapter; |
| | | import com.application.zhangshi_app_android.bean.AnnualHealthStatusBean; |
| | | import com.application.zhangshi_app_android.bean.PrivacyBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityAnnualHealthStatusDetailBinding; |
| | | import com.application.zhangshi_app_android.databinding.ActivityPrivacyDetailBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.04.28. 20:44 |
| | | * @desc |
| | | * @desc 隐私详情 (仅供查看) |
| | | */ |
| | | public class PrivacyDetailActivity extends DLBaseActivity<ActivityPrivacyDetailBinding,PrivacyDetailActivityViewModel> { |
| | | |
| | | private ImageRvAdapter adapter; |
| | | private ElectronicFileAddAdapter adapter; |
| | | private MemoRvAdapter memoRvAdapter; |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | |
| | | import com.android.app_base.widget.LinearItemDecoration; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.adapter.MemoRvAdapter; |
| | | import com.application.zhangshi_app_android.bean.CleanStorageBean; |
| | | import com.application.zhangshi_app_android.bean.PropertyBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityCleanStorageDetailBinding; |
| | | import com.application.zhangshi_app_android.databinding.ActivityPropertyDetailBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.04.21. 21:02 |
| | | * @desc 个人财产 详情 |
| | | * @desc 个人财产 详情 (仅供查看) |
| | | */ |
| | | public class PropertyDetailActivity extends DLBaseActivity<ActivityPropertyDetailBinding,PropertyDetailActivityViewModel> { |
| | | |
| | | private ImageRvAdapter adapter; |
| | | private ElectronicFileAddAdapter adapter; |
| | | private MemoRvAdapter memoRvAdapter; |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | |
| | | package com.application.zhangshi_app_android.ui.function; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.ClipData; |
| | | import android.content.Intent; |
| | | import android.net.Uri; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.EditText; |
| | | import android.widget.PopupWindow; |
| | | |
| | | import androidx.activity.result.ActivityResult; |
| | | import androidx.activity.result.ActivityResultCallback; |
| | | import androidx.activity.result.ActivityResultLauncher; |
| | | import androidx.activity.result.contract.ActivityResultContracts; |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | |
| | | import com.android.app_base.base.adapter.BaseRVAdapter; |
| | | import com.android.app_base.base.dialog.BaseDialog; |
| | | import com.android.app_base.base.dialog.UIDialog; |
| | | import com.android.app_base.base.dialog.WaitDialog; |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.GetFilePathFromUri; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.bean.IncomeAndExpensesBean; |
| | | import com.application.zhangshi_app_android.bean.PropertyBean; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.TourismExperienceBean; |
| | | import com.application.zhangshi_app_android.databinding.AcitivityTourismExperienceDetailBinding; |
| | | import com.application.zhangshi_app_android.databinding.ActivityPropertyDetailBinding; |
| | | import com.application.zhangshi_app_android.ui.DLBaseActivity; |
| | | import com.github.gzuliyujiang.wheelpicker.DatePicker; |
| | | import com.github.gzuliyujiang.wheelpicker.OptionPicker; |
| | |
| | | public class TourismExperienceDetailActivity extends DLBaseActivity<AcitivityTourismExperienceDetailBinding,TourismExperienceDetailActivityViewModel> { |
| | | private int type;// 0 查看可修改删除 1 新增 2 直接修改 |
| | | private PopupWindow popupWindow; |
| | | private ImageRvAdapter adapter; |
| | | private ElectronicFileAddAdapter adapter; |
| | | private BaseDialog mWaitDialog; |
| | | private ActivityResultLauncher<Intent> activityResultLauncher; |
| | | |
| | | @Override |
| | | public int getLayoutId() { |
| | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | | View footerView = View.inflate(this,R.layout.item_image_footer,null); |
| | | binding.rvImage.addFooterView(footerView); |
| | | binding.rvImage.requestLayout(); |
| | | footerView.setOnClickListener(new View.OnClickListener() { |
| | | adapter.setItemAndAddClickListener(new ElectronicFileAddAdapter.OnItemAndAddClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 9, new OnResultCallbackListener<LocalMedia>() { |
| | | public void onItemClick(View v, int position) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onAddClick() { |
| | | OptionPicker picker = getOptionPicker(Arrays.asList("图片视频","其他文件")); |
| | | picker.setTitle("选择文件类型"); |
| | | picker.setOnOptionPickedListener(new OnOptionPickedListener() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | String path = media.getRealPath(); |
| | | File file = new File(path); |
| | | if (file.exists()) { |
| | | viewModel.uploadFile(file); |
| | | } |
| | | public void onOptionPicked(int position, Object item) { |
| | | if (item.equals("图片视频")) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 0,9, new OnResultCallbackListener<LocalMedia>() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | | for (LocalMedia media : result) { |
| | | String path = media.getRealPath(); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | TourismExperienceBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | Intent intent = new Intent(Intent.ACTION_GET_CONTENT); |
| | | // Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); |
| | | intent.setType("*/*"); // 限制文件类型 |
| | | intent.addCategory(Intent.CATEGORY_OPENABLE); // 添加 CATEGORY_OPENABLE 分类,告诉系统要选择的内容可以被打开,这样系统会过滤掉不能被应用打开的文件,以提供更好的用户体验。 |
| | | intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); // 允许多选 |
| | | activityResultLauncher.launch(intent); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | }); |
| | | picker.show(); |
| | | |
| | | } |
| | | }); |
| | | adapter.setOnChildClickListener(R.id.iv_delete, new BaseRVAdapter.OnChildClickListener() { |
| | |
| | | picker.show(); |
| | | } |
| | | }); |
| | | activityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() { |
| | | @Override |
| | | public void onActivityResult(ActivityResult result) { |
| | | if (result.getResultCode() == Activity.RESULT_OK) { |
| | | if (result.getData() == null){ |
| | | return; |
| | | } |
| | | // 获取选中的多个文件的 URI |
| | | ClipData clipData = result.getData().getClipData(); |
| | | if (clipData != null) { |
| | | int itemCount = clipData.getItemCount(); |
| | | for (int i = 0; i < itemCount; i++) { |
| | | Uri uri = clipData.getItemAt(i).getUri(); |
| | | // 使用选中的文件 URI 进行后续操作,比如读取文件内容等 |
| | | String path = GetFilePathFromUri.getFileAbsolutePath(getSelfActivity(),uri); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | TourismExperienceBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | }else { |
| | | // 获取选中的单个文件的 URI |
| | | Uri selectedFileUri = result.getData().getData(); |
| | | String path = GetFilePathFromUri.getFileAbsolutePath(getSelfActivity(),selectedFileUri); |
| | | if (path!=null){ |
| | | viewModel.addUploadFile(path); |
| | | TourismExperienceBean bean = viewModel.getBeanLiveData().getValue(); |
| | | if (bean !=null){ |
| | | List<String> urlList = Utils.splitString2List(bean.getUrl(),","); |
| | | urlList.add(path); |
| | | bean.setUrl(Utils.appendList2String(urlList,",")); |
| | | } |
| | | viewModel.getBeanLiveData().setValue(bean); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | |
| | | viewModel.update(); |
| | | }); |
| | | } |
| | | binding.rvImage.getFooterViews().forEach(new Consumer<View>() { |
| | | @Override |
| | | public void accept(View view) { |
| | | view.setVisibility(View.VISIBLE); |
| | | } |
| | | }); |
| | | adapter.setIsEdited(true); |
| | | }else { |
| | | binding.ivOperate.setOnClickListener(v -> { |
| | | popupWindow.showAsDropDown(binding.ivOperate,-ScreenSizeUtils.dip2px(this,85) +binding.ivOperate.getWidth(),0); |
| | | }); |
| | | binding.rvImage.getFooterViews().forEach(new Consumer<View>() { |
| | | @Override |
| | | public void accept(View view) { |
| | | view.setVisibility(View.GONE); |
| | | } |
| | | }); |
| | | setIsEdited(false); |
| | | } |
| | | }); |
| | | } |
| | |
| | | public void onLeftClick(TitleBar titleBar) { |
| | | finish(); |
| | | } |
| | | |
| | | public void setIsEdited(boolean isEdited){ |
| | | adapter.setIsEdited(isEdited); |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogLoading() { |
| | | if (mWaitDialog == null) { |
| | | mWaitDialog = new WaitDialog.Builder(this) |
| | | // 消息文本可以不用填写 |
| | | .setMessage("正在上传") |
| | | .create(); |
| | | } |
| | | if (!mWaitDialog.isShowing()) { |
| | | mWaitDialog.show(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void dialogDismiss() { |
| | | if (mWaitDialog != null && mWaitDialog.isShowing()) { |
| | | mWaitDialog.dismiss(); |
| | | mWaitDialog = null; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.lifecycle.MutableLiveData; |
| | | |
| | | import com.android.app_base.base.StateViewEnum; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.android.app_base.utils.rxbus.RxBus; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.bean.TourismExperienceBean; |
| | | import com.application.zhangshi_app_android.bean.UploadFileResponseBean; |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import io.reactivex.Observable; |
| | | import io.reactivex.ObservableSource; |
| | | import io.reactivex.Observer; |
| | | import io.reactivex.disposables.Disposable; |
| | | import io.reactivex.functions.Action; |
| | | import io.reactivex.functions.Consumer; |
| | | import io.reactivex.functions.Function; |
| | | import okhttp3.MediaType; |
| | | import okhttp3.MultipartBody; |
| | | import okhttp3.RequestBody; |
| | |
| | | |
| | | private MutableLiveData<TourismExperienceBean> beanLiveData; |
| | | private MutableLiveData<Boolean> typeLiveData;//true 编辑状态 false 展示状态 |
| | | private final List<String> uploadFileList = new ArrayList<>();//需要上传的文件列表 |
| | | |
| | | public TourismExperienceDetailActivityViewModel(@NonNull Application application) { |
| | | super(application); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 添加 收支台账 |
| | | * 添加 旅游经历 |
| | | */ |
| | | public void add() { |
| | | System.out.println(beanLiveData.getValue()); |
| | | model.addTourismExperience(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | if (uploadFileList.size() > 0) { |
| | | List<Observable<String>> observables = new ArrayList<>(); |
| | | for (String path : uploadFileList) { |
| | | File file = new File(path); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | Observable<String> uploadObservable = model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<String>>() { |
| | | @Override |
| | | public ObservableSource<String> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | if (resultData.getCode() == CODE_SUCCESS) { |
| | | TourismExperienceBean bean = getBeanLiveData().getValue(); |
| | | if (bean != null) { |
| | | String urls = bean.getUrl(); |
| | | //替换图片地址 |
| | | urls = urls.replace(path, resultData.getData().getUrl()); |
| | | bean.setUrl(urls); |
| | | getBeanLiveData().postValue(bean); |
| | | } |
| | | return Observable.just(path); |
| | | } else { |
| | | return Observable.error(new Exception(resultData.getMsg())); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | observables.add(uploadObservable); |
| | | } |
| | | Observable.zip(observables, result -> result) |
| | | .flatMap(new Function<Object[], Observable<ResultData<String>>>() { |
| | | @Override |
| | | public Observable<ResultData<String>> apply(Object[] objects) throws Exception { |
| | | //移除已经上传的文件 |
| | | //把objects数组转换成list,然后移除 |
| | | for (Object object : objects) { |
| | | uploadFileList.remove((String) object); |
| | | } |
| | | return model.addTourismExperience(beanLiveData.getValue()); |
| | | } |
| | | } |
| | | }) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS) { |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | } else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | model.addTourismExperience(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("添加成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除 收支台账 |
| | | * 删除 旅游经历 |
| | | */ |
| | | public void delete() { |
| | | if (beanLiveData.getValue() == null){ |
| | |
| | | * 修改小医生 |
| | | */ |
| | | public void update() { |
| | | model.updateTourismExperience(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 上传电子文件 |
| | | */ |
| | | public void uploadFile(File file) { |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | model.uploadFile(body) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<UploadFileResponseBean>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<UploadFileResponseBean> resultData) { |
| | | if (resultData.getCode() == CODE_SUCCESS){ |
| | | TourismExperienceBean bean = beanLiveData.getValue(); |
| | | String url; |
| | | if (bean != null){ |
| | | url = bean.getUrl(); |
| | | if (url == null){ |
| | | url = resultData.getData().getUrl(); |
| | | if (uploadFileList.size() > 0){ |
| | | List<Observable<String>> observables = new ArrayList<>(); |
| | | for (String path : uploadFileList) { |
| | | File file = new File(path); |
| | | RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); |
| | | MultipartBody.Part body = MultipartBody.Part.createFormData("uploadFile", file.getName(), requestBody); |
| | | Observable<String> uploadObservable = model.uploadFile(body) |
| | | .flatMap(new Function<ResultData<UploadFileResponseBean>, ObservableSource<String>>() { |
| | | @Override |
| | | public ObservableSource<String> apply(ResultData<UploadFileResponseBean> resultData) throws Exception { |
| | | if (resultData.getCode() == CODE_SUCCESS){ |
| | | TourismExperienceBean bean = getBeanLiveData().getValue(); |
| | | if (bean != null){ |
| | | String urls = bean.getUrl(); |
| | | //替换图片地址 |
| | | urls = urls.replace(path,resultData.getData().getUrl()); |
| | | bean.setUrl(urls); |
| | | getBeanLiveData().postValue(bean); |
| | | } |
| | | return Observable.just(path); |
| | | }else { |
| | | url = url + "," + resultData.getData().getUrl(); |
| | | return Observable.error(new Exception(resultData.getMsg())); |
| | | } |
| | | bean.setUrl(url); |
| | | beanLiveData.postValue(bean); |
| | | } |
| | | }else { |
| | | messageLiveData.postValue(resultData.getMsg()); |
| | | }); |
| | | |
| | | observables.add(uploadObservable); |
| | | } |
| | | Observable.zip(observables,result -> result) |
| | | .flatMap(new Function<Object[], Observable<ResultData<String>>>() { |
| | | @Override |
| | | public Observable<ResultData<String>> apply(Object[] objects) throws Exception { |
| | | //移除已经上传的文件 |
| | | //把objects数组转换成list,然后移除 |
| | | for (Object object : objects) { |
| | | uploadFileList.remove((String) object); |
| | | } |
| | | return model.updateTourismExperience(beanLiveData.getValue()); |
| | | } |
| | | } |
| | | }) |
| | | .doOnSubscribe(new Consumer<Disposable>() { |
| | | @Override |
| | | public void accept(Disposable disposable) throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_LOADING); |
| | | } |
| | | }) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DIALOG_DISMISS); |
| | | } |
| | | }) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | }else { |
| | | model.updateTourismExperience(beanLiveData.getValue()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<String>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<String> stringResultData) { |
| | | if (stringResultData.getCode() == CODE_SUCCESS){ |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | RxBus.getInstance().post(beanLiveData.getValue()); |
| | | messageLiveData.postValue("修改成功"); |
| | | }else { |
| | | messageLiveData.postValue(stringResultData.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | public MutableLiveData<Boolean> getTypeLiveData() { |
| | | if (typeLiveData == null){ |
| | | typeLiveData = new MutableLiveData<>(); |
| | |
| | | } |
| | | return beanLiveData; |
| | | } |
| | | |
| | | public List<String> getUploadFileList() { |
| | | return uploadFileList; |
| | | } |
| | | |
| | | public void addUploadFile(String url) { |
| | | uploadFileList.add(url); |
| | | } |
| | | } |
| | |
| | | import com.android.app_base.base.view.BaseFragment; |
| | | import com.android.app_base.utils.GlideUtil; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.bean.BannerBean; |
| | | import com.application.zhangshi_app_android.databinding.FragmentVideoBinding; |
| | | import com.shuyu.gsyvideoplayer.GSYVideoManager; |
| | | import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder; |
| | |
| | | */ |
| | | public class VideoFragment extends BaseFragment<FragmentVideoBinding, VideoFragmentViewModel> { |
| | | OrientationUtils orientationUtils; |
| | | private List<String> videoList; |
| | | private List<BannerBean> videoList; |
| | | private boolean isPlay; |
| | | private boolean isPause; |
| | | |
| | | private VideoFragment() { |
| | | public VideoFragment() { |
| | | } |
| | | |
| | | public static VideoFragment newInstance() { |
| | |
| | | @Override |
| | | protected void initParam() { |
| | | if (getArguments() != null) { |
| | | videoList = (List<String>) getArguments().getSerializable("videoList"); |
| | | videoList = (List<BannerBean>) getArguments().getSerializable("videoList"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void initView() { |
| | | if (videoList != null && videoList.size() > 0){ |
| | | String playUrl = null; |
| | | for (BannerBean bannerBean : videoList) { |
| | | if (bannerBean.getChoose() == 1){ |
| | | playUrl = bannerBean.getUrl(); |
| | | break; |
| | | } |
| | | } |
| | | if (playUrl != null){ |
| | | binding.videoPlayer.setVisibility(View.VISIBLE); |
| | | binding.layoutDataNull.setVisibility(View.GONE); |
| | | //增加封面 |
| | | ImageView imageView = new ImageView(getSelfActivity()); |
| | | imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); |
| | | GlideUtil.loadVideoCover(videoList.get(0), imageView,-1,1); |
| | | //增加title |
| | | binding.videoPlayer.getTitleTextView().setVisibility(View.GONE); |
| | | binding.videoPlayer.getBackButton().setVisibility(View.GONE); |
| | | |
| | | |
| | | //外部辅助的旋转,帮助全屏 |
| | | //orientationUtils = new OrientationUtils(this, binding.videoPlayer); |
| | | //初始化不打开外部的旋转 |
| | | // orientationUtils.setEnable(false); |
| | | |
| | | //增加封面 |
| | | ImageView imageView = new ImageView(getSelfActivity()); |
| | | imageView.setScaleType(ImageView.ScaleType.CENTER); |
| | | GlideUtil.loadVideoCover(playUrl, imageView,-1,1); |
| | | //增加title |
| | | binding.videoPlayer.getTitleTextView().setVisibility(View.GONE); |
| | | binding.videoPlayer.getBackButton().setVisibility(View.GONE); |
| | | GSYVideoOptionBuilder gsyVideoOption = new GSYVideoOptionBuilder(); |
| | | gsyVideoOption.setThumbImageView(imageView) |
| | | .setIsTouchWiget(true) |
| | |
| | | .setLockLand(false) |
| | | .setAutoFullWithSize(false) |
| | | .setShowFullAnimation(false) |
| | | .setUrl(videoList.get(0)) |
| | | .setUrl(playUrl) |
| | | .setNeedLockFull(true) |
| | | .setCacheWithPlay(false) |
| | | .setVideoTitle("") |
| | | .setLooping(true) |
| | | .setLooping(false) |
| | | ///不需要旋转 |
| | | .setNeedOrientationUtils(false) |
| | | .setVideoAllCallBack(new GSYSampleCallBack() { |
| | |
| | | |
| | | } |
| | | |
| | | public void setVideoList(List<String> videoList) { |
| | | public void setVideoList(List<BannerBean> videoList) { |
| | | this.videoList = videoList; |
| | | Bundle args = new Bundle(); |
| | | args.putSerializable("videoList", (Serializable) videoList); |
| | | setArguments(args); |
| | | if (isAdded()){ |
| | | initView(); |
| | | } |
| | | } |
| | | |
| | | public List<BannerBean> getVideoList() { |
| | | return videoList; |
| | | } |
| | | |
| | | @Override |
| | |
| | | AppManager.getAppManager().startActivity(GenealogyActivity.class); |
| | | mOperatePopupWindow.dismiss(); |
| | | }); |
| | | mOperatePopupWindow.getContentView().findViewById(R.id.tv_relation).setOnClickListener(v -> { |
| | | AppManager.getAppManager().startActivity(HomeMindMapActivity.class); |
| | | mOperatePopupWindow.dismiss(); |
| | | }); |
| | | final GestureDetector gestureDetector = new GestureDetector(getSelfActivity(), new GestureDetector.SimpleOnGestureListener() { |
| | | @Override |
| | | public boolean onDoubleTap(MotionEvent e) { |
New file |
| | |
| | | package com.application.zhangshi_app_android.ui.home; |
| | | |
| | | import android.webkit.WebChromeClient; |
| | | import android.webkit.WebResourceRequest; |
| | | import android.webkit.WebSettings; |
| | | import android.webkit.WebView; |
| | | import android.webkit.WebViewClient; |
| | | import android.widget.Toast; |
| | | |
| | | import androidx.lifecycle.Observer; |
| | | |
| | | import com.android.app_base.base.view.BaseActivity; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.bean.HomeRootBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityHomeMindMapBinding; |
| | | import com.google.gson.Gson; |
| | | import com.hjq.bar.TitleBar; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.08.08. 18:56 |
| | | * @desc |
| | | */ |
| | | public class HomeMindMapActivity extends BaseActivity<ActivityHomeMindMapBinding,HomeMindMapActivityViewModel> { |
| | | @Override |
| | | public int getLayoutId() { |
| | | return R.layout.activity_home_mind_map; |
| | | } |
| | | |
| | | @Override |
| | | public int getVariableId() { |
| | | return BR.viewModel; |
| | | } |
| | | |
| | | @Override |
| | | public void initParam() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void initView() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void initData() { |
| | | viewModel.getHomeRootBeanList(); |
| | | // HomeRootBean rootMember = new HomeRootBean(); |
| | | // rootMember.setNickName("张一"); |
| | | // rootMember.setImg("URL_of_avatar"); |
| | | // rootMember.setIdentity(1); |
| | | // HomeRootBean spouse = new HomeRootBean(); |
| | | // spouse.setNickName("张一老婆"); |
| | | // spouse.setImg("URL_of_avatar"); |
| | | // spouse.setIdentity(1); |
| | | //// rootMember.setSpouse(spouse); |
| | | // |
| | | // List<HomeRootBean> children = new ArrayList<>(); |
| | | // HomeRootBean father = new HomeRootBean(); |
| | | // father.setNickName("张二一"); |
| | | // father.setImg("URL_of_avatar"); |
| | | // father.setIdentity(2); |
| | | // HomeRootBean mother = new HomeRootBean(); |
| | | // mother.setNickName("张二一老婆"); |
| | | // mother.setImg("URL_of_avatar"); |
| | | // mother.setIdentity(2); |
| | | // father.setSpouse(mother); |
| | | // children.add(father); |
| | | // |
| | | // List<HomeRootBean> children2 = new ArrayList<>(); |
| | | // HomeRootBean son = new HomeRootBean(); |
| | | // son.setNickName("张三一"); |
| | | // son.setImg("URL_of_avatar"); |
| | | // son.setIdentity(2); |
| | | // HomeRootBean daughter = new HomeRootBean(); |
| | | // daughter.setNickName("张三一老婆"); |
| | | // daughter.setImg("URL_of_avatar"); |
| | | // daughter.setIdentity(2); |
| | | //// son.setSpouse(daughter); |
| | | // children2.add(son); |
| | | // HomeRootBean son1 = new HomeRootBean(); |
| | | // son1.setNickName("张三二"); |
| | | // son1.setImg("URL_of_avatar"); |
| | | // son1.setIdentity(2); |
| | | // HomeRootBean daughter1 = new HomeRootBean(); |
| | | // daughter1.setNickName("张三二老婆"); |
| | | // daughter1.setImg("URL_of_avatar"); |
| | | // daughter1.setIdentity(2); |
| | | // son1.setSpouse(daughter1); |
| | | // children2.add(son1); |
| | | // HomeRootBean son2 = new HomeRootBean(); |
| | | // son2.setNickName("张三三"); |
| | | // son2.setImg("URL_of_avatar"); |
| | | // son2.setIdentity(3); |
| | | // HomeRootBean daughter2 = new HomeRootBean(); |
| | | // daughter2.setNickName("张三三老婆"); |
| | | // daughter2.setImg("URL_of_avatar"); |
| | | // daughter2.setIdentity(3); |
| | | // List<HomeRootBean> children3 = new ArrayList<>(); |
| | | // son2.setSpouse(daughter2); |
| | | // children3.add(son2); |
| | | // HomeRootBean son3 = new HomeRootBean(); |
| | | // son3.setNickName("张三四"); |
| | | // son3.setImg("URL_of_avatar"); |
| | | // son3.setIdentity(3); |
| | | // HomeRootBean daughter3 = new HomeRootBean(); |
| | | // daughter3.setNickName("张三四老婆"); |
| | | // daughter3.setImg("URL_of_avatar"); |
| | | // daughter3.setIdentity(3); |
| | | // son3.setSpouse(daughter3); |
| | | // children3.add(son3); |
| | | // son1.setChildList(children3); |
| | | // father.setChildList(children2); |
| | | // |
| | | // HomeRootBean uncle = new HomeRootBean(); |
| | | // uncle.setNickName("张二二"); |
| | | // uncle.setImg("URL_of_avatar"); |
| | | // uncle.setIdentity(2); |
| | | // HomeRootBean aunt = new HomeRootBean(); |
| | | // aunt.setNickName("张二二老婆"); |
| | | // aunt.setImg("URL_of_avatar"); |
| | | // aunt.setIdentity(2); |
| | | //// uncle.setSpouse(aunt); |
| | | // children.add(uncle); |
| | | // |
| | | // HomeRootBean brother = new HomeRootBean(); |
| | | // brother.setNickName("张二三"); |
| | | // brother.setImg("URL_of_avatar"); |
| | | // brother.setIdentity(2); |
| | | // HomeRootBean sister = new HomeRootBean(); |
| | | // sister.setNickName("张二三老婆"); |
| | | // sister.setImg("URL_of_avatar"); |
| | | // sister.setIdentity(2); |
| | | // brother.setSpouse(sister); |
| | | // children.add(brother); |
| | | // brother.setChildList(children2); |
| | | // HomeRootBean brotherSon = new HomeRootBean(); |
| | | // brotherSon.setNickName("张二三儿子"); |
| | | // brotherSon.setImg("URL_of_avatar"); |
| | | // brotherSon.setIdentity(2); |
| | | // List<HomeRootBean> brotherChildren = new ArrayList<>(); |
| | | // brotherChildren.add(brotherSon); |
| | | // brother.setChildList(brotherChildren); |
| | | // |
| | | // HomeRootBean brother2 = new HomeRootBean(); |
| | | // brother2.setNickName("张二四"); |
| | | // brother2.setImg("URL_of_avatar"); |
| | | // brother2.setIdentity(2); |
| | | // HomeRootBean sister2 = new HomeRootBean(); |
| | | // sister2.setNickName("张二四老婆"); |
| | | // sister2.setImg("URL_of_avatar"); |
| | | // sister2.setIdentity(2); |
| | | // brother2.setSpouse(sister2); |
| | | // children.add(brother2); |
| | | // |
| | | // |
| | | // rootMember.setChildList(children); |
| | | // binding.scrollHomeMindMapLayout.setRootMember(rootMember); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void initLiveDataObserve() { |
| | | viewModel.getHomeRootBeanLiveData().observe(this, new Observer<List<HomeRootBean>>() { |
| | | @Override |
| | | public void onChanged(List<HomeRootBean> homeRootBeans) { |
| | | if (homeRootBeans == null || homeRootBeans.size() == 0) { |
| | | return; |
| | | } |
| | | binding.scrollHomeMindMapLayout.setRootMember(homeRootBeans.get(0)); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onLeftClick(TitleBar titleBar) { |
| | | finish(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.application.zhangshi_app_android.ui.home; |
| | | |
| | | import static com.android.app_base.base.BaseConfig.CODE_SUCCESS; |
| | | |
| | | import android.app.Application; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.lifecycle.MutableLiveData; |
| | | |
| | | import com.android.app_base.base.StateViewEnum; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.application.zhangshi_app_android.bean.HomeRootBean; |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | | |
| | | import java.util.List; |
| | | |
| | | import io.reactivex.Observer; |
| | | import io.reactivex.disposables.Disposable; |
| | | import io.reactivex.functions.Action; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.08.08. 18:57 |
| | | * @desc |
| | | */ |
| | | public class HomeMindMapActivityViewModel extends BaseViewModel<DataRepository> { |
| | | |
| | | private MutableLiveData<List<HomeRootBean>> homeRootBeanLiveData;//家根网成员列表 |
| | | public HomeMindMapActivityViewModel(@NonNull Application application) { |
| | | super(application); |
| | | } |
| | | |
| | | @Override |
| | | protected DataRepository initModel() { |
| | | return DataRepository.getInstance(); |
| | | } |
| | | |
| | | public void getHomeRootBeanList() { |
| | | model.getHomeRoot("4") |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .doFinally(new Action() { |
| | | @Override |
| | | public void run() throws Exception { |
| | | changeStateView(StateViewEnum.DATA_FINISH); |
| | | } |
| | | }) |
| | | .subscribe(new Observer<ResultData<List<HomeRootBean>>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<List<HomeRootBean>> data) { |
| | | if (data.getCode() == CODE_SUCCESS){ |
| | | homeRootBeanLiveData.postValue(data.getData()); |
| | | }else { |
| | | getMessageLivaData().postValue(data.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | getMessageLivaData().postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | public MutableLiveData<List<HomeRootBean>> getHomeRootBeanLiveData() { |
| | | if (homeRootBeanLiveData == null) { |
| | | homeRootBeanLiveData = new MutableLiveData<>(); |
| | | } |
| | | return homeRootBeanLiveData; |
| | | } |
| | | |
| | | public void setHomeRootBeanLiveData(MutableLiveData<List<HomeRootBean>> homeRootBeanLiveData) { |
| | | this.homeRootBeanLiveData = homeRootBeanLiveData; |
| | | } |
| | | } |
| | |
| | | if (loginResponseBeanResultData.getCode() == CODE_SUCCESS){ |
| | | String token = loginResponseBeanResultData.getData().getToken(); |
| | | UserManager.getInstance().setToken(token); |
| | | ToastUtils.showShort("登陆成功"); |
| | | AppManager.getAppManager().startActivity(MainActivity.class); |
| | | AppManager.getAppManager().finishCurrentActivity(); |
| | | ToastUtils.showShort("登陆成功"); |
| | | }else { |
| | | changeStateView(StateViewEnum.DATA_ERROR); |
| | | messageLiveData.postValue(loginResponseBeanResultData.getMsg()); |
| | |
| | | import com.android.app_base.base.view.BaseFragment; |
| | | import com.android.app_base.helper.DoubleClickHelper; |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.rxbus.MessageEvent; |
| | | import com.android.app_base.utils.rxbus.RxBus; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.bean.GrowthExperienceInformationBean; |
| | | import com.application.zhangshi_app_android.bean.UpdateVersionBean; |
| | | import com.application.zhangshi_app_android.databinding.ActivityMainBinding; |
| | | import com.application.zhangshi_app_android.ui.dialog.UpdateDialog; |
| | | import com.application.zhangshi_app_android.ui.dialog.VersionUpdateDialog; |
| | | import com.application.zhangshi_app_android.ui.function.FunctionFragment; |
| | | import com.application.zhangshi_app_android.ui.home.HomeFragment; |
| | |
| | | @Override |
| | | public void initData() { |
| | | viewModel.getUpdateVersion(); |
| | | if (TextUtils.isEmpty(UserManager.getInstance().getUserName()) || TextUtils.isEmpty(UserManager.getInstance().getUserAvatar())) { |
| | | viewModel.getInfo(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public void onChanged(UpdateVersionBean updateVersionBean) { |
| | | if(updateVersionBean != null && updateVersionBean.getVersionCode()> AppUtils.getAppVersionCode()&&!TextUtils.isEmpty(updateVersionBean.getAppUrl())){ |
| | | VersionUpdateDialog.Builder dialogBuilder = new VersionUpdateDialog.Builder(getSelfActivity()) |
| | | .setContent(updateVersionBean.getContent()) |
| | | .setDownloadUrl(updateVersionBean.getAppUrl()) |
| | | ; |
| | | if(updateVersionBean.isForceUpdate()){ |
| | | dialogBuilder.setCancelable(false); |
| | | dialogBuilder.setCanceledOnTouchOutside(false); |
| | | // VersionUpdateDialog.Builder dialogBuilder = new VersionUpdateDialog.Builder(getSelfActivity()) |
| | | // .setContent(updateVersionBean.getContent()) |
| | | // .setDownloadUrl(updateVersionBean.getAppUrl()) |
| | | // ; |
| | | // if(updateVersionBean.getForceUpdate() == 1){ |
| | | // dialogBuilder.setCancelable(false); |
| | | // dialogBuilder.setCanceledOnTouchOutside(false); |
| | | // } |
| | | // dialogBuilder.show(); |
| | | |
| | | } |
| | | dialogBuilder.show(); |
| | | new UpdateDialog.Builder(getSelfActivity()) |
| | | // 版本名 |
| | | .setVersionName(updateVersionBean.getVersionName()) |
| | | // 是否强制更新 |
| | | .setForceUpdate(updateVersionBean.getForceUpdate()==1) |
| | | // 更新日志 |
| | | .setUpdateLog(updateVersionBean.getContent()) |
| | | // 下载 URL |
| | | .setDownloadUrl(updateVersionBean.getAppUrl()) |
| | | .show(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | viewModel.getInfoLiveData().observe(this, new Observer<GrowthExperienceInformationBean>() { |
| | | @Override |
| | | public void onChanged(GrowthExperienceInformationBean informationBean) { |
| | | if(informationBean != null){ |
| | | UserManager.getInstance().setUserName(informationBean.getNickName()); |
| | | UserManager.getInstance().setUserAvatar(informationBean.getUrl()); |
| | | RxBus.getInstance().post(new MessageEvent(MessageEvent.EVENT_UPDATE_USER_INFO,informationBean)); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.application.zhangshi_app_android.bean.AnnualHealthStatusBean; |
| | | import com.application.zhangshi_app_android.bean.GrowthExperienceInformationBean; |
| | | import com.application.zhangshi_app_android.bean.PageResponseBean; |
| | | import com.application.zhangshi_app_android.bean.UpdateVersionBean; |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | |
| | | public class MainViewModel extends BaseViewModel<DataRepository> { |
| | | |
| | | private MutableLiveData<UpdateVersionBean> updateVersionBeanLiveData = new MutableLiveData<>(); |
| | | private MutableLiveData<GrowthExperienceInformationBean> infoLiveData;//个人信息 |
| | | |
| | | public MainViewModel(@NonNull Application application) { |
| | | super(application); |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取更新版本 |
| | | */ |
| | | public void getUpdateVersion() { |
| | | model.getUpdateVersion() |
| | | .compose(RxUtils.schedulersTransformer()) |
| | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 获取个人信息 |
| | | */ |
| | | public void getInfo(){ |
| | | model.getGrowthExperienceInformation() |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<GrowthExperienceInformationBean>>() { |
| | | @Override |
| | | public void onSubscribe(Disposable d) { |
| | | addSubscribe(d); |
| | | } |
| | | |
| | | @Override |
| | | public void onNext(ResultData<GrowthExperienceInformationBean> data) { |
| | | if (data.getCode() == CODE_SUCCESS){ |
| | | getInfoLiveData().postValue(data.getData()); |
| | | }else { |
| | | messageLiveData.postValue(data.getMsg()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | messageLiveData.postValue(e.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void onComplete() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | public MutableLiveData<GrowthExperienceInformationBean> getInfoLiveData() { |
| | | if (infoLiveData == null){ |
| | | infoLiveData = new MutableLiveData<>(); |
| | | } |
| | | return infoLiveData; |
| | | } |
| | | |
| | | public void setInfoLiveData(GrowthExperienceInformationBean infoBean) { |
| | | if (infoLiveData == null){ |
| | | infoLiveData = new MutableLiveData<>(); |
| | | } |
| | | infoLiveData.setValue(infoBean); |
| | | } |
| | | |
| | | public MutableLiveData<UpdateVersionBean> getUpdateVersionBeanLiveData() { |
| | | if (updateVersionBeanLiveData == null) updateVersionBeanLiveData = new MutableLiveData<>(); |
| | | return updateVersionBeanLiveData; |
| | |
| | | import com.android.app_base.base.view.BaseActivity; |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.SPUtils; |
| | | import com.android.app_base.utils.Utils; |
| | | import com.application.zhangshi_app_android.BR; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.adapter.ImageRvAdapter; |
| | | import com.application.zhangshi_app_android.bean.FamilyMemorabiliaBean; |
| | | import com.application.zhangshi_app_android.adapter.ElectronicFileAddAdapter; |
| | | import com.application.zhangshi_app_android.databinding.ActivityLoginBgChangeBinding; |
| | | import com.hjq.bar.TitleBar; |
| | | import com.luck.picture.lib.entity.LocalMedia; |
| | | import com.luck.picture.lib.interfaces.OnResultCallbackListener; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | |
| | | * @desc 登录背景更换 Activity |
| | | */ |
| | | public class LoginBgChangeActivity extends BaseActivity<ActivityLoginBgChangeBinding,LoginBgChangeActivityViewModel> { |
| | | private ImageRvAdapter adapter; |
| | | private ElectronicFileAddAdapter adapter; |
| | | private Set<String> loginBackgrounds; |
| | | private String selectLoginBackground; |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void initView() { |
| | | adapter = new ImageRvAdapter(this); |
| | | adapter = new ElectronicFileAddAdapter(this); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3); |
| | | binding.rvImage.setLayoutManager(gridLayoutManager); |
| | | binding.rvImage.setNestedScrollingEnabled(false); |
| | | View footerView = View.inflate(this,R.layout.item_image_footer,null); |
| | | binding.rvImage.addFooterView(footerView); |
| | | binding.rvImage.requestLayout(); |
| | | footerView.setOnClickListener(new View.OnClickListener() { |
| | | adapter.setShowSelectIcon(true); |
| | | adapter.setItemAndAddClickListener(new ElectronicFileAddAdapter.OnItemAndAddClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 9, new OnResultCallbackListener<LocalMedia>() { |
| | | public void onItemClick(View itemView, int position) { |
| | | if (selectLoginBackground != null && selectLoginBackground.equals(adapter.getItem(position))){ |
| | | selectLoginBackground = null; |
| | | adapter.clearSelectedItems(); |
| | | |
| | | }else { |
| | | selectLoginBackground = adapter.getItem(position); |
| | | adapter.changeSingleSelected(selectLoginBackground); |
| | | } |
| | | SPUtils.getInstance("loginBackground").put("selectLoginBackground",selectLoginBackground); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onAddClick() { |
| | | UserManager.getInstance().selectImage(getSelfActivity(), 1,9, new OnResultCallbackListener<LocalMedia>() { |
| | | @Override |
| | | public void onResult(ArrayList<LocalMedia> result) { |
| | | if (result.size() == 0) return; |
| | |
| | | @Override |
| | | public void onChildClick(RecyclerView recyclerView, View childView, int position) { |
| | | if (Boolean.TRUE.equals(viewModel.getTypeLiveData().getValue())){ |
| | | //TODO 删除图片 |
| | | // viewModel.deleteFile(adapter.getItem(position)); |
| | | loginBackgrounds.remove(adapter.getItem(position)); |
| | | adapter.removeItem(position); |
| | | SPUtils.getInstance("loginBackground").put("loginBackgrounds",loginBackgrounds); |
| | | if (!loginBackgrounds.contains(selectLoginBackground)){ |
| | | selectLoginBackground = null; |
| | | adapter.clearSelectedItems(); |
| | | SPUtils.getInstance("loginBackground").put("selectLoginBackground",selectLoginBackground); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | adapter.setIsEdited(true); |
| | | adapter.setOnItemClickListener(new BaseRVAdapter.OnItemClickListener() { |
| | | @Override |
| | | public void onItemClick(RecyclerView recyclerView, View itemView, int position) { |
| | | selectLoginBackground = adapter.getItem(position); |
| | | adapter.setSelectPosition(selectLoginBackground); |
| | | SPUtils.getInstance("loginBackground").put("selectLoginBackground",selectLoginBackground); |
| | | } |
| | | }); |
| | | binding.rvImage.setAdapter(adapter); |
| | |
| | | for (String loginBackground : loginBackgrounds) { |
| | | adapter.addItem(loginBackground); |
| | | } |
| | | adapter.setSelectPosition(selectLoginBackground); |
| | | adapter.changeSingleSelected(selectLoginBackground); |
| | | }else { |
| | | loginBackgrounds = new HashSet<>(); |
| | | } |
| | |
| | | viewModel.getTypeLiveData().observe(this, new Observer<Boolean>() { |
| | | @Override |
| | | public void onChanged(Boolean aBoolean) { |
| | | adapter.setIsSelected(!aBoolean); |
| | | adapter.setIsEdited(aBoolean); |
| | | adapter.setPreview(!aBoolean); |
| | | binding.ivOperate.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | |
| | | @Override |
| | | public void onNext(ResultData<UploadFileResponseBean> resultData) { |
| | | if (resultData.getCode() == CODE_SUCCESS){ |
| | | // FamilyMemorabiliaBean bean = getBeanMutableLiveData().getValue(); |
| | | // String url; |
| | | // if (bean != null){ |
| | | // url = bean.getUrl(); |
| | | // if (url == null){ |
| | | // url = resultData.getData().getUrl(); |
| | | // }else { |
| | | // url = url + "," + resultData.getData().getUrl(); |
| | | // } |
| | | // bean.setUrl(url); |
| | | // beanMutableLiveData.postValue(bean); |
| | | |
| | | // } |
| | | }else { |
| | | messageLiveData.postValue(resultData.getMsg()); |
| | |
| | | import android.view.ViewGroup; |
| | | import android.widget.PopupWindow; |
| | | |
| | | import com.android.app_base.base.dialog.BaseDialog; |
| | | import com.android.app_base.base.dialog.UIDialog; |
| | | import com.android.app_base.base.view.BaseFragment; |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.manager.UserManager; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.android.app_base.utils.rxbus.MessageEvent; |
| | | import com.android.app_base.utils.rxbus.RxBus; |
| | |
| | | import com.application.zhangshi_app_android.ui.DLBaseFragment; |
| | | import com.application.zhangshi_app_android.ui.dialog.PetOwnerInfoDialog; |
| | | import com.application.zhangshi_app_android.ui.function.PetMemoActivity; |
| | | import com.application.zhangshi_app_android.ui.login.LoginActivity; |
| | | |
| | | import io.reactivex.Observer; |
| | | import io.reactivex.functions.Consumer; |
| | |
| | | binding.ivOperate.setOnClickListener(v -> { |
| | | popupWindow.showAsDropDown(binding.ivOperate,-ScreenSizeUtils.dip2px(getSelfActivity(),85) +binding.ivOperate.getWidth(),0); |
| | | }); |
| | | |
| | | binding.tvLoginOut.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | new UIDialog.Builder(getSelfActivity()) |
| | | .setTitle("提示") |
| | | .setContent("确定要退出登录吗?") |
| | | .setConfirm("确定") |
| | | .setCancel("取消") |
| | | .setListener(new UIDialog.OnListener() { |
| | | @Override |
| | | public void onConfirm(BaseDialog dialog) { |
| | | UserManager.getInstance().loginOut(); |
| | | AppManager.getAppManager().startActivity(new Intent(getSelfActivity(), LoginActivity.class)); |
| | | getSelfActivity().finish(); |
| | | } |
| | | }) |
| | | .show(); |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
New file |
| | |
| | | package com.application.zhangshi_app_android.widget; |
| | | |
| | | import android.graphics.Path; |
| | | import android.graphics.RectF; |
| | | import android.view.View; |
| | | import android.widget.ImageView; |
| | | |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.bean.HomeRootBean; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.08.13. 7:39 |
| | | * @desc 双亲节点 |
| | | */ |
| | | public class DoubleNode extends Node{ |
| | | private View memberItemView;//成员view |
| | | private ImageView expandIconView;//展开按钮 |
| | | private View spouseView;//配偶view |
| | | |
| | | public DoubleNode(HomeRootBean member) { |
| | | super(member); |
| | | |
| | | //双亲节点 前后路径长度 有两倍的 pathLength |
| | | if (member.getIdentity() > 1 && member.getChildList() != null && member.getChildList().size() > 0){ |
| | | //非 第一代 且 有子代, 节点宽度 = view宽度 + 前后路径长度 + 展开按钮宽度 |
| | | width = pathLength * 2 + getItemViewWidth() + pathLength * 2 + getExpandIconWidth(); |
| | | }else if (member.getIdentity() > 1 && (member.getChildList() == null || member.getChildList().size() == 0)) { |
| | | //非 第一代 且 无子代, 节点宽度 = view宽度 + 前路径长度 |
| | | width = getItemViewWidth() + pathLength * 2; |
| | | }else if (member.getIdentity() == 1 && member.getChildList() != null && member.getChildList().size() > 0) { |
| | | //第一代 且 有子代, 节点宽度 = view宽度 + 后路径长度 + 展开按钮宽度 |
| | | width = getItemViewWidth() + pathLength * 2+ getExpandIconWidth(); |
| | | }else if (member.getIdentity() == 1 && (member.getChildList() == null || member.getChildList().size() == 0)) { |
| | | //第一代 且 无子代, 节点宽度 = view宽度 |
| | | width = getItemViewWidth(); |
| | | } |
| | | //双亲节点 高度 = view高度 + 配偶view高度 + 配偶view上下间距 |
| | | height = getItemViewHeight() * 2 + spouseMargin; |
| | | initView(); |
| | | } |
| | | |
| | | private void initView() { |
| | | memberItemView = createItemView(member); |
| | | spouseView = createItemView(member.getSpouse()); |
| | | expandIconView = createExpandIconView(); |
| | | viewList.add(memberItemView); |
| | | viewList.add(spouseView); |
| | | viewList.add(expandIconView); |
| | | |
| | | if (isExpand){ |
| | | expandIconView.setBackgroundResource(R.drawable.ic_collapse); |
| | | }else { |
| | | expandIconView.setBackgroundResource(R.drawable.ic_expand); |
| | | } |
| | | expandIconView.setOnClickListener(v -> { |
| | | if (isExpand){ |
| | | expandIconView.setBackgroundResource(R.drawable.ic_expand); |
| | | for (Node child : children) { |
| | | child.setVisible(false); |
| | | } |
| | | isExpand = false; |
| | | }else { |
| | | expandIconView.setBackgroundResource(R.drawable.ic_collapse); |
| | | for (Node child : children) { |
| | | child.setVisible(true); |
| | | } |
| | | isExpand = true; |
| | | } |
| | | memberItemView.requestLayout(); |
| | | spouseView.requestLayout(); |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | protected void setViewPosition(int x, int centerY) { |
| | | left = x; |
| | | right = left + width; |
| | | this.centerY = centerY; |
| | | top = centerY - height/2; |
| | | bottom = top + height; |
| | | |
| | | if (member.getIdentity() > 1) {//非 第一代 才有前置连线 |
| | | viewLeft = left + 2 * pathLength; |
| | | } else { |
| | | viewLeft = left; |
| | | } |
| | | memberItemView.setX(viewLeft); |
| | | memberItemView.setY(centerY - memberItemView.getMeasuredHeight() - spouseMargin/2f); |
| | | viewRight = viewLeft + memberItemView.getMeasuredWidth(); |
| | | |
| | | spouseView.setX(viewLeft); |
| | | spouseView.setY(centerY + spouseMargin/2f); |
| | | |
| | | viewTop = (int) memberItemView.getY(); |
| | | viewBottom = (int) (spouseView.getY() + spouseView.getMeasuredHeight()); |
| | | |
| | | expandIconView.setX(viewRight + pathLength * 2); |
| | | expandIconView.setY(centerY - expandIconView.getMeasuredHeight()/2f); |
| | | |
| | | setPath(); |
| | | } |
| | | |
| | | private void setPath() { |
| | | //setPath 之前,先清空 |
| | | prePathList.clear(); |
| | | nextPathList.clear(); |
| | | |
| | | if (member.getChildList() != null && member.getChildList().size() > 0){//有子节点,才有后置连线,才有展开按钮 |
| | | expandIconView.setVisibility(View.VISIBLE); |
| | | float rLeft = viewRight; |
| | | float rRight = viewRight + pathLength; |
| | | float rTop = memberItemView.getY()+memberItemView.getMeasuredHeight()/2f; |
| | | float rBottom = spouseView.getY()+spouseView.getMeasuredHeight()/2f; |
| | | Path path = new Path(); |
| | | //左上角 |
| | | path.moveTo(rLeft, rTop); |
| | | // --- |
| | | path.lineTo(rRight - cornerRadius, rTop); |
| | | // 添加圆弧路径,右上角的圆角 |
| | | path.arcTo(new RectF(rRight-2*cornerRadius, rTop, rRight, rTop+2*cornerRadius), 270, 90, false); |
| | | // ---- |
| | | // | |
| | | // | |
| | | path.lineTo(rRight, rBottom - cornerRadius); |
| | | // 添加圆弧路径,右下角的圆角 |
| | | path.arcTo(new RectF(rRight - 2 * cornerRadius, rBottom - 2 * cornerRadius, rRight, rBottom), 0, 90, false); |
| | | // ---- |
| | | // | |
| | | // | |
| | | // ---- |
| | | path.lineTo(rLeft, rBottom); |
| | | //移到右中间 |
| | | path.moveTo(rRight, centerY); |
| | | // ---- |
| | | // |____ |
| | | // | |
| | | // ---- |
| | | path.lineTo(rRight + pathLength, centerY); |
| | | nextPathList.add(path); |
| | | |
| | | }else { |
| | | expandIconView.setVisibility(View.GONE); |
| | | viewList.remove(expandIconView); |
| | | } |
| | | if (member.getIdentity() > 1){//非 第一代 才有前置连线 |
| | | float rLeft = viewLeft - pathLength; |
| | | float rRight = viewLeft; |
| | | float rTop = memberItemView.getY()+memberItemView.getMeasuredHeight()/2f; |
| | | float rBottom = spouseView.getY()+spouseView.getMeasuredHeight()/2f; |
| | | Path path = new Path(); |
| | | //右上角 |
| | | path.moveTo(rRight, rTop); |
| | | // --- |
| | | path.lineTo(rLeft + cornerRadius, rTop); |
| | | // 添加圆弧路径,左上角的圆角 |
| | | path.arcTo(new RectF(rLeft, rTop, rLeft+2*cornerRadius, rTop+2*cornerRadius), 270, -90, false); |
| | | // ---- |
| | | // | |
| | | // | |
| | | path.lineTo(rLeft, rBottom - cornerRadius); |
| | | // 添加圆弧路径,左下角的圆角 |
| | | path.arcTo(new RectF(rLeft, rBottom - 2 * cornerRadius, rLeft + 2 * cornerRadius, rBottom), 180, -90, false); |
| | | // ---- |
| | | // | |
| | | // | |
| | | // ---- |
| | | path.lineTo(rRight, rBottom); |
| | | //移到左中间 |
| | | path.moveTo(rLeft, centerY); |
| | | // ---- |
| | | // ___| |
| | | // | |
| | | // ---- |
| | | path.lineTo(rLeft - pathLength, centerY); |
| | | prePathList.add(path); |
| | | } |
| | | } |
| | | |
| | | //设置分叉点Y坐标集合 |
| | | public void setForkYList(List<Integer> yList){ |
| | | if (yList == null || yList.size() < 2){ |
| | | return; |
| | | } |
| | | forkPathList.clear(); |
| | | |
| | | //取出最大和最小 |
| | | int rBottom = 0; |
| | | int rTop = 0; |
| | | for (int i = 0; i < yList.size(); i++) { |
| | | if (i == 0){ |
| | | rTop = yList.get(i); |
| | | rBottom = yList.get(i); |
| | | }else { |
| | | if (yList.get(i) > rBottom){ |
| | | rBottom = yList.get(i); |
| | | } |
| | | if (yList.get(i) < rTop){ |
| | | rTop = yList.get(i); |
| | | } |
| | | } |
| | | } |
| | | yList.remove((Integer) rTop); |
| | | yList.remove((Integer) rBottom); |
| | | |
| | | float rLeft = right + pathLength; |
| | | float rRight = rLeft + pathLength; |
| | | Path path = new Path(); |
| | | //右上角 |
| | | path.moveTo(rRight, rTop); |
| | | // --- |
| | | path.lineTo(rLeft + cornerRadius, rTop); |
| | | // 添加圆弧路径,左上角的圆角 |
| | | path.arcTo(new RectF(rLeft, rTop, rLeft+2*cornerRadius, rTop+2*cornerRadius), 270, -90, false); |
| | | // ---- |
| | | // | |
| | | // | |
| | | path.lineTo(rLeft, rBottom - cornerRadius); |
| | | // 添加圆弧路径,左下角的圆角 |
| | | path.arcTo(new RectF(rLeft, rBottom - 2 * cornerRadius, rLeft + 2 * cornerRadius, rBottom), 180, -90, false); |
| | | // ---- |
| | | // | |
| | | // | |
| | | // ---- |
| | | path.lineTo(rRight, rBottom); |
| | | //移到左中间 |
| | | path.moveTo(rLeft, centerY); |
| | | // ---- |
| | | // ___| |
| | | // | |
| | | // ---- |
| | | path.lineTo(rLeft - pathLength, centerY); |
| | | for (Integer y : yList) { |
| | | path.moveTo(rLeft, y); |
| | | path.lineTo(rRight, y); |
| | | } |
| | | forkPathList.add(path); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.application.zhangshi_app_android.widget; |
| | | |
| | | import android.content.Context; |
| | | import android.graphics.Canvas; |
| | | import android.graphics.Color; |
| | | import android.graphics.Paint; |
| | | import android.graphics.Path; |
| | | import android.util.AttributeSet; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.ImageView; |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.constraintlayout.utils.widget.ImageFilterView; |
| | | |
| | | import com.android.app_base.utils.GlideUtil; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.bean.HomeRootBean; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.08.12. 1:19 |
| | | * @desc 家族导图 自定义布局 |
| | | */ |
| | | public class HomeMindMapLayout extends FrameLayout { |
| | | boolean isAutoLayout = true;// 是否自动布局 |
| | | private Paint linePaint; |
| | | private HomeRootBean rootMember;// 根节点成员 |
| | | private Node rootNode;// 根节点 |
| | | private Map<HomeRootBean, View> viewMap = new HashMap<>();// 存放所有节点的view,记录节点的view是否已被addView |
| | | |
| | | private int width, height;// 当前布局的宽高 |
| | | private int minHeight, minWidth;// 当前布局的最小宽高 |
| | | private int padding = 100;//内容矩形 与 FrameLayout矩形 的padding |
| | | private static final int spouseMargin = ScreenSizeUtils.dip2px(15);// 配偶两个view之间的间隔 |
| | | private final int verticalMargin = ScreenSizeUtils.dip2px(20);// //节点竖直方向间距 |
| | | |
| | | private static final int pathLength = ScreenSizeUtils.dip2px(20);// 线条长度 |
| | | |
| | | public HomeMindMapLayout(@NonNull Context context) { |
| | | this(context, null); |
| | | } |
| | | |
| | | public HomeMindMapLayout(@NonNull Context context, @Nullable AttributeSet attrs) { |
| | | super(context, attrs); |
| | | init(); |
| | | } |
| | | |
| | | private void init() { |
| | | linePaint = new Paint(); |
| | | linePaint.setColor(Color.parseColor("#FFEBA4AA")); |
| | | linePaint.setStrokeWidth(ScreenSizeUtils.dip2px(2f)); |
| | | linePaint.setStyle(Paint.Style.STROKE); |
| | | linePaint.setStrokeJoin(Paint.Join.ROUND); |
| | | linePaint.setStrokeMiter(10); |
| | | linePaint.setAntiAlias(true); |
| | | |
| | | // 设置ViewGroup默认调用onDraw方法 |
| | | setWillNotDraw(false); |
| | | } |
| | | |
| | | public void setRootMember(HomeRootBean root) { |
| | | //等待布局加载完成后再设置数据 |
| | | post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | setRootMemberReal(root); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private void setRootMemberReal(HomeRootBean root) { |
| | | this.rootMember = root; |
| | | // 清空viewMap |
| | | viewMap.clear(); |
| | | if (rootMember != null) { // 绘制根节点,在竖直方向上居中 |
| | | if (rootMember.getSpouse() == null){ |
| | | rootNode = new SimpleNode(rootMember); |
| | | }else { |
| | | rootNode = new DoubleNode(rootMember); |
| | | } |
| | | rootNode.setPosition(padding,padding); |
| | | //把所有节点的view添加到viewGroup中 |
| | | addNodeView(rootNode); |
| | | requestLayout(); |
| | | } |
| | | } |
| | | |
| | | private void addNodeView(Node rootNode) { |
| | | for (View view : rootNode.viewList) { |
| | | addView(view); |
| | | } |
| | | if (rootNode.getChildren() != null && rootNode.getChildren().size() > 0) { |
| | | for (Node child : rootNode.getChildren()) { |
| | | addNodeView(child); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void onLayout(boolean changed, int left, int top, int right, int bottom) { |
| | | super.onLayout(changed, left, top, right, bottom); |
| | | } |
| | | |
| | | @Override |
| | | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
| | | super.onMeasure(widthMeasureSpec, heightMeasureSpec); |
| | | if(rootNode != null){ |
| | | // 是否自适应布局 |
| | | if (isAutoLayout) { |
| | | //需要随着内容的显示内容动态显示view |
| | | rootNode.setPosition(padding, padding); |
| | | width = rootNode.getAllVisibleWidth() + padding * 2; |
| | | height = rootNode.getAllVisibleHeight() + padding * 2; |
| | | } else { |
| | | //不需要随着内容的显示内容动态显示view |
| | | width = rootNode.getAllWidth() + padding * 2; |
| | | height = rootNode.getAllHeight() + padding * 2; |
| | | } |
| | | } |
| | | setMeasuredDimension(Math.max(minWidth,width),Math.max(minHeight,height)); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void onDraw(Canvas canvas) { |
| | | super.onDraw(canvas); |
| | | if (rootNode != null) { |
| | | drawNodeLine(canvas, rootNode); |
| | | } |
| | | } |
| | | |
| | | private void drawNodeLine(Canvas canvas, Node rootNode) { |
| | | //根据根节点的可见性判断是否绘制线条 |
| | | if (rootNode.isVisible()){ |
| | | if (rootNode.nextPathList != null) { |
| | | for (Path path : rootNode.nextPathList) { |
| | | canvas.drawPath(path, linePaint); |
| | | } |
| | | } |
| | | if (rootNode.prePathList != null) { |
| | | for (Path path : rootNode.prePathList) { |
| | | canvas.drawPath(path, linePaint); |
| | | } |
| | | } |
| | | if (rootNode.isExpand){ |
| | | if (rootNode.forkPathList != null) { |
| | | for (Path path : rootNode.forkPathList) { |
| | | canvas.drawPath(path, linePaint); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (rootNode.getChildren() != null && rootNode.getChildren().size() > 0) { |
| | | for (Node child : rootNode.getChildren()) { |
| | | drawNodeLine(canvas, child); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | private ImageView createExpandIconView() { |
| | | ImageView expandView = new ImageView(getContext()); |
| | | FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(pathLength,pathLength); |
| | | expandView.setLayoutParams(params); |
| | | int widthMeasureSpec = MeasureSpec.makeMeasureSpec(pathLength, MeasureSpec.EXACTLY); |
| | | int heightMeasureSpec = MeasureSpec.makeMeasureSpec(pathLength, MeasureSpec.EXACTLY); |
| | | expandView.measure(widthMeasureSpec,heightMeasureSpec); |
| | | return expandView; |
| | | } |
| | | |
| | | private View createItemView(HomeRootBean member) { |
| | | // 使用布局填充器加载节点布局 |
| | | LayoutInflater inflater = LayoutInflater.from(getContext()); |
| | | View familyMemberView = inflater.inflate(R.layout.item_family_member, null, false); |
| | | |
| | | familyMemberView.measure(MeasureSpec.makeMeasureSpec((1 << 30) - 1, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec((1 << 30) - 1, MeasureSpec.AT_MOST)); |
| | | // 获取测量后的宽高 |
| | | int width = familyMemberView.getMeasuredWidth(); |
| | | int height = familyMemberView.getMeasuredHeight(); |
| | | |
| | | // 添加到父布局前再次测量 |
| | | familyMemberView.measure( |
| | | View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY), |
| | | View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.EXACTLY) |
| | | ); |
| | | |
| | | if (member == null) { |
| | | return familyMemberView; |
| | | } |
| | | |
| | | // 获取布局中的组件 |
| | | TextView tv_generation = familyMemberView.findViewById(R.id.tv_generation); |
| | | ImageFilterView iv_avatar = familyMemberView.findViewById(R.id.iv_avatar); |
| | | TextView tv_name = familyMemberView.findViewById(R.id.tv_name); |
| | | |
| | | // 设置节点内容 |
| | | tv_generation.setText(String.valueOf(member.getIdentity())); |
| | | if (member.getImg() != null) { |
| | | GlideUtil.loadImage(member.getImg(), iv_avatar); |
| | | } |
| | | tv_name.setText(member.getNickName()); |
| | | |
| | | return familyMemberView; |
| | | } |
| | | |
| | | public void setMinSize(int minWidth, int minHeight) { |
| | | this.minWidth = minWidth; |
| | | this.minHeight = minHeight; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.application.zhangshi_app_android.widget; |
| | | |
| | | import android.graphics.Path; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.ImageView; |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.constraintlayout.utils.widget.ImageFilterView; |
| | | |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.android.app_base.utils.GlideUtil; |
| | | import com.android.app_base.utils.ScreenSizeUtils; |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.bean.HomeRootBean; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.Queue; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.08.13. 6:47 |
| | | * @desc |
| | | */ |
| | | public abstract class Node{ |
| | | protected HomeRootBean member;//成员 |
| | | protected Node parent;//父节点 |
| | | protected final List<Node> children = new ArrayList<>(); //子节点 |
| | | |
| | | protected static final int pathLength = ScreenSizeUtils.dip2px(20);// 连线的一般长度 |
| | | protected static final int cornerRadius = ScreenSizeUtils.dip2px(5); // 连线拐角 圆角半径 |
| | | |
| | | protected static final int spouseMargin = ScreenSizeUtils.dip2px(15);// 配偶两个view之间的间隔 |
| | | protected static final int verticalMargin = ScreenSizeUtils.dip2px(20);// //节点竖直方向间距 |
| | | protected static final int horizontalMargin = 2 * pathLength;// 分叉节点之间的间距 |
| | | protected boolean isExpand = true;//是否展开子节点 |
| | | protected boolean isVisible = true;//是否可见 |
| | | protected int width, height;// 当前节点的宽高 |
| | | protected int viewLeft;// view的左边 |
| | | protected int viewRight;// view右边 |
| | | protected int viewTop;// view的上边 |
| | | protected int viewBottom;// view的下边 |
| | | |
| | | protected int left;// 节点左边 |
| | | protected int right;// 节点右边 |
| | | protected int top;// 节点顶部 |
| | | protected int bottom;// 节点底部 |
| | | protected int centerY;// 节点中间Y |
| | | protected final List<Path> nextPathList = new ArrayList<>();//后置连线 |
| | | protected final List<Path> prePathList = new ArrayList<>();//前置连线 |
| | | protected final List<Path> forkPathList = new ArrayList<>();//分叉连线 |
| | | protected final List<View> viewList = new ArrayList<>(); |
| | | |
| | | public Node(HomeRootBean member){ |
| | | this.member = member; |
| | | if (member != null) { |
| | | // 递归创建子节点 |
| | | if (member.getChildList() != null && member.getChildList().size() > 0) { |
| | | // 所有可见的子节点需要的宽高总和 |
| | | for (HomeRootBean child : member.getChildList()) { |
| | | // 根据是否有配偶创建不同的节点 |
| | | if (child != null) { |
| | | Node node; |
| | | if (child.getSpouse() != null) { |
| | | node = new DoubleNode(child); |
| | | } else { |
| | | node = new SimpleNode(child); |
| | | } |
| | | node.parent = this; |
| | | children.add(node); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 初始化所有节点 |
| | | * @param x 所有节点最左边的x坐标 |
| | | * @param y 所有节点最高的y坐标 |
| | | */ |
| | | public void setPosition(int x,int y){ |
| | | if (this.parent!=null){ |
| | | throw new RuntimeException("只能初始化根节点"); |
| | | } |
| | | //根据可见性找到最后一个第一子节点,即最上边的节点 |
| | | setViewPositionRecursion(getVisibleTopNode(), this,x,y); |
| | | } |
| | | |
| | | /** |
| | | * 递归设置所有节点的位置 |
| | | * @param topNode 顶部节点,这颗节点树的最上边的节点 |
| | | * @param rootNode 根节点,这颗节点树的根节点 |
| | | * startNode 必须是 topNode 祖先节点 |
| | | * @param x 整颗节点树的x坐标 |
| | | * @param y 整颗节点树的y坐标 |
| | | */ |
| | | public void setViewPositionRecursion(Node topNode,Node rootNode,int x,int y){ |
| | | if (topNode == rootNode) { |
| | | //如果顶部节点就是根节点,那么根节点的位置就是x,y,不需要继续递归 |
| | | rootNode.setViewPosition(x, y + rootNode.getAllVisibleHeight()/2); |
| | | return; |
| | | } |
| | | |
| | | //因为 y 是整颗节点树的y坐标,正常情况下,y都会是 顶部节点topNode 的y坐标 |
| | | //但是 有一种情况,就是顶部节点topNode刚好是根节点rootNode的唯一子节点,且topNode没有配偶,此时topNode的高度比rootNode的高度小,所以此时的y是rootNode的y坐标 |
| | | int centerY; |
| | | if (rootNode.height >= topNode.height && rootNode == topNode.parent && rootNode.children.size() == 1){ |
| | | centerY = y + rootNode.getAllVisibleHeight()/2; |
| | | }else { |
| | | centerY = y + topNode.getAllVisibleHeight()/2; |
| | | } |
| | | topNode.setViewPosition(x + topNode.getToSpecifyNodeWidth(rootNode) - topNode.width, centerY); |
| | | // 根据topNode的位置,递归设置所有节点的位置 |
| | | Node node = topNode; |
| | | while (node != rootNode) { |
| | | Node parentNode = node.parent; |
| | | List<Integer> centerYList = new ArrayList<>(); |
| | | int currentBottom = 0; |
| | | for (Node child : parentNode.children) { |
| | | if (child == node) { |
| | | centerYList.add(child.centerY); |
| | | currentBottom = currentBottom + node.getVisibleTopNode().top + node.getAllVisibleHeight(); |
| | | continue; |
| | | } |
| | | if (!child.isVisible){ |
| | | continue; |
| | | } |
| | | // 递归设置以child为根节点的所有节点的位置 |
| | | setViewPositionRecursion(child.getVisibleTopNode(), child, node.left,currentBottom + verticalMargin); |
| | | |
| | | currentBottom = currentBottom + verticalMargin + child.getAllVisibleHeight(); |
| | | centerYList.add(child.centerY); |
| | | } |
| | | |
| | | //取最大值、最小值 和 的中间 |
| | | int totalCenterY = 0; |
| | | if (centerYList.size() > 0) { |
| | | int min = centerYList.get(0); |
| | | int max = centerYList.get(0); |
| | | for (int i = 1; i < centerYList.size(); i++) { |
| | | int centerY1 = centerYList.get(i); |
| | | if (centerY1 < min) { |
| | | min = centerY1; |
| | | } |
| | | if (centerY1 > max) { |
| | | max = centerY1; |
| | | } |
| | | } |
| | | totalCenterY = (min + max) / 2; |
| | | } |
| | | |
| | | if (parentNode.children.size() > 1) { |
| | | // 设置父节点的位置 |
| | | parentNode.setViewPosition(node.left - horizontalMargin - parentNode.width, totalCenterY); |
| | | // 设置分叉节点的位置 |
| | | parentNode.setForkYList(centerYList); |
| | | }else { |
| | | parentNode.setViewPosition(node.left - parentNode.width, totalCenterY); |
| | | } |
| | | node = parentNode; |
| | | } |
| | | } |
| | | |
| | | public Node getVisibleTopNode(){ |
| | | Node topNode; |
| | | if (!isVisible){ |
| | | return null; |
| | | } |
| | | if (!isExpand){ |
| | | return this; |
| | | } |
| | | if (children.size() > 0) { |
| | | topNode = children.get(0).getVisibleTopNode(); |
| | | } else { |
| | | topNode = this; |
| | | } |
| | | return topNode; |
| | | } |
| | | |
| | | // 设置对应类型节点的位置 由子类实现 |
| | | protected abstract void setViewPosition(int x, int centerY); |
| | | protected abstract void setForkYList(List<Integer> yList); |
| | | |
| | | protected View createItemView(HomeRootBean bean) { |
| | | // 使用布局填充器加载节点布局 |
| | | LayoutInflater inflater = LayoutInflater.from(AppManager.getAppManager().currentActivity()); |
| | | View familyMemberView = inflater.inflate(R.layout.item_family_member, null, false); |
| | | familyMemberView.measure(View.MeasureSpec.makeMeasureSpec((1 << 30) - 1, View.MeasureSpec.AT_MOST), |
| | | View.MeasureSpec.makeMeasureSpec((1 << 30) - 1, View.MeasureSpec.AT_MOST)); |
| | | |
| | | // 防止addView时,所有这里创建的view的高宽被限制成一样的 |
| | | ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); |
| | | familyMemberView.setLayoutParams(params); |
| | | |
| | | if (bean == null) { |
| | | return familyMemberView; |
| | | } |
| | | // 获取布局中的组件 |
| | | TextView tv_generation = familyMemberView.findViewById(R.id.tv_generation); |
| | | ImageFilterView iv_avatar = familyMemberView.findViewById(R.id.iv_avatar); |
| | | TextView tv_name = familyMemberView.findViewById(R.id.tv_name); |
| | | |
| | | // 设置节点内容 |
| | | tv_generation.setText(String.valueOf(bean.getIdentity())); |
| | | if (bean.getImg() != null) { |
| | | GlideUtil.loadImage(bean.getImg(), iv_avatar); |
| | | } |
| | | tv_name.setText(bean.getNickName()); |
| | | tv_name.setSelected(true); |
| | | return familyMemberView; |
| | | } |
| | | |
| | | protected ImageView createExpandIconView() { |
| | | ImageView expandView = new ImageView(AppManager.getAppManager().currentActivity()); |
| | | FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(pathLength,pathLength); |
| | | expandView.setLayoutParams(params); |
| | | int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(pathLength, View.MeasureSpec.EXACTLY); |
| | | int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(pathLength, View.MeasureSpec.EXACTLY); |
| | | expandView.measure(widthMeasureSpec,heightMeasureSpec); |
| | | return expandView; |
| | | } |
| | | |
| | | public void setVisible(boolean visible) { |
| | | isVisible = visible; |
| | | setViewVisible(visible); |
| | | if (!visible){//不可见时 子节点也不可见 |
| | | for (Node child : children) { |
| | | child.setVisible(false); |
| | | } |
| | | }else { //可见时,子节点可见性由是否展开决定 |
| | | for (Node child : children) { |
| | | child.setVisible(isExpand); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void setViewVisible(boolean visible){ |
| | | for (View view : viewList) { |
| | | view.setVisibility(visible?View.VISIBLE:View.GONE); |
| | | } |
| | | } |
| | | |
| | | |
| | | //计算从根节点到当前节点的 所经过 的 分叉节点数(有多个子节点的节点) |
| | | public int calculateForkCountRecursion(Node node){ |
| | | if (node == null) { |
| | | return 0; |
| | | } |
| | | if (node.parent == null){ |
| | | return 0; |
| | | } |
| | | if (node.parent.children.size() > 1){ |
| | | return 1 + calculateForkCountRecursion(node.parent); |
| | | }else { |
| | | return calculateForkCountRecursion(node.parent); |
| | | } |
| | | } |
| | | |
| | | public int getAllWidth(){ |
| | | int maxWidth = 0; |
| | | for (Node deepestVisibleNode : findDeepestNodes(false)) { |
| | | int width = deepestVisibleNode.getToSpecifyNodeWidth(null); |
| | | if (width > maxWidth){ |
| | | maxWidth = width; |
| | | } |
| | | } |
| | | return maxWidth; |
| | | } |
| | | |
| | | //获取 ”显示出 以当前节点为根节点 的 所有可见节点 “所需的宽度 |
| | | public int getAllVisibleWidth(){ |
| | | int maxWidth = 0; |
| | | if (isVisible){ |
| | | for (Node deepestVisibleNode : findDeepestNodes(true)) { |
| | | int width = deepestVisibleNode.getToSpecifyNodeWidth(null); |
| | | if (width > maxWidth){ |
| | | maxWidth = width; |
| | | } |
| | | } |
| | | } |
| | | return maxWidth; |
| | | } |
| | | |
| | | //获取当前节点到只指定节点的全部宽度 (指定节点为null时,表示到根节点) |
| | | public int getToSpecifyNodeWidth(Node specifyNode){ |
| | | int totalWidth = width; |
| | | Node currentNode = parent; |
| | | if (specifyNode == null){ |
| | | while (currentNode != null){ |
| | | totalWidth += currentNode.width; |
| | | if (currentNode.children.size() > 1){ |
| | | // |
| | | totalWidth += horizontalMargin; |
| | | } |
| | | currentNode = currentNode.parent; |
| | | } |
| | | }else { |
| | | boolean flag = false; |
| | | while (currentNode != null){ |
| | | totalWidth += currentNode.width; |
| | | if (currentNode.children.size() > 1){ |
| | | totalWidth += horizontalMargin; |
| | | } |
| | | if (currentNode == specifyNode){ |
| | | flag = true; |
| | | break; |
| | | } |
| | | currentNode = currentNode.parent; |
| | | } |
| | | if (!flag){ |
| | | totalWidth = 0; |
| | | } |
| | | } |
| | | |
| | | return totalWidth; |
| | | } |
| | | // 寻找当前可见的最深节点列表,true表示只考虑可见节点,false表示考虑所有节点 |
| | | public List<Node> findDeepestNodes(boolean considerVisible) { |
| | | List<Node> deepestNodes = new ArrayList<>(); // 初始化为空列表 |
| | | int maxDepth = -1; // 默认深度为-1,表示没有找到最深节点 |
| | | |
| | | Queue<Node> queue = new LinkedList<>(); |
| | | queue.offer(this); |
| | | |
| | | while (!queue.isEmpty()) { |
| | | Node current = queue.poll(); |
| | | int currentDepth = current.getDepth(); |
| | | |
| | | // 根据传入的参数判断是否考虑可见节点 |
| | | if (!considerVisible || (considerVisible && current.isVisible)) { |
| | | if (currentDepth >= maxDepth) { |
| | | // 如果当前节点的深度大于等于maxDepth,更新maxDepth |
| | | if (currentDepth > maxDepth) { |
| | | maxDepth = currentDepth; |
| | | deepestNodes.clear(); // 清空之前的结果 |
| | | } |
| | | deepestNodes.add(current); |
| | | } |
| | | } |
| | | |
| | | // 只有当前节点可见时才继续遍历其子节点 |
| | | if (!considerVisible || (considerVisible && current.isVisible)) { |
| | | for (Node child : current.children) { |
| | | if (child.parent != null) { |
| | | queue.offer(child); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return deepestNodes; |
| | | } |
| | | |
| | | // 获取节点的深度 |
| | | public int getDepth() { |
| | | int depth = 0; |
| | | Node currentNode = this; |
| | | while (currentNode.parent != null) { |
| | | depth++; |
| | | currentNode = currentNode.parent; |
| | | } |
| | | return depth; |
| | | } |
| | | |
| | | public int getAllHeight(){ |
| | | return getNodeTreeHeightRecursion(this,false); |
| | | } |
| | | |
| | | //获取 ”显示出 以当前节点为根节点 的 所有可见节点 “所需的高度 |
| | | public int getAllVisibleHeight(){ |
| | | return isVisible? getNodeTreeHeightRecursion(this,true):0; |
| | | } |
| | | |
| | | // 递归获取节点的可见高度总和,true表示考虑节点的可见性(即获取可见节点),false表示不考虑(即获取全部节点) |
| | | public int getNodeTreeHeightRecursion(Node node, boolean considerVisible){ |
| | | if (node == null){ |
| | | return 0; |
| | | } |
| | | if (considerVisible) { |
| | | if (!node.isVisible) { |
| | | return 0; |
| | | } |
| | | if (!node.isExpand) { |
| | | return node.height; |
| | | } |
| | | } |
| | | if (node.children.size() == 0){ |
| | | return node.height; |
| | | }else { |
| | | int heightSum = 0; |
| | | for (Node child : node.children) { |
| | | if (getNodeTreeHeightRecursion(child,considerVisible)!=0){ |
| | | heightSum += verticalMargin; |
| | | } |
| | | heightSum += getNodeTreeHeightRecursion(child,considerVisible); |
| | | } |
| | | //子节点每两个之间还有竖直间隔 |
| | | return Math.max(node.height,heightSum); |
| | | } |
| | | } |
| | | |
| | | public int getWidth(){ |
| | | return width; |
| | | } |
| | | |
| | | public int getHeight(){ |
| | | return height; |
| | | } |
| | | |
| | | public List<Node> getChildren() { |
| | | return children; |
| | | } |
| | | |
| | | |
| | | public void addChild(Node node){ |
| | | children.add(node); |
| | | } |
| | | |
| | | public boolean isExpand() { |
| | | return isExpand; |
| | | } |
| | | |
| | | public void setExpand(boolean expand) { |
| | | isExpand = expand; |
| | | } |
| | | |
| | | public boolean isVisible() { |
| | | return isVisible; |
| | | } |
| | | |
| | | public List<Path> getNextPathList() { |
| | | return nextPathList; |
| | | } |
| | | |
| | | public List<Path> getPrePathList() { |
| | | return prePathList; |
| | | } |
| | | |
| | | public List<View> getViewList() { |
| | | return viewList; |
| | | } |
| | | |
| | | // 获取 每个 itemView 的宽度 |
| | | public int getItemViewWidth(){ |
| | | View itemView = createItemView(null); |
| | | return itemView.getMeasuredWidth(); |
| | | } |
| | | // 获取 每个 itemView 的高度 |
| | | public int getItemViewHeight(){ |
| | | View itemView = createItemView(null); |
| | | return itemView.getMeasuredHeight(); |
| | | } |
| | | //获取展开按钮的宽度 |
| | | public int getExpandIconWidth(){ |
| | | ImageView expandIconView = createExpandIconView(); |
| | | return expandIconView.getMeasuredWidth(); |
| | | } |
| | | |
| | | |
| | | public int getViewWidth(){ |
| | | return viewBottom - viewTop; |
| | | } |
| | | } |
New file |
| | |
| | | package com.application.zhangshi_app_android.widget; |
| | | |
| | | import android.graphics.Path; |
| | | import android.graphics.RectF; |
| | | import android.view.View; |
| | | import android.widget.ImageView; |
| | | |
| | | import com.application.zhangshi_app_android.R; |
| | | import com.application.zhangshi_app_android.bean.HomeRootBean; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.08.13. 7:35 |
| | | * @desc 单亲节点 |
| | | */ |
| | | public class SimpleNode extends Node{ |
| | | private View memberItemView;//成员view |
| | | private ImageView expandIconView;//展开按钮 |
| | | |
| | | |
| | | public SimpleNode(HomeRootBean member) { |
| | | super(member); |
| | | if (member.getIdentity() > 1 && member.getChildList() != null && member.getChildList().size() > 0){ |
| | | //非 第一代 且 有子代, 节点宽度 = view宽度 + 前后路径长度 + 展开按钮宽度 |
| | | width = pathLength + getItemViewWidth() + pathLength + getExpandIconWidth(); |
| | | }else if (member.getIdentity() > 1 && (member.getChildList() == null || member.getChildList().size() == 0)) { |
| | | //非 第一代 且 无子代, 节点宽度 = view宽度 + 前路径长度 |
| | | width = getItemViewWidth() + pathLength; |
| | | }else if (member.getIdentity() == 1 && member.getChildList() != null && member.getChildList().size() > 0) { |
| | | //第一代 且 有子代, 节点宽度 = view宽度 + 后路径长度 + 展开按钮宽度 |
| | | width = getItemViewWidth() + pathLength + getExpandIconWidth(); |
| | | }else if (member.getIdentity() == 1 && (member.getChildList() == null || member.getChildList().size() == 0)) { |
| | | //第一代 且 无子代, 节点宽度 = view宽度 |
| | | width = getItemViewWidth(); |
| | | } |
| | | //单亲节点 高度 = view高度 |
| | | height = getItemViewHeight(); |
| | | initView(); |
| | | } |
| | | |
| | | private void initView() { |
| | | memberItemView = createItemView(member); |
| | | expandIconView = createExpandIconView(); |
| | | viewList.add(memberItemView); |
| | | viewList.add(expandIconView); |
| | | |
| | | if (isExpand){ |
| | | expandIconView.setBackgroundResource(R.drawable.ic_collapse); |
| | | }else { |
| | | expandIconView.setBackgroundResource(R.drawable.ic_expand); |
| | | } |
| | | expandIconView.setOnClickListener(v -> { |
| | | if (isExpand){ |
| | | expandIconView.setBackgroundResource(R.drawable.ic_expand); |
| | | for (Node child : children) { |
| | | child.setVisible(false); |
| | | } |
| | | isExpand = false; |
| | | }else { |
| | | expandIconView.setBackgroundResource(R.drawable.ic_collapse); |
| | | for (Node child : children) { |
| | | child.setVisible(true); |
| | | } |
| | | isExpand = true; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | protected void setViewPosition(int x, int centerY) { |
| | | left = x; |
| | | right = left + width; |
| | | this.centerY = centerY; |
| | | top = centerY - height/2; |
| | | bottom = centerY + height/2; |
| | | |
| | | if (member.getIdentity() > 1){//非 第一代 才有前置连线 |
| | | viewLeft = left + pathLength; |
| | | }else { |
| | | viewLeft = left; |
| | | } |
| | | memberItemView.setX(viewLeft); |
| | | memberItemView.setY(centerY - memberItemView.getMeasuredHeight()/2f); |
| | | viewRight = viewLeft + memberItemView.getMeasuredWidth(); |
| | | viewTop = (int) memberItemView.getY(); |
| | | viewBottom = (int) (memberItemView.getY() + memberItemView.getMeasuredHeight()); |
| | | |
| | | expandIconView.setX(viewRight + pathLength); |
| | | expandIconView.setY(centerY - expandIconView.getMeasuredHeight()/2f); |
| | | |
| | | right = (int) (expandIconView.getMeasuredWidth() + expandIconView.getX()); |
| | | |
| | | setPath(); |
| | | } |
| | | |
| | | private void setPath() { |
| | | prePathList.clear(); |
| | | nextPathList.clear(); |
| | | |
| | | if (member.getChildList() != null && member.getChildList().size() > 0){//有子节点,才有后置连线,才有展开按钮 |
| | | expandIconView.setVisibility(View.VISIBLE); |
| | | Path path = new Path(); |
| | | path.moveTo(viewRight, centerY); |
| | | path.lineTo(expandIconView.getX(), centerY); |
| | | nextPathList.add(path); |
| | | }else { |
| | | expandIconView.setVisibility(View.GONE); |
| | | viewList.remove(expandIconView); |
| | | right = viewRight; |
| | | } |
| | | if (member.getIdentity() > 1){//非 第一代 才有前置连线 |
| | | Path path = new Path(); |
| | | path.moveTo(viewLeft, centerY); |
| | | path.lineTo(left, centerY); |
| | | prePathList.add(path); |
| | | } |
| | | } |
| | | |
| | | //设置分叉点Y坐标集合 |
| | | public void setForkYList(List<Integer> yList){ |
| | | if (yList == null || yList.size() < 2){ |
| | | return; |
| | | } |
| | | forkPathList.clear(); |
| | | |
| | | //取出最大和最小 |
| | | int rBottom = 0; |
| | | int rTop = 0; |
| | | for (int i = 0; i < yList.size(); i++) { |
| | | if (i == 0){ |
| | | rTop = yList.get(i); |
| | | rBottom = yList.get(i); |
| | | }else { |
| | | if (yList.get(i) > rBottom){ |
| | | rBottom = yList.get(i); |
| | | } |
| | | if (yList.get(i) < rTop){ |
| | | rTop = yList.get(i); |
| | | } |
| | | } |
| | | } |
| | | yList.remove((Integer) rTop); |
| | | yList.remove((Integer) rBottom); |
| | | |
| | | float rLeft = right + pathLength; |
| | | float rRight = rLeft + pathLength; |
| | | Path path = new Path(); |
| | | //右上角 |
| | | path.moveTo(rRight, rTop); |
| | | // --- |
| | | path.lineTo(rLeft + cornerRadius, rTop); |
| | | // 添加圆弧路径,左上角的圆角 |
| | | path.arcTo(new RectF(rLeft, rTop, rLeft+2*cornerRadius, rTop+2*cornerRadius), 270, -90, false); |
| | | // ---- |
| | | // | |
| | | // | |
| | | path.lineTo(rLeft, rBottom - cornerRadius); |
| | | // 添加圆弧路径,左下角的圆角 |
| | | path.arcTo(new RectF(rLeft, rBottom - 2 * cornerRadius, rLeft + 2 * cornerRadius, rBottom), 180, -90, false); |
| | | // ---- |
| | | // | |
| | | // | |
| | | // ---- |
| | | path.lineTo(rRight, rBottom); |
| | | //移到左中间 |
| | | path.moveTo(rLeft, centerY); |
| | | // ---- |
| | | // ___| |
| | | // | |
| | | // ---- |
| | | path.lineTo(rLeft - pathLength, centerY); |
| | | for (Integer y : yList) { |
| | | path.moveTo(rLeft, y); |
| | | path.lineTo(rRight, y); |
| | | } |
| | | forkPathList.add(path); |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <layout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | xmlns:tools="http://schemas.android.com/tools"> |
| | | |
| | | <data> |
| | | <variable |
| | | name="viewModel" |
| | | type="com.application.zhangshi_app_android.ui.function.ContactsImportActivityViewModel" /> |
| | | </data> |
| | | |
| | | <androidx.constraintlayout.widget.ConstraintLayout |
| | | android:id="@+id/parentLayout" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="@color/color_normal_background" |
| | | android:orientation="vertical" |
| | | > |
| | | <com.android.app_base.widget.ExtendTitleBar |
| | | android:id="@+id/titleBar" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:leftIcon="@drawable/ic_back" |
| | | app:titleGravity="left" |
| | | app:title="通讯录导入" |
| | | > |
| | | <FrameLayout |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:layout_marginHorizontal="16dp" |
| | | android:layout_gravity="center_vertical|end" |
| | | > |
| | | <ImageView |
| | | android:id="@+id/iv_operate" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:visibility="gone" |
| | | android:background="@drawable/ic_operate_finish" |
| | | /> |
| | | </FrameLayout> |
| | | |
| | | </com.android.app_base.widget.ExtendTitleBar> |
| | | <LinearLayout |
| | | android:id="@+id/layout_data_null" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical" |
| | | android:gravity="center" |
| | | android:visibility="gone" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toBottomOf="@+id/titleBar"> |
| | | |
| | | <ImageView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:background="@drawable/img_data_null" |
| | | /> |
| | | <TextView |
| | | android:id="@+id/tv_data_null" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="18dp" |
| | | android:text="手机通讯录暂无数据" |
| | | android:textSize="14sp" |
| | | android:textColor="#73000000" |
| | | /> |
| | | </LinearLayout> |
| | | |
| | | <com.scwang.smart.refresh.layout.SmartRefreshLayout |
| | | android:id="@+id/refreshLayout" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | app:layout_constraintTop_toBottomOf="@+id/titleBar" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | > |
| | | <com.scwang.smart.refresh.header.MaterialHeader |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | /> |
| | | <androidx.recyclerview.widget.RecyclerView |
| | | android:id="@+id/recyclerView" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | tools:itemCount="20" |
| | | tools:listitem="@layout/item_contacts_detail" |
| | | /> |
| | | |
| | | <com.scwang.smart.refresh.footer.BallPulseFooter |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content"/> |
| | | </com.scwang.smart.refresh.layout.SmartRefreshLayout> |
| | | |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
| | | |
| | | </layout> |
| | |
| | | android:id="@+id/titleBar" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:title="@{viewModel.beanMutableLiveData.id==0?`新增家大事记`:viewModel.beanMutableLiveData.title}" |
| | | app:title="@{viewModel.beanLiveData.id==0?`新增家大事记`:viewModel.beanLiveData.title}" |
| | | app:titleGravity="left" |
| | | > |
| | | <FrameLayout |
| | |
| | | android:textColorHint="#6b000000" |
| | | android:textColor="#DE000000" |
| | | android:textSize="16sp" |
| | | android:text="@={viewModel.beanMutableLiveData.title}" |
| | | android:text="@={viewModel.beanLiveData.title}" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | /> |
| | | |
| | |
| | | android:layout_marginTop="@dimen/dp_2" |
| | | android:hint="@{viewModel.typeLiveData?`请输入时间(格式:2001-01-01)`:``}" |
| | | android:inputType="text" |
| | | android:text="@={viewModel.beanMutableLiveData.happenTime}" |
| | | android:text="@={viewModel.beanLiveData.happenTime}" |
| | | android:textColor="#DE000000" |
| | | android:textColorHint="#6b000000" |
| | | android:textSize="16sp" |
| | |
| | | android:inputType="text" |
| | | android:hint="@{viewModel.typeLiveData?`请输入人物`:``}" |
| | | android:textColorHint="#6b000000" |
| | | android:text="@={viewModel.beanMutableLiveData.people}" |
| | | android:text="@={viewModel.beanLiveData.people}" |
| | | android:textColor="#DE000000" |
| | | android:textSize="16sp" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | |
| | | android:hint="@{viewModel.typeLiveData?`请输入地点`:``}" |
| | | android:textColorHint="#6b000000" |
| | | android:textColor="#DE000000" |
| | | android:text="@={viewModel.beanMutableLiveData.address}" |
| | | android:text="@={viewModel.beanLiveData.address}" |
| | | android:textSize="16sp" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | /> |
| | |
| | | android:hint="@{viewModel.typeLiveData?`请输入备注`:``}" |
| | | android:textColorHint="#6b000000" |
| | | android:textColor="#DE000000" |
| | | android:text="@={viewModel.beanMutableLiveData.remark}" |
| | | android:text="@={viewModel.beanLiveData.remark}" |
| | | android:textSize="16sp" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | /> |
| | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="@{viewModel.healthCareBaseInfoBeanLiveData.name +`现状健康情况信息`}" |
| | | android:text="@{viewModel.healthCareBaseInfoBeanLiveData.name!=null?viewModel.healthCareBaseInfoBeanLiveData.name+`现状健康情况信息`:`现状健康情况信息`}" |
| | | android:textColor="@color/black" |
| | | android:textSize="20sp" |
| | | tools:text="xxx现状健康情况信息" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareBaseInfoBeanLiveData.name}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:textColor="#DE000000" |
| | | android:hint="@{viewModel.typeLiveData?`请输入姓名`:``}" |
| | | android:textSize="14sp" |
| | | android:textColor="#DE000000" |
| | | android:layout_marginTop="5dp" |
| | | android:inputType="textMultiLine" |
| | | /> |
| | |
| | | /> |
| | | <TextView |
| | | android:id="@+id/tv_sex" |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareBaseInfoBeanLiveData.sexStr}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入性别`:``}" |
| | | android:textColor="#DE000000" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="5dp" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareBaseInfoBeanLiveData.educationLevel}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" android:textColor="#DE000000" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入文化程度`:``}" |
| | | android:textColor="#DE000000" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="5dp" |
| | | android:inputType="textMultiLine" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareBaseInfoBeanLiveData.work}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" android:textColor="#DE000000" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入职业`:``}" |
| | | android:textColor="#DE000000" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="5dp" |
| | | android:inputType="textMultiLine" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareBaseInfoBeanLiveData.phone}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" android:textColor="#DE000000" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入电话`:``}" |
| | | android:textColor="#DE000000" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="5dp" |
| | | android:inputType="phone" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareBaseInfoBeanLiveData.email}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" android:textColor="#DE000000" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入电子邮件`:``}" |
| | | android:textColor="#DE000000" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="5dp" |
| | | android:inputType="textMultiLine" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareBaseInfoBeanLiveData.address}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" android:textColor="#DE000000" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入住址`:``}" |
| | | android:textColor="#DE000000" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="5dp" |
| | | android:inputType="textMultiLine" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareBaseInfoBeanLiveData.medicine}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" android:textColor="#DE000000" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入常用药物`:``}" |
| | | android:textColor="#DE000000" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="5dp" |
| | | android:inputType="textMultiLine" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareBaseInfoBeanLiveData.baseDisease}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" android:textColor="#DE000000" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入目前基础病`:``}" |
| | | android:textColor="#DE000000" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="5dp" |
| | | android:inputType="textMultiLine" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareLifeHabitsBeanLiveData.eatGood}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" android:textColor="#DE000000" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入饮食(喜)`:``}" |
| | | android:textColor="#DE000000" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="5dp" |
| | | android:inputType="textMultiLine" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareLifeHabitsBeanLiveData.eatBad}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" android:textColor="#DE000000" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入饮食(忌)`:``}" |
| | | android:textColor="#DE000000" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="5dp" |
| | | android:inputType="textMultiLine" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareLifeHabitsBeanLiveData.hobby}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入爱好`:``}" |
| | | android:textColor="#DE000000" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="5dp" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareLifeHabitsBeanLiveData.addition}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" android:textColor="#DE000000" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入嗜好`:``}" |
| | | android:textColor="#DE000000" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="5dp" |
| | | android:inputType="textMultiLine" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareLifeHabitsBeanLiveData.eatGood}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入大便频率`:``}" |
| | | android:textColor="#DE000000" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="5dp" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareLifeHabitsBeanLiveData.eatGood}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" android:textColor="#DE000000" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入小便频率`:``}" |
| | | android:textColor="#DE000000" |
| | | android:textSize="14sp" |
| | | android:layout_marginTop="5dp" |
| | | android:inputType="textMultiLine" |
| | |
| | | android:text="@={viewModel.healthCareNursingExaminationBeanLiveData.temperature}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入体温度数`:``}" |
| | | android:textColor="#B3000000" |
| | | android:textSize="16sp" |
| | | android:layout_marginTop="5dp" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareNursingExaminationBeanLiveData.pulse}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入脉搏频率`:``}" |
| | | android:textColor="#B3000000" |
| | | android:textSize="16sp" |
| | | android:layout_marginTop="5dp" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareNursingExaminationBeanLiveData.bloodPressure}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入血压`:``}" |
| | | android:textColor="#B3000000" |
| | | android:textSize="16sp" |
| | | android:layout_marginTop="5dp" |
| | |
| | | android:alpha="0.54" |
| | | /> |
| | | <EditText |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.healthCareNursingExaminationBeanLiveData.weight}" |
| | | android:background="@null" |
| | | android:enabled="@{viewModel.typeLiveData}" |
| | | android:hint="@{viewModel.typeLiveData?`请输入体重`:``}" |
| | | android:textColor="#B3000000" |
| | | android:textSize="16sp" |
| | | android:layout_marginTop="5dp" |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <layout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto"> |
| | | |
| | | <data> |
| | | <variable |
| | | name="viewModel" |
| | | type="com.application.zhangshi_app_android.ui.home.HomeMindMapActivityViewModel" /> |
| | | </data> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:orientation="vertical" |
| | | > |
| | | <com.android.app_base.widget.ExtendTitleBar |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:title="家族关系" |
| | | app:titleGravity="left" |
| | | app:leftIcon="@drawable/ic_back" |
| | | /> |
| | | <com.otaliastudios.zoom.ZoomLayout |
| | | android:id="@+id/zoomLayout" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="1" |
| | | android:scrollbars="vertical|horizontal" |
| | | app:transformation="centerInside" |
| | | app:transformationGravity="auto" |
| | | app:alignment="center" |
| | | app:overScrollHorizontal="true" |
| | | app:overScrollVertical="true" |
| | | app:overPinchable="true" |
| | | app:horizontalPanEnabled="true" |
| | | app:verticalPanEnabled="true" |
| | | app:zoomEnabled="true" |
| | | app:flingEnabled="true" |
| | | app:scrollEnabled="true" |
| | | app:oneFingerScrollEnabled="true" |
| | | app:twoFingersScrollEnabled="true" |
| | | app:threeFingersScrollEnabled="true" |
| | | app:minZoom="1" |
| | | app:minZoomType="zoom" |
| | | app:maxZoom="2.5" |
| | | app:maxZoomType="realZoom" |
| | | app:animationDuration="280" |
| | | app:hasClickableChildren="true"> |
| | | |
| | | <com.application.zhangshi_app_android.widget.HomeMindMapLayout |
| | | android:id="@+id/scrollHomeMindMapLayout" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | /> |
| | | |
| | | </com.otaliastudios.zoom.ZoomLayout> |
| | | </LinearLayout> |
| | | </layout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <layout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | xmlns:tools="http://schemas.android.com/tools"> |
| | | |
| | | <data> |
| | | <variable |
| | | name="viewModel" |
| | | type="com.application.zhangshi_app_android.ui.function.ImageSelectActivityViewModel" /> |
| | | </data> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:orientation="vertical" |
| | | android:background="@color/color_normal_background" |
| | | > |
| | | <com.android.app_base.widget.ExtendTitleBar |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:titleGravity="left" |
| | | app:title="@{viewModel.flagLiveData==0?`图片选择`:`视频选择`}" |
| | | app:leftIcon="@drawable/ic_back" |
| | | > |
| | | <FrameLayout |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:layout_marginHorizontal="16dp" |
| | | android:layout_gravity="center_vertical|end" |
| | | > |
| | | <ImageView |
| | | android:id="@+id/iv_operate" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:background="@{viewModel.typeLiveData?@drawable/ic_operate_finish:@drawable/ic_operate_select_white}" |
| | | /> |
| | | </FrameLayout> |
| | | |
| | | </com.android.app_base.widget.ExtendTitleBar> |
| | | <RelativeLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="20dp" |
| | | android:layout_marginHorizontal="20dp" |
| | | > |
| | | <com.android.app_base.widget.WrapRecyclerView |
| | | android:id="@+id/rv_image" |
| | | android:orientation="vertical" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginBottom="20dp" |
| | | android:layout_marginTop="2dp" |
| | | android:paddingStart="10dp" |
| | | android:paddingEnd="5dp" |
| | | android:paddingVertical="10dp" |
| | | tools:itemCount="3" |
| | | tools:listitem="@layout/item_electronic_file_add" |
| | | /> |
| | | </RelativeLayout> |
| | | </LinearLayout> |
| | | </layout> |
| | |
| | | |
| | | <ImageView |
| | | android:id="@+id/iv_bg_zhang" |
| | | android:layout_width="wrap_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_centerHorizontal="true" |
| | | android:layout_marginTop="18dp" |
| | | android:layout_centerInParent="true" |
| | | android:background="@drawable/bg_login_zhang" |
| | | app:imageUri="@{viewModel.selectLoginBackgroundLiveData}" |
| | | app:imageUrl="@{viewModel.selectLoginBackgroundLiveData}" |
| | | android:scaleType="centerCrop" |
| | | /> |
| | | |
| | | <TextView |
| | |
| | | android:paddingEnd="5dp" |
| | | android:paddingVertical="10dp" |
| | | tools:itemCount="3" |
| | | tools:listitem="@layout/item_image" |
| | | tools:listitem="@layout/item_electronic_file_add" |
| | | /> |
| | | </RelativeLayout> |
| | | </LinearLayout> |
| | |
| | | android:layout_height="wrap_content" |
| | | android:textSize="16sp" |
| | | android:textColor="#FF131215" |
| | | android:text="@{viewModel.infoLiveData.content}" |
| | | android:text="@{viewModel.infoLiveData.notion}" |
| | | /> |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | |
| | | android:layout_marginTop="-4dp" |
| | | tools:layout_height="wrap_content" |
| | | > |
| | | <LinearLayout |
| | | android:id="@+id/layout_search_parameter" |
| | | android:orientation="vertical" |
| | | <androidx.core.widget.NestedScrollView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:background="@color/white" |
| | | android:layout_marginHorizontal="56dp" |
| | | android:paddingEnd="12dp" |
| | | android:paddingStart="5dp" |
| | | > |
| | | |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.3dp" |
| | | android:background="#FF939393" /> |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/layout_search_parameter" |
| | | android:orientation="vertical" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center"> |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="wrap_content" |
| | | android:text="宠物名" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:gravity="center" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | /> |
| | | |
| | | <com.android.app_base.widget.ClearEditText |
| | | android:layout_width="0dp" |
| | | android:layout_weight="4" |
| | | android:layout_height="wrap_content" |
| | | android:background="@null" |
| | | android:inputType="text" |
| | | android:layout_marginStart="6dp" |
| | | android:text="@={viewModel.requestBeanLiveData.name}" |
| | | android:hint="请输入宠物名" |
| | | android:textColorHint="#61000000" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | app:background="@drawable/ic_clear" |
| | | /> |
| | | </LinearLayout> |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.5dp" |
| | | android:background="#FF939393" /> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center" |
| | | android:layout_height="wrap_content" |
| | | android:background="@color/white" |
| | | android:layout_marginHorizontal="56dp" |
| | | android:paddingEnd="12dp" |
| | | android:paddingStart="5dp" |
| | | > |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="match_parent" |
| | | android:text="出生日期" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:gravity="center" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | /> |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.3dp" |
| | | android:background="#FF939393" /> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="4" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center"> |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="wrap_content" |
| | | android:text="犬名" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:gravity="center" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | /> |
| | | |
| | | <com.android.app_base.widget.ClearEditText |
| | | android:layout_width="0dp" |
| | | android:layout_weight="4" |
| | | android:layout_height="wrap_content" |
| | | android:background="@null" |
| | | android:inputType="text" |
| | | android:layout_marginStart="6dp" |
| | | android:text="@={viewModel.requestBeanLiveData.name}" |
| | | android:hint="请输入犬名" |
| | | android:textColorHint="#61000000" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | app:background="@drawable/ic_clear" |
| | | /> |
| | | </LinearLayout> |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.5dp" |
| | | android:background="#FF939393" /> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center" |
| | | > |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:layout_width="0dp" |
| | | android:layout_height="match_parent" |
| | | android:layout_weight="1" |
| | | android:gravity="center" |
| | | android:maxLines="1" |
| | | android:text="出生日期" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeTextType="uniform" /> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="4" |
| | | android:gravity="center" |
| | | > |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/et_start_time" |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center" |
| | | android:layout_marginStart="6dp" |
| | | android:text="@={viewModel.requestBeanLiveData.happenStartTime}" |
| | | android:hint="开始时间" |
| | | android:textColorHint="#61000000" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:maxLines="1" |
| | | android:lines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | tools:text="2022-01-01" |
| | | /> |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="—" |
| | | /> |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/et_end_time" |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:gravity="center" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.requestBeanLiveData.happenEndTime}" |
| | | android:hint="结束时间" |
| | | android:textColorHint="#61000000" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | tools:text="2022-01-01" |
| | | /> |
| | | <ImageView |
| | | android:id="@+id/iv_time_clear" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:background="@drawable/ic_clear" |
| | | android:visibility="invisible" |
| | | /> |
| | | </LinearLayout> |
| | | |
| | | </LinearLayout> |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.3dp" |
| | | android:background="#FF939393" /> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center"> |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="match_parent" |
| | | android:text="犬种" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:gravity="center" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | /> |
| | | |
| | | <com.android.app_base.widget.ClearEditText |
| | | android:layout_width="0dp" |
| | | android:layout_weight="4" |
| | | android:layout_height="wrap_content" |
| | | android:background="@null" |
| | | android:inputType="text" |
| | | android:layout_marginStart="6dp" |
| | | android:text="@={viewModel.requestBeanLiveData.type}" |
| | | android:hint="请输入犬种" |
| | | android:textColorHint="#61000000" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | app:background="@drawable/ic_clear" |
| | | /> |
| | | </LinearLayout> |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.3dp" |
| | | android:background="#FF939393" /> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center"> |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="match_parent" |
| | | android:text="性别" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:gravity="center" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | /> |
| | | |
| | | <com.android.app_base.widget.ClearEditText |
| | | android:id="@+id/et_sex" |
| | | android:layout_width="0dp" |
| | | android:layout_weight="4" |
| | | android:layout_height="wrap_content" |
| | | android:background="@null" |
| | | android:inputType="text" |
| | | android:layout_marginStart="6dp" |
| | | android:text="@={viewModel.requestBeanLiveData.sexStr}" |
| | | android:hint="请选择性别" |
| | | android:textColorHint="#61000000" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | app:background="@drawable/ic_clear" |
| | | app:isEditable="@{false}" |
| | | /> |
| | | </LinearLayout> |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.3dp" |
| | | android:background="#FF939393" /> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center"> |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="match_parent" |
| | | android:text="犬只颜色" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:gravity="center" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | /> |
| | | |
| | | <com.android.app_base.widget.ClearEditText |
| | | android:layout_width="0dp" |
| | | android:layout_weight="4" |
| | | android:layout_height="wrap_content" |
| | | android:background="@null" |
| | | android:inputType="text" |
| | | android:layout_marginStart="6dp" |
| | | android:text="@={viewModel.requestBeanLiveData.color}" |
| | | android:hint="请输入犬只颜色" |
| | | android:textColorHint="#61000000" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | app:background="@drawable/ic_clear" |
| | | /> |
| | | </LinearLayout> |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.3dp" |
| | | android:background="#FF939393" /> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center"> |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="match_parent" |
| | | android:text="犬证号码" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:gravity="center" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | /> |
| | | |
| | | <com.android.app_base.widget.ClearEditText |
| | | android:layout_width="0dp" |
| | | android:layout_weight="4" |
| | | android:layout_height="wrap_content" |
| | | android:background="@null" |
| | | android:inputType="text" |
| | | android:layout_marginStart="6dp" |
| | | android:text="@={viewModel.requestBeanLiveData.idNum}" |
| | | android:hint="请输入犬证号码" |
| | | android:textColorHint="#61000000" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | app:background="@drawable/ic_clear" |
| | | /> |
| | | </LinearLayout> |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.3dp" |
| | | android:background="#FF939393" /> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center" |
| | | > |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/et_start_time" |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:text="防伪码" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:gravity="center" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | /> |
| | | <com.android.app_base.widget.ClearEditText |
| | | android:layout_width="0dp" |
| | | android:layout_weight="4" |
| | | android:layout_height="wrap_content" |
| | | android:background="@null" |
| | | android:inputType="text" |
| | | android:layout_marginStart="6dp" |
| | | android:text="@={viewModel.requestBeanLiveData.happenStartTime}" |
| | | android:hint="开始时间" |
| | | android:textColorHint="#61000000" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:maxLines="1" |
| | | android:lines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | tools:text="2022-01-01" |
| | | /> |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="—" |
| | | /> |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/et_end_time" |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:gravity="center" |
| | | android:layout_height="wrap_content" |
| | | android:text="@={viewModel.requestBeanLiveData.happenEndTime}" |
| | | android:hint="结束时间" |
| | | android:text="@={viewModel.requestBeanLiveData.securityCode}" |
| | | android:hint="请输入防伪码" |
| | | android:textColorHint="#61000000" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | tools:text="2022-01-01" |
| | | /> |
| | | <ImageView |
| | | android:id="@+id/iv_time_clear" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:background="@drawable/ic_clear" |
| | | android:visibility="invisible" |
| | | app:background="@drawable/ic_clear" |
| | | /> |
| | | </LinearLayout> |
| | | |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.3dp" |
| | | android:background="#FF939393" /> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center" |
| | | > |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="match_parent" |
| | | android:text="饮食(喜)" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:gravity="center" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | /> |
| | | <com.android.app_base.widget.ClearEditText |
| | | android:layout_width="0dp" |
| | | android:layout_weight="4" |
| | | android:layout_height="wrap_content" |
| | | android:background="@null" |
| | | android:inputType="text" |
| | | android:layout_marginStart="6dp" |
| | | android:text="@={viewModel.requestBeanLiveData.eatHabit}" |
| | | android:hint="请输入饮食习惯(喜)" |
| | | android:textColorHint="#61000000" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | app:background="@drawable/ic_clear" |
| | | /> |
| | | </LinearLayout> |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.3dp" |
| | | android:background="#FF939393" /> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center" |
| | | > |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="match_parent" |
| | | android:text="饮食(恶)" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:gravity="center" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | /> |
| | | <com.android.app_base.widget.ClearEditText |
| | | android:layout_width="0dp" |
| | | android:layout_weight="4" |
| | | android:layout_height="wrap_content" |
| | | android:background="@null" |
| | | android:inputType="text" |
| | | android:layout_marginStart="6dp" |
| | | android:text="@={viewModel.requestBeanLiveData.disEatHabit}" |
| | | android:hint="请输入饮食习惯(恶)" |
| | | android:textColorHint="#61000000" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | app:background="@drawable/ic_clear" |
| | | /> |
| | | </LinearLayout> |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.3dp" |
| | | android:background="#FF939393" /> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center" |
| | | > |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="match_parent" |
| | | android:text="生活(爱好)" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:gravity="center" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | /> |
| | | <com.android.app_base.widget.ClearEditText |
| | | android:layout_width="0dp" |
| | | android:layout_weight="4" |
| | | android:layout_height="wrap_content" |
| | | android:background="@null" |
| | | android:inputType="text" |
| | | android:layout_marginStart="6dp" |
| | | android:text="@={viewModel.requestBeanLiveData.lifeHabit}" |
| | | android:hint="请输入生活习惯(爱好)" |
| | | android:textColorHint="#61000000" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | app:background="@drawable/ic_clear" |
| | | /> |
| | | </LinearLayout> |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.3dp" |
| | | android:background="#FF939393" /> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center" |
| | | > |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="match_parent" |
| | | android:text="生活(嗜好)" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:gravity="center" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | /> |
| | | <com.android.app_base.widget.ClearEditText |
| | | android:layout_width="0dp" |
| | | android:layout_weight="4" |
| | | android:layout_height="wrap_content" |
| | | android:background="@null" |
| | | android:inputType="text" |
| | | android:layout_marginStart="6dp" |
| | | android:text="@={viewModel.requestBeanLiveData.disLifeHabit}" |
| | | android:hint="请输入生活习惯(嗜好)" |
| | | android:textColorHint="#61000000" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | app:background="@drawable/ic_clear" |
| | | /> |
| | | </LinearLayout> |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.3dp" |
| | | android:background="#FF939393" /> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center" |
| | | > |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="match_parent" |
| | | android:text="听懂方言" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:gravity="center" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | /> |
| | | <com.android.app_base.widget.ClearEditText |
| | | android:layout_width="0dp" |
| | | android:layout_weight="4" |
| | | android:layout_height="wrap_content" |
| | | android:background="@null" |
| | | android:inputType="text" |
| | | android:layout_marginStart="6dp" |
| | | android:text="@={viewModel.requestBeanLiveData.dialect}" |
| | | android:hint="请输入听懂方言" |
| | | android:textColorHint="#61000000" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | app:background="@drawable/ic_clear" |
| | | /> |
| | | </LinearLayout> |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.3dp" |
| | | android:background="#FF939393" /> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="40dp" |
| | | android:gravity="center" |
| | | > |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="match_parent" |
| | | android:text="居住地址" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:gravity="center" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | /> |
| | | <com.android.app_base.widget.ClearEditText |
| | | android:layout_width="0dp" |
| | | android:layout_weight="4" |
| | | android:layout_height="wrap_content" |
| | | android:background="@null" |
| | | android:inputType="text" |
| | | android:layout_marginStart="6dp" |
| | | android:text="@={viewModel.requestBeanLiveData.address}" |
| | | android:hint="请输入居住地址" |
| | | android:textColorHint="#61000000" |
| | | android:textColor="#FF333333" |
| | | android:textSize="14sp" |
| | | android:maxLines="1" |
| | | app:autoSizeTextType="uniform" |
| | | app:autoSizeMinTextSize="10sp" |
| | | app:autoSizeMaxTextSize="14sp" |
| | | app:background="@drawable/ic_clear" |
| | | /> |
| | | </LinearLayout> |
| | | </LinearLayout> |
| | | </LinearLayout> |
| | | |
| | | </androidx.core.widget.NestedScrollView> |
| | | </RelativeLayout> |
| | | |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
| | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginHorizontal="40dp" |
| | | android:layout_marginHorizontal="30dp" |
| | | android:layout_marginVertical="20dp" |
| | | android:orientation="vertical" |
| | | > |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <layout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:tools="http://schemas.android.com/tools" |
| | | > |
| | | |
| | | <data> |
| | | |
| | | </data> |
| | | |
| | | <com.android.app_base.widget.VideoPlayerView |
| | | android:id="@+id/videoplayerView" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:keepScreenOn="true" |
| | | android:orientation="vertical" |
| | | tools:context=".ui.activity.VideoPlayActivity" /> |
| | | </layout> |
| | |
| | | android:layout_height="wrap_content" |
| | | app:cardBackgroundColor="#FFFFFCFC" |
| | | app:cardCornerRadius="5dp" |
| | | android:layout_marginHorizontal="30dp"> |
| | | android:layout_marginHorizontal="30dp" |
| | | android:layout_marginBottom="5dp" |
| | | > |
| | | |
| | | <androidx.constraintlayout.widget.ConstraintLayout |
| | | android:layout_width="match_parent" |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:text="@{bean.myName}" |
| | | android:text="@{bean.myName == null ? `————` : bean.myName}" |
| | | android:textColor="@color/black" |
| | | android:textSize="14sp" /> |
| | | </LinearLayout> |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:text="@{bean.nickName}" |
| | | android:text="@{bean.nickName == null ? `————` : bean.nickName}" |
| | | android:textColor="@color/black" |
| | | android:textSize="14sp" /> |
| | | </LinearLayout> |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:text="@{bean.name}" |
| | | android:text="@{bean.name == null ? `————` : bean.name}" |
| | | android:textColor="@color/black" |
| | | android:textSize="14sp" /> |
| | | </LinearLayout> |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:text="@{bean.work}" |
| | | android:text="@{bean.work == null ? `————` : bean.work}" |
| | | android:textColor="@color/black" |
| | | android:textSize="14sp" /> |
| | | </LinearLayout> |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:text="@{bean.phone}" |
| | | android:text="@{bean.phone == null ? `————` : bean.phone}" |
| | | android:textColor="@color/black" |
| | | android:textSize="14sp" /> |
| | | </LinearLayout> |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:text="@{`微信号:`+ bean.wx}" |
| | | android:text="@{bean.wx == null ? `微信号:————` : `微信号:`+ bean.wx}" |
| | | android:textColor="@color/black" |
| | | android:textSize="10sp" |
| | | /> |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="wrap_content" |
| | | android:text="@{`QQ号:`+ bean.wx}" |
| | | android:text="@{bean.qq == null ? `QQ号: ————` : `QQ号:`+ bean.qq}" |
| | | android:textColor="@color/black" |
| | | android:textSize="10sp" /> |
| | | |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:text="@{`推特:`+ bean.wx}" |
| | | android:text="@{bean.twitter == null ? `推特:————` : `推特:`+ bean.twitter}" |
| | | android:textColor="@color/black" |
| | | android:textSize="10sp" /> |
| | | </LinearLayout> |
| | |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:text="@{bean.remark}" |
| | | android:text="@{bean.remark == null ? `————` : bean.remark}" |
| | | android:textColor="@color/black" |
| | | android:textSize="14sp" /> |
| | | </LinearLayout> |
| | |
| | | <RelativeLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="10dp" |
| | | android:layout_marginVertical="10dp" |
| | | > |
| | | <androidx.recyclerview.widget.RecyclerView |
| | | android:layout_width="match_parent" |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | xmlns:tools="http://schemas.android.com/tools" |
| | | android:layout_width="260dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | app:cardBackgroundColor="@color/white" |
| | | app:cardCornerRadius="5dp" |
| | | app:cardElevation="0px" |
| | | > |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical"> |
| | | |
| | | <FrameLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content"> |
| | | |
| | | <androidx.appcompat.widget.AppCompatImageView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:background="@drawable/update_app_top_bg" |
| | | /> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:layout_marginHorizontal="30dp" |
| | | android:layout_marginBottom="5dp" |
| | | android:orientation="vertical"> |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="发现新版本" |
| | | android:textColor="@color/white" |
| | | android:textSize="22sp" /> |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/tv_update_name" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginStart="10dp" |
| | | android:layout_marginTop="5dp" |
| | | android:textColor="@color/white" |
| | | android:textSize="20sp" |
| | | tools:text="3.2.1" /> |
| | | |
| | | </LinearLayout> |
| | | |
| | | </FrameLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical"> |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginHorizontal="20dp" |
| | | android:text="更新内容" |
| | | android:textColor="@color/black" |
| | | android:textSize="17sp" |
| | | android:textStyle="bold" /> |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/tv_update_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginHorizontal="20dp" |
| | | android:layout_marginVertical="10dp" |
| | | android:lineSpacingExtra="5dp" |
| | | android:maxLines="4" |
| | | android:minLines="3" |
| | | android:scrollbars="vertical" |
| | | android:textColor="#99000000" |
| | | android:textSize="15sp" |
| | | tools:text="6\n66\n666\n6666\n66666" /> |
| | | |
| | | <ProgressBar |
| | | android:id="@+id/pb_update_progress" |
| | | style="?android:attr/progressBarStyleHorizontal" |
| | | android:progressDrawable="@drawable/shape_gradient_update_progress" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="6dp" |
| | | android:layout_gravity="center_horizontal" |
| | | android:layout_marginHorizontal="20dp" |
| | | android:layout_marginTop="3dp" |
| | | android:indeterminate="false" |
| | | android:visibility="gone" |
| | | tools:progress="50" |
| | | tools:visibility="visible" /> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:orientation="horizontal"> |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/tv_update_close" |
| | | android:layout_width="0px" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:focusable="true" |
| | | android:gravity="center" |
| | | android:paddingVertical="15dp" |
| | | android:text="下次再说" |
| | | android:textColor="#66000000" |
| | | android:textSize="14sp" /> |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/tv_update_update" |
| | | android:layout_width="0px" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:focusable="true" |
| | | android:gravity="center" |
| | | android:paddingVertical="15dp" |
| | | android:text="立即更新" |
| | | android:textColor="#FF3560F4" |
| | | android:textSize="@dimen/sp_15" /> |
| | | </LinearLayout> |
| | | |
| | | </LinearLayout> |
| | | |
| | | </LinearLayout> |
| | | |
| | | </androidx.cardview.widget.CardView> |
| | |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="快来更新啦~" |
| | | android:textSize="@dimen/sp_24" |
| | | android:textSize="24sp" |
| | | android:textStyle="bold" |
| | | android:textColor="#FF3560F4" |
| | | android:layout_gravity="center" |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="15dp" |
| | | android:max="100" |
| | | android:progress="50" |
| | | android:progressDrawable="@drawable/shape_gradient_update_progress" |
| | | /> |
| | | |
| | |
| | | android:orientation="horizontal"> |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:background="@drawable/ic_search" /> |
| | | android:id="@+id/iv_operate_select" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/ic_operate_select_white" /> |
| | | |
| | | <ImageView |
| | | android:id="@+id/iv_operate" |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_marginStart="@dimen/dp_16" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:layout_marginStart="16dp" |
| | | android:background="@drawable/ic_operate" /> |
| | | |
| | | </LinearLayout> |
| | | </com.android.app_base.widget.ExtendTitleBar> |
| | | |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/layout_banner" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="200dp" |
| | | android:layout_height="0dp" |
| | | app:layout_constraintDimensionRatio="16:9" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toBottomOf="@id/titleBar" |
| | |
| | | android:layout_height="match_parent" |
| | | /> |
| | | </FrameLayout> |
| | | <RelativeLayout |
| | | android:id="@+id/layout_data_null" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:orientation="vertical" |
| | | > |
| | | <ImageView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:src="@drawable/img_data_null" |
| | | android:scaleType="center" |
| | | /> |
| | | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="空空如也~" |
| | | android:textColor="#73000000" |
| | | android:layout_gravity="center" |
| | | android:layout_centerHorizontal="true" |
| | | android:layout_alignParentBottom="true" |
| | | android:layout_marginBottom="10dp" |
| | | /> |
| | | </RelativeLayout> |
| | | |
| | | </FrameLayout> |
| | | |
| | | <LinearLayout |
| | |
| | | app:layout_constraintTop_toBottomOf="@id/tv_core_module"> |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/function_family_root_net" /> |
| | | |
| | | <TextView |
| | |
| | | app:layout_constraintTop_toTopOf="@id/layout_home_root_net"> |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/function_asset" /> |
| | | |
| | | <TextView |
| | |
| | | app:layout_constraintTop_toTopOf="@id/layout_home_root_net"> |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/function_honor" /> |
| | | |
| | | <TextView |
| | |
| | | > |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/function_little_doctor" |
| | | /> |
| | | <TextView |
| | |
| | | > |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/function_cleaning" |
| | | /> |
| | | <TextView |
| | |
| | | app:layout_constraintTop_toTopOf="@id/layout_little_doctor"> |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/function_mail_list" /> |
| | | |
| | | <TextView |
| | |
| | | app:layout_constraintTop_toTopOf="@id/layout_little_doctor"> |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/function_pamper_pet" /> |
| | | |
| | | <TextView |
| | |
| | | app:layout_constraintTop_toBottomOf="@+id/layout_little_doctor"> |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/function_income_expense" /> |
| | | |
| | | <TextView |
| | |
| | | app:layout_constraintTop_toBottomOf="@id/tv_personal_module"> |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/function_growth" /> |
| | | |
| | | <TextView |
| | |
| | | app:layout_constraintTop_toTopOf="@id/layout_growing_up"> |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/function_marriage" /> |
| | | |
| | | <TextView |
| | |
| | | app:layout_constraintTop_toTopOf="@+id/layout_growing_up"> |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/function_property"/> |
| | | |
| | | <TextView |
| | |
| | | app:layout_constraintTop_toTopOf="@+id/layout_growing_up"> |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/function_wish"/> |
| | | |
| | | <TextView |
| | |
| | | app:layout_constraintTop_toBottomOf="@+id/layout_growing_up"> |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/function_tour" /> |
| | | |
| | | <TextView |
| | |
| | | app:layout_constraintTop_toTopOf="@+id/layout_tourism"> |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/function_health" /> |
| | | |
| | | <TextView |
| | |
| | | app:layout_constraintTop_toTopOf="@+id/layout_tourism"> |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/function_honor" /> |
| | | |
| | | <TextView |
| | |
| | | app:layout_constraintTop_toTopOf="@+id/layout_tourism"> |
| | | |
| | | <ImageView |
| | | android:layout_width="@dimen/dp_24" |
| | | android:layout_height="@dimen/dp_24" |
| | | android:layout_width="24dp" |
| | | android:layout_height="24dp" |
| | | android:background="@drawable/function_privacy" /> |
| | | |
| | | <TextView |
| | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="还没上传照片 ~" |
| | | android:text="空空如也 ~" |
| | | android:textColor="#73000000" |
| | | android:layout_gravity="center" |
| | | android:layout_centerHorizontal="true" |
| | |
| | | android:background="#33000000" |
| | | /> |
| | | </LinearLayout> |
| | | <TextView |
| | | android:id="@+id/tv_login_out" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:layout_marginTop="20dp" |
| | | android:background="@drawable/shape_ff093878_10_solid" |
| | | android:gravity="center" |
| | | android:paddingHorizontal="70dp" |
| | | android:paddingVertical="5dp" |
| | | android:text="退出登录" |
| | | android:textColor="@color/white" |
| | | android:textSize="18dp" /> |
| | | </LinearLayout> |
| | | </ScrollView> |
| | | |
| | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="还没上传视频 ~" |
| | | android:text="还没指定视频 ~" |
| | | android:textColor="#73000000" |
| | | android:layout_gravity="center" |
| | | android:layout_centerHorizontal="true" |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <layout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | xmlns:tools="http://schemas.android.com/tools"> |
| | | |
| | | <data> |
| | | |
| | | </data> |
| | | |
| | | <FrameLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="#363636"> |
| | | <androidx.viewpager2.widget.ViewPager2 |
| | | android:id="@+id/view_pager" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | /> |
| | | |
| | | <FrameLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="bottom|center_horizontal" |
| | | android:layout_marginBottom="20dp" > |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/tv_image_preview_indicator" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:textColor="#FF757575" |
| | | android:textSize="16sp" |
| | | android:visibility="invisible" |
| | | tools:text="1/10" |
| | | tools:visibility="visible" /> |
| | | |
| | | </FrameLayout> |
| | | |
| | | </FrameLayout> |
| | | </layout> |
| | |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | app:round="8dp" |
| | | android:background="@color/teal_200" |
| | | android:background="@color/white" |
| | | android:layout_margin="5dp" |
| | | app:imageUrl="@{bean.url.split(`,`)[0]}" |
| | | /> |
| | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="@{bean.name}" |
| | | android:text="@{bean.name == null?`————`:bean.name}" |
| | | android:maxLines="1" |
| | | android:textColor="@color/black" |
| | | android:textSize="14sp" |
| | |
| | | <TextView |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:text="@{bean.nickName}" |
| | | android:text="@{bean.nickName==null?`——`:bean.nickName}" |
| | | android:textColor="#80000000" |
| | | android:textSize="12sp" |
| | | android:layout_weight="2" |
| | |
| | | <TextView |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:text="@{bean.work}" |
| | | android:text="@{bean.work == null?`————`:bean.work}" |
| | | android:textColor="#80000000" |
| | | android:textSize="12sp" |
| | | android:maxLines="1" |
| | |
| | | <TextView |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:text="@{bean.phone}" |
| | | android:text="@{bean.phone == null?`————`:bean.phone}" |
| | | android:ellipsize="end" |
| | | android:textColor="#80000000" |
| | | android:textSize="12sp" |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <layout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | xmlns:tools="http://schemas.android.com/tools"> |
| | | |
| | | <data> |
| | | <variable |
| | | name="url" |
| | | type="String" /> |
| | | </data> |
| | | <androidx.constraintlayout.widget.ConstraintLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | > |
| | | <FrameLayout |
| | | android:id="@+id/fl_image" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | app:layout_constraintDimensionRatio="1:1" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | > |
| | | <FrameLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:layout_margin="7dp" |
| | | > |
| | | <androidx.constraintlayout.utils.widget.ImageFilterView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="#73fab4cd" |
| | | app:round="10dp" |
| | | /> |
| | | <androidx.constraintlayout.utils.widget.ImageFilterView |
| | | android:id="@+id/iv_image" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | app:imageUrl="@{url}" |
| | | app:round="10dp" |
| | | /> |
| | | <FrameLayout |
| | | android:id="@+id/fl_play" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:visibility="gone" |
| | | tools:visibility="visible" |
| | | > |
| | | <androidx.constraintlayout.utils.widget.ImageFilterView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="@drawable/ps_ic_shadow_bg" |
| | | app:round="10dp" |
| | | /> |
| | | <ImageView |
| | | android:id="@+id/iv_play" |
| | | android:layout_width="30dp" |
| | | android:layout_height="30dp" |
| | | android:background="@drawable/ps_ic_video_play" |
| | | android:layout_gravity="center" |
| | | /> |
| | | </FrameLayout> |
| | | </FrameLayout> |
| | | |
| | | <ImageView |
| | | android:id="@+id/iv_delete" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:background="@drawable/ic_image_delete" |
| | | android:layout_gravity="top|end" |
| | | /> |
| | | <ImageView |
| | | android:id="@+id/iv_select" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:background="@drawable/ic_image_select" |
| | | android:layout_gravity="top|start" |
| | | /> |
| | | </FrameLayout> |
| | | <FrameLayout |
| | | android:id="@+id/fl_add" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | app:layout_constraintDimensionRatio="1:1" |
| | | android:layout_margin="7dp" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | android:background="@drawable/shape_73fab4cd_solid" |
| | | |
| | | > |
| | | <ImageView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:background="@drawable/ic_import_add" |
| | | android:layout_gravity="center" |
| | | /> |
| | | </FrameLayout> |
| | | |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
| | | </layout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <layout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto"> |
| | | |
| | | <data> |
| | | |
| | | </data> |
| | | |
| | | <androidx.cardview.widget.CardView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | app:cardCornerRadius="10dp" |
| | | app:cardElevation="5dp" |
| | | android:layout_margin="1dp"> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:layout_marginHorizontal="12dp" |
| | | android:layout_marginVertical="5dp" |
| | | android:orientation="horizontal" |
| | | android:gravity="center" |
| | | > |
| | | |
| | | <!-- 身份代数 --> |
| | | <TextView |
| | | android:id="@+id/tv_generation" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="1" |
| | | android:textSize="18sp" |
| | | android:textColor="#FFEBA4AA" |
| | | /> |
| | | |
| | | <!-- 头像 --> |
| | | <androidx.constraintlayout.utils.widget.ImageFilterView |
| | | android:id="@+id/iv_avatar" |
| | | android:layout_width="30dp" |
| | | android:layout_height="30dp" |
| | | android:layout_marginStart="8dp" |
| | | android:layout_marginEnd="10dp" |
| | | android:background="@drawable/img_sakura" |
| | | app:roundPercent="1" |
| | | /> |
| | | <!-- 名字 --> |
| | | <TextView |
| | | android:id="@+id/tv_name" |
| | | android:layout_width="70dp" |
| | | android:layout_height="wrap_content" |
| | | android:text="林佳林佳" |
| | | android:textSize="16sp" |
| | | android:textColor="#FF5F6980" |
| | | android:ellipsize="marquee" |
| | | android:singleLine="true" |
| | | android:focusable="true" |
| | | android:focusableInTouchMode="true" |
| | | android:marqueeRepeatLimit="marquee_forever" |
| | | /> |
| | | </LinearLayout> |
| | | |
| | | |
| | | </androidx.cardview.widget.CardView> |
| | | </layout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <layout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto"> |
| | | |
| | | <data> |
| | | <variable |
| | | name="bean" |
| | | type="String" /> |
| | | </data> |
| | | |
| | | <com.luck.picture.lib.photoview.PhotoView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | app:imageUrl="@{bean}" |
| | | /> |
| | | </layout> |
| | |
| | | android:id="@+id/rv_image" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | tools:listitem="@layout/item_image" |
| | | tools:listitem="@layout/item_electronic_file" |
| | | tools:itemCount="3" |
| | | /> |
| | | |
| | |
| | | android:gravity="center" |
| | | > |
| | | <androidx.constraintlayout.utils.widget.ImageFilterView |
| | | android:id="@+id/dl_home_user_avatar" |
| | | android:layout_width="50dp" |
| | | android:layout_height="50dp" |
| | | app:roundPercent="1" |
| | | android:background="@drawable/img_sakura" |
| | | /> |
| | | <TextView |
| | | android:id="@+id/dl_home_user_name" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="张喵" |
| | |
| | | android:textColor="#FF333333" |
| | | android:textSize="12sp" |
| | | /> |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0.3dp" |
| | | android:background="#FF939393" |
| | | /> |
| | | <TextView |
| | | android:id="@+id/tv_relation" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="32dp" |
| | | android:text="家族关系" |
| | | android:gravity="center" |
| | | android:textColor="#FF333333" |
| | | android:textSize="12sp" |
| | | /> |
| | | |
| | | </LinearLayout> |
| | | |
| | | </androidx.cardview.widget.CardView> |
| | |
| | | <item name="android:textColor">#FF000000</item> |
| | | </style> |
| | | |
| | | |
| | | </resources> |
| | |
| | | <item name="android:overScrollMode">never</item> |
| | | |
| | | </style> |
| | | |
| | | <!-- 全屏主题样式 --> |
| | | <style name="FullScreenTheme" parent="Theme.app"> |
| | | <item name="android:windowFullscreen">true</item> |
| | | </style> |
| | | </resources> |
| | |
| | | <external-path |
| | | name="external_files" |
| | | path="." /> |
| | | |
| | | <!--1、对应内部内存卡根目录:Context.getFileDir()--> |
| | | <files-path |
| | | name="int_root" |
| | | path="." /> |
| | | <!--2、对应应用默认缓存根目录:Context.getCacheDir()--> |
| | | <cache-path |
| | | name="app_cache" |
| | | path="." /> |
| | | <!--3、对应外部内存卡根目录:Environment.getExternalStorageDirectory()--> |
| | | <external-path |
| | | name="ext_root" |
| | | path="." /> |
| | | <!--4、对应外部内存卡根目录下的APP公共目录:Context.getExternalFileDir(String)--> |
| | | <external-files-path |
| | | name="ext_pub" |
| | | path="." /> |
| | | <!--5、对应外部内存卡根目录下的APP缓存目录:Context.getExternalCacheDir()--> |
| | | <external-cache-path |
| | | name="ext_cache" |
| | | path="." /> |
| | | </paths> |
| | |
| | | } |
| | | |
| | | android { |
| | | |
| | | namespace 'com.android.app_base' |
| | | compileSdk 33 |
| | | |
| | |
| | | consumerProguardFiles "consumer-rules.pro" |
| | | } |
| | | |
| | | buildTypes { |
| | | release { |
| | | minifyEnabled false |
| | | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
| | | } |
| | | } |
| | | compileOptions { |
| | | sourceCompatibility JavaVersion.VERSION_1_8 |
| | | targetCompatibility JavaVersion.VERSION_1_8 |
| | |
| | | api 'com.squareup.okhttp3:okhttp:4.10.0' |
| | | api 'com.squareup.okhttp3:logging-interceptor:4.10.0' |
| | | |
| | | // 网络请求框架:https://github.com/getActivity/EasyHttp |
| | | api 'com.github.getActivity:EasyHttp:12.0' |
| | | |
| | | //Rxjava |
| | | api "io.reactivex.rxjava2:rxjava:2.2.21" |
| | | api 'io.reactivex.rxjava2:rxandroid:2.1.1' |
| | |
| | | //implementation 'com.geyifeng.immersionbar:immersionbar-ktx:3.2.2' // kotlin扩展(可选) |
| | | |
| | | //图片相关 |
| | | api 'com.github.bumptech.glide:glide:4.14.2' |
| | | api 'com.github.bumptech.glide:glide:4.15.1' |
| | | annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0' |
| | | |
| | | //内存泄露工具 |
| | |
| | | |
| | | //图片选择器 |
| | | // PictureSelector 基础 (必须) |
| | | api 'io.github.lucksiege:pictureselector:v3.10.8' |
| | | api 'io.github.lucksiege:pictureselector:v3.11.1' |
| | | // 图片压缩 (按需引入) |
| | | api 'io.github.lucksiege:compress:v3.10.8' |
| | | // 图片裁剪 (按需引入) |
| | |
| | | //视频播放 |
| | | //完整版引入 |
| | | api 'com.github.CarGuo.GSYVideoPlayer:GSYVideoPlayer:v8.4.0-release-jitpack' |
| | | |
| | | //自由滚动、缩放布局 |
| | | api "com.otaliastudios:zoomlayout:1.9.0" |
| | | |
| | | } |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
| | | <uses-permission android:name="android.permission.INTERNET" /> |
| | | </manifest> |
| | |
| | | |
| | | import androidx.annotation.NonNull; |
| | | |
| | | import com.android.app_base.BuildConfig; |
| | | import com.android.app_base.http.OkHttpHelper; |
| | | import com.android.app_base.manager.AppManager; |
| | | import com.blankj.utilcode.util.Utils; |
| | | import com.hjq.http.EasyConfig; |
| | | |
| | | /** |
| | | * Application基类 |
| | |
| | | public class ImageViewAdapter { |
| | | @BindingAdapter({"imageUrl"}) |
| | | public static void loadUrlImage(ImageView imageView, String url) { |
| | | GlideUtil.loadImage(url, imageView); |
| | | } |
| | | @BindingAdapter({"imageUri"}) |
| | | public static void loadUriImage(ImageView imageView, String uri) { |
| | | if (TextUtils.isEmpty(uri)){ |
| | | if (TextUtils.isEmpty(url)) { |
| | | return; |
| | | } |
| | | imageView.setImageURI(Uri.parse(uri)); |
| | | |
| | | GlideUtil.loadImage(url, imageView); |
| | | } |
| | | @BindingAdapter({"imageBase64"}) |
| | | public static void setBase64Image(ImageView imageView, String imageString) { |
New file |
| | |
| | | package com.android.app_base.base.dialog; |
| | | |
| | | import android.content.Context; |
| | | import android.text.TextUtils; |
| | | import android.widget.ImageView; |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.annotation.DrawableRes; |
| | | import androidx.annotation.StringRes; |
| | | |
| | | import com.android.app_base.R; |
| | | |
| | | /** |
| | | * 提示对话框 |
| | | */ |
| | | public final class TipsDialog { |
| | | |
| | | public final static int ICON_FINISH = R.drawable.tips_finish_ic; |
| | | public final static int ICON_ERROR = R.drawable.tips_error_ic; |
| | | public final static int ICON_WARNING = R.drawable.tips_warning_ic; |
| | | |
| | | public static final class Builder |
| | | extends BaseDialog.Builder<Builder> |
| | | implements Runnable, BaseDialog.OnShowListener { |
| | | |
| | | private final TextView mMessageView; |
| | | private final ImageView mIconView; |
| | | |
| | | private int mDuration = 2000; |
| | | |
| | | public Builder(Context context) { |
| | | super(context); |
| | | setContentView(R.layout.tips_dialog); |
| | | setAnimStyle(BaseDialog.ANIM_TOAST); |
| | | setBackgroundDimEnabled(false); |
| | | setCancelable(false); |
| | | |
| | | mMessageView = findViewById(R.id.tv_tips_message); |
| | | mIconView = findViewById(R.id.iv_tips_icon); |
| | | |
| | | addOnShowListener(this); |
| | | } |
| | | |
| | | public Builder setIcon(@DrawableRes int id) { |
| | | mIconView.setImageResource(id); |
| | | return this; |
| | | } |
| | | |
| | | public Builder setDuration(int duration) { |
| | | mDuration = duration; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setMessage(@StringRes int id) { |
| | | return setMessage(getContext().getString(id)); |
| | | } |
| | | public Builder setMessage(CharSequence text) { |
| | | mMessageView.setText(text); |
| | | return this; |
| | | } |
| | | |
| | | @Override |
| | | public BaseDialog create() { |
| | | // 如果显示的图标为空就抛出异常 |
| | | if (mIconView.getDrawable() == null) { |
| | | throw new IllegalArgumentException("显示的图标为空"); |
| | | } |
| | | // 如果内容为空就抛出异常 |
| | | if (TextUtils.isEmpty(mMessageView.getText().toString())) { |
| | | throw new IllegalArgumentException("内容为空"); |
| | | } |
| | | |
| | | return super.create(); |
| | | } |
| | | |
| | | @Override |
| | | public void onShow(BaseDialog dialog) { |
| | | // 延迟自动关闭 |
| | | postDelayed(this, mDuration); |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | if (!isShowing()) { |
| | | return; |
| | | } |
| | | dismiss(); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | public B setTitle(CharSequence text) { |
| | | mTitleView.setText(text); |
| | | mTitleView.setVisibility((text == null || "".equals(text.toString())) ? View.GONE : View.VISIBLE); |
| | | return (B) this; |
| | | } |
| | | |
| | |
| | | |
| | | public B setCancel(CharSequence text) { |
| | | mCancelView.setText(text); |
| | | mCancelView.setVisibility((text == null || "".equals(text.toString())) ? View.GONE : View.VISIBLE); |
| | | return (B) this; |
| | | } |
| | | |
| | |
| | | /** |
| | | * 点击取消时回调 |
| | | */ |
| | | default void onCancel(BaseDialog dialog) {} |
| | | default void onCancel(BaseDialog dialog) { |
| | | dialog.dismiss(); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import com.android.app_base.R; |
| | | |
| | | /** |
| | | * 加载等待对话框 |
| | | */ |
| | | public final class WaitDialog { |
| | | |
| | | public static final class Builder |
New file |
| | |
| | | package com.android.app_base.base.model; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.08.19. 23:56 |
| | | * @desc |
| | | */ |
| | | public class SimpleModel extends BaseModel{ |
| | | |
| | | @Override |
| | | public void onCleared() { |
| | | |
| | | } |
| | | } |
| | |
| | | import com.android.app_base.base.action.ClickAction; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.base.StateViewEnum; |
| | | import com.android.app_base.base.viewmodel.SimpleViewModel; |
| | | import com.blankj.utilcode.util.ToastUtils; |
| | | import com.gyf.immersionbar.ImmersionBar; |
| | | import com.hjq.bar.TitleBar; |
| | |
| | | if (type instanceof ParameterizedType){ |
| | | vmClass = (Class) ((ParameterizedType) type).getActualTypeArguments()[1]; |
| | | } else { |
| | | //如果没有指定泛型参数,则默认使用BaseViewModel |
| | | vmClass = (Class<VM>) BaseViewModel.class; |
| | | //如果没有指定泛型参数,则默认使用SimpleViewModel |
| | | vmClass = (Class<VM>) SimpleViewModel.class; |
| | | } |
| | | return new ViewModelProvider(this, (ViewModelProvider.Factory) ViewModelProvider.AndroidViewModelFactory.getInstance(getApplication())).get(vmClass); |
| | | } |
| | |
| | | public abstract class BaseFragment<VDB extends ViewDataBinding,VM extends BaseViewModel> extends Fragment implements TitleBarAction, ClickAction { |
| | | protected VDB binding; |
| | | protected VM viewModel; |
| | | private int viewModelId; |
| | | protected int viewModelId; |
| | | |
| | | /** |
| | | * 标题栏对象 |
| | | */ |
| | | private TitleBar mTitleBar; |
| | | protected TitleBar mTitleBar; |
| | | /** |
| | | * 状态栏沉浸 |
| | | */ |
| | | private ImmersionBar mImmersionBar; |
| | | protected ImmersionBar mImmersionBar; |
| | | /** |
| | | * 根布局 |
| | | */ |
| | | private View mRootView; |
| | | protected View mRootView; |
| | | /** |
| | | * 该Fragment是否加载过数据 |
| | | * */ |
| | | private boolean isLoaded; |
| | | protected boolean isLoaded; |
| | | |
| | | |
| | | @Override |
| | |
| | | |
| | | |
| | | @Override |
| | | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| | | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |
| | | super.onViewCreated(view, savedInstanceState); |
| | | //绑定 ViewDataBinding 和 ViewModel |
| | | initViewDataBindingAndViewModel(); |
| | |
| | | */ |
| | | protected VDB initViewBinding(LayoutInflater inflater, @Nullable ViewGroup container) { |
| | | return DataBindingUtil.inflate(inflater,getLayoutId(), container, false); |
| | | |
| | | } |
| | | |
| | | /** |
New file |
| | |
| | | package com.android.app_base.base.viewmodel; |
| | | |
| | | import android.app.Application; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | |
| | | import com.android.app_base.base.model.SimpleModel; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.08.19. 18:29 |
| | | * @desc 简单的ViewModel |
| | | */ |
| | | public class SimpleViewModel extends BaseViewModel<SimpleModel>{ |
| | | public SimpleViewModel(@NonNull Application application) { |
| | | super(application); |
| | | } |
| | | |
| | | @Override |
| | | protected SimpleModel initModel() { |
| | | return new SimpleModel(); |
| | | } |
| | | } |
| | |
| | | |
| | | import android.content.Context; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | |
| | | import com.blankj.utilcode.util.NetworkUtils; |
| | | |
| | | import java.io.IOException; |
| | |
| | | this.context = context; |
| | | } |
| | | |
| | | @NonNull |
| | | @Override |
| | | public Response intercept(Chain chain) throws IOException { |
| | | Request request = chain.request(); |
| | |
| | | import android.os.Build; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.fragment.app.Fragment; |
| | | |
| | | import com.android.app_base.utils.GlideEngine; |
| | | import com.android.app_base.utils.SPUtils; |
| | |
| | | import com.blankj.utilcode.util.PermissionUtils; |
| | | import com.luck.picture.lib.basic.PictureSelector; |
| | | import com.luck.picture.lib.config.SelectMimeType; |
| | | import com.luck.picture.lib.engine.CropEngine; |
| | | import com.luck.picture.lib.entity.LocalMedia; |
| | | import com.luck.picture.lib.interfaces.OnResultCallbackListener; |
| | | |
| | |
| | | * 获取权限 |
| | | */ |
| | | public void getPermissions(PermissionUtils.SimpleCallback simpleCallback, @NonNull String... permissions) { |
| | | if (isGranted(permissions)){ |
| | | simpleCallback.onGranted(); |
| | | return; |
| | | } |
| | | // if (isGranted(permissions)){ |
| | | // simpleCallback.onGranted(); |
| | | // return; |
| | | // } |
| | | PermissionUtils.permission(permissions).callback(simpleCallback).request(); |
| | | } |
| | | |
| | | /** |
| | | * 选择图片 |
| | | * @param activity 上下文 |
| | | * @param chooseMode 选择模式 SelectMimeType.TYPE_ALL = 0;TYPE_IMAGE = 1;TYPE_VIDEO = 2;TYPE_AUDIO = 3; |
| | | * @param maxSelectNum 最大选择数量 |
| | | * @param onResultCallbackListener 回调 |
| | | */ |
| | | public void selectImage(Activity activity,int maxSelectNum,OnResultCallbackListener<LocalMedia> onResultCallbackListener){ |
| | | public void selectImage(Activity activity,int chooseMode,int maxSelectNum,OnResultCallbackListener<LocalMedia> onResultCallbackListener){ |
| | | String[] permissions; |
| | | if (Build.VERSION.SDK_INT >= 33) { |
| | | permissions = new String[]{Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.READ_MEDIA_VIDEO, Manifest.permission.READ_MEDIA_AUDIO, Manifest.permission.CAMERA}; |
| | |
| | | @Override |
| | | public void onGranted() { |
| | | PictureSelector.create(activity) |
| | | .openGallery(SelectMimeType.ofImage()) |
| | | .openGallery(chooseMode) |
| | | .setImageEngine(GlideEngine.createGlideEngine()) |
| | | .setPermissionsInterceptListener(new OnPermissionsInterceptListenerImpl()) |
| | | .isMaxSelectEnabledMask(true)// 达到最大选择数是否开启禁选蒙层 |
| | | .isWithSelectVideoImage(true)// 图片和视频是否可以同选,只在ofAll模式下有效 |
| | | .setMaxSelectNum(maxSelectNum) |
| | | .forResult(onResultCallbackListener); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public void setToken(String token){ |
| | | SPUtils.getInstance("tokenInfo").put("token",token); |
| | | } |
| | | public void clearToken(){ |
| | | SPUtils.getInstance("tokenInfo").clear(); |
| | | } |
| | | |
| | | public String getToken(){ |
| | | return SPUtils.getInstance("tokenInfo").getString("token"); |
| | | } |
| | | |
| | | public void setUserName(String userName){ |
| | | SPUtils.getInstance("userInfo").put("userName",userName); |
| | | } |
| | | public String getUserName(){ |
| | | return SPUtils.getInstance("userInfo").getString("userName"); |
| | | } |
| | | public void clearUserName(){ |
| | | SPUtils.getInstance("userInfo").remove("userName"); |
| | | } |
| | | public void clearUserInfo(){ |
| | | SPUtils.getInstance("userInfo").clear(); |
| | | } |
| | | |
| | | public void setUserAvatar(String userAvatar){ |
| | | SPUtils.getInstance("userInfo").put("userAvatar",userAvatar); |
| | | } |
| | | public String getUserAvatar(){ |
| | | return SPUtils.getInstance("userInfo").getString("userAvatar"); |
| | | } |
| | | public void clearUserAvatar(){ |
| | | SPUtils.getInstance("userInfo").remove("userAvatar"); |
| | | } |
| | | |
| | | public void loginOut(){ |
| | | clearToken(); |
| | | clearUserInfo(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.android.app_base.utils; |
| | | |
| | | import static android.os.Environment.MEDIA_MOUNTED; |
| | | |
| | | import android.annotation.SuppressLint; |
| | | import android.content.ContentResolver; |
| | | import android.content.ContentUris; |
| | | import android.content.Context; |
| | | import android.database.Cursor; |
| | | import android.net.Uri; |
| | | import android.os.Build; |
| | | import android.os.Environment; |
| | | import android.os.FileUtils; |
| | | import android.provider.DocumentsContract; |
| | | import android.provider.MediaStore; |
| | | import android.provider.OpenableColumns; |
| | | import android.text.TextUtils; |
| | | |
| | | import androidx.annotation.RequiresApi; |
| | | import androidx.annotation.WorkerThread; |
| | | |
| | | import java.io.BufferedInputStream; |
| | | import java.io.BufferedOutputStream; |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.URISyntaxException; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public class ContentUriUtils { |
| | | |
| | | /** |
| | | * make sure to use this getFilePath method from worker thread |
| | | */ |
| | | @WorkerThread |
| | | public static String getFilePath(Context context, Uri fileUri) throws URISyntaxException { |
| | | Uri uri = fileUri; |
| | | String selection = null; |
| | | String[] selectionArgs = null; |
| | | |
| | | // Uri is different in versions after KITKAT (Android 4.4), we need to |
| | | if (Build.VERSION.SDK_INT >= 19 && DocumentsContract.isDocumentUri(context.getApplicationContext(), uri)) { |
| | | if (isExternalStorageDocument(uri)) { |
| | | String docId = DocumentsContract.getDocumentId(uri); |
| | | String[] split = docId.split(":"); |
| | | return Environment.getExternalStorageDirectory().toString() + "/" + split[1]; |
| | | } else if (isDownloadsDocument(uri)) { |
| | | String id = DocumentsContract.getDocumentId(uri); |
| | | uri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); |
| | | } else if (isMediaDocument(uri)) { |
| | | String docId = DocumentsContract.getDocumentId(uri); |
| | | String[] split = docId.split(":"); |
| | | String type = split[0]; |
| | | if ("image".equals(type)) { |
| | | uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; |
| | | } else if ("video".equals(type)) { |
| | | uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; |
| | | } else if ("audio".equals(type)) { |
| | | uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; |
| | | } |
| | | selection = "_id=?"; |
| | | selectionArgs = new String[]{split[1]}; |
| | | } |
| | | } |
| | | if ("content".equals(uri.getScheme())) { |
| | | if (isGooglePhotosUri(uri)) { |
| | | return uri.getLastPathSegment(); |
| | | } |
| | | String[] projection = {MediaStore.Images.Media.DATA}; |
| | | try { |
| | | Cursor cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); |
| | | if (cursor != null) { |
| | | String path = null; |
| | | int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); |
| | | if (cursor.moveToFirst()) { |
| | | path = cursor.getString(column_index); |
| | | cursor.close(); |
| | | } |
| | | return path; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } else if ("file".equals(uri.getScheme())) { |
| | | return uri.getPath(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static boolean isExternalStorageDocument(Uri uri) { |
| | | return "com.android.externalstorage.documents".equals(uri.getAuthority()); |
| | | } |
| | | |
| | | public static boolean isDownloadsDocument(Uri uri) { |
| | | return "com.android.providers.downloads.documents".equals(uri.getAuthority()); |
| | | } |
| | | |
| | | public static boolean isMediaDocument(Uri uri) { |
| | | return "com.android.providers.media.documents".equals(uri.getAuthority()); |
| | | } |
| | | |
| | | public static boolean isGooglePhotosUri(Uri uri) { |
| | | return "com.google.android.apps.photos.content".equals(uri.getAuthority()); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.android.app_base.utils; |
| | | |
| | | import static android.os.Environment.MEDIA_MOUNTED; |
| | | |
| | | import android.annotation.SuppressLint; |
| | | import android.content.ContentResolver; |
| | | import android.content.ContentUris; |
| | | import android.content.Context; |
| | | import android.database.Cursor; |
| | | import android.net.Uri; |
| | | import android.os.Build; |
| | | import android.os.Environment; |
| | | import android.os.FileUtils; |
| | | import android.provider.DocumentsContract; |
| | | import android.provider.MediaStore; |
| | | import android.provider.OpenableColumns; |
| | | import android.text.TextUtils; |
| | | |
| | | import androidx.annotation.RequiresApi; |
| | | |
| | | import java.io.BufferedInputStream; |
| | | import java.io.BufferedOutputStream; |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | |
| | | public class GetFilePathFromUri { |
| | | |
| | | /** |
| | | * 文件路径名称 |
| | | */ |
| | | public static String dirPathName = "appFiles"; |
| | | |
| | | /** |
| | | * 判断手机的外部存储是否有,如果没有就用内部存储 |
| | | * |
| | | * @param context |
| | | * @param dir |
| | | * @return |
| | | */ |
| | | public static String getFileDirPath(Context context, String dir) { |
| | | String directoryPath = ""; |
| | | if (MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {//判断外部存储是否可用 |
| | | directoryPath = context.getExternalFilesDir(dir).getAbsolutePath(); |
| | | } else {//没外部存储就使用内部存储 |
| | | directoryPath = context.getFilesDir() + File.separator + dir; |
| | | } |
| | | File file = new File(directoryPath); |
| | | if (!file.exists()) {//判断文件目录是否存在 |
| | | file.mkdirs(); |
| | | } |
| | | return directoryPath; |
| | | } |
| | | |
| | | /** |
| | | * 根据Uri获取文件绝对路径,解决Android4.4以上版本Uri转换 兼容Android 10 |
| | | * |
| | | * @param context |
| | | * @param imageUri |
| | | */ |
| | | public static String getFileAbsolutePath(Context context, Uri imageUri) { |
| | | if (context == null || imageUri == null) { |
| | | return null; |
| | | } |
| | | |
| | | //4.4以下的版本 |
| | | if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.KITKAT) { |
| | | return getRealFilePath(context, imageUri); |
| | | } else if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT |
| | | && android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.Q |
| | | && DocumentsContract.isDocumentUri(context, imageUri)) {//大于4.4,小于10 |
| | | if (isExternalStorageDocument(imageUri)) { |
| | | String docId = DocumentsContract.getDocumentId(imageUri); |
| | | String[] split = docId.split(":"); |
| | | String type = split[0]; |
| | | if ("primary".equalsIgnoreCase(type)) { |
| | | return Environment.getExternalStorageDirectory() + "/" + split[1]; |
| | | } |
| | | } else if (isDownloadsDocument(imageUri)) { |
| | | String id = DocumentsContract.getDocumentId(imageUri); |
| | | if (!TextUtils.isEmpty(id)) { |
| | | if (id.startsWith("raw:")) {//已经返回真实路径 |
| | | return id.replaceFirst("raw:", ""); |
| | | } |
| | | } |
| | | Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); |
| | | return getDataColumn(context, contentUri, null, null); |
| | | } else if (isMediaDocument(imageUri)) { |
| | | String docId = DocumentsContract.getDocumentId(imageUri); |
| | | String[] split = docId.split(":"); |
| | | String type = split[0]; |
| | | Uri contentUri = null; |
| | | if ("image".equals(type)) { |
| | | contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; |
| | | } else if ("video".equals(type)) { |
| | | contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; |
| | | } else if ("audio".equals(type)) { |
| | | contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; |
| | | } |
| | | String selection = MediaStore.Images.Media._ID + "=?"; |
| | | String[] selectionArgs = new String[]{split[1]}; |
| | | return getDataColumn(context, contentUri, selection, selectionArgs); |
| | | } |
| | | } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {// MediaStore (and general) 大于等于10 |
| | | return uriToFileApiQ(context, imageUri); |
| | | } else if ("content".equalsIgnoreCase(imageUri.getScheme())) { |
| | | // Return the remote address |
| | | if (isGooglePhotosUri(imageUri)) { |
| | | return imageUri.getLastPathSegment(); |
| | | } |
| | | if (Build.VERSION.SDK_INT >= 24) { |
| | | return getFilePathFromUri(context, imageUri); //content 类型 |
| | | } else { |
| | | return getDataColumn(context, imageUri, null, null); |
| | | } |
| | | } |
| | | // File |
| | | else if ("file".equalsIgnoreCase(imageUri.getScheme())) { |
| | | return imageUri.getPath(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private static String getRealFilePath(final Context context, final Uri uri) { |
| | | if (null == uri) { |
| | | return null; |
| | | } |
| | | final String scheme = uri.getScheme(); |
| | | String data = null; |
| | | if (scheme == null) { |
| | | data = uri.getPath(); |
| | | } else if (ContentResolver.SCHEME_FILE.equals(scheme)) { |
| | | data = uri.getPath(); |
| | | } else if (ContentResolver.SCHEME_CONTENT.equals(scheme)) { |
| | | String[] projection = {MediaStore.Images.ImageColumns.DATA}; |
| | | Cursor cursor = context.getContentResolver().query(uri, projection, null, null, null); |
| | | if (null != cursor) { |
| | | if (cursor.moveToFirst()) { |
| | | int index = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); |
| | | if (index > -1) { |
| | | data = cursor.getString(index); |
| | | } |
| | | } |
| | | cursor.close(); |
| | | } |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @param uri The Uri to check. |
| | | * @return Whether the Uri authority is ExternalStorageProvider. |
| | | */ |
| | | private static boolean isExternalStorageDocument(Uri uri) { |
| | | return "com.android.externalstorage.documents".equals(uri.getAuthority()); |
| | | } |
| | | |
| | | /** |
| | | * @param uri The Uri to check. |
| | | * @return Whether the Uri authority is DownloadsProvider. |
| | | */ |
| | | private static boolean isDownloadsDocument(Uri uri) { |
| | | return "com.android.providers.downloads.documents".equals(uri.getAuthority()); |
| | | } |
| | | |
| | | private static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { |
| | | Cursor cursor = null; |
| | | String column = MediaStore.Images.Media.DATA; |
| | | String[] projection = {column}; |
| | | try { |
| | | cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); |
| | | if (cursor != null && cursor.moveToFirst()) { |
| | | int index = cursor.getColumnIndexOrThrow(column); |
| | | return cursor.getString(index); |
| | | } |
| | | } finally { |
| | | if (cursor != null) { |
| | | cursor.close(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * @param uri The Uri to check. |
| | | * @return Whether the Uri authority is MediaProvider. |
| | | */ |
| | | private static boolean isMediaDocument(Uri uri) { |
| | | return "com.android.providers.media.documents".equals(uri.getAuthority()); |
| | | } |
| | | |
| | | /** |
| | | * @param uri The Uri to check. |
| | | * @return Whether the Uri authority is Google Photos. |
| | | */ |
| | | private static boolean isGooglePhotosUri(Uri uri) { |
| | | return "com.google.android.apps.photos.content".equals(uri.getAuthority()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Android 10 以上适配 另一种写法 |
| | | * |
| | | * @param context |
| | | * @param uri |
| | | * @return |
| | | */ |
| | | @SuppressLint("Range") |
| | | private static String getFileFromContentUri(Context context, Uri uri) { |
| | | if (uri == null) { |
| | | return null; |
| | | } |
| | | String filePath; |
| | | String[] filePathColumn = {MediaStore.MediaColumns.DATA, MediaStore.MediaColumns.DISPLAY_NAME}; |
| | | ContentResolver contentResolver = context.getContentResolver(); |
| | | Cursor cursor = contentResolver.query(uri, filePathColumn, null, |
| | | null, null); |
| | | if (cursor != null) { |
| | | cursor.moveToFirst(); |
| | | try { |
| | | filePath = cursor.getString(cursor.getColumnIndex(filePathColumn[0])); |
| | | return filePath; |
| | | } catch (Exception e) { |
| | | } finally { |
| | | cursor.close(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * Android 10 以上适配 |
| | | * |
| | | * @param context |
| | | * @param uri |
| | | * @return |
| | | */ |
| | | @RequiresApi(api = Build.VERSION_CODES.Q) |
| | | private static String uriToFileApiQ(Context context, Uri uri) { |
| | | File file = null; |
| | | //android10以上转换 |
| | | if (uri.getScheme().equals(ContentResolver.SCHEME_FILE)) { |
| | | file = new File(uri.getPath()); |
| | | } else if (uri.getScheme().equals(ContentResolver.SCHEME_CONTENT)) { |
| | | //把文件复制到沙盒目录 |
| | | ContentResolver contentResolver = context.getContentResolver(); |
| | | Cursor cursor = contentResolver.query(uri, null, null, null, null); |
| | | if (cursor.moveToFirst()) { |
| | | @SuppressLint("Range") |
| | | String displayName = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)); |
| | | try { |
| | | InputStream is = contentResolver.openInputStream(uri); |
| | | // File file1 = new File(context.getExternalCacheDir().getAbsolutePath()+"/"+System.currentTimeMillis()); |
| | | // if (!file1.exists()) { |
| | | // file1.mkdir(); |
| | | // } |
| | | String dirPath = getFileDirPath(context, dirPathName); |
| | | File cache = new File(dirPath, displayName); |
| | | FileOutputStream fos = new FileOutputStream(cache); |
| | | FileUtils.copy(is, fos); |
| | | file = cache; |
| | | fos.close(); |
| | | is.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return file.getAbsolutePath(); |
| | | } |
| | | |
| | | private static String getFilePathFromUri(Context context, Uri uri) { |
| | | String realFilePath = getRealFilePath(context, uri); //防止获取不到真实的地址,因此这里需要进行判断 |
| | | if (!TextUtils.isEmpty(realFilePath)) { |
| | | return realFilePath; |
| | | } |
| | | // File filesDir = context.getApplicationContext().getFilesDir(); |
| | | String filesDir = getFileDirPath(context, dirPathName); |
| | | String fileName = getFileName(uri); |
| | | if (!TextUtils.isEmpty(fileName)) { |
| | | File copyFile1 = new File(filesDir + File.separator + fileName); |
| | | copyFile(context, uri, copyFile1); |
| | | return copyFile1.getAbsolutePath(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private static String getFileName(Uri uri) { |
| | | if (uri == null) { |
| | | return null; |
| | | } |
| | | String fileName = null; |
| | | String path = uri.getPath(); |
| | | int cut = path.lastIndexOf('/'); |
| | | if (cut != -1) { |
| | | fileName = path.substring(cut + 1); |
| | | } |
| | | return fileName; |
| | | } |
| | | |
| | | private static void copyFile(Context context, Uri srcUri, File dstFile) { |
| | | try { |
| | | InputStream inputStream = context.getContentResolver().openInputStream(srcUri); |
| | | if (inputStream == null) { |
| | | return; |
| | | } |
| | | OutputStream outputStream = new FileOutputStream(dstFile); |
| | | copyStream(inputStream, outputStream); |
| | | inputStream.close(); |
| | | outputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | private static int copyStream(InputStream input, OutputStream output) { |
| | | final int BUFFER_SIZE = 1024 * 2; |
| | | byte[] buffer = new byte[BUFFER_SIZE]; |
| | | BufferedInputStream in = new BufferedInputStream(input, BUFFER_SIZE); |
| | | BufferedOutputStream out = new BufferedOutputStream(output, BUFFER_SIZE); |
| | | int count = 0, n = 0; |
| | | try { |
| | | while ((n = in.read(buffer, 0, BUFFER_SIZE)) != -1) { |
| | | out.write(buffer, 0, n); |
| | | count += n; |
| | | } |
| | | out.flush(); |
| | | } catch (Exception e) { |
| | | } finally { |
| | | try { |
| | | out.close(); |
| | | in.close(); |
| | | } catch (Exception e) { |
| | | } |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | } |
| | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | |
| | | import com.android.app_base.base.BaseApplication; |
| | | |
| | | /** |
| | | * @author Ljj |
| | | * @date 2023.03.13. 17:40 |
| | |
| | | final float scale = context.getResources().getDisplayMetrics().density; |
| | | return (int) (dpValue * scale + 0.5f); |
| | | } |
| | | public static int dip2px(float dpValue) { |
| | | final float scale = BaseApplication.getInstance().getResources().getDisplayMetrics().density; |
| | | return (int) (dpValue * scale + 0.5f); |
| | | } |
| | | |
| | | /** |
| | | * 根据手机的分辨率从 px(像素) 的单位 转成为 dp |
| | |
| | | package com.android.app_base.utils; |
| | | |
| | | import android.animation.ValueAnimator; |
| | | import android.app.ActivityManager; |
| | | import android.app.Application; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.graphics.Bitmap; |
| | | import android.graphics.Canvas; |
| | | import android.graphics.drawable.BitmapDrawable; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.net.ConnectivityManager; |
| | | import android.net.NetworkInfo; |
| | | import android.net.Uri; |
| | | import android.os.Build; |
| | | import android.os.Environment; |
| | |
| | | import android.view.View; |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.core.content.ContextCompat; |
| | | import androidx.core.content.FileProvider; |
| | | |
| | | import com.android.app_base.base.BaseApplication; |
| | | import com.blankj.utilcode.util.LogUtils; |
| | | |
| | | import java.io.File; |
| | |
| | | Intent intent = new Intent(Intent.ACTION_VIEW); |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
| | | intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| | | Uri contentUri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".fileprovider", file); |
| | | Uri contentUri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".file-provider", file); |
| | | intent.setDataAndType(contentUri, "application/vnd.android.package-archive"); |
| | | } else { |
| | | // Uri uri = Uri.parse("file://" + file.toString()); |
| | |
| | | context.startActivity(intent); |
| | | } |
| | | |
| | | /** |
| | | * 判断是否有网络 |
| | | */ |
| | | public static boolean checkNetwork() { |
| | | // if (context == null) { |
| | | // return false; |
| | | // } |
| | | // ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); |
| | | // if (mConnectivityManager == null) { |
| | | // return false; |
| | | // } |
| | | // NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo(); |
| | | // return mNetworkInfo != null && mNetworkInfo.isAvailable(); |
| | | |
| | | Application application = BaseApplication.getInstance(); |
| | | if (application != null) { |
| | | ConnectivityManager manager = ContextCompat.getSystemService(application, ConnectivityManager.class); |
| | | if (manager != null) { |
| | | NetworkInfo info = manager.getActiveNetworkInfo(); |
| | | // 判断网络是否连接 |
| | | if (info == null || !info.isConnected()) { |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 把 view 转换成 drawable |
| | | */ |
| | | public static Drawable convertViewToDrawable(View view) { |
| | | view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), |
| | | View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); |
| | | int width = view.getMeasuredWidth(); |
| | | int height = view.getMeasuredHeight(); |
| | | |
| | | Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); |
| | | Canvas canvas = new Canvas(bitmap); |
| | | |
| | | view.layout(0, 0, width, height); |
| | | view.draw(canvas); |
| | | |
| | | return new BitmapDrawable(view.getResources(), bitmap); |
| | | } |
| | | |
| | | } |
| | |
| | | public class MessageEvent { |
| | | public static final int EVENT_INFO_UPDATE = 1; |
| | | public static final int EVENT_TOURISM_CONSUME_CHANGE = 2; |
| | | public static final int EVENT_REFRESH_DATA = 3; |
| | | public static final int EVENT_UPDATE_USER_INFO = 4; |
| | | private int messageEventCode; |
| | | private Object messageEventData; |
| | | |
| | |
| | | */ |
| | | public final class ClearEditText extends AppCompatEditText |
| | | implements View.OnTouchListener, |
| | | View.OnFocusChangeListener, TextWatcher { |
| | | View.OnFocusChangeListener { |
| | | |
| | | private Drawable mClearDrawable; |
| | | |
| | |
| | | setDrawableVisible(false); |
| | | super.setOnTouchListener(this); |
| | | super.setOnFocusChangeListener(this); |
| | | super.addTextChangedListener(this); |
| | | super.addTextChangedListener(new TextWatcher() { |
| | | @Override |
| | | public void onTextChanged(CharSequence s, int start, int before, int count) { |
| | | setDrawableVisible(s.length() > 0); |
| | | } |
| | | |
| | | @Override |
| | | public void beforeTextChanged(CharSequence s, int start, int count, int after) {} |
| | | |
| | | @Override |
| | | public void afterTextChanged(Editable s) {} |
| | | }); |
| | | } |
| | | |
| | | private void setDrawableVisible(boolean visible) { |
| | |
| | | * {@link TextWatcher} |
| | | */ |
| | | |
| | | @Override |
| | | public void onTextChanged(CharSequence s, int start, int before, int count) { |
| | | if (isFocused()) { |
| | | setDrawableVisible(s.length() > 0); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void beforeTextChanged(CharSequence s, int start, int count, int after) {} |
| | | |
| | | @Override |
| | | public void afterTextChanged(Editable s) {} |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.android.app_base.widget; |
| | | |
| | | import android.animation.ValueAnimator; |
| | | import android.content.Context; |
| | | import android.content.res.TypedArray; |
| | | import android.graphics.Canvas; |
| | | import android.graphics.Color; |
| | | import android.graphics.CornerPathEffect; |
| | | import android.graphics.Paint; |
| | | import android.graphics.Path; |
| | | import android.graphics.PathMeasure; |
| | | import android.graphics.RectF; |
| | | import android.util.AttributeSet; |
| | | import android.view.View; |
| | | import android.view.animation.AnticipateInterpolator; |
| | | |
| | | import androidx.annotation.Nullable; |
| | | |
| | | import com.android.app_base.R; |
| | | |
| | | |
| | | /** |
| | | * 播放暂停动效的按钮 |
| | | */ |
| | | public final class PlayButton extends View { |
| | | |
| | | /** 播放状态 */ |
| | | public static final int STATE_PLAY = 0; |
| | | /** 暂停状态 */ |
| | | public static final int STATE_PAUSE = 1; |
| | | |
| | | /** 当前状态 */ |
| | | private int mCurrentState = STATE_PAUSE; |
| | | |
| | | /** 动画时间 */ |
| | | private int mAnimDuration; |
| | | |
| | | private final Paint mPaint; |
| | | |
| | | private int mWidth, mHeight; |
| | | |
| | | private int mCenterX, mCenterY; |
| | | |
| | | private int mCircleRadius; |
| | | |
| | | private RectF mRectF, mBgRectF; |
| | | |
| | | private float mFraction = 1; |
| | | |
| | | private final Path mPath, mDstPath; |
| | | |
| | | private final PathMeasure mPathMeasure; |
| | | |
| | | private float mPathLength; |
| | | |
| | | public PlayButton(Context context) { |
| | | this(context, null); |
| | | } |
| | | |
| | | public PlayButton(Context context, @Nullable AttributeSet attrs) { |
| | | this(context, attrs, 0); |
| | | } |
| | | |
| | | public PlayButton(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { |
| | | super(context, attrs, defStyleAttr); |
| | | |
| | | TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.PlayButton); |
| | | int lineColor = typedArray.getColor(R.styleable.PlayButton_pb_lineColor, Color.WHITE); |
| | | int lineSize = typedArray.getInteger(R.styleable.PlayButton_pb_lineSize, (int) getResources().getDimension(R.dimen.dp_4)); |
| | | mAnimDuration = typedArray.getInteger(R.styleable.PlayButton_pb_animDuration, 200); |
| | | typedArray.recycle(); |
| | | |
| | | // 关闭硬件加速 |
| | | setLayerType(View.LAYER_TYPE_SOFTWARE, null); |
| | | |
| | | mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); |
| | | mPaint.setStyle(Paint.Style.STROKE); |
| | | mPaint.setStrokeCap(Paint.Cap.ROUND); |
| | | mPaint.setColor(lineColor); |
| | | mPaint.setStrokeWidth(lineSize); |
| | | mPaint.setPathEffect(new CornerPathEffect(1)); |
| | | |
| | | mPath = new Path(); |
| | | mDstPath = new Path(); |
| | | mPathMeasure = new PathMeasure(); |
| | | } |
| | | |
| | | @Override |
| | | protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) { |
| | | super.onSizeChanged(width, height, oldWidth, oldHeight); |
| | | mWidth = width * 9 / 10; |
| | | mHeight = height * 9 / 10; |
| | | mCircleRadius = mWidth / (int) getResources().getDimension(R.dimen.dp_4); |
| | | mCenterX = width / 2; |
| | | mCenterY = height / 2; |
| | | mRectF = new RectF(mCenterX - mCircleRadius, mCenterY + 0.6f * mCircleRadius, |
| | | mCenterX + mCircleRadius, mCenterY + 2.6f * mCircleRadius); |
| | | mBgRectF = new RectF(mCenterX - mWidth / 2f ,mCenterY - mHeight / 2f , |
| | | mCenterX + mWidth / 2f, mCenterY + mHeight / 2f); |
| | | mPath.moveTo(mCenterX - mCircleRadius, mCenterY + 1.8f * mCircleRadius); |
| | | mPath.lineTo(mCenterX - mCircleRadius, mCenterY - 1.8f * mCircleRadius); |
| | | mPath.lineTo(mCenterX + mCircleRadius, mCenterY); |
| | | mPath.close(); |
| | | mPathMeasure.setPath(mPath, false); |
| | | mPathLength = mPathMeasure.getLength(); |
| | | } |
| | | |
| | | @Override |
| | | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
| | | switch (MeasureSpec.getMode(widthMeasureSpec)) { |
| | | case MeasureSpec.AT_MOST: |
| | | case MeasureSpec.UNSPECIFIED: |
| | | widthMeasureSpec = MeasureSpec.makeMeasureSpec((int) getResources().getDimension(R.dimen.dp_60), MeasureSpec.EXACTLY); |
| | | break; |
| | | case MeasureSpec.EXACTLY: |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | switch (MeasureSpec.getMode(heightMeasureSpec)) { |
| | | case MeasureSpec.AT_MOST: |
| | | case MeasureSpec.UNSPECIFIED: |
| | | heightMeasureSpec = MeasureSpec.makeMeasureSpec((int) getResources().getDimension(R.dimen.dp_60), MeasureSpec.EXACTLY); |
| | | break; |
| | | case MeasureSpec.EXACTLY: |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | setMeasuredDimension(widthMeasureSpec, heightMeasureSpec); |
| | | } |
| | | |
| | | @Override |
| | | protected void onDraw(Canvas canvas) { |
| | | super.onDraw(canvas); |
| | | canvas.drawCircle(mCenterX, mCenterY, mWidth / 2f, mPaint); |
| | | if (mFraction < 0) { |
| | | // 弹性部分 |
| | | canvas.drawLine(mCenterX + mCircleRadius, mCenterY - 1.6f * mCircleRadius + 10 * mCircleRadius * mFraction, |
| | | mCenterX + mCircleRadius, mCenterY + 1.6f * mCircleRadius + 10 * mCircleRadius * mFraction, mPaint); |
| | | |
| | | canvas.drawLine(mCenterX - mCircleRadius, mCenterY - 1.6f * mCircleRadius, |
| | | mCenterX - mCircleRadius, mCenterY + 1.6f * mCircleRadius, mPaint); |
| | | |
| | | canvas.drawArc(mBgRectF, -105 , 360 , false, mPaint); |
| | | } else if (mFraction <= 0.3) { |
| | | // 右侧直线和下方曲线 |
| | | canvas.drawLine(mCenterX + mCircleRadius, mCenterY - 1.6f * mCircleRadius + mCircleRadius * 3.2f / 0.3f * mFraction, |
| | | mCenterX + mCircleRadius, mCenterY + 1.6f * mCircleRadius, mPaint); |
| | | |
| | | canvas.drawLine(mCenterX - mCircleRadius, mCenterY - 1.6f * mCircleRadius, |
| | | mCenterX - mCircleRadius, mCenterY + 1.6f * mCircleRadius, mPaint); |
| | | |
| | | if (mFraction != 0) { |
| | | canvas.drawArc(mRectF, 0f, 180f / 0.3f * mFraction, false, mPaint); |
| | | } |
| | | |
| | | canvas.drawArc(mBgRectF, -105 + 360 * mFraction, 360 * (1 - mFraction), false, mPaint); |
| | | } else if (mFraction <= 0.6) { |
| | | // 下方曲线和三角形 |
| | | canvas.drawArc(mRectF, 180f / 0.3f * (mFraction - 0.3f), 180 - 180f / 0.3f * (mFraction - 0.3f), false , mPaint); |
| | | |
| | | mDstPath.reset(); |
| | | mPathMeasure.getSegment(0.02f * mPathLength, 0.38f * mPathLength + 0.42f * mPathLength / 0.3f * (mFraction - 0.3f) , |
| | | mDstPath, true); |
| | | canvas.drawPath(mDstPath, mPaint); |
| | | |
| | | canvas.drawArc(mBgRectF, -105 + 360 * mFraction, 360 * (1 - mFraction), false, mPaint); |
| | | } else if (mFraction <= 0.8) { |
| | | // 三角形 |
| | | mDstPath.reset(); |
| | | mPathMeasure.getSegment(0.02f * mPathLength + 0.2f * mPathLength / 0.2f * (mFraction - 0.6f) |
| | | , 0.8f * mPathLength + 0.2f * mPathLength / 0.2f * (mFraction - 0.6f) , |
| | | mDstPath, true); |
| | | canvas.drawPath(mDstPath, mPaint); |
| | | |
| | | canvas.drawArc(mBgRectF, -105 + 360 * mFraction, 360 * (1 - mFraction), false, mPaint); |
| | | } else { |
| | | // 弹性部分 |
| | | mDstPath.reset(); |
| | | mPathMeasure.getSegment(10 * mCircleRadius * (mFraction - 1) |
| | | , mPathLength , |
| | | mDstPath, true); |
| | | canvas.drawPath(mDstPath, mPaint); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 播放状态 |
| | | */ |
| | | public void play() { |
| | | if (mCurrentState == STATE_PLAY) { |
| | | return; |
| | | } |
| | | mCurrentState = STATE_PLAY; |
| | | ValueAnimator valueAnimator = ValueAnimator.ofFloat(1f, 100f); |
| | | valueAnimator.setDuration(mAnimDuration); |
| | | valueAnimator.setInterpolator(new AnticipateInterpolator()); |
| | | valueAnimator.addUpdateListener(animation -> { |
| | | mFraction = 1 - animation.getAnimatedFraction(); |
| | | invalidate(); |
| | | }); |
| | | valueAnimator.start(); |
| | | } |
| | | |
| | | /** |
| | | * 暂停状态 |
| | | */ |
| | | public void pause() { |
| | | if (mCurrentState == STATE_PAUSE) { |
| | | return; |
| | | } |
| | | mCurrentState = STATE_PAUSE; |
| | | ValueAnimator valueAnimator = ValueAnimator.ofFloat(1.f, 100f); |
| | | valueAnimator.setDuration(mAnimDuration); |
| | | valueAnimator.setInterpolator(new AnticipateInterpolator()); |
| | | valueAnimator.addUpdateListener(animation -> { |
| | | mFraction = animation.getAnimatedFraction(); |
| | | invalidate(); |
| | | }); |
| | | valueAnimator.start(); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前状态 |
| | | */ |
| | | public int getCurrentState() { |
| | | return mCurrentState; |
| | | } |
| | | |
| | | /** |
| | | * 设置动画时间 |
| | | */ |
| | | public void setAnimDuration(int duration) { |
| | | mAnimDuration = duration; |
| | | } |
| | | |
| | | /** |
| | | * 设置线条颜色 |
| | | */ |
| | | public void setLineColor(int color) { |
| | | mPaint.setColor(color); |
| | | invalidate(); |
| | | } |
| | | |
| | | /** |
| | | * 设置线条大小 |
| | | */ |
| | | public void setLineSize(int size) { |
| | | mPaint.setStrokeWidth(size); |
| | | invalidate(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.android.app_base.widget; |
| | | |
| | | import android.animation.ValueAnimator; |
| | | import android.annotation.SuppressLint; |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | import android.media.AudioManager; |
| | | import android.media.MediaPlayer; |
| | | import android.net.Uri; |
| | | import android.provider.Settings; |
| | | import android.text.TextUtils; |
| | | import android.util.AttributeSet; |
| | | import android.view.LayoutInflater; |
| | | import android.view.MotionEvent; |
| | | import android.view.View; |
| | | import android.view.ViewConfiguration; |
| | | import android.view.ViewGroup; |
| | | import android.view.Window; |
| | | import android.view.WindowManager; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.SeekBar; |
| | | import android.widget.TextView; |
| | | import android.widget.VideoView; |
| | | |
| | | import androidx.annotation.DrawableRes; |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.core.content.ContextCompat; |
| | | import androidx.lifecycle.Lifecycle; |
| | | import androidx.lifecycle.LifecycleEventObserver; |
| | | import androidx.lifecycle.LifecycleOwner; |
| | | |
| | | import com.airbnb.lottie.LottieAnimationView; |
| | | import com.android.app_base.R; |
| | | import com.android.app_base.base.action.ActivityAction; |
| | | import com.android.app_base.base.dialog.UIDialog; |
| | | |
| | | import java.io.File; |
| | | import java.util.Formatter; |
| | | import java.util.Locale; |
| | | |
| | | /** |
| | | * 视频播放控件 |
| | | */ |
| | | public final class VideoPlayerView extends FrameLayout |
| | | implements LifecycleEventObserver, |
| | | SeekBar.OnSeekBarChangeListener, |
| | | View.OnClickListener, ActivityAction, |
| | | MediaPlayer.OnPreparedListener, |
| | | MediaPlayer.OnInfoListener, |
| | | MediaPlayer.OnCompletionListener, |
| | | MediaPlayer.OnErrorListener { |
| | | |
| | | /** 刷新间隔 */ |
| | | private static final int REFRESH_TIME = 1000; |
| | | /** 面板隐藏间隔 */ |
| | | private static final int CONTROLLER_TIME = 3000; |
| | | /** 提示对话框隐藏间隔 */ |
| | | private static final int DIALOG_TIME = 500; |
| | | /** 动画执行时间 */ |
| | | private static final int ANIM_TIME = 500; |
| | | |
| | | private final ViewGroup mTopLayout; |
| | | private final TextView mTitleView; |
| | | private final View mLeftView; |
| | | |
| | | private final ViewGroup mBottomLayout; |
| | | private final TextView mPlayTime; |
| | | private final TextView mTotalTime; |
| | | private final SeekBar mProgressView; |
| | | |
| | | private final VideoView mVideoView; |
| | | private final PlayButton mControlView; |
| | | private final ImageView mLockView; |
| | | |
| | | private ViewGroup mMessageLayout; |
| | | private final LottieAnimationView mLottieView; |
| | | private final TextView mMessageView; |
| | | |
| | | /** 视频宽度 */ |
| | | private int mVideoWidth; |
| | | /** 视频高度 */ |
| | | private int mVideoHeight; |
| | | |
| | | /** 锁定面板 */ |
| | | private boolean mLockMode; |
| | | /** 显示面板 */ |
| | | private boolean mControllerShow = false; |
| | | |
| | | /** 触摸按下的 X 坐标 */ |
| | | private float mViewDownX; |
| | | /** 触摸按下的 Y 坐标 */ |
| | | private float mViewDownY; |
| | | /** 手势开关 */ |
| | | private boolean mGestureEnabled; |
| | | /** 当前播放进度 */ |
| | | private int mCurrentProgress; |
| | | /** 返回监听器 */ |
| | | @Nullable |
| | | private OnPlayListener mListener; |
| | | |
| | | /** 音量管理器 */ |
| | | private final AudioManager mAudioManager; |
| | | /** 最大音量值 */ |
| | | private int mMaxVoice; |
| | | /** 当前音量值 */ |
| | | private int mCurrentVolume; |
| | | /** 当前亮度值 */ |
| | | private float mCurrentBrightness; |
| | | /** 当前窗口对象 */ |
| | | private Window mWindow; |
| | | /** 调整秒数 */ |
| | | private int mAdjustSecond; |
| | | /** 触摸方向 */ |
| | | private int mTouchOrientation = -1; |
| | | |
| | | public VideoPlayerView(@NonNull Context context) { |
| | | this(context, null); |
| | | } |
| | | |
| | | public VideoPlayerView(@NonNull Context context, @Nullable AttributeSet attrs) { |
| | | this(context, attrs, 0); |
| | | } |
| | | |
| | | public VideoPlayerView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { |
| | | this(context, attrs, defStyleAttr, 0); |
| | | } |
| | | |
| | | public VideoPlayerView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { |
| | | super(context, attrs, defStyleAttr, defStyleRes); |
| | | |
| | | LayoutInflater.from(getContext()).inflate(R.layout.widget_player_view, this, true); |
| | | mTopLayout = findViewById(R.id.ll_player_view_top); |
| | | mLeftView = findViewById(R.id.iv_player_view_left); |
| | | mTitleView = findViewById(R.id.tv_player_view_title); |
| | | |
| | | mBottomLayout = findViewById(R.id.ll_player_view_bottom); |
| | | mPlayTime = findViewById(R.id.tv_player_view_play_time); |
| | | mTotalTime = findViewById(R.id.tv_player_view_total_time); |
| | | mProgressView = findViewById(R.id.sb_player_view_progress); |
| | | |
| | | mVideoView = findViewById(R.id.vv_player_view_video); |
| | | mLockView = findViewById(R.id.iv_player_view_lock); |
| | | mControlView = findViewById(R.id.iv_player_view_control); |
| | | |
| | | mMessageLayout = findViewById(R.id.cv_player_view_message); |
| | | mLottieView = findViewById(R.id.lav_player_view_lottie); |
| | | mMessageView = findViewById(R.id.tv_player_view_message); |
| | | |
| | | mLeftView.setOnClickListener(this); |
| | | mControlView.setOnClickListener(this); |
| | | mLockView.setOnClickListener(this); |
| | | this.setOnClickListener(this); |
| | | |
| | | mProgressView.setOnSeekBarChangeListener(this); |
| | | |
| | | mVideoView.setOnPreparedListener(this); |
| | | mVideoView.setOnCompletionListener(this); |
| | | mVideoView.setOnInfoListener(this); |
| | | mVideoView.setOnErrorListener(this); |
| | | |
| | | mAudioManager = ContextCompat.getSystemService(getContext(), AudioManager.class); |
| | | } |
| | | |
| | | /** |
| | | * 设置播放器生命管控(自动回调生命周期方法) |
| | | */ |
| | | public void setLifecycleOwner(LifecycleOwner owner) { |
| | | owner.getLifecycle().addObserver(this); |
| | | } |
| | | |
| | | /** |
| | | * {@link LifecycleEventObserver} |
| | | */ |
| | | |
| | | @Override |
| | | public void onStateChanged(@NonNull LifecycleOwner source, @NonNull Lifecycle.Event event) { |
| | | switch (event) { |
| | | case ON_RESUME: |
| | | onResume(); |
| | | break; |
| | | case ON_PAUSE: |
| | | onPause(); |
| | | break; |
| | | case ON_DESTROY: |
| | | onDestroy(); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置视频标题 |
| | | */ |
| | | public void setVideoTitle(CharSequence title) { |
| | | if (TextUtils.isEmpty(title)) { |
| | | return; |
| | | } |
| | | mTitleView.setText(title); |
| | | } |
| | | |
| | | /** |
| | | * 设置视频源 |
| | | */ |
| | | public void setVideoSource(File file) { |
| | | if (file == null || !file.isFile()) { |
| | | return; |
| | | } |
| | | mVideoView.setVideoPath(file.getPath()); |
| | | } |
| | | |
| | | public void setVideoSource(String url) { |
| | | if (TextUtils.isEmpty(url)) { |
| | | return; |
| | | } |
| | | mVideoView.setVideoURI(Uri.parse(url)); |
| | | } |
| | | |
| | | /** |
| | | * 开始播放 |
| | | */ |
| | | public void start() { |
| | | mVideoView.start(); |
| | | mControlView.play(); |
| | | // 延迟隐藏控制面板 |
| | | removeCallbacks(mHideControllerRunnable); |
| | | postDelayed(mHideControllerRunnable, CONTROLLER_TIME); |
| | | } |
| | | |
| | | /** |
| | | * 暂停播放 |
| | | */ |
| | | public void pause() { |
| | | mVideoView.pause(); |
| | | mControlView.pause(); |
| | | // 延迟隐藏控制面板 |
| | | removeCallbacks(mHideControllerRunnable); |
| | | postDelayed(mHideControllerRunnable, CONTROLLER_TIME); |
| | | } |
| | | |
| | | /** |
| | | * 锁定控制面板 |
| | | */ |
| | | public void lock() { |
| | | mLockMode = true; |
| | | mLockView.setImageResource(R.drawable.video_lock_close_ic); |
| | | mTopLayout.setVisibility(GONE); |
| | | mBottomLayout.setVisibility(GONE); |
| | | mControlView.setVisibility(GONE); |
| | | // 延迟隐藏控制面板 |
| | | removeCallbacks(mHideControllerRunnable); |
| | | postDelayed(mHideControllerRunnable, CONTROLLER_TIME); |
| | | } |
| | | |
| | | /** |
| | | * 解锁控制面板 |
| | | */ |
| | | public void unlock() { |
| | | mLockMode = false; |
| | | mLockView.setImageResource(R.drawable.video_lock_open_ic); |
| | | mTopLayout.setVisibility(VISIBLE); |
| | | if (mVideoView.isPlaying()) { |
| | | mBottomLayout.setVisibility(VISIBLE); |
| | | } |
| | | mControlView.setVisibility(VISIBLE); |
| | | // 延迟隐藏控制面板 |
| | | removeCallbacks(mHideControllerRunnable); |
| | | postDelayed(mHideControllerRunnable, CONTROLLER_TIME); |
| | | } |
| | | |
| | | /** |
| | | * 是否正在播放 |
| | | */ |
| | | public boolean isPlaying() { |
| | | return mVideoView.isPlaying(); |
| | | } |
| | | |
| | | /** |
| | | * 设置视频播放进度 |
| | | */ |
| | | public void setProgress(int progress) { |
| | | if (progress > mVideoView.getDuration()) { |
| | | progress = mVideoView.getDuration(); |
| | | } |
| | | // 要跳转的进度必须和当前播放进度相差 1 秒以上 |
| | | if (Math.abs(progress - mVideoView.getCurrentPosition()) > 1000) { |
| | | mVideoView.seekTo(progress); |
| | | mProgressView.setProgress(progress); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取视频播放进度 |
| | | */ |
| | | public int getProgress() { |
| | | return mVideoView.getCurrentPosition(); |
| | | } |
| | | |
| | | /** |
| | | * 获取视频的总进度 |
| | | */ |
| | | public int getDuration() { |
| | | return mVideoView.getDuration(); |
| | | } |
| | | |
| | | /** |
| | | * 设置手势开关 |
| | | */ |
| | | public void setGestureEnabled(boolean enabled) { |
| | | mGestureEnabled = enabled; |
| | | } |
| | | |
| | | /** |
| | | * 设置返回监听 |
| | | */ |
| | | public void setOnPlayListener(@Nullable OnPlayListener listener) { |
| | | mListener = listener; |
| | | mLeftView.setVisibility(mListener != null ? VISIBLE : INVISIBLE); |
| | | } |
| | | |
| | | /** |
| | | * 显示面板 |
| | | */ |
| | | public void showController() { |
| | | if (mControllerShow) { |
| | | return; |
| | | } |
| | | |
| | | mControllerShow = true; |
| | | |
| | | ValueAnimator topAnimator = ValueAnimator.ofInt(-mTopLayout.getHeight(), 0); |
| | | topAnimator.setDuration(ANIM_TIME); |
| | | topAnimator.addUpdateListener(animation -> { |
| | | int translationY = (int) animation.getAnimatedValue(); |
| | | mTopLayout.setTranslationY(translationY); |
| | | if (translationY != -mTopLayout.getHeight()) { |
| | | return; |
| | | } |
| | | |
| | | if (mTopLayout.getVisibility() == INVISIBLE) { |
| | | mTopLayout.setVisibility(VISIBLE); |
| | | } |
| | | }); |
| | | topAnimator.start(); |
| | | |
| | | ValueAnimator bottomAnimator = ValueAnimator.ofInt(mBottomLayout.getHeight(), 0); |
| | | bottomAnimator.setDuration(ANIM_TIME); |
| | | bottomAnimator.addUpdateListener(animation -> { |
| | | int translationY = (int) animation.getAnimatedValue(); |
| | | mBottomLayout.setTranslationY(translationY); |
| | | if (translationY != mBottomLayout.getHeight()) { |
| | | return; |
| | | } |
| | | |
| | | if (mBottomLayout.getVisibility() == INVISIBLE) { |
| | | mBottomLayout.setVisibility(VISIBLE); |
| | | } |
| | | }); |
| | | bottomAnimator.start(); |
| | | |
| | | ValueAnimator alphaAnimator = ValueAnimator.ofFloat(0f, 1f); |
| | | alphaAnimator.setDuration(ANIM_TIME); |
| | | alphaAnimator.addUpdateListener(animation -> { |
| | | float alpha = (float) animation.getAnimatedValue(); |
| | | mLockView.setAlpha(alpha); |
| | | mControlView.setAlpha(alpha); |
| | | if (alpha != 0) { |
| | | return; |
| | | } |
| | | |
| | | if (mLockView.getVisibility() == INVISIBLE) { |
| | | mLockView.setVisibility(VISIBLE); |
| | | } |
| | | if (mControlView.getVisibility() == INVISIBLE) { |
| | | mControlView.setVisibility(VISIBLE); |
| | | } |
| | | }); |
| | | alphaAnimator.start(); |
| | | } |
| | | |
| | | /** |
| | | * 隐藏面板 |
| | | */ |
| | | public void hideController() { |
| | | if (!mControllerShow) { |
| | | return; |
| | | } |
| | | |
| | | mControllerShow = false; |
| | | |
| | | ValueAnimator topAnimator = ValueAnimator.ofInt(0, -mTopLayout.getHeight()); |
| | | topAnimator.setDuration(ANIM_TIME); |
| | | topAnimator.addUpdateListener(animation -> { |
| | | int translationY = (int) animation.getAnimatedValue(); |
| | | mTopLayout.setTranslationY(translationY); |
| | | if (translationY != -mTopLayout.getHeight()) { |
| | | return; |
| | | } |
| | | |
| | | if (mTopLayout.getVisibility() == VISIBLE) { |
| | | mTopLayout.setVisibility(INVISIBLE); |
| | | } |
| | | }); |
| | | topAnimator.start(); |
| | | |
| | | ValueAnimator bottomAnimator = ValueAnimator.ofInt(0, mBottomLayout.getHeight()); |
| | | bottomAnimator.setDuration(ANIM_TIME); |
| | | bottomAnimator.addUpdateListener(animation -> { |
| | | int translationY = (int) animation.getAnimatedValue(); |
| | | mBottomLayout.setTranslationY(translationY); |
| | | if (translationY != mBottomLayout.getHeight()) { |
| | | return; |
| | | } |
| | | |
| | | if (mBottomLayout.getVisibility() == VISIBLE) { |
| | | mBottomLayout.setVisibility(INVISIBLE); |
| | | } |
| | | }); |
| | | bottomAnimator.start(); |
| | | |
| | | ValueAnimator alphaAnimator = ValueAnimator.ofFloat(1f, 0f); |
| | | alphaAnimator.setDuration(ANIM_TIME); |
| | | alphaAnimator.addUpdateListener(animation -> { |
| | | float alpha = (float) animation.getAnimatedValue(); |
| | | mLockView.setAlpha(alpha); |
| | | mControlView.setAlpha(alpha); |
| | | if (alpha != 0) { |
| | | return; |
| | | } |
| | | |
| | | if (mLockView.getVisibility() == VISIBLE) { |
| | | mLockView.setVisibility(INVISIBLE); |
| | | } |
| | | if (mControlView.getVisibility() == VISIBLE) { |
| | | mControlView.setVisibility(INVISIBLE); |
| | | } |
| | | }); |
| | | alphaAnimator.start(); |
| | | } |
| | | |
| | | public void onResume() { |
| | | mVideoView.resume(); |
| | | } |
| | | |
| | | public void onPause() { |
| | | mVideoView.suspend(); |
| | | pause(); |
| | | } |
| | | |
| | | public void onDestroy() { |
| | | mVideoView.stopPlayback(); |
| | | removeCallbacks(mRefreshRunnable); |
| | | removeCallbacks(mShowControllerRunnable); |
| | | removeCallbacks(mHideControllerRunnable); |
| | | removeCallbacks(mShowMessageRunnable); |
| | | removeCallbacks(mHideMessageRunnable); |
| | | removeAllViews(); |
| | | } |
| | | |
| | | @Override |
| | | protected void onWindowVisibilityChanged(int visibility) { |
| | | // 这里解释一下 onWindowVisibilityChanged 方法调用的时机 |
| | | // 从前台返回到后台:先调用 onWindowVisibilityChanged(View.INVISIBLE) 后调用 onWindowVisibilityChanged(View.GONE) |
| | | // 从后台返回到前台:先调用 onWindowVisibilityChanged(View.INVISIBLE) 后调用 onWindowVisibilityChanged(View.VISIBLE) |
| | | super.onWindowVisibilityChanged(visibility); |
| | | // 这里修复了 Activity 从后台返回到前台时 VideoView 从头开始播放的问题 |
| | | if (visibility != VISIBLE) { |
| | | return; |
| | | } |
| | | mVideoView.seekTo(mCurrentProgress); |
| | | mProgressView.setProgress(mCurrentProgress); |
| | | } |
| | | |
| | | /** |
| | | * {@link SeekBar.OnSeekBarChangeListener} |
| | | */ |
| | | @Override |
| | | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { |
| | | if (fromUser) { |
| | | mPlayTime.setText(conversionTime(progress)); |
| | | return; |
| | | } |
| | | |
| | | if (progress != 0) { |
| | | // 记录当前播放进度 |
| | | mCurrentProgress = progress; |
| | | } else { |
| | | // 如果 Activity 返回到后台,progress 会等于 0,而 mVideoView.getDuration 会等于 -1 |
| | | // 所以要避免在这种情况下记录当前的播放进度,以便用户从后台返回到前台的时候恢复正确的播放进度 |
| | | if (mVideoView.getDuration() > 0) { |
| | | mCurrentProgress = progress; |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onStartTrackingTouch(SeekBar seekBar) { |
| | | removeCallbacks(mRefreshRunnable); |
| | | removeCallbacks(mHideControllerRunnable); |
| | | } |
| | | |
| | | @Override |
| | | public void onStopTrackingTouch(SeekBar seekBar) { |
| | | postDelayed(mRefreshRunnable, REFRESH_TIME); |
| | | postDelayed(mHideControllerRunnable, CONTROLLER_TIME); |
| | | // 设置选择的播放进度 |
| | | setProgress(seekBar.getProgress()); |
| | | } |
| | | |
| | | /** |
| | | * {@link MediaPlayer.OnPreparedListener} |
| | | */ |
| | | @Override |
| | | public void onPrepared(MediaPlayer player) { |
| | | mPlayTime.setText(conversionTime(0)); |
| | | mTotalTime.setText(conversionTime(player.getDuration())); |
| | | mProgressView.setMax(mVideoView.getDuration()); |
| | | |
| | | // 获取视频的宽高 |
| | | mVideoWidth = player.getVideoWidth(); |
| | | mVideoHeight = player.getVideoHeight(); |
| | | |
| | | // VideoView 的宽高 |
| | | int viewWidth = getWidth(); |
| | | int viewHeight = getHeight(); |
| | | |
| | | // 基于比例调整大小 |
| | | if (mVideoWidth * viewHeight < viewWidth * mVideoHeight) { |
| | | // 视频宽度过大,进行纠正 |
| | | viewWidth = viewHeight * mVideoWidth / mVideoHeight; |
| | | } else if (mVideoWidth * viewHeight > viewWidth * mVideoHeight) { |
| | | // 视频高度过大,进行纠正 |
| | | viewHeight = viewWidth * mVideoHeight / mVideoWidth; |
| | | } |
| | | |
| | | // 重新设置 VideoView 的宽高 |
| | | ViewGroup.LayoutParams params = mVideoView.getLayoutParams(); |
| | | params.width = viewWidth; |
| | | params.height = viewHeight; |
| | | mVideoView.setLayoutParams(params); |
| | | |
| | | post(mShowControllerRunnable); |
| | | postDelayed(mRefreshRunnable, REFRESH_TIME / 2); |
| | | |
| | | if (mListener == null) { |
| | | return; |
| | | } |
| | | mListener.onPlayStart(this); |
| | | } |
| | | |
| | | /** |
| | | * {@link MediaPlayer.OnCompletionListener} |
| | | */ |
| | | @Override |
| | | public void onCompletion(MediaPlayer player) { |
| | | pause(); |
| | | if (mListener == null) { |
| | | return; |
| | | } |
| | | mListener.onPlayEnd(this); |
| | | } |
| | | |
| | | /** |
| | | * {@link MediaPlayer.OnInfoListener} |
| | | */ |
| | | @Override |
| | | public boolean onInfo(MediaPlayer player, int what, int extra) { |
| | | switch (what) { |
| | | // 视频播放卡顿开始 |
| | | case MediaPlayer.MEDIA_INFO_BUFFERING_START: |
| | | mLottieView.setAnimation(R.raw.progress); |
| | | mLottieView.playAnimation(); |
| | | mMessageView.setText("加载中…"); |
| | | post(mShowMessageRunnable); |
| | | return true; |
| | | // 视频播放卡顿结束 |
| | | case MediaPlayer.MEDIA_INFO_BUFFERING_END: |
| | | mLottieView.cancelAnimation(); |
| | | mMessageView.setText("加载中…"); |
| | | postDelayed(mHideMessageRunnable, DIALOG_TIME); |
| | | return true; |
| | | default: |
| | | break; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * {@link MediaPlayer.OnErrorListener} |
| | | */ |
| | | |
| | | @Override |
| | | public boolean onError(MediaPlayer player, int what, int extra) { |
| | | Activity activity = getActivity(); |
| | | if (activity == null) { |
| | | return false; |
| | | } |
| | | |
| | | String message; |
| | | if (what == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) { |
| | | message = "该视频不适合在此设备上播放"; |
| | | } else { |
| | | message = "无法播放此视频"; |
| | | } |
| | | message += "\n" + String.format("错误类型:%d,错误代码:%d", what, extra); |
| | | new UIDialog.Builder(getActivity()) |
| | | .setTitle("") |
| | | .setContent(message) |
| | | .setConfirm("确定") |
| | | .setCancel(null) |
| | | .setListener(dialog -> onCompletion(player)) |
| | | .setCancelable(false) |
| | | .show(); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * {@link View.OnClickListener} |
| | | */ |
| | | |
| | | @Override |
| | | public void onClick(View view) { |
| | | if (view == this) { |
| | | |
| | | // 先移除之前发送的 |
| | | removeCallbacks(mShowControllerRunnable); |
| | | removeCallbacks(mHideControllerRunnable); |
| | | |
| | | if (mControllerShow) { |
| | | // 隐藏控制面板 |
| | | post(mHideControllerRunnable); |
| | | return; |
| | | } |
| | | |
| | | // 显示控制面板 |
| | | post(mShowControllerRunnable); |
| | | postDelayed(mHideControllerRunnable, CONTROLLER_TIME); |
| | | |
| | | } else if (view == mLeftView) { |
| | | |
| | | if (mListener == null) { |
| | | return; |
| | | } |
| | | mListener.onClickBack(this); |
| | | |
| | | } else if (view == mControlView) { |
| | | |
| | | if (mControlView.getVisibility() != VISIBLE) { |
| | | return; |
| | | } |
| | | |
| | | if (isPlaying()) { |
| | | pause(); |
| | | } else { |
| | | start(); |
| | | } |
| | | // 先移除之前发送的 |
| | | removeCallbacks(mShowControllerRunnable); |
| | | removeCallbacks(mHideControllerRunnable); |
| | | // 重置显示隐藏面板任务 |
| | | if (!mControllerShow) { |
| | | post(mShowControllerRunnable); |
| | | } |
| | | postDelayed(mHideControllerRunnable, CONTROLLER_TIME); |
| | | if (mListener == null) { |
| | | return; |
| | | } |
| | | mListener.onClickPlay(this); |
| | | |
| | | } else if (view == mLockView) { |
| | | |
| | | if (mLockMode) { |
| | | unlock(); |
| | | } else { |
| | | lock(); |
| | | } |
| | | if (mListener == null) { |
| | | return; |
| | | } |
| | | mListener.onClickLock(this); |
| | | } |
| | | } |
| | | |
| | | public int getVideoWidth() { |
| | | return mVideoWidth; |
| | | } |
| | | |
| | | public int getVideoHeight() { |
| | | return mVideoHeight; |
| | | } |
| | | |
| | | @SuppressLint("ClickableViewAccessibility") |
| | | @Override |
| | | public boolean onTouchEvent(MotionEvent event) { |
| | | // 满足任一条件:关闭手势控制、处于锁定状态、处于缓冲状态 |
| | | if (!mGestureEnabled || mLockMode || mLottieView.isAnimating()) { |
| | | return super.onTouchEvent(event); |
| | | } |
| | | |
| | | switch (event.getAction()) { |
| | | case MotionEvent.ACTION_DOWN: |
| | | mMaxVoice = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); |
| | | mCurrentVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC); |
| | | |
| | | mWindow = getActivity().getWindow(); |
| | | mCurrentBrightness = mWindow.getAttributes().screenBrightness; |
| | | // 如果当前亮度是默认的,那么就获取系统当前的屏幕亮度 |
| | | if (mCurrentBrightness == WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE) { |
| | | try { |
| | | // 这里需要注意,Settings.System.SCREEN_BRIGHTNESS 获取到的值在小米手机上面会超过 255 |
| | | mCurrentBrightness = Math.min(Settings.System.getInt( |
| | | getContext().getContentResolver(), |
| | | Settings.System.SCREEN_BRIGHTNESS), 255) / 255f; |
| | | } catch (Settings.SettingNotFoundException ignored) { |
| | | mCurrentBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_OFF; |
| | | } |
| | | } |
| | | |
| | | mViewDownX = event.getX(); |
| | | mViewDownY = event.getY(); |
| | | removeCallbacks(mHideControllerRunnable); |
| | | break; |
| | | case MotionEvent.ACTION_MOVE: |
| | | // 计算偏移的距离(按下的位置 - 当前触摸的位置) |
| | | float distanceX = mViewDownX - event.getX(); |
| | | float distanceY = mViewDownY - event.getY(); |
| | | // 手指偏移的距离一定不能太短,这个是前提条件 |
| | | if (Math.abs(distanceY) < ViewConfiguration.get(getContext()).getScaledTouchSlop()) { |
| | | break; |
| | | } |
| | | if (mTouchOrientation == -1) { |
| | | // 判断滚动方向是垂直的还是水平的 |
| | | if (Math.abs(distanceY) > Math.abs(distanceX)) { |
| | | mTouchOrientation = LinearLayout.VERTICAL; |
| | | } else if (Math.abs(distanceY) < Math.abs(distanceX)) { |
| | | mTouchOrientation = LinearLayout.HORIZONTAL; |
| | | } |
| | | } |
| | | |
| | | // 如果手指触摸方向是水平的 |
| | | if (mTouchOrientation == LinearLayout.HORIZONTAL) { |
| | | int second = -(int) (distanceX / (float) getWidth() * 60f); |
| | | int progress = getProgress() + second * 1000; |
| | | if (progress >= 0 && progress <= getDuration()) { |
| | | mAdjustSecond = second; |
| | | mLottieView.setImageResource(mAdjustSecond < 0 ? |
| | | R.drawable.video_schedule_rewind_ic : |
| | | R.drawable.video_schedule_forward_ic); |
| | | mMessageView.setText(String.format("%s s", Math.abs(mAdjustSecond))); |
| | | post(mShowMessageRunnable); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | // 如果手指触摸方向是垂直的 |
| | | if (mTouchOrientation == LinearLayout.VERTICAL) { |
| | | // 判断触摸点是在屏幕左边还是右边 |
| | | if ((int) event.getX() < getWidth() / 2) { |
| | | // 手指在屏幕左边 |
| | | float delta = (distanceY / getHeight()) * WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_FULL; |
| | | if (delta == 0) { |
| | | break; |
| | | } |
| | | |
| | | // 更新系统亮度 |
| | | float brightness = Math.min(Math.max(mCurrentBrightness + delta, |
| | | WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_OFF), |
| | | WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_FULL); |
| | | WindowManager.LayoutParams attributes = mWindow.getAttributes(); |
| | | attributes.screenBrightness = brightness; |
| | | mWindow.setAttributes(attributes); |
| | | |
| | | int percent = (int) (brightness * 100); |
| | | |
| | | @DrawableRes int iconId; |
| | | if (percent > 100 / 3 * 2) { |
| | | iconId = R.drawable.video_brightness_high_ic; |
| | | } else if (percent > 100 / 3) { |
| | | iconId = R.drawable.video_brightness_medium_ic; |
| | | } else { |
| | | iconId = R.drawable.video_brightness_low_ic; |
| | | } |
| | | mLottieView.setImageResource(iconId); |
| | | mMessageView.setText(String.format("%s %%", percent)); |
| | | post(mShowMessageRunnable); |
| | | break; |
| | | } |
| | | |
| | | // 手指在屏幕右边 |
| | | float delta = (distanceY / getHeight()) * mMaxVoice; |
| | | if (delta == 0) { |
| | | break; |
| | | } |
| | | |
| | | // 更新系统音量 |
| | | int voice = (int) Math.min(Math.max(mCurrentVolume + delta, 0), mMaxVoice); |
| | | mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, voice, 0); |
| | | |
| | | int percent = voice * 100 / mMaxVoice; |
| | | |
| | | @DrawableRes int iconId; |
| | | if (percent > 100 / 3 * 2) { |
| | | iconId = R.drawable.video_volume_high_ic; |
| | | } else if (percent > 100 / 3) { |
| | | iconId = R.drawable.video_volume_medium_ic; |
| | | } else if (percent != 0) { |
| | | iconId = R.drawable.video_volume_low_ic; |
| | | } else { |
| | | iconId = R.drawable.video_volume_mute_ic; |
| | | } |
| | | mLottieView.setImageResource(iconId); |
| | | mMessageView.setText(String.format("%s %%", percent)); |
| | | post(mShowMessageRunnable); |
| | | break; |
| | | } |
| | | break; |
| | | case MotionEvent.ACTION_UP: |
| | | if (Math.abs(mViewDownX - event.getX()) <= ViewConfiguration.get(getContext()).getScaledTouchSlop() && |
| | | Math.abs(mViewDownY - event.getY()) <= ViewConfiguration.get(getContext()).getScaledTouchSlop()) { |
| | | // 如果整个视频播放区域太大,触摸移动会导致触发点击事件,所以这里换成手动派发点击事件 |
| | | if (isEnabled() && isClickable()) { |
| | | performClick(); |
| | | } |
| | | } |
| | | case MotionEvent.ACTION_CANCEL: |
| | | mTouchOrientation = -1; |
| | | mCurrentVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC); |
| | | if (mAdjustSecond != 0) { |
| | | // 调整播放进度 |
| | | setProgress(getProgress() + mAdjustSecond * 1000); |
| | | mAdjustSecond = 0; |
| | | } |
| | | postDelayed(mHideControllerRunnable, CONTROLLER_TIME); |
| | | postDelayed(mHideMessageRunnable, DIALOG_TIME); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 刷新任务 |
| | | */ |
| | | private final Runnable mRefreshRunnable = new Runnable() { |
| | | |
| | | @Override |
| | | public void run() { |
| | | int progress = mVideoView.getCurrentPosition(); |
| | | // 这里优化了播放的秒数计算,将 800 毫秒估算成 1 秒 |
| | | if (progress + 1000 < mVideoView.getDuration()) { |
| | | // 进行四舍五入计算 |
| | | progress = Math.round(progress / 1000f) * 1000; |
| | | } |
| | | mPlayTime.setText(conversionTime(progress)); |
| | | mProgressView.setProgress(progress); |
| | | mProgressView.setSecondaryProgress((int) (mVideoView.getBufferPercentage() / 100f * mVideoView.getDuration())); |
| | | if (mVideoView.isPlaying()) { |
| | | if (!mLockMode && mBottomLayout.getVisibility() == GONE) { |
| | | mBottomLayout.setVisibility(VISIBLE); |
| | | } |
| | | } else { |
| | | if (mBottomLayout.getVisibility() == VISIBLE) { |
| | | mBottomLayout.setVisibility(GONE); |
| | | } |
| | | } |
| | | postDelayed(this, REFRESH_TIME); |
| | | |
| | | if (mListener == null) { |
| | | return; |
| | | } |
| | | mListener.onPlayProgress(VideoPlayerView.this); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 显示控制面板 |
| | | */ |
| | | private final Runnable mShowControllerRunnable = () -> { |
| | | if (!mControllerShow) { |
| | | showController(); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 隐藏控制面板 |
| | | */ |
| | | private final Runnable mHideControllerRunnable = () -> { |
| | | if (mControllerShow) { |
| | | hideController(); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 显示提示 |
| | | */ |
| | | private final Runnable mShowMessageRunnable = () -> { |
| | | hideController(); |
| | | mMessageLayout.setVisibility(VISIBLE); |
| | | }; |
| | | |
| | | /** |
| | | * 隐藏提示 |
| | | */ |
| | | private final Runnable mHideMessageRunnable = () -> { |
| | | mMessageLayout.setVisibility(GONE); |
| | | }; |
| | | |
| | | /** |
| | | * 时间转换 |
| | | */ |
| | | public static String conversionTime(int time) { |
| | | Formatter formatter = new Formatter(Locale.getDefault()); |
| | | // 总秒数 |
| | | int totalSeconds = time / 1000; |
| | | // 小时数 |
| | | int hours = totalSeconds / 3600; |
| | | // 分钟数 |
| | | int minutes = (totalSeconds / 60) % 60; |
| | | // 秒数 |
| | | int seconds = totalSeconds % 60; |
| | | if (hours > 0) { |
| | | return formatter.format("%d:%02d:%02d", hours, minutes, seconds).toString(); |
| | | } else { |
| | | return formatter.format("%02d:%02d", minutes, seconds).toString(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 点击返回监听器 |
| | | */ |
| | | public interface OnPlayListener { |
| | | |
| | | /** |
| | | * 点击了返回按钮(可在此处处理返回事件) |
| | | */ |
| | | default void onClickBack(VideoPlayerView view) {} |
| | | |
| | | /** |
| | | * 点击了锁定按钮 |
| | | */ |
| | | default void onClickLock(VideoPlayerView view) {} |
| | | |
| | | /** |
| | | * 点击了播放按钮 |
| | | */ |
| | | default void onClickPlay(VideoPlayerView view) {} |
| | | |
| | | /** |
| | | * 播放开始(可在此处设置播放进度) |
| | | */ |
| | | default void onPlayStart(VideoPlayerView view) {} |
| | | |
| | | /** |
| | | * 播放进度发生改变 |
| | | */ |
| | | default void onPlayProgress(VideoPlayerView view) {} |
| | | |
| | | /** |
| | | * 播放结束(可在此处结束播放或者循环播放) |
| | | */ |
| | | default void onPlayEnd(VideoPlayerView view) {} |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_24" |
| | | android:height="@dimen/dp_24" |
| | | android:viewportWidth="1024" |
| | | android:viewportHeight="1024"> |
| | | |
| | | <path |
| | | android:fillColor="#7C7C7C" |
| | | android:pathData="M478.312,644.159 C502.692,671.061,542.819,670.698,566.819,643.27 |
| | | L837.388,334.048 C845.147,325.181,844.248,311.704,835.381,303.945 |
| | | C826.515,296.186,813.037,297.085,805.278,305.952 L534.71,615.173 |
| | | C527.508,623.404,517.169,623.498,509.928,615.508 L229.141,305.674 |
| | | C221.229,296.944,207.738,296.28,199.008,304.192 |
| | | C190.277,312.104,189.614,325.595,197.526,334.326 L478.312,644.159 Z" /> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_24" |
| | | android:height="@dimen/dp_24" |
| | | android:viewportWidth="1024" |
| | | android:viewportHeight="1024"> |
| | | |
| | | <path |
| | | android:fillColor="#7C7C7C" |
| | | android:pathData="M363.841,472.979 C336.939,497.359,337.302,537.486,364.73,561.486 |
| | | L673.952,832.055 C682.819,839.814,696.296,838.915,704.055,830.048 |
| | | C711.814,821.181,710.915,807.704,702.048,799.945 L392.827,529.376 |
| | | C384.596,522.174,384.502,511.835,392.492,504.594 L702.326,223.808 |
| | | C711.056,215.896,711.72,202.405,703.808,193.674 |
| | | C695.896,184.944,682.405,184.28,673.674,192.192 L363.841,472.979 Z" /> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_24" |
| | | android:height="@dimen/dp_24" |
| | | android:viewportWidth="1024" |
| | | android:viewportHeight="1024"> |
| | | |
| | | <path |
| | | android:fillColor="#7C7C7C" |
| | | android:pathData="M642.174,504.594 C650.164,511.835,650.071,522.174,641.84,529.376 |
| | | L332.619,799.945 C323.752,807.704,322.853,821.181,330.612,830.048 |
| | | C338.37,838.915,351.848,839.814,360.715,832.055 L669.936,561.486 |
| | | C697.365,537.486,697.728,497.359,670.826,472.979 L360.992,192.192 |
| | | C352.262,184.28,338.771,184.944,330.859,193.674 |
| | | C322.947,202.405,323.611,215.896,332.341,223.808 L642.174,504.594 Z" /> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_24" |
| | | android:height="@dimen/dp_24" |
| | | android:viewportWidth="1024" |
| | | android:viewportHeight="1024"> |
| | | |
| | | <path |
| | | android:fillColor="#7C7C7C" |
| | | android:pathData="M509.928,387.159 C517.169,379.169,527.508,379.262,534.71,387.493 |
| | | L805.278,696.715 C813.037,705.582,826.515,706.48,835.381,698.722 |
| | | C844.248,690.963,845.147,677.485,837.388,668.619 L566.819,359.397 |
| | | C542.819,331.968,502.692,331.605,478.312,358.508 L197.526,668.341 |
| | | C189.614,677.071,190.277,690.563,199.008,698.474 |
| | | C207.738,706.386,221.229,705.723,229.141,696.992 L509.928,387.159 Z" /> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_200" |
| | | android:height="@dimen/dp_200" |
| | | android:viewportWidth="200" |
| | | android:viewportHeight="200"> |
| | | |
| | | <path |
| | | android:fillColor="#fff" |
| | | android:pathData="M87.6,16.91 C98.16,15.62,109.06,15.68,119.41,18.33 |
| | | C124.49,19.98,129.75,21.13,134.57,23.48 C153.48,31.95,169.1,47.62,177.16,66.74 |
| | | C188.04,91.49,185.85,121.45,171.39,144.31 |
| | | C161.98,159.73,147.27,171.6,130.57,178.29 |
| | | C126.37,179.53,122.2,180.89,117.98,182.04 C108.47,184.2,98.57,184.3,88.91,183.26 |
| | | C82.27,182.57,75.99,180.24,69.65,178.3 C53.29,171.93,38.88,160.44,29.42,145.6 |
| | | C16.61,125.88,12.44,100.53,19.03,77.87 C22.51,63.95,30.19,51.29,40.1,40.99 |
| | | C52.89,28.24,69.69,19.55,87.6,16.91 M97.17,20.19 |
| | | C92.17,20.65,87.13,20.85,82.26,22.2 C54.09,28.34,30.18,51.04,23.02,79.02 |
| | | C18.82,93.21,19.06,108.55,23.5,122.65 C31.94,153.12,60.49,176.68,91.97,179.38 |
| | | C107.79,181.1,124.15,177.77,138.09,170.09 |
| | | C160.43,158.23,176.2,135.11,179.27,110.02 C181.67,93.33,177.88,75.95,169.8,61.24 |
| | | C155.78,35.41,126.49,18.85,97.17,20.19 Z" /> |
| | | <path |
| | | android:fillColor="#fff" |
| | | android:pathData="M71.57,71.32 C72.81,70.99,74.15,71.07,75,72.15 |
| | | C82.67,79.46,89.98,87.15,97.62,94.48 C99.12,96.09,101.68,95.5,102.95,93.92 |
| | | C110.29,86.63,117.59,79.29,124.91,71.98 C125.83,70.78,127.29,70.33,128.74,70.77 |
| | | C129.84,72.28,129.32,73.93,128,75.05 C120.71,82.39,113.36,89.66,106.06,96.99 |
| | | C104.4,98.28,103.92,101,105.59,102.49 C113.11,110.29,121.04,117.72,128.46,125.6 |
| | | C130.46,127.55,127.35,130.13,125.53,128.38 |
| | | C117.87,121.04,110.49,113.41,102.91,105.99 |
| | | C101.66,104.42,99.1,103.98,97.66,105.54 C89.28,113.43,81.56,122.02,72.94,129.66 |
| | | C71.58,128.77,69.61,126.99,71.52,125.5 C79.08,117.73,86.9,110.2,94.46,102.44 |
| | | C96.34,100.66,95.27,97.83,93.46,96.47 C86.6,89.69,79.83,82.82,72.97,76.04 |
| | | C71.72,74.81,70.02,73.04,71.57,71.32 Z" /> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_200" |
| | | android:height="@dimen/dp_200" |
| | | android:viewportWidth="200" |
| | | android:viewportHeight="200"> |
| | | |
| | | <path |
| | | android:fillColor="#fff" |
| | | android:pathData="M85.51,16.89 C100.87,14.38,116.95,15.74,131.44,21.55 |
| | | C148.47,28.24,163.29,40.52,172.78,56.18 C180.85,68.92,184.82,83.96,185.25,98.97 |
| | | C185.6,120.71,176.92,142.34,161.85,157.99 |
| | | C148.45,171.88,130.3,181.22,111.09,183.5 C94.13,185.72,76.45,182.82,61.26,174.86 |
| | | C43.56,165.92,29.32,150.44,21.64,132.18 C13.36,112.26,12.93,89.03,21.07,68.99 |
| | | C31.6,42.01,57.01,21.69,85.51,16.89 M99.28,20.3 |
| | | C74.6,20.43,50.26,32.66,35.63,52.57 C23.84,68.29,17.92,88.49,20.29,108.07 |
| | | C22.39,128.82,33.03,148.68,49.36,161.7 C62.73,172.66,79.76,179.06,97.03,179.63 |
| | | C114.93,180.4,132.96,174.92,147.45,164.41 |
| | | C164.35,152.17,176.49,133.18,179.56,112.46 C182.02,99.4,180.07,85.83,175.9,73.33 |
| | | C169.47,55.52,156.56,40.12,140.03,30.82 C127.72,23.73,113.48,20.14,99.28,20.3 Z" /> |
| | | <path |
| | | android:fillColor="#fff" |
| | | android:pathData="M136.71,79.68 C137.76,78.23,139.38,79.26,140.75,79.5 |
| | | C140.65,80.89,140.73,82.5,139.43,83.4 C124.6,98.23,109.83,113.13,94.96,127.92 |
| | | C92.68,130.12,90.62,132.59,88.02,134.42 C86.5,134.8,85.65,133.17,84.59,132.41 |
| | | C77.32,124.7,69.83,117.19,62.32,109.7 C61.52,108.82,60.58,108.01,60.12,106.88 |
| | | C60.09,104.97,62.63,103.28,64.05,104.97 C70.8,111.61,77.24,118.59,84.01,125.22 |
| | | C84.92,126.08,85.95,126.86,87.17,127.22 C90.46,126.75,92.43,123.83,94.69,121.72 |
| | | C108.75,107.76,122.57,93.56,136.71,79.68 Z" /> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_200" |
| | | android:height="@dimen/dp_200" |
| | | android:viewportWidth="200" |
| | | android:viewportHeight="200"> |
| | | |
| | | <path |
| | | android:fillColor="#fff" |
| | | android:pathData="M94.32,15.54 C114.87,14.04,135.84,20.4,151.99,33.19 |
| | | C163.64,42.11,172.76,54.25,178.36,67.8 C185.27,84.22,186.43,102.84,182.33,120.12 |
| | | C177.39,140.39,164.63,158.65,147.26,170.22 |
| | | C130.97,181.37,110.65,186.29,91.05,184.18 |
| | | C65.68,181.82,42.02,166.86,28.47,145.38 C17.64,128.52,13.24,107.75,16.16,87.94 |
| | | C18.83,68.04,29.22,49.4,44.31,36.23 C58.13,24.11,75.96,16.67,94.32,15.54 |
| | | M94.3,20.49 C79.91,21.6,65.73,26.47,53.98,34.91 |
| | | C37.14,46.67,25.28,65.24,21.65,85.45 C16.18,113.39,27.26,143.84,49.54,161.59 |
| | | C62.21,172.06,78.27,178.41,94.67,179.44 |
| | | C112.25,180.77,130.24,175.91,144.76,165.92 |
| | | C161.46,154.82,173.46,136.99,177.75,117.43 |
| | | C184.53,88.77,173.55,56.83,150.52,38.47 C135,25.53,114.41,19.14,94.3,20.49 Z" /> |
| | | <path |
| | | android:fillColor="#fff" |
| | | android:pathData="M98.36,51.38 C100.49,49.67,104.77,50.64,104.31,53.96 |
| | | C104.39,75.3,104.41,96.65,104.3,117.99 C104.64,122.25,96.93,122.47,97.34,118.07 |
| | | C97.2,97.36,97.36,76.65,97.26,55.94 C97.41,54.43,96.98,52.44,98.36,51.38 Z" /> |
| | | <path |
| | | android:fillColor="#fff" |
| | | android:pathData="M98.47,140.65 C101.84,138.51,106.67,142.12,105.24,145.99 |
| | | C104.57,148.71,101.34,148.91,99.07,148.64 |
| | | C95.45,147.79,95.31,142.17,98.47,140.65 Z" /> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <!-- 透明背景按压效果样式 --> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <!-- 按压状态 --> |
| | | <item android:drawable="@color/black5" android:state_pressed="true" /> |
| | | |
| | | <!-- 选中状态 --> |
| | | <item android:drawable="@color/black5" android:state_selected="true" /> |
| | | |
| | | <!-- 焦点状态 --> |
| | | <item android:drawable="@color/black5" android:state_focused="true" /> |
| | | |
| | | <!-- 默认状态 --> |
| | | <item android:drawable="@color/transparent" /> |
| | | |
| | | </selector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_24" |
| | | android:height="@dimen/dp_24" |
| | | android:viewportWidth="24" |
| | | android:viewportHeight="24"> |
| | | |
| | | <path |
| | | android:fillColor="@color/white" |
| | | android:pathData="M20,8.69L20,4h-4.69L12,0.69 8.69,4L4,4v4.69L0.69,12 4,15.31L4,20h4.69L12,23.31 15.31,20L20,20v-4.69L23.31,12 20,8.69zM12,18c-3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6 6,2.69 6,6 -2.69,6 -6,6zM12,8c-2.21,0 -4,1.79 -4,4s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4z"/> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_24" |
| | | android:height="@dimen/dp_24" |
| | | android:viewportWidth="24" |
| | | android:viewportHeight="24"> |
| | | |
| | | <path |
| | | android:fillColor="@color/white" |
| | | android:pathData="M20,15.31L23.31,12 20,8.69V4h-4.69L12,0.69 8.69,4H4v4.69L0.69,12 4,15.31V20h4.69L12,23.31 15.31,20H20v-4.69zM12,18c-3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6 6,2.69 6,6 -2.69,6 -6,6z"/> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_24" |
| | | android:height="@dimen/dp_24" |
| | | android:viewportWidth="24" |
| | | android:viewportHeight="24"> |
| | | |
| | | <path |
| | | android:fillColor="@color/white" |
| | | android:pathData="M20,8.69V4h-4.69L12,0.69 8.69,4H4v4.69L0.69,12 4,15.31V20h4.69L12,23.31 15.31,20H20v-4.69L23.31,12 20,8.69zM12,18c-0.89,0 -1.74,-0.2 -2.5,-0.55C11.56,16.5 13,14.42 13,12s-1.44,-4.5 -3.5,-5.45C10.26,6.2 11.11,6 12,6c3.31,0 6,2.69 6,6s-2.69,6 -6,6z"/> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_24" |
| | | android:height="@dimen/dp_24" |
| | | android:autoMirrored="true" |
| | | android:viewportWidth="24.0" |
| | | android:viewportHeight="24.0"> |
| | | <path |
| | | android:fillColor="#FFFFFF" |
| | | android:pathData="M12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1s3.1,1.39 3.1,3.1v2L8.9,8L8.9,6zM18,20L6,20L6,10h12v10z" /> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_24" |
| | | android:height="@dimen/dp_24" |
| | | android:autoMirrored="true" |
| | | android:viewportWidth="24.0" |
| | | android:viewportHeight="24.0"> |
| | | <path |
| | | android:fillColor="#FFFFFF" |
| | | android:pathData="M12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6h1.9c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM18,20L6,20L6,10h12v10z" /> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <shape xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:shape="oval"> |
| | | <size |
| | | android:width="@dimen/dp_15" |
| | | android:height="@dimen/dp_15" /> |
| | | |
| | | <solid android:color="#FFFFFF" /> |
| | | </shape> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <!-- 进度条的整体背景颜色 --> |
| | | <item android:id="@android:id/background"> |
| | | <shape> |
| | | <corners android:radius="@dimen/dp_5" /> |
| | | <solid android:color="#40FFFFFF" /> |
| | | </shape> |
| | | </item> |
| | | |
| | | <!-- 未播放进度条的颜色 --> |
| | | <item android:id="@android:id/secondaryProgress"> |
| | | <clip> |
| | | <shape> |
| | | <corners android:radius="@dimen/dp_5" /> |
| | | <solid android:color="#59FFFFFF" /> |
| | | </shape> |
| | | </clip> |
| | | </item> |
| | | |
| | | <!-- 已播放进度条 --> |
| | | <item android:id="@android:id/progress"> |
| | | <clip> |
| | | <shape> |
| | | <corners android:radius="@dimen/dp_5" /> |
| | | <solid android:color="#FFFFFF" /> |
| | | </shape> |
| | | </clip> |
| | | </item> |
| | | </layer-list> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_24" |
| | | android:height="@dimen/dp_24" |
| | | android:viewportWidth="24" |
| | | android:viewportHeight="24"> |
| | | |
| | | <path |
| | | android:fillColor="#FFFFFF" |
| | | android:pathData="M4,18l8.5,-6L4,6v12zM13,6v12l8.5,-6L13,6z"/> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_24" |
| | | android:height="@dimen/dp_24" |
| | | android:viewportWidth="24" |
| | | android:viewportHeight="24"> |
| | | |
| | | <path |
| | | android:fillColor="#FFFFFF" |
| | | android:pathData="M11,18L11,6l-8.5,6 8.5,6zM11.5,12l8.5,6L20,6l-8.5,6z"/> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_24" |
| | | android:height="@dimen/dp_24" |
| | | android:viewportWidth="24" |
| | | android:viewportHeight="24"> |
| | | |
| | | <path |
| | | android:fillColor="@color/white" |
| | | android:pathData="M3,9v6h4l5,5L12,4L7,9L3,9zM16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM14,3.23v2.06c2.89,0.86 5,3.54 5,6.71s-2.11,5.85 -5,6.71v2.06c4.01,-0.91 7,-4.49 7,-8.77s-2.99,-7.86 -7,-8.77z"/> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_24" |
| | | android:height="@dimen/dp_24" |
| | | android:viewportWidth="24" |
| | | android:viewportHeight="24"> |
| | | |
| | | <path |
| | | android:fillColor="#FFFFFF" |
| | | android:pathData="M7,9v6h4l5,5V4l-5,5H7z"/> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_24" |
| | | android:height="@dimen/dp_24" |
| | | android:viewportWidth="24" |
| | | android:viewportHeight="24"> |
| | | |
| | | <path |
| | | android:fillColor="#FFFFFF" |
| | | android:pathData="M18.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM5,9v6h4l5,5V4L9,9H5z"/> |
| | | </vector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="@dimen/dp_24" |
| | | android:height="@dimen/dp_24" |
| | | android:viewportWidth="24" |
| | | android:viewportHeight="24"> |
| | | |
| | | <path |
| | | android:fillColor="#FFFFFF" |
| | | android:pathData="M16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v2.21l2.45,2.45c0.03,-0.2 0.05,-0.41 0.05,-0.63zM19,12c0,0.94 -0.2,1.82 -0.54,2.64l1.51,1.51C20.63,14.91 21,13.5 21,12c0,-4.28 -2.99,-7.86 -7,-8.77v2.06c2.89,0.86 5,3.54 5,6.71zM4.27,3L3,4.27 7.73,9L3,9v6h4l5,5v-6.73l4.25,4.25c-0.67,0.52 -1.42,0.93 -2.25,1.18v2.06c1.38,-0.31 2.63,-0.95 3.69,-1.81L19.73,21 21,19.73l-9,-9L4.27,3zM12,4L9.91,6.09 12,8.18L12,4z"/> |
| | | </vector> |
| | |
| | | app:autoSizeMinTextSize="16sp" |
| | | android:textStyle="bold" |
| | | android:layout_marginHorizontal="20dp" |
| | | tools:text="标题" /> |
| | | tools:text="标题" |
| | | tools:visibility="visible" |
| | | /> |
| | | |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_content" |
| | | android:padding="10dp" |
| | | android:text="内容" |
| | | android:text="" |
| | | tools:text="内容" |
| | | android:gravity="center" |
| | | android:textColor="#FF757575" |
| | | android:textSize="16sp" |
| | |
| | | android:paddingVertical="15dp" |
| | | android:text="取消" |
| | | android:textColor="#FFF83F39" |
| | | android:textSize="@dimen/sp_14" /> |
| | | android:textSize="@dimen/sp_14" |
| | | /> |
| | | |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/transparent_selector" |
| | | android:focusable="true" |
| | | android:gravity="center" |
| | | android:paddingVertical="15dp" |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | xmlns:tools="http://schemas.android.com/tools" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:gravity="center" |
| | | android:orientation="vertical" |
| | | app:cardBackgroundColor="#D9000000" |
| | | app:cardCornerRadius="15dp" |
| | | app:cardElevation="0px" |
| | | > |
| | | |
| | | <LinearLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center" |
| | | android:minWidth="110dp" |
| | | android:minHeight="110dp" |
| | | android:orientation="vertical"> |
| | | |
| | | <androidx.appcompat.widget.AppCompatImageView |
| | | android:id="@+id/iv_tips_icon" |
| | | android:layout_width="60dp" |
| | | android:layout_height="60dp" |
| | | android:layout_marginTop="10dp" |
| | | app:srcCompat="@drawable/tips_warning_ic" |
| | | /> |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/tv_tips_message" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginHorizontal="15dp" |
| | | android:layout_marginTop="5dp" |
| | | android:layout_marginBottom="10dp" |
| | | android:maxLines="3" |
| | | android:textColor="#ffffff" |
| | | android:textSize="14sp" |
| | | tools:text="提示语" /> |
| | | </LinearLayout> |
| | | |
| | | </androidx.cardview.widget.CardView> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | xmlns:tools="http://schemas.android.com/tools" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="#000000" |
| | | android:orientation="vertical"> |
| | | |
| | | <VideoView |
| | | android:id="@+id/vv_player_view_video" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:layout_gravity="center" |
| | | android:keepScreenOn="true" /> |
| | | |
| | | <FrameLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:fitsSystemWindows="true" |
| | | android:orientation="vertical"> |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/ll_player_view_top" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="top" |
| | | android:orientation="horizontal" |
| | | android:visibility="invisible" |
| | | tools:visibility="visible"> |
| | | |
| | | <androidx.appcompat.widget.AppCompatImageView |
| | | android:id="@+id/iv_player_view_left" |
| | | android:layout_width="@dimen/dp_50" |
| | | android:layout_height="@dimen/dp_50" |
| | | android:layout_gravity="center_vertical" |
| | | android:padding="@dimen/dp_10" |
| | | android:visibility="invisible" |
| | | app:srcCompat="@drawable/arrows_left_ic" |
| | | app:tint="#FFFFFF" |
| | | tools:visibility="visible" /> |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/tv_player_view_title" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:layout_marginHorizontal="@dimen/dp_50" |
| | | android:ellipsize="marquee" |
| | | android:gravity="center_horizontal" |
| | | android:singleLine="true" |
| | | android:textColor="#FFFFFF" |
| | | android:textSize="@dimen/sp_17" |
| | | tools:text="我是视频标题" /> |
| | | |
| | | </FrameLayout> |
| | | |
| | | <com.android.app_base.widget.PlayButton |
| | | android:id="@+id/iv_player_view_control" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:visibility="invisible" |
| | | tools:visibility="visible" /> |
| | | |
| | | <androidx.constraintlayout.utils.widget.ImageFilterView |
| | | android:id="@+id/iv_player_view_lock" |
| | | android:layout_width="@dimen/dp_45" |
| | | android:layout_height="@dimen/dp_45" |
| | | android:layout_gravity="start|center_vertical" |
| | | android:layout_marginStart="@dimen/dp_5" |
| | | android:padding="@dimen/dp_10" |
| | | android:visibility="invisible" |
| | | android:background="#4D000000" |
| | | app:roundPercent="1" |
| | | app:srcCompat="@drawable/video_lock_open_ic" |
| | | tools:visibility="visible" /> |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/ll_player_view_bottom" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="bottom" |
| | | android:gravity="center_vertical" |
| | | android:orientation="horizontal" |
| | | android:paddingHorizontal="@dimen/dp_15" |
| | | android:visibility="invisible" |
| | | tools:visibility="visible"> |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/tv_player_view_play_time" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:textColor="#FFFFFF" |
| | | android:textSize="@dimen/sp_14" |
| | | tools:text="00:00" /> |
| | | |
| | | <androidx.appcompat.widget.AppCompatSeekBar |
| | | android:id="@+id/sb_player_view_progress" |
| | | android:layout_width="0px" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:foreground="@null" |
| | | android:maxHeight="@dimen/dp_2" |
| | | android:paddingVertical="@dimen/dp_10" |
| | | android:progressDrawable="@drawable/video_progress_bg" |
| | | android:thumb="@drawable/video_progress_ball_bg" |
| | | tools:max="100" |
| | | tools:progress="50" |
| | | tools:secondaryProgress="80" |
| | | tools:targetApi="m" /> |
| | | |
| | | <androidx.appcompat.widget.AppCompatTextView |
| | | android:id="@+id/tv_player_view_total_time" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:textColor="#FFFFFF" |
| | | android:textSize="@dimen/sp_14" |
| | | tools:text="10:00" /> |
| | | |
| | | </LinearLayout> |
| | | |
| | | </FrameLayout> |
| | | |
| | | <androidx.cardview.widget.CardView |
| | | android:id="@+id/cv_player_view_message" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:gravity="center" |
| | | android:orientation="vertical" |
| | | android:visibility="gone" |
| | | app:cardBackgroundColor="#D9000000" |
| | | app:cardCornerRadius="@dimen/dp_15" |
| | | app:cardElevation="0px" |
| | | tools:visibility="visible"> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center" |
| | | android:minWidth="@dimen/dp_110" |
| | | android:minHeight="@dimen/dp_110" |
| | | android:orientation="vertical" |
| | | android:padding="@dimen/dp_10"> |
| | | |
| | | <com.airbnb.lottie.LottieAnimationView |
| | | android:id="@+id/lav_player_view_lottie" |
| | | android:layout_width="@dimen/dp_70" |
| | | android:layout_height="@dimen/dp_70" |
| | | app:lottie_autoPlay="false" |
| | | app:lottie_loop="true" |
| | | app:lottie_rawRes="@raw/progress" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_player_view_message" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginHorizontal="@dimen/dp_15" |
| | | android:layout_marginTop="@dimen/dp_5" |
| | | android:maxLines="3" |
| | | android:textColor="#FFFFFF" |
| | | android:textSize="@dimen/sp_14" |
| | | tools:text="加载中…" /> |
| | | </LinearLayout> |
| | | |
| | | </androidx.cardview.widget.CardView> |
| | | |
| | | </FrameLayout> |
| | |
| | | <attr name="background" format="reference"/> |
| | | <attr name="padding" format="dimension"/> |
| | | </declare-styleable> |
| | | |
| | | <declare-styleable name="PlayButton"> |
| | | <!-- 线条颜色 --> |
| | | <attr name="pb_lineColor" format="color" /> |
| | | <!-- 线条大小 --> |
| | | <attr name="pb_lineSize" format="integer" /> |
| | | <!-- 动画时间 --> |
| | | <attr name="pb_animDuration" format="integer" /> |
| | | </declare-styleable> |
| | | </resources> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <resources> |
| | | |
| | | <!-- 透明色 --> |
| | | <color name="transparent">#00000000</color> |
| | | <!-- 熊猫色(黑白背景通吃) --> |
| | | <color name="panda">#FF757575</color> |
| | | |
| | | <!-- 白色 --> |
| | | <color name="white">#FFFFFFFF</color> |
| | | <color name="white95">#F2FFFFFF</color> |
| | | <color name="white90">#E6FFFFFF</color> |
| | | <color name="white85">#D9FFFFFF</color> |
| | | <color name="white80">#CCFFFFFF</color> |
| | | <color name="white75">#BFFFFFFF</color> |
| | | <color name="white70">#B3FFFFFF</color> |
| | | <color name="white65">#A6FFFFFF</color> |
| | | <color name="white60">#99FFFFFF</color> |
| | | <color name="white55">#8CFFFFFF</color> |
| | | <color name="white50">#80FFFFFF</color> |
| | | <color name="white45">#73FFFFFF</color> |
| | | <color name="white40">#66FFFFFF</color> |
| | | <color name="white35">#59FFFFFF</color> |
| | | <color name="white30">#4DFFFFFF</color> |
| | | <color name="white25">#40FFFFFF</color> |
| | | <color name="white20">#33FFFFFF</color> |
| | | <color name="white15">#26FFFFFF</color> |
| | | <color name="white10">#1AFFFFFF</color> |
| | | <color name="white5">#0DFFFFFF</color> |
| | | |
| | | <!-- 黑色 --> |
| | | <color name="black">#FF000000</color> |
| | | <color name="black95">#F2000000</color> |
| | | <color name="black90">#E6000000</color> |
| | | <color name="black85">#D9000000</color> |
| | | <color name="black80">#CC000000</color> |
| | | <color name="black75">#B000000F</color> |
| | | <color name="black70">#B3000000</color> |
| | | <color name="black65">#A6000000</color> |
| | | <color name="black60">#99000000</color> |
| | | <color name="black55">#8C000000</color> |
| | | <color name="black50">#80000000</color> |
| | | <color name="black45">#73000000</color> |
| | | <color name="black40">#66000000</color> |
| | | <color name="black35">#59000000</color> |
| | | <color name="black30">#4D000000</color> |
| | | <color name="black25">#40000000</color> |
| | | <color name="black20">#33000000</color> |
| | | <color name="black15">#26000000</color> |
| | | <color name="black10">#1A000000</color> |
| | | <color name="black5">#0D000000</color> |
| | | |
| | | <!-- 灰色 --> |
| | | <color name="gray">#FF808080</color> |
| | | <!-- 红色 --> |
| | | <color name="red">#FFFF0000</color> |
| | | <!-- 金色 --> |
| | | <color name="gold">#FFFFD700</color> |
| | | <!-- 黄色 --> |
| | | <color name="yellow">#FFFFFF00</color> |
| | | <!-- 绿色 --> |
| | | <color name="green">#FF008000</color> |
| | | <!-- 蓝色 --> |
| | | <color name="blue">#FF0000FF</color> |
| | | <!-- 紫色 --> |
| | | <color name="purple">#FF800080</color> |
| | | <!-- 粉色 --> |
| | | <color name="pink">#FFFFC0CB</color> |
| | | <!-- 橙色 --> |
| | | <color name="orange">#FFFFA500</color> |
| | | |
| | | </resources> |
| | |
| | | <item name="android:windowEnterAnimation">@anim/right_in_window</item> |
| | | <item name="android:windowExitAnimation">@anim/right_out_window</item> |
| | | </style> |
| | | |
| | | |
| | | </resources> |
| | |
| | | |
| | | android.injected.testOnly=false |
| | | |
| | | KEY_PATH=zhangshiapp.keystore |
| | | KEY_PATH=zhangshiapp.keystore.jks |
| | | KEY_PASS=123456 |
| | | ALIAS_NAME=alias |
| | | ALIAS_PASS=123456 |