Commit c1d7d48c5d11878be63cf636054dea00e7bf62c4
0 parents
ver 1.0
Showing
187 changed files
with
11851 additions
and
0 deletions
.gitignore
0 → 100644
.idea/codeStyles/Project.xml
0 → 100644
| 1 | +++ a/.idea/codeStyles/Project.xml | |
| 1 | +<component name="ProjectCodeStyleConfiguration"> | |
| 2 | + <code_scheme name="Project" version="173"> | |
| 3 | + <codeStyleSettings language="XML"> | |
| 4 | + <indentOptions> | |
| 5 | + <option name="CONTINUATION_INDENT_SIZE" value="4" /> | |
| 6 | + </indentOptions> | |
| 7 | + <arrangement> | |
| 8 | + <rules> | |
| 9 | + <section> | |
| 10 | + <rule> | |
| 11 | + <match> | |
| 12 | + <AND> | |
| 13 | + <NAME>xmlns:android</NAME> | |
| 14 | + <XML_ATTRIBUTE /> | |
| 15 | + <XML_NAMESPACE>^$</XML_NAMESPACE> | |
| 16 | + </AND> | |
| 17 | + </match> | |
| 18 | + </rule> | |
| 19 | + </section> | |
| 20 | + <section> | |
| 21 | + <rule> | |
| 22 | + <match> | |
| 23 | + <AND> | |
| 24 | + <NAME>xmlns:.*</NAME> | |
| 25 | + <XML_ATTRIBUTE /> | |
| 26 | + <XML_NAMESPACE>^$</XML_NAMESPACE> | |
| 27 | + </AND> | |
| 28 | + </match> | |
| 29 | + <order>BY_NAME</order> | |
| 30 | + </rule> | |
| 31 | + </section> | |
| 32 | + <section> | |
| 33 | + <rule> | |
| 34 | + <match> | |
| 35 | + <AND> | |
| 36 | + <NAME>.*:id</NAME> | |
| 37 | + <XML_ATTRIBUTE /> | |
| 38 | + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | |
| 39 | + </AND> | |
| 40 | + </match> | |
| 41 | + </rule> | |
| 42 | + </section> | |
| 43 | + <section> | |
| 44 | + <rule> | |
| 45 | + <match> | |
| 46 | + <AND> | |
| 47 | + <NAME>.*:name</NAME> | |
| 48 | + <XML_ATTRIBUTE /> | |
| 49 | + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | |
| 50 | + </AND> | |
| 51 | + </match> | |
| 52 | + </rule> | |
| 53 | + </section> | |
| 54 | + <section> | |
| 55 | + <rule> | |
| 56 | + <match> | |
| 57 | + <AND> | |
| 58 | + <NAME>name</NAME> | |
| 59 | + <XML_ATTRIBUTE /> | |
| 60 | + <XML_NAMESPACE>^$</XML_NAMESPACE> | |
| 61 | + </AND> | |
| 62 | + </match> | |
| 63 | + </rule> | |
| 64 | + </section> | |
| 65 | + <section> | |
| 66 | + <rule> | |
| 67 | + <match> | |
| 68 | + <AND> | |
| 69 | + <NAME>style</NAME> | |
| 70 | + <XML_ATTRIBUTE /> | |
| 71 | + <XML_NAMESPACE>^$</XML_NAMESPACE> | |
| 72 | + </AND> | |
| 73 | + </match> | |
| 74 | + </rule> | |
| 75 | + </section> | |
| 76 | + <section> | |
| 77 | + <rule> | |
| 78 | + <match> | |
| 79 | + <AND> | |
| 80 | + <NAME>.*</NAME> | |
| 81 | + <XML_ATTRIBUTE /> | |
| 82 | + <XML_NAMESPACE>^$</XML_NAMESPACE> | |
| 83 | + </AND> | |
| 84 | + </match> | |
| 85 | + <order>BY_NAME</order> | |
| 86 | + </rule> | |
| 87 | + </section> | |
| 88 | + <section> | |
| 89 | + <rule> | |
| 90 | + <match> | |
| 91 | + <AND> | |
| 92 | + <NAME>.*</NAME> | |
| 93 | + <XML_ATTRIBUTE /> | |
| 94 | + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | |
| 95 | + </AND> | |
| 96 | + </match> | |
| 97 | + <order>ANDROID_ATTRIBUTE_ORDER</order> | |
| 98 | + </rule> | |
| 99 | + </section> | |
| 100 | + <section> | |
| 101 | + <rule> | |
| 102 | + <match> | |
| 103 | + <AND> | |
| 104 | + <NAME>.*</NAME> | |
| 105 | + <XML_ATTRIBUTE /> | |
| 106 | + <XML_NAMESPACE>.*</XML_NAMESPACE> | |
| 107 | + </AND> | |
| 108 | + </match> | |
| 109 | + <order>BY_NAME</order> | |
| 110 | + </rule> | |
| 111 | + </section> | |
| 112 | + </rules> | |
| 113 | + </arrangement> | |
| 114 | + </codeStyleSettings> | |
| 115 | + </code_scheme> | |
| 116 | +</component> | |
| 0 | 117 | \ No newline at end of file | ... | ... |
.idea/gradle.xml
0 → 100644
| 1 | +++ a/.idea/gradle.xml | |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<project version="4"> | |
| 3 | + <component name="GradleMigrationSettings" migrationVersion="1" /> | |
| 4 | + <component name="GradleSettings"> | |
| 5 | + <option name="linkedExternalProjectsSettings"> | |
| 6 | + <GradleProjectSettings> | |
| 7 | + <option name="testRunner" value="PLATFORM" /> | |
| 8 | + <option name="distributionType" value="DEFAULT_WRAPPED" /> | |
| 9 | + <option name="externalProjectPath" value="$PROJECT_DIR$" /> | |
| 10 | + <option name="gradleJvm" value="1.8" /> | |
| 11 | + <option name="modules"> | |
| 12 | + <set> | |
| 13 | + <option value="$PROJECT_DIR$" /> | |
| 14 | + <option value="$PROJECT_DIR$/app" /> | |
| 15 | + <option value="$PROJECT_DIR$/publish" /> | |
| 16 | + </set> | |
| 17 | + </option> | |
| 18 | + <option name="resolveModulePerSourceSet" value="false" /> | |
| 19 | + </GradleProjectSettings> | |
| 20 | + </option> | |
| 21 | + </component> | |
| 22 | +</project> | |
| 0 | 23 | \ No newline at end of file | ... | ... |
.idea/jarRepositories.xml
0 → 100644
| 1 | +++ a/.idea/jarRepositories.xml | |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<project version="4"> | |
| 3 | + <component name="RemoteRepositoriesConfiguration"> | |
| 4 | + <remote-repository> | |
| 5 | + <option name="id" value="central" /> | |
| 6 | + <option name="name" value="Maven Central repository" /> | |
| 7 | + <option name="url" value="https://repo1.maven.org/maven2" /> | |
| 8 | + </remote-repository> | |
| 9 | + <remote-repository> | |
| 10 | + <option name="id" value="jboss.community" /> | |
| 11 | + <option name="name" value="JBoss Community repository" /> | |
| 12 | + <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" /> | |
| 13 | + </remote-repository> | |
| 14 | + <remote-repository> | |
| 15 | + <option name="id" value="BintrayJCenter" /> | |
| 16 | + <option name="name" value="BintrayJCenter" /> | |
| 17 | + <option name="url" value="https://jcenter.bintray.com/" /> | |
| 18 | + </remote-repository> | |
| 19 | + <remote-repository> | |
| 20 | + <option name="id" value="Google" /> | |
| 21 | + <option name="name" value="Google" /> | |
| 22 | + <option name="url" value="https://dl.google.com/dl/android/maven2/" /> | |
| 23 | + </remote-repository> | |
| 24 | + <remote-repository> | |
| 25 | + <option name="id" value="maven" /> | |
| 26 | + <option name="name" value="maven" /> | |
| 27 | + <option name="url" value="http://android.nexus.cnlive.com/repository/cnlive-mixed/" /> | |
| 28 | + </remote-repository> | |
| 29 | + <remote-repository> | |
| 30 | + <option name="id" value="maven3" /> | |
| 31 | + <option name="name" value="maven3" /> | |
| 32 | + <option name="url" value="https://dl.bintray.com/granzon/cnlive" /> | |
| 33 | + </remote-repository> | |
| 34 | + <remote-repository> | |
| 35 | + <option name="id" value="maven2" /> | |
| 36 | + <option name="name" value="maven2" /> | |
| 37 | + <option name="url" value="https://jitpack.io" /> | |
| 38 | + </remote-repository> | |
| 39 | + <remote-repository> | |
| 40 | + <option name="id" value="maven4" /> | |
| 41 | + <option name="name" value="maven4" /> | |
| 42 | + <option name="url" value="https://dl.bintray.com/granzon/cnliveLibs" /> | |
| 43 | + </remote-repository> | |
| 44 | + <remote-repository> | |
| 45 | + <option name="id" value="MavenRepo" /> | |
| 46 | + <option name="name" value="MavenRepo" /> | |
| 47 | + <option name="url" value="https://repo.maven.apache.org/maven2/" /> | |
| 48 | + </remote-repository> | |
| 49 | + <remote-repository> | |
| 50 | + <option name="id" value="maven5" /> | |
| 51 | + <option name="name" value="maven5" /> | |
| 52 | + <option name="url" value="http://maven.aliyun.com/nexus/content/repositories/releases" /> | |
| 53 | + </remote-repository> | |
| 54 | + </component> | |
| 55 | +</project> | |
| 0 | 56 | \ No newline at end of file | ... | ... |
.idea/misc.xml
0 → 100644
| 1 | +++ a/.idea/misc.xml | |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<project version="4"> | |
| 3 | + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |
| 4 | + <output url="file://$PROJECT_DIR$/build/classes" /> | |
| 5 | + </component> | |
| 6 | + <component name="ProjectType"> | |
| 7 | + <option name="id" value="Android" /> | |
| 8 | + </component> | |
| 9 | +</project> | |
| 0 | 10 | \ No newline at end of file | ... | ... |
.idea/runConfigurations.xml
0 → 100644
| 1 | +++ a/.idea/runConfigurations.xml | |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<project version="4"> | |
| 3 | + <component name="RunConfigurationProducerService"> | |
| 4 | + <option name="ignoredProducers"> | |
| 5 | + <set> | |
| 6 | + <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" /> | |
| 7 | + <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" /> | |
| 8 | + <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" /> | |
| 9 | + </set> | |
| 10 | + </option> | |
| 11 | + </component> | |
| 12 | +</project> | |
| 0 | 13 | \ No newline at end of file | ... | ... |
.idea/vcs.xml
0 → 100644
app/.gitignore
0 → 100644
app/build.gradle
0 → 100644
| 1 | +++ a/app/build.gradle | |
| 1 | +apply plugin: 'com.android.application' | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | +repositories { | |
| 6 | + mavenCentral() | |
| 7 | + maven { | |
| 8 | + url "http://maven.aliyun.com/nexus/content/repositories/releases" | |
| 9 | + } | |
| 10 | + flatDir { | |
| 11 | + dirs 'libs' | |
| 12 | + } | |
| 13 | +} | |
| 14 | + | |
| 15 | +def action = rootProject.ext.action | |
| 16 | + | |
| 17 | +def ACTION_SHARE_RELEASE = action.ACTION_SHARE_RELEASE | |
| 18 | + | |
| 19 | + | |
| 20 | +static def stringValue(def value) { | |
| 21 | + return "\"${value}\"" | |
| 22 | +} | |
| 23 | + | |
| 24 | +android { | |
| 25 | + compileSdkVersion = 29 | |
| 26 | + buildToolsVersion = "29.0.2" | |
| 27 | + | |
| 28 | + defaultConfig { | |
| 29 | + applicationId "com.cnlive.publishingworks" | |
| 30 | + minSdkVersion 19 | |
| 31 | + targetSdkVersion 29 | |
| 32 | + versionCode 1 | |
| 33 | + versionName "1.0" | |
| 34 | + multiDexEnabled true | |
| 35 | + //启用renderscript | |
| 36 | + renderscriptTargetApi 15 | |
| 37 | + renderscriptSupportModeEnabled true | |
| 38 | + | |
| 39 | + | |
| 40 | + ndk { | |
| 41 | + abiFilters "armeabi-v7a" | |
| 42 | + } | |
| 43 | + | |
| 44 | + buildConfigField("String", "ACTION_SHARE_RELEASE", stringValue(ACTION_SHARE_RELEASE)) | |
| 45 | + | |
| 46 | + manifestPlaceholders = [ | |
| 47 | + ACTION_SHARE_RELEASE : ACTION_SHARE_RELEASE, | |
| 48 | + ] | |
| 49 | + | |
| 50 | + javaCompileOptions { | |
| 51 | + annotationProcessorOptions { | |
| 52 | + arguments = [AROUTER_MODULE_NAME: project.getName(), AROUTER_GENERATE_DOC: "enable"] | |
| 53 | + } | |
| 54 | + } | |
| 55 | + } | |
| 56 | + | |
| 57 | + buildTypes { | |
| 58 | + release { | |
| 59 | + minifyEnabled false | |
| 60 | + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | |
| 61 | + } | |
| 62 | + } | |
| 63 | + | |
| 64 | + compileOptions { | |
| 65 | + sourceCompatibility JavaVersion.VERSION_1_8 | |
| 66 | + targetCompatibility JavaVersion.VERSION_1_8 | |
| 67 | + } | |
| 68 | + | |
| 69 | + dataBinding { | |
| 70 | + enabled true | |
| 71 | + } | |
| 72 | + | |
| 73 | + dexOptions { | |
| 74 | + javaMaxHeapSize '4g' | |
| 75 | + } | |
| 76 | +} | |
| 77 | + | |
| 78 | +dependencies { | |
| 79 | + implementation fileTree(dir: "libs", include: ["*.jar"]) | |
| 80 | + implementation "androidx.legacy:legacy-support-v4:$rootProject.androidX_legacy_support_v4" | |
| 81 | + implementation "androidx.appcompat:appcompat:$rootProject.androidXAppcompat" | |
| 82 | + implementation "androidx.recyclerview:recyclerview:$rootProject.androidXRecyclerview" | |
| 83 | + implementation "androidx.constraintlayout:constraintlayout:$rootProject.androidXConstraintlayout" | |
| 84 | + implementation 'androidx.multidex:multidex:2.0.0' | |
| 85 | + //glide | |
| 86 | + implementation "com.github.bumptech.glide:glide:$rootProject.glide" | |
| 87 | + implementation "jp.wasabeef:glide-transformations:$rootProject.glideTransformations" | |
| 88 | + implementation project(path: ':publish') | |
| 89 | + annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.compiler" | |
| 90 | + | |
| 91 | + implementation "pub.devrel:easypermissions:$rootProject.easypermissions" | |
| 92 | + implementation "com.chensl.rotatephotoview:rotatephotoview:$rootProject.rotatephotoview" | |
| 93 | + | |
| 94 | + implementation "com.alibaba:arouter-api:$rootProject.arouterApiVersion" | |
| 95 | + annotationProcessor "com.alibaba:arouter-compiler:$rootProject.arouterCompilerVersion" | |
| 96 | + implementation "com.qmuiteam:qmui:$rootProject.qmui" | |
| 97 | + | |
| 98 | +} | |
| 0 | 99 | \ No newline at end of file | ... | ... |
app/proguard-rules.pro
0 → 100644
| 1 | +++ a/app/proguard-rules.pro | |
| 1 | +# Add project specific ProGuard rules here. | |
| 2 | +# You can control the set of applied configuration files using the | |
| 3 | +# proguardFiles setting in build.gradle. | |
| 4 | +# | |
| 5 | +# For more details, see | |
| 6 | +# http://developer.android.com/guide/developing/tools/proguard.html | |
| 7 | + | |
| 8 | +# If your project uses WebView with JS, uncomment the following | |
| 9 | +# and specify the fully qualified class name to the JavaScript interface | |
| 10 | +# class: | |
| 11 | +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | |
| 12 | +# public *; | |
| 13 | +#} | |
| 14 | + | |
| 15 | +# Uncomment this to preserve the line number information for | |
| 16 | +# debugging stack traces. | |
| 17 | +#-keepattributes SourceFile,LineNumberTable | |
| 18 | + | |
| 19 | +# If you keep the line number information, uncomment this to | |
| 20 | +# hide the original source file name. | |
| 21 | +#-renamesourcefileattribute SourceFile | |
| 0 | 22 | \ No newline at end of file | ... | ... |
app/src/androidTest/java/com/cnlive/publishingworks/ExampleInstrumentedTest.java
0 → 100644
| 1 | +++ a/app/src/androidTest/java/com/cnlive/publishingworks/ExampleInstrumentedTest.java | |
| 1 | +package com.cnlive.publishingworks; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | + | |
| 5 | +import androidx.test.platform.app.InstrumentationRegistry; | |
| 6 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | |
| 7 | + | |
| 8 | +import org.junit.Test; | |
| 9 | +import org.junit.runner.RunWith; | |
| 10 | + | |
| 11 | +import static org.junit.Assert.*; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * Instrumented test, which will execute on an Android device. | |
| 15 | + * | |
| 16 | + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | |
| 17 | + */ | |
| 18 | +@RunWith(AndroidJUnit4.class) | |
| 19 | +public class ExampleInstrumentedTest { | |
| 20 | + @Test | |
| 21 | + public void useAppContext() { | |
| 22 | + // Context of the app under test. | |
| 23 | + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | |
| 24 | + assertEquals("com.cnlive.publishingworks", appContext.getPackageName()); | |
| 25 | + } | |
| 26 | +} | |
| 0 | 27 | \ No newline at end of file | ... | ... |
app/src/main/AndroidManifest.xml
0 → 100644
| 1 | +++ a/app/src/main/AndroidManifest.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + package="com.cnlive.publishingworks"> | |
| 4 | + | |
| 5 | + <application | |
| 6 | + android:name=".Application" | |
| 7 | + android:allowBackup="true" | |
| 8 | + android:icon="@mipmap/ic_launcher" | |
| 9 | + android:label="@string/app_name" | |
| 10 | + android:roundIcon="@mipmap/ic_launcher_round" | |
| 11 | + android:supportsRtl="true" | |
| 12 | + android:theme="@style/AppTheme"> | |
| 13 | + <activity android:name=".MainActivity"> | |
| 14 | + <intent-filter> | |
| 15 | + <action android:name="android.intent.action.MAIN" /> | |
| 16 | + | |
| 17 | + <category android:name="android.intent.category.LAUNCHER" /> | |
| 18 | + </intent-filter> | |
| 19 | + </activity> | |
| 20 | + </application> | |
| 21 | + | |
| 22 | +</manifest> | |
| 0 | 23 | \ No newline at end of file | ... | ... |
app/src/main/java/com/cnlive/publishingworks/Application.java
0 → 100644
| 1 | +++ a/app/src/main/java/com/cnlive/publishingworks/Application.java | |
| 1 | +package com.cnlive.publishingworks; | |
| 2 | + | |
| 3 | +import com.alibaba.android.arouter.launcher.ARouter; | |
| 4 | + | |
| 5 | +import androidx.multidex.MultiDex; | |
| 6 | + | |
| 7 | + | |
| 8 | +public class Application extends android.app.Application { | |
| 9 | + @Override | |
| 10 | + public void onCreate() { | |
| 11 | + super.onCreate(); | |
| 12 | + ARouter.openDebug(); | |
| 13 | + ARouter.init(this); | |
| 14 | + MultiDex.install(this); | |
| 15 | + } | |
| 16 | +} | ... | ... |
app/src/main/java/com/cnlive/publishingworks/MainActivity.java
0 → 100644
| 1 | +++ a/app/src/main/java/com/cnlive/publishingworks/MainActivity.java | |
| 1 | +package com.cnlive.publishingworks; | |
| 2 | + | |
| 3 | +import androidx.appcompat.app.AppCompatActivity; | |
| 4 | + | |
| 5 | +import android.os.Bundle; | |
| 6 | +import android.view.View; | |
| 7 | + | |
| 8 | +import com.alibaba.android.arouter.launcher.ARouter; | |
| 9 | + | |
| 10 | +public class MainActivity extends AppCompatActivity { | |
| 11 | + | |
| 12 | + @Override | |
| 13 | + protected void onCreate(Bundle savedInstanceState) { | |
| 14 | + super.onCreate(savedInstanceState); | |
| 15 | + setContentView(R.layout.activity_main); | |
| 16 | + findViewById(R.id.gogg).setOnClickListener(this::onClick); | |
| 17 | + } | |
| 18 | + | |
| 19 | + public void onClick(View view) { | |
| 20 | + ARouter.getInstance().build("/cnmain/ReleasePublishAcityity") | |
| 21 | + .navigation(view.getContext()); | |
| 22 | + } | |
| 23 | +} | |
| 0 | 24 | \ No newline at end of file | ... | ... |
app/src/main/res/color/s_btn_blue_border.xml
0 → 100644
| 1 | +++ a/app/src/main/res/color/s_btn_blue_border.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<selector xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" tools:ignore="MissingDefaultResource"> | |
| 3 | + <item android:color="@color/app_color_blue_disabled" android:state_enabled="false" /> | |
| 4 | + <item android:color="@color/app_color_blue_pressed" android:state_pressed="true" /> | |
| 5 | + <item android:color="@color/app_color_blue" /> | |
| 6 | +</selector> | |
| 0 | 7 | \ No newline at end of file | ... | ... |
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
0 → 100644
| 1 | +++ a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml | |
| 1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
| 2 | + xmlns:aapt="http://schemas.android.com/aapt" | |
| 3 | + android:width="108dp" | |
| 4 | + android:height="108dp" | |
| 5 | + android:viewportWidth="108" | |
| 6 | + android:viewportHeight="108"> | |
| 7 | + <path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z"> | |
| 8 | + <aapt:attr name="android:fillColor"> | |
| 9 | + <gradient | |
| 10 | + android:endX="85.84757" | |
| 11 | + android:endY="92.4963" | |
| 12 | + android:startX="42.9492" | |
| 13 | + android:startY="49.59793" | |
| 14 | + android:type="linear"> | |
| 15 | + <item | |
| 16 | + android:color="#44000000" | |
| 17 | + android:offset="0.0" /> | |
| 18 | + <item | |
| 19 | + android:color="#00000000" | |
| 20 | + android:offset="1.0" /> | |
| 21 | + </gradient> | |
| 22 | + </aapt:attr> | |
| 23 | + </path> | |
| 24 | + <path | |
| 25 | + android:fillColor="#FFFFFF" | |
| 26 | + android:fillType="nonZero" | |
| 27 | + android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z" | |
| 28 | + android:strokeWidth="1" | |
| 29 | + android:strokeColor="#00000000" /> | |
| 30 | +</vector> | |
| 0 | 31 | \ No newline at end of file | ... | ... |
app/src/main/res/drawable/ic_launcher_background.xml
0 → 100644
| 1 | +++ a/app/src/main/res/drawable/ic_launcher_background.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:width="108dp" | |
| 4 | + android:height="108dp" | |
| 5 | + android:viewportWidth="108" | |
| 6 | + android:viewportHeight="108"> | |
| 7 | + <path | |
| 8 | + android:fillColor="#3DDC84" | |
| 9 | + android:pathData="M0,0h108v108h-108z" /> | |
| 10 | + <path | |
| 11 | + android:fillColor="#00000000" | |
| 12 | + android:pathData="M9,0L9,108" | |
| 13 | + android:strokeWidth="0.8" | |
| 14 | + android:strokeColor="#33FFFFFF" /> | |
| 15 | + <path | |
| 16 | + android:fillColor="#00000000" | |
| 17 | + android:pathData="M19,0L19,108" | |
| 18 | + android:strokeWidth="0.8" | |
| 19 | + android:strokeColor="#33FFFFFF" /> | |
| 20 | + <path | |
| 21 | + android:fillColor="#00000000" | |
| 22 | + android:pathData="M29,0L29,108" | |
| 23 | + android:strokeWidth="0.8" | |
| 24 | + android:strokeColor="#33FFFFFF" /> | |
| 25 | + <path | |
| 26 | + android:fillColor="#00000000" | |
| 27 | + android:pathData="M39,0L39,108" | |
| 28 | + android:strokeWidth="0.8" | |
| 29 | + android:strokeColor="#33FFFFFF" /> | |
| 30 | + <path | |
| 31 | + android:fillColor="#00000000" | |
| 32 | + android:pathData="M49,0L49,108" | |
| 33 | + android:strokeWidth="0.8" | |
| 34 | + android:strokeColor="#33FFFFFF" /> | |
| 35 | + <path | |
| 36 | + android:fillColor="#00000000" | |
| 37 | + android:pathData="M59,0L59,108" | |
| 38 | + android:strokeWidth="0.8" | |
| 39 | + android:strokeColor="#33FFFFFF" /> | |
| 40 | + <path | |
| 41 | + android:fillColor="#00000000" | |
| 42 | + android:pathData="M69,0L69,108" | |
| 43 | + android:strokeWidth="0.8" | |
| 44 | + android:strokeColor="#33FFFFFF" /> | |
| 45 | + <path | |
| 46 | + android:fillColor="#00000000" | |
| 47 | + android:pathData="M79,0L79,108" | |
| 48 | + android:strokeWidth="0.8" | |
| 49 | + android:strokeColor="#33FFFFFF" /> | |
| 50 | + <path | |
| 51 | + android:fillColor="#00000000" | |
| 52 | + android:pathData="M89,0L89,108" | |
| 53 | + android:strokeWidth="0.8" | |
| 54 | + android:strokeColor="#33FFFFFF" /> | |
| 55 | + <path | |
| 56 | + android:fillColor="#00000000" | |
| 57 | + android:pathData="M99,0L99,108" | |
| 58 | + android:strokeWidth="0.8" | |
| 59 | + android:strokeColor="#33FFFFFF" /> | |
| 60 | + <path | |
| 61 | + android:fillColor="#00000000" | |
| 62 | + android:pathData="M0,9L108,9" | |
| 63 | + android:strokeWidth="0.8" | |
| 64 | + android:strokeColor="#33FFFFFF" /> | |
| 65 | + <path | |
| 66 | + android:fillColor="#00000000" | |
| 67 | + android:pathData="M0,19L108,19" | |
| 68 | + android:strokeWidth="0.8" | |
| 69 | + android:strokeColor="#33FFFFFF" /> | |
| 70 | + <path | |
| 71 | + android:fillColor="#00000000" | |
| 72 | + android:pathData="M0,29L108,29" | |
| 73 | + android:strokeWidth="0.8" | |
| 74 | + android:strokeColor="#33FFFFFF" /> | |
| 75 | + <path | |
| 76 | + android:fillColor="#00000000" | |
| 77 | + android:pathData="M0,39L108,39" | |
| 78 | + android:strokeWidth="0.8" | |
| 79 | + android:strokeColor="#33FFFFFF" /> | |
| 80 | + <path | |
| 81 | + android:fillColor="#00000000" | |
| 82 | + android:pathData="M0,49L108,49" | |
| 83 | + android:strokeWidth="0.8" | |
| 84 | + android:strokeColor="#33FFFFFF" /> | |
| 85 | + <path | |
| 86 | + android:fillColor="#00000000" | |
| 87 | + android:pathData="M0,59L108,59" | |
| 88 | + android:strokeWidth="0.8" | |
| 89 | + android:strokeColor="#33FFFFFF" /> | |
| 90 | + <path | |
| 91 | + android:fillColor="#00000000" | |
| 92 | + android:pathData="M0,69L108,69" | |
| 93 | + android:strokeWidth="0.8" | |
| 94 | + android:strokeColor="#33FFFFFF" /> | |
| 95 | + <path | |
| 96 | + android:fillColor="#00000000" | |
| 97 | + android:pathData="M0,79L108,79" | |
| 98 | + android:strokeWidth="0.8" | |
| 99 | + android:strokeColor="#33FFFFFF" /> | |
| 100 | + <path | |
| 101 | + android:fillColor="#00000000" | |
| 102 | + android:pathData="M0,89L108,89" | |
| 103 | + android:strokeWidth="0.8" | |
| 104 | + android:strokeColor="#33FFFFFF" /> | |
| 105 | + <path | |
| 106 | + android:fillColor="#00000000" | |
| 107 | + android:pathData="M0,99L108,99" | |
| 108 | + android:strokeWidth="0.8" | |
| 109 | + android:strokeColor="#33FFFFFF" /> | |
| 110 | + <path | |
| 111 | + android:fillColor="#00000000" | |
| 112 | + android:pathData="M19,29L89,29" | |
| 113 | + android:strokeWidth="0.8" | |
| 114 | + android:strokeColor="#33FFFFFF" /> | |
| 115 | + <path | |
| 116 | + android:fillColor="#00000000" | |
| 117 | + android:pathData="M19,39L89,39" | |
| 118 | + android:strokeWidth="0.8" | |
| 119 | + android:strokeColor="#33FFFFFF" /> | |
| 120 | + <path | |
| 121 | + android:fillColor="#00000000" | |
| 122 | + android:pathData="M19,49L89,49" | |
| 123 | + android:strokeWidth="0.8" | |
| 124 | + android:strokeColor="#33FFFFFF" /> | |
| 125 | + <path | |
| 126 | + android:fillColor="#00000000" | |
| 127 | + android:pathData="M19,59L89,59" | |
| 128 | + android:strokeWidth="0.8" | |
| 129 | + android:strokeColor="#33FFFFFF" /> | |
| 130 | + <path | |
| 131 | + android:fillColor="#00000000" | |
| 132 | + android:pathData="M19,69L89,69" | |
| 133 | + android:strokeWidth="0.8" | |
| 134 | + android:strokeColor="#33FFFFFF" /> | |
| 135 | + <path | |
| 136 | + android:fillColor="#00000000" | |
| 137 | + android:pathData="M19,79L89,79" | |
| 138 | + android:strokeWidth="0.8" | |
| 139 | + android:strokeColor="#33FFFFFF" /> | |
| 140 | + <path | |
| 141 | + android:fillColor="#00000000" | |
| 142 | + android:pathData="M29,19L29,89" | |
| 143 | + android:strokeWidth="0.8" | |
| 144 | + android:strokeColor="#33FFFFFF" /> | |
| 145 | + <path | |
| 146 | + android:fillColor="#00000000" | |
| 147 | + android:pathData="M39,19L39,89" | |
| 148 | + android:strokeWidth="0.8" | |
| 149 | + android:strokeColor="#33FFFFFF" /> | |
| 150 | + <path | |
| 151 | + android:fillColor="#00000000" | |
| 152 | + android:pathData="M49,19L49,89" | |
| 153 | + android:strokeWidth="0.8" | |
| 154 | + android:strokeColor="#33FFFFFF" /> | |
| 155 | + <path | |
| 156 | + android:fillColor="#00000000" | |
| 157 | + android:pathData="M59,19L59,89" | |
| 158 | + android:strokeWidth="0.8" | |
| 159 | + android:strokeColor="#33FFFFFF" /> | |
| 160 | + <path | |
| 161 | + android:fillColor="#00000000" | |
| 162 | + android:pathData="M69,19L69,89" | |
| 163 | + android:strokeWidth="0.8" | |
| 164 | + android:strokeColor="#33FFFFFF" /> | |
| 165 | + <path | |
| 166 | + android:fillColor="#00000000" | |
| 167 | + android:pathData="M79,19L79,89" | |
| 168 | + android:strokeWidth="0.8" | |
| 169 | + android:strokeColor="#33FFFFFF" /> | |
| 170 | +</vector> | ... | ... |
app/src/main/res/layout/activity_main.xml
0 → 100644
| 1 | +++ a/app/src/main/res/layout/activity_main.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | |
| 4 | + xmlns:tools="http://schemas.android.com/tools"> | |
| 5 | + | |
| 6 | + <data> | |
| 7 | + | |
| 8 | + </data> | |
| 9 | + | |
| 10 | + <RelativeLayout | |
| 11 | + android:layout_width="match_parent" | |
| 12 | + android:layout_height="match_parent" | |
| 13 | + tools:context=".MainActivity"> | |
| 14 | + | |
| 15 | + <Button | |
| 16 | + android:id="@+id/gogg" | |
| 17 | + android:layout_width="wrap_content" | |
| 18 | + android:layout_height="wrap_content" | |
| 19 | + android:layout_centerInParent="true" | |
| 20 | + android:text="跳转发布" | |
| 21 | + /> | |
| 22 | + | |
| 23 | + </RelativeLayout> | |
| 24 | +</layout> | |
| 0 | 25 | \ No newline at end of file | ... | ... |
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
0 → 100644
| 1 | +++ a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + <background android:drawable="@drawable/ic_launcher_background" /> | |
| 4 | + <foreground android:drawable="@drawable/ic_launcher_foreground" /> | |
| 5 | +</adaptive-icon> | |
| 0 | 6 | \ No newline at end of file | ... | ... |
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
0 → 100644
| 1 | +++ a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + <background android:drawable="@drawable/ic_launcher_background" /> | |
| 4 | + <foreground android:drawable="@drawable/ic_launcher_foreground" /> | |
| 5 | +</adaptive-icon> | |
| 0 | 6 | \ No newline at end of file | ... | ... |
app/src/main/res/mipmap-hdpi/ic_launcher.png
0 → 100644
3.51 KB
app/src/main/res/mipmap-hdpi/ic_launcher_round.png
0 → 100644
5.21 KB
app/src/main/res/mipmap-mdpi/ic_launcher.png
0 → 100644
2.57 KB
app/src/main/res/mipmap-mdpi/ic_launcher_round.png
0 → 100644
3.31 KB
app/src/main/res/mipmap-xhdpi/ic_launcher.png
0 → 100644
4.81 KB
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
0 → 100644
7.3 KB
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
0 → 100644
7.72 KB
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
0 → 100644
11.6 KB
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
0 → 100644
10.4 KB
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
0 → 100644
16.2 KB
app/src/main/res/values/colors.xml
0 → 100644
app/src/main/res/values/strings.xml
0 → 100644
app/src/main/res/values/styles.xml
0 → 100644
| 1 | +++ a/app/src/main/res/values/styles.xml | |
| 1 | +<resources> | |
| 2 | + <!-- Base application theme. --> | |
| 3 | + <style name="AppTheme" parent="QMUI.Compat.NoActionBar"> | |
| 4 | + <!-- 配置Android提供的theme --> | |
| 5 | + <item name="android:listPreferredItemHeight">?attr/qmui_list_item_height_higher</item> | |
| 6 | + <item name="android:listPreferredItemHeightSmall">?attr/qmui_list_item_height</item> | |
| 7 | + <item name="colorPrimaryDark">@color/transparent</item> | |
| 8 | + <!-- 配置qmui提供的theme --> | |
| 9 | + <item name="qmui_config_color_blue">@color/white</item> | |
| 10 | + <item name="qmui_round_btn_bg_color">@color/white</item> | |
| 11 | + <item name="qmui_content_spacing_horizontal">20dp</item> | |
| 12 | + <item name="qmui_content_padding_horizontal">@dimen/qmui_content_spacing_horizontal</item> | |
| 13 | + | |
| 14 | + <item name="qmui_bottom_sheet_grid_item_mini_width">96dp</item> | |
| 15 | + </style> | |
| 16 | + | |
| 17 | +</resources> | |
| 0 | 18 | \ No newline at end of file | ... | ... |
app/src/test/java/com/cnlive/publishingworks/ExampleUnitTest.java
0 → 100644
| 1 | +++ a/app/src/test/java/com/cnlive/publishingworks/ExampleUnitTest.java | |
| 1 | +package com.cnlive.publishingworks; | |
| 2 | + | |
| 3 | +import org.junit.Test; | |
| 4 | + | |
| 5 | +import static org.junit.Assert.*; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Example local unit test, which will execute on the development machine (host). | |
| 9 | + * | |
| 10 | + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | |
| 11 | + */ | |
| 12 | +public class ExampleUnitTest { | |
| 13 | + @Test | |
| 14 | + public void addition_isCorrect() { | |
| 15 | + assertEquals(4, 2 + 2); | |
| 16 | + } | |
| 17 | +} | |
| 0 | 18 | \ No newline at end of file | ... | ... |
build.gradle
0 → 100644
| 1 | +++ a/build.gradle | |
| 1 | +// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
| 2 | +apply from: "config.gradle" | |
| 3 | + | |
| 4 | +buildscript { | |
| 5 | + repositories { | |
| 6 | + google() | |
| 7 | + jcenter() | |
| 8 | + } | |
| 9 | + dependencies { | |
| 10 | + classpath "com.android.tools.build:gradle:3.5.0" | |
| 11 | + | |
| 12 | + // NOTE: Do not place your application dependencies here; they belong | |
| 13 | + // in the individual module build.gradle files | |
| 14 | + } | |
| 15 | +} | |
| 16 | + | |
| 17 | +allprojects { | |
| 18 | + repositories { | |
| 19 | + google() | |
| 20 | + jcenter() | |
| 21 | + maven { | |
| 22 | + url maven.mavenMixedUrl | |
| 23 | + credentials { username = nexusId;password = nexusPw } | |
| 24 | + } | |
| 25 | + | |
| 26 | + maven { | |
| 27 | + url "https://jitpack.io" | |
| 28 | + } | |
| 29 | + maven { | |
| 30 | + url 'https://dl.bintray.com/granzon/cnlive' | |
| 31 | + } | |
| 32 | + maven { | |
| 33 | + url 'https://dl.bintray.com/granzon/cnliveLibs' | |
| 34 | + } | |
| 35 | + } | |
| 36 | +} | |
| 37 | + | |
| 38 | +task clean(type: Delete) { | |
| 39 | + delete rootProject.buildDir | |
| 40 | +} | |
| 41 | + | |
| 42 | +ext { | |
| 43 | + supportV4 = '27.1.0' | |
| 44 | + appcompatV7 = '27.1.0' | |
| 45 | + recyclerviewV7 = '27.1.0' | |
| 46 | + constraintLayout = '1.1.2' | |
| 47 | + //androidX | |
| 48 | + androidXAppcompat = '1.0.0' | |
| 49 | + androidXRecyclerview = '1.0.0' | |
| 50 | + androidXConstraintlayout = '1.1.3' | |
| 51 | + | |
| 52 | + androidX_legacy_support_v4 = '1.0.0' | |
| 53 | + | |
| 54 | + glide = '4.11.0' | |
| 55 | + glideTransformations = '4.1.0' | |
| 56 | + compiler = '4.11.0' | |
| 57 | + | |
| 58 | + easypermissions = '1.0.0' | |
| 59 | + rotatephotoview = '1.0.5' | |
| 60 | + | |
| 61 | + libCnUtil = '3.1.0' | |
| 62 | + libCnVideo = '3.2.3' | |
| 63 | + | |
| 64 | + qmui = '1.1.5' | |
| 65 | + | |
| 66 | + libLargeImage = '1.0.4-androidx' | |
| 67 | + libBase = '1.9.5.9-androidx' | |
| 68 | + libVideoQiniu = '1.0.7.2' | |
| 69 | + | |
| 70 | + //阿里路由框架 | |
| 71 | + arouterApiVersion = '1.5.0' | |
| 72 | + arouterCompilerVersion = '1.2.1' | |
| 73 | + libNewMediaPicker = '1.0.2.7' | |
| 74 | + qmui = '1.1.5' | |
| 75 | + libEmoj = '2.2.3.6-androidx' | |
| 76 | + location = 'latest.integration' | |
| 77 | + | |
| 78 | + appArch = '1.3.6.5-androidx' | |
| 79 | + //视频库 | |
| 80 | + libVideoQiniu = '1.0.7-androidx' | |
| 81 | + //七牛 | |
| 82 | + qiniuAndroidSdk = '7.4.3' | |
| 83 | + //greendao | |
| 84 | + greendao = '3.3.0' | |
| 85 | + | |
| 86 | +} | |
| 0 | 87 | \ No newline at end of file | ... | ... |
config.gradle
0 → 100644
| 1 | +++ a/config.gradle | |
| 1 | +ext { | |
| 2 | + //Nexus 访问账号 | |
| 3 | + nexusId = "developer" | |
| 4 | + nexusPw = "android_2019" | |
| 5 | + | |
| 6 | + //Nexus 发布配置 | |
| 7 | + maven = [ | |
| 8 | + //发布版地址(暂未使用) | |
| 9 | + mavenUrl : "http://android.nexus.cnlive.com/repository/cnlive/", | |
| 10 | + //快照版地址(暂未使用) | |
| 11 | + mavenDevUrl : "http://android.nexus.cnlive.com/repository/cnlive-snapshot/", | |
| 12 | + //混合版地址 | |
| 13 | + mavenMixedUrl : "http://android.nexus.cnlive.com/repository/cnlive-mixed/", | |
| 14 | + //发布账号(单独分配) | |
| 15 | + mavenUserName: "developer", | |
| 16 | + mavenPwd : "android_2019" | |
| 17 | + ] | |
| 18 | + | |
| 19 | + //Maven Base库配置 | |
| 20 | + out_shared = [ | |
| 21 | + //编译方式 | |
| 22 | + debug : false, | |
| 23 | + //版本号 | |
| 24 | + version: "1.0.0.0", | |
| 25 | + //Lib库前缀 | |
| 26 | + packeg : "com.cnlive.publish", | |
| 27 | + //Lib库名称 | |
| 28 | + name : "publish_works" | |
| 29 | + ] | |
| 30 | + | |
| 31 | + action = [ | |
| 32 | + ACTION_SHARE_RELEASE : "netpp.intent.action.SHARE_RELEASE", | |
| 33 | + ] | |
| 34 | +} | |
| 0 | 35 | \ No newline at end of file | ... | ... |
gradle.properties
0 → 100644
| 1 | +++ a/gradle.properties | |
| 1 | +# Project-wide Gradle settings. | |
| 2 | +# IDE (e.g. Android Studio) users: | |
| 3 | +# Gradle settings configured through the IDE *will override* | |
| 4 | +# any settings specified in this file. | |
| 5 | +# For more details on how to configure your build environment visit | |
| 6 | +# http://www.gradle.org/docs/current/userguide/build_environment.html | |
| 7 | +# Specifies the JVM arguments used for the daemon process. | |
| 8 | +# The setting is particularly useful for tweaking memory settings. | |
| 9 | +org.gradle.jvmargs=-Xmx2048m | |
| 10 | +# When configured, Gradle will run in incubating parallel mode. | |
| 11 | +# This option should only be used with decoupled projects. More details, visit | |
| 12 | +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | |
| 13 | +# org.gradle.parallel=true | |
| 14 | +# AndroidX package structure to make it clearer which packages are bundled with the | |
| 15 | +# Android operating system, and which are packaged with your app"s APK | |
| 16 | +# https://developer.android.com/topic/libraries/support-library/androidx-rn | |
| 17 | +android.useAndroidX=true | |
| 18 | +android.injected.testOnly=false | |
| 19 | +# Automatically convert third-party libraries to use AndroidX | |
| 20 | +android.enableJetifier=true | |
| 0 | 21 | \ No newline at end of file | ... | ... |
gradle/wrapper/gradle-wrapper.jar
0 → 100644
No preview for this file type
gradle/wrapper/gradle-wrapper.properties
0 → 100644
| 1 | +++ a/gradle/wrapper/gradle-wrapper.properties | |
| 1 | +#Wed Nov 11 16:27:07 CST 2020 | |
| 2 | +distributionBase=GRADLE_USER_HOME | |
| 3 | +distributionPath=wrapper/dists | |
| 4 | +zipStoreBase=GRADLE_USER_HOME | |
| 5 | +zipStorePath=wrapper/dists | |
| 6 | +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip | ... | ... |
gradlew
0 → 100644
| 1 | +++ a/gradlew | |
| 1 | +#!/usr/bin/env sh | |
| 2 | + | |
| 3 | +############################################################################## | |
| 4 | +## | |
| 5 | +## Gradle start up script for UN*X | |
| 6 | +## | |
| 7 | +############################################################################## | |
| 8 | + | |
| 9 | +# Attempt to set APP_HOME | |
| 10 | +# Resolve links: $0 may be a link | |
| 11 | +PRG="$0" | |
| 12 | +# Need this for relative symlinks. | |
| 13 | +while [ -h "$PRG" ] ; do | |
| 14 | + ls=`ls -ld "$PRG"` | |
| 15 | + link=`expr "$ls" : '.*-> \(.*\)$'` | |
| 16 | + if expr "$link" : '/.*' > /dev/null; then | |
| 17 | + PRG="$link" | |
| 18 | + else | |
| 19 | + PRG=`dirname "$PRG"`"/$link" | |
| 20 | + fi | |
| 21 | +done | |
| 22 | +SAVED="`pwd`" | |
| 23 | +cd "`dirname \"$PRG\"`/" >/dev/null | |
| 24 | +APP_HOME="`pwd -P`" | |
| 25 | +cd "$SAVED" >/dev/null | |
| 26 | + | |
| 27 | +APP_NAME="Gradle" | |
| 28 | +APP_BASE_NAME=`basename "$0"` | |
| 29 | + | |
| 30 | +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | |
| 31 | +DEFAULT_JVM_OPTS="" | |
| 32 | + | |
| 33 | +# Use the maximum available, or set MAX_FD != -1 to use that value. | |
| 34 | +MAX_FD="maximum" | |
| 35 | + | |
| 36 | +warn () { | |
| 37 | + echo "$*" | |
| 38 | +} | |
| 39 | + | |
| 40 | +die () { | |
| 41 | + echo | |
| 42 | + echo "$*" | |
| 43 | + echo | |
| 44 | + exit 1 | |
| 45 | +} | |
| 46 | + | |
| 47 | +# OS specific support (must be 'true' or 'false'). | |
| 48 | +cygwin=false | |
| 49 | +msys=false | |
| 50 | +darwin=false | |
| 51 | +nonstop=false | |
| 52 | +case "`uname`" in | |
| 53 | + CYGWIN* ) | |
| 54 | + cygwin=true | |
| 55 | + ;; | |
| 56 | + Darwin* ) | |
| 57 | + darwin=true | |
| 58 | + ;; | |
| 59 | + MINGW* ) | |
| 60 | + msys=true | |
| 61 | + ;; | |
| 62 | + NONSTOP* ) | |
| 63 | + nonstop=true | |
| 64 | + ;; | |
| 65 | +esac | |
| 66 | + | |
| 67 | +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar | |
| 68 | + | |
| 69 | +# Determine the Java command to use to start the JVM. | |
| 70 | +if [ -n "$JAVA_HOME" ] ; then | |
| 71 | + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | |
| 72 | + # IBM's JDK on AIX uses strange locations for the executables | |
| 73 | + JAVACMD="$JAVA_HOME/jre/sh/java" | |
| 74 | + else | |
| 75 | + JAVACMD="$JAVA_HOME/bin/java" | |
| 76 | + fi | |
| 77 | + if [ ! -x "$JAVACMD" ] ; then | |
| 78 | + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME | |
| 79 | + | |
| 80 | +Please set the JAVA_HOME variable in your environment to match the | |
| 81 | +location of your Java installation." | |
| 82 | + fi | |
| 83 | +else | |
| 84 | + JAVACMD="java" | |
| 85 | + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | |
| 86 | + | |
| 87 | +Please set the JAVA_HOME variable in your environment to match the | |
| 88 | +location of your Java installation." | |
| 89 | +fi | |
| 90 | + | |
| 91 | +# Increase the maximum file descriptors if we can. | |
| 92 | +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then | |
| 93 | + MAX_FD_LIMIT=`ulimit -H -n` | |
| 94 | + if [ $? -eq 0 ] ; then | |
| 95 | + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then | |
| 96 | + MAX_FD="$MAX_FD_LIMIT" | |
| 97 | + fi | |
| 98 | + ulimit -n $MAX_FD | |
| 99 | + if [ $? -ne 0 ] ; then | |
| 100 | + warn "Could not set maximum file descriptor limit: $MAX_FD" | |
| 101 | + fi | |
| 102 | + else | |
| 103 | + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" | |
| 104 | + fi | |
| 105 | +fi | |
| 106 | + | |
| 107 | +# For Darwin, add options to specify how the application appears in the dock | |
| 108 | +if $darwin; then | |
| 109 | + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" | |
| 110 | +fi | |
| 111 | + | |
| 112 | +# For Cygwin, switch paths to Windows format before running java | |
| 113 | +if $cygwin ; then | |
| 114 | + APP_HOME=`cygpath --path --mixed "$APP_HOME"` | |
| 115 | + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` | |
| 116 | + JAVACMD=`cygpath --unix "$JAVACMD"` | |
| 117 | + | |
| 118 | + # We build the pattern for arguments to be converted via cygpath | |
| 119 | + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` | |
| 120 | + SEP="" | |
| 121 | + for dir in $ROOTDIRSRAW ; do | |
| 122 | + ROOTDIRS="$ROOTDIRS$SEP$dir" | |
| 123 | + SEP="|" | |
| 124 | + done | |
| 125 | + OURCYGPATTERN="(^($ROOTDIRS))" | |
| 126 | + # Add a user-defined pattern to the cygpath arguments | |
| 127 | + if [ "$GRADLE_CYGPATTERN" != "" ] ; then | |
| 128 | + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" | |
| 129 | + fi | |
| 130 | + # Now convert the arguments - kludge to limit ourselves to /bin/sh | |
| 131 | + i=0 | |
| 132 | + for arg in "$@" ; do | |
| 133 | + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` | |
| 134 | + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option | |
| 135 | + | |
| 136 | + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition | |
| 137 | + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` | |
| 138 | + else | |
| 139 | + eval `echo args$i`="\"$arg\"" | |
| 140 | + fi | |
| 141 | + i=$((i+1)) | |
| 142 | + done | |
| 143 | + case $i in | |
| 144 | + (0) set -- ;; | |
| 145 | + (1) set -- "$args0" ;; | |
| 146 | + (2) set -- "$args0" "$args1" ;; | |
| 147 | + (3) set -- "$args0" "$args1" "$args2" ;; | |
| 148 | + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; | |
| 149 | + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; | |
| 150 | + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; | |
| 151 | + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; | |
| 152 | + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; | |
| 153 | + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; | |
| 154 | + esac | |
| 155 | +fi | |
| 156 | + | |
| 157 | +# Escape application args | |
| 158 | +save () { | |
| 159 | + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done | |
| 160 | + echo " " | |
| 161 | +} | |
| 162 | +APP_ARGS=$(save "$@") | |
| 163 | + | |
| 164 | +# Collect all arguments for the java command, following the shell quoting and substitution rules | |
| 165 | +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" | |
| 166 | + | |
| 167 | +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong | |
| 168 | +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then | |
| 169 | + cd "$(dirname "$0")" | |
| 170 | +fi | |
| 171 | + | |
| 172 | +exec "$JAVACMD" "$@" | ... | ... |
gradlew.bat
0 → 100644
| 1 | +++ a/gradlew.bat | |
| 1 | +@if "%DEBUG%" == "" @echo off | |
| 2 | +@rem ########################################################################## | |
| 3 | +@rem | |
| 4 | +@rem Gradle startup script for Windows | |
| 5 | +@rem | |
| 6 | +@rem ########################################################################## | |
| 7 | + | |
| 8 | +@rem Set local scope for the variables with windows NT shell | |
| 9 | +if "%OS%"=="Windows_NT" setlocal | |
| 10 | + | |
| 11 | +set DIRNAME=%~dp0 | |
| 12 | +if "%DIRNAME%" == "" set DIRNAME=. | |
| 13 | +set APP_BASE_NAME=%~n0 | |
| 14 | +set APP_HOME=%DIRNAME% | |
| 15 | + | |
| 16 | +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | |
| 17 | +set DEFAULT_JVM_OPTS= | |
| 18 | + | |
| 19 | +@rem Find java.exe | |
| 20 | +if defined JAVA_HOME goto findJavaFromJavaHome | |
| 21 | + | |
| 22 | +set JAVA_EXE=java.exe | |
| 23 | +%JAVA_EXE% -version >NUL 2>&1 | |
| 24 | +if "%ERRORLEVEL%" == "0" goto init | |
| 25 | + | |
| 26 | +echo. | |
| 27 | +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | |
| 28 | +echo. | |
| 29 | +echo Please set the JAVA_HOME variable in your environment to match the | |
| 30 | +echo location of your Java installation. | |
| 31 | + | |
| 32 | +goto fail | |
| 33 | + | |
| 34 | +:findJavaFromJavaHome | |
| 35 | +set JAVA_HOME=%JAVA_HOME:"=% | |
| 36 | +set JAVA_EXE=%JAVA_HOME%/bin/java.exe | |
| 37 | + | |
| 38 | +if exist "%JAVA_EXE%" goto init | |
| 39 | + | |
| 40 | +echo. | |
| 41 | +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% | |
| 42 | +echo. | |
| 43 | +echo Please set the JAVA_HOME variable in your environment to match the | |
| 44 | +echo location of your Java installation. | |
| 45 | + | |
| 46 | +goto fail | |
| 47 | + | |
| 48 | +:init | |
| 49 | +@rem Get command-line arguments, handling Windows variants | |
| 50 | + | |
| 51 | +if not "%OS%" == "Windows_NT" goto win9xME_args | |
| 52 | + | |
| 53 | +:win9xME_args | |
| 54 | +@rem Slurp the command line arguments. | |
| 55 | +set CMD_LINE_ARGS= | |
| 56 | +set _SKIP=2 | |
| 57 | + | |
| 58 | +:win9xME_args_slurp | |
| 59 | +if "x%~1" == "x" goto execute | |
| 60 | + | |
| 61 | +set CMD_LINE_ARGS=%* | |
| 62 | + | |
| 63 | +:execute | |
| 64 | +@rem Setup the command line | |
| 65 | + | |
| 66 | +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar | |
| 67 | + | |
| 68 | +@rem Execute Gradle | |
| 69 | +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% | |
| 70 | + | |
| 71 | +:end | |
| 72 | +@rem End local scope for the variables with windows NT shell | |
| 73 | +if "%ERRORLEVEL%"=="0" goto mainEnd | |
| 74 | + | |
| 75 | +:fail | |
| 76 | +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of | |
| 77 | +rem the _cmd.exe /c_ return code! | |
| 78 | +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 | |
| 79 | +exit /b 1 | |
| 80 | + | |
| 81 | +:mainEnd | |
| 82 | +if "%OS%"=="Windows_NT" endlocal | |
| 83 | + | |
| 84 | +:omega | ... | ... |
publish/.gitignore
0 → 100644
publish/build.gradle
0 → 100644
| 1 | +++ a/publish/build.gradle | |
| 1 | +apply plugin: 'com.android.library' | |
| 2 | + | |
| 3 | +android { | |
| 4 | + compileSdkVersion = 29 | |
| 5 | + buildToolsVersion = "29.0.2" | |
| 6 | + | |
| 7 | + defaultConfig { | |
| 8 | + minSdkVersion 19 | |
| 9 | + targetSdkVersion 29 | |
| 10 | + versionCode 1 | |
| 11 | + versionName "1.0" | |
| 12 | + multiDexEnabled true | |
| 13 | + javaCompileOptions { | |
| 14 | + annotationProcessorOptions { | |
| 15 | + arguments = [AROUTER_MODULE_NAME: project.getName(), AROUTER_GENERATE_DOC: "enable"] | |
| 16 | + } | |
| 17 | + } | |
| 18 | + } | |
| 19 | + | |
| 20 | + buildTypes { | |
| 21 | + release { | |
| 22 | + minifyEnabled false | |
| 23 | + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | |
| 24 | + } | |
| 25 | + } | |
| 26 | + | |
| 27 | + compileOptions { | |
| 28 | + sourceCompatibility JavaVersion.VERSION_1_8 | |
| 29 | + targetCompatibility JavaVersion.VERSION_1_8 | |
| 30 | + } | |
| 31 | + | |
| 32 | + dataBinding { | |
| 33 | + enabled true | |
| 34 | + } | |
| 35 | + | |
| 36 | + dexOptions { | |
| 37 | + javaMaxHeapSize '4g' | |
| 38 | + } | |
| 39 | +} | |
| 40 | + | |
| 41 | +dependencies { | |
| 42 | + implementation fileTree(dir: "libs", include: ["*.jar"]) | |
| 43 | + implementation "androidx.legacy:legacy-support-v4:$rootProject.androidX_legacy_support_v4" | |
| 44 | + implementation "androidx.appcompat:appcompat:$rootProject.androidXAppcompat" | |
| 45 | + implementation "androidx.recyclerview:recyclerview:$rootProject.androidXRecyclerview" | |
| 46 | + implementation "androidx.constraintlayout:constraintlayout:$rootProject.androidXConstraintlayout" | |
| 47 | + implementation 'androidx.multidex:multidex:2.0.0' | |
| 48 | + implementation "com.cnlive.libs:base:$rootProject.libBase" | |
| 49 | + | |
| 50 | + //glide | |
| 51 | + implementation "com.github.bumptech.glide:glide:$rootProject.glide" | |
| 52 | + implementation "jp.wasabeef:glide-transformations:$rootProject.glideTransformations" | |
| 53 | + annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.compiler" | |
| 54 | + | |
| 55 | + implementation "pub.devrel:easypermissions:$rootProject.easypermissions" | |
| 56 | + implementation "com.chensl.rotatephotoview:rotatephotoview:$rootProject.rotatephotoview" | |
| 57 | + implementation "com.qmuiteam:qmui:$rootProject.qmui" | |
| 58 | + | |
| 59 | + implementation "com.alibaba:arouter-api:$rootProject.arouterApiVersion" | |
| 60 | + annotationProcessor "com.alibaba:arouter-compiler:$rootProject.arouterCompilerVersion" | |
| 61 | + implementation "com.cnlive.libs:arch:$rootProject.appArch" | |
| 62 | + implementation "com.cnlive.media:NewMediaPicker:$rootProject.libNewMediaPicker" | |
| 63 | + implementation "com.cnlive.libs:emoj:$rootProject.libEmoj" | |
| 64 | +//高德地图-定位服务 | |
| 65 | + implementation "com.amap.api:location:$rootProject.location" | |
| 66 | + implementation "com.cnlive.libs:video_qiniu:$rootProject.libVideoQiniu" | |
| 67 | + | |
| 68 | + //七牛上传 | |
| 69 | + implementation "com.qiniu:qiniu-android-sdk:$rootProject.qiniuAndroidSdk" | |
| 70 | +//GreenDao | |
| 71 | + api "org.greenrobot:greendao:$rootProject.greendao" | |
| 72 | + //implementation project(':lib_network') | |
| 73 | + | |
| 74 | +} | |
| 0 | 75 | \ No newline at end of file | ... | ... |
publish/consumer-rules.pro
0 → 100644
| 1 | +++ a/publish/consumer-rules.pro | ... | ... |
publish/proguard-rules.pro
0 → 100644
| 1 | +++ a/publish/proguard-rules.pro | |
| 1 | +# Add project specific ProGuard rules here. | |
| 2 | +# You can control the set of applied configuration files using the | |
| 3 | +# proguardFiles setting in build.gradle. | |
| 4 | +# | |
| 5 | +# For more details, see | |
| 6 | +# http://developer.android.com/guide/developing/tools/proguard.html | |
| 7 | + | |
| 8 | +# If your project uses WebView with JS, uncomment the following | |
| 9 | +# and specify the fully qualified class name to the JavaScript interface | |
| 10 | +# class: | |
| 11 | +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | |
| 12 | +# public *; | |
| 13 | +#} | |
| 14 | + | |
| 15 | +# Uncomment this to preserve the line number information for | |
| 16 | +# debugging stack traces. | |
| 17 | +#-keepattributes SourceFile,LineNumberTable | |
| 18 | + | |
| 19 | +# If you keep the line number information, uncomment this to | |
| 20 | +# hide the original source file name. | |
| 21 | +#-renamesourcefileattribute SourceFile | |
| 0 | 22 | \ No newline at end of file | ... | ... |
publish/src/androidTest/java/com/cnlive/publish/ExampleInstrumentedTest.java
0 → 100644
| 1 | +++ a/publish/src/androidTest/java/com/cnlive/publish/ExampleInstrumentedTest.java | |
| 1 | +package com.cnlive.publish; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | + | |
| 5 | +import androidx.test.platform.app.InstrumentationRegistry; | |
| 6 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | |
| 7 | + | |
| 8 | +import org.junit.Test; | |
| 9 | +import org.junit.runner.RunWith; | |
| 10 | + | |
| 11 | +import static org.junit.Assert.*; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * Instrumented test, which will execute on an Android device. | |
| 15 | + * | |
| 16 | + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | |
| 17 | + */ | |
| 18 | +@RunWith(AndroidJUnit4.class) | |
| 19 | +public class ExampleInstrumentedTest { | |
| 20 | + @Test | |
| 21 | + public void useAppContext() { | |
| 22 | + // Context of the app under test. | |
| 23 | + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | |
| 24 | + assertEquals("com.cnlive.publish.test", appContext.getPackageName()); | |
| 25 | + } | |
| 26 | +} | |
| 0 | 27 | \ No newline at end of file | ... | ... |
publish/src/main/AndroidManifest.xml
0 → 100644
| 1 | +++ a/publish/src/main/AndroidManifest.xml | |
| 1 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
| 2 | + package="com.cnlive.publish"> | |
| 3 | + | |
| 4 | + <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> | |
| 5 | + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | |
| 6 | + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | |
| 7 | + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | |
| 8 | + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | |
| 9 | + <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | |
| 10 | + <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" /> | |
| 11 | + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | |
| 12 | + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | |
| 13 | + <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> | |
| 14 | + <uses-permission android:name="android.permission.CAMERA" /> | |
| 15 | + <uses-permission android:name="android.permission.READ_CONTACTS" /> | |
| 16 | + <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> | |
| 17 | + <uses-permission android:name="android.permission.CALL_PHONE" /> | |
| 18 | + <uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE" /> | |
| 19 | + <uses-permission android:name="com.sec.android.provider.badge.permission.READ" /> | |
| 20 | + <uses-permission android:name="com.sec.android.provider.badge.permission.WRITE" /> | |
| 21 | + <uses-permission android:name="android.permission.VIBRATE" /> | |
| 22 | + <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> | |
| 23 | + <uses-permission android:name="android.permission.RECEIVE_SMS" /> | |
| 24 | + | |
| 25 | + <application | |
| 26 | + android:largeHeap="true"> | |
| 27 | + <activity | |
| 28 | + android:name="com.cnlive.publish.activity.ReleasePublishAcityity" | |
| 29 | + android:configChanges="keyboardHidden|screenSize|orientation|smallestScreenSize|screenLayout" | |
| 30 | + android:launchMode="singleTop" | |
| 31 | + android:screenOrientation="portrait" | |
| 32 | + android:windowSoftInputMode="stateHidden|adjustPan"> | |
| 33 | + | |
| 34 | + <!-- 系统分享 单个文件 --> | |
| 35 | + <intent-filter> | |
| 36 | + <action android:name="${ACTION_SHARE_RELEASE}" /> | |
| 37 | + | |
| 38 | + <category android:name="android.intent.category.DEFAULT" /> | |
| 39 | + <!-- 文字类型 --> | |
| 40 | + <data android:mimeType="text/plain" /> | |
| 41 | + </intent-filter> | |
| 42 | + </activity> | |
| 43 | + </application> | |
| 44 | +</manifest> | |
| 0 | 45 | \ No newline at end of file | ... | ... |
publish/src/main/java/com/cnlive/publish/activity/ReleasePublishAcityity.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/activity/ReleasePublishAcityity.java | |
| 1 | +package com.cnlive.publish.activity; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.content.Intent; | |
| 5 | +import android.net.Uri; | |
| 6 | +import android.os.Bundle; | |
| 7 | + | |
| 8 | +import com.alibaba.android.arouter.facade.annotation.Route; | |
| 9 | +import com.cnlive.libs.base.ui.IBackFragment; | |
| 10 | +import com.cnlive.libs.base.ui.QMUIFragment; | |
| 11 | +import com.cnlive.libs.base.ui.QMUIFragmentActivity; | |
| 12 | +import com.cnlive.libs.base.util.ShareReleaseInfoUtil; | |
| 13 | +import com.cnlive.media.media.entity.Media; | |
| 14 | +import com.cnlive.publish.R; | |
| 15 | +import com.cnlive.publish.fragment.ReleaseInfoEditFragment; | |
| 16 | +import com.cnlive.publish.util.StatusBarUtil; | |
| 17 | + | |
| 18 | + | |
| 19 | +import java.io.File; | |
| 20 | +import java.util.ArrayList; | |
| 21 | + | |
| 22 | +import androidx.annotation.NonNull; | |
| 23 | + | |
| 24 | +@Route(path = "/cnmain/ReleasePublishAcityity") | |
| 25 | +public class ReleasePublishAcityity extends QMUIFragmentActivity { | |
| 26 | + | |
| 27 | + public static final int REQUEST_CODE_SELECT_CAMERA = 10004; | |
| 28 | + public static final int REQUEST_CODE_SELECT_READ_WRITE = 10005; | |
| 29 | + public static final int REQUEST_CODE_SELECT_READ_WRITE_2 = 10006; | |
| 30 | + /* private String imgs; | |
| 31 | + private String textwit; | |
| 32 | + private String tagName; | |
| 33 | + private String witContentId; | |
| 34 | + private String videopath; | |
| 35 | + private String duration; | |
| 36 | + private String createtime; | |
| 37 | + private String taglist; | |
| 38 | + private String jumpType; | |
| 39 | + private String json;*/ | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 默认开启方式 不带任何数据 | |
| 43 | + * | |
| 44 | + * @param context | |
| 45 | + */ | |
| 46 | + public static void start(Context context) { | |
| 47 | + Intent intent = new Intent(context, ReleasePublishAcityity.class); | |
| 48 | + context.startActivity(intent); | |
| 49 | + } | |
| 50 | + | |
| 51 | + public static void start(Context context, int type) { | |
| 52 | + Intent intent = new Intent(context, ReleasePublishAcityity.class); | |
| 53 | + intent.putExtra("type", type); | |
| 54 | + context.startActivity(intent); | |
| 55 | + } | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 发布信息编辑模式 传入List<Media> | |
| 59 | + * | |
| 60 | + * @param context | |
| 61 | + */ | |
| 62 | + public static void start(Context context, ArrayList<Media> select) { | |
| 63 | + start(context, select, 0, "", "nocircle"); | |
| 64 | + } | |
| 65 | + | |
| 66 | + public static void start(Context context, ArrayList<Media> select, int type, String content, String isCircle) { | |
| 67 | + if (select == null) return; | |
| 68 | + Intent intent = new Intent(context, ReleasePublishAcityity.class); | |
| 69 | + intent.putParcelableArrayListExtra("select", select); | |
| 70 | + intent.putExtra("type", type); | |
| 71 | + intent.putExtra("content", content); | |
| 72 | + intent.putExtra("isCircle", isCircle); | |
| 73 | + context.startActivity(intent); | |
| 74 | + } | |
| 75 | + | |
| 76 | + @Override | |
| 77 | + protected int getContextViewId() { | |
| 78 | + return R.id.fragment_context; | |
| 79 | + } | |
| 80 | + | |
| 81 | + @Override | |
| 82 | + protected void onCreate(Bundle savedInstanceState) { | |
| 83 | + super.onCreate(savedInstanceState); | |
| 84 | + if (savedInstanceState != null) return; | |
| 85 | + StatusBarUtil.setStatusBarWrite(this); | |
| 86 | + //StatusBarUtil2.setColor(this, getResources().getColor(R.color.im_color_fff), 0); | |
| 87 | + QMUIFragment fragment = initShareDataFragment(getIntent()); | |
| 88 | + /*if (getIntent() != null && BuildConfig.ACTION_SHARE_RELEASE.equals(getIntent().getAction())) { | |
| 89 | + imgs = getIntent().getStringExtra("imgs"); | |
| 90 | + textwit = getIntent().getStringExtra("textwit"); | |
| 91 | + tagName = getIntent().getStringExtra("tagName"); | |
| 92 | + witContentId = getIntent().getStringExtra("witContentId"); | |
| 93 | + int type = getIntent().getIntExtra("type", 0); | |
| 94 | + videopath = getIntent().getStringExtra("videopath"); | |
| 95 | + duration = getIntent().getStringExtra("duration"); | |
| 96 | + createtime = getIntent().getStringExtra("createtime"); | |
| 97 | + taglist = getIntent().getStringExtra("taglist"); | |
| 98 | + jumpType = getIntent().getStringExtra("jumpType"); | |
| 99 | + json = getIntent().getStringExtra("json"); | |
| 100 | + if (type == 2) { | |
| 101 | + fragment = initEditDataFragment(getIntent()); | |
| 102 | + } | |
| 103 | + }*/ | |
| 104 | + | |
| 105 | + if (fragment == null) fragment = initEditDataFragment(getIntent()); | |
| 106 | + if (fragment == null) finish(); | |
| 107 | + else startFragment(fragment); | |
| 108 | + } | |
| 109 | + | |
| 110 | + @Override | |
| 111 | + protected void onNewIntent(Intent intent) { | |
| 112 | + super.onNewIntent(intent); | |
| 113 | + int type = intent.getIntExtra("type", 0); | |
| 114 | + if (type == 3) { | |
| 115 | + ArrayList<Media> select = intent.getParcelableArrayListExtra("select"); | |
| 116 | + String content = intent.getStringExtra("content"); | |
| 117 | + startFragment(ReleaseInfoEditFragment.newInstance(select, 3, content)); | |
| 118 | + } else { | |
| 119 | + QMUIFragment fragment = initShareDataFragment(intent); | |
| 120 | + if (fragment != null) startFragment(fragment); | |
| 121 | + } | |
| 122 | + } | |
| 123 | + | |
| 124 | + //默认编辑页面 | |
| 125 | + private QMUIFragment initEditDataFragment(Intent intent) { | |
| 126 | + ArrayList<Media> select = intent.getParcelableArrayListExtra("select"); | |
| 127 | + String content = intent.getStringExtra("content"); | |
| 128 | + int type = intent.getIntExtra("type", 0); | |
| 129 | + String isCircle = intent.getStringExtra("isCircle"); | |
| 130 | + if (type == 1) { | |
| 131 | + return ReleaseInfoEditFragment.newInstance(select, isCircle); | |
| 132 | + } else if (type == 0) { | |
| 133 | + return ReleaseInfoEditFragment.newInstance(select, isCircle); | |
| 134 | + } else if (type == 3) { | |
| 135 | + return ReleaseInfoEditFragment.newInstance(select, 3, content); | |
| 136 | + } else if (type == 4) { | |
| 137 | + String name = intent.getStringExtra("name"); | |
| 138 | + String path = intent.getStringExtra("path"); | |
| 139 | + String parentDir = intent.getStringExtra("parentDir"); | |
| 140 | + long time = intent.getLongExtra("time", -1L); | |
| 141 | + long size = intent.getLongExtra("size", -1L); | |
| 142 | + int id = intent.getIntExtra("id", -1); | |
| 143 | + int mediaType = intent.getIntExtra("mediaType", -1); | |
| 144 | + if (select == null) select = new ArrayList<>(); | |
| 145 | + select.clear(); | |
| 146 | + Uri uri = Uri.fromFile(new File(path == null ? "" : path)); | |
| 147 | + Media media = new Media(path, name, time, mediaType, size, id, parentDir, uri + ""); | |
| 148 | + select.add(media); | |
| 149 | + return ReleaseInfoEditFragment.newInstance(select); | |
| 150 | + } else { | |
| 151 | + String imgs = getIntent().getStringExtra("imgs"); | |
| 152 | + String textwit = getIntent().getStringExtra("textwit"); | |
| 153 | + String tagName = getIntent().getStringExtra("tagName"); | |
| 154 | + String witContentId = getIntent().getStringExtra("witContentId"); | |
| 155 | + int typ = getIntent().getIntExtra("type", 0); | |
| 156 | + String videopath = getIntent().getStringExtra("videopath"); | |
| 157 | + String fileUri = getIntent().getStringExtra("fileUri"); | |
| 158 | + String duration = getIntent().getStringExtra("duration"); | |
| 159 | + String createtime = getIntent().getStringExtra("createtime"); | |
| 160 | + String taglist = getIntent().getStringExtra("taglist"); | |
| 161 | + String jumpType = getIntent().getStringExtra("jumpType"); | |
| 162 | + String json = getIntent().getStringExtra("json"); | |
| 163 | + return ReleaseInfoEditFragment.newInstance(select, 2, textwit, imgs, tagName, witContentId, videopath, duration, createtime, taglist, jumpType, json, fileUri); | |
| 164 | + } | |
| 165 | + } | |
| 166 | + | |
| 167 | + //分享事件编辑页面 | |
| 168 | + public QMUIFragment initShareDataFragment(Intent intent) { | |
| 169 | + if (intent == null || intent.getAction() == null) return null; | |
| 170 | + if (intent.getExtras() == null || intent.getType() == null) return null; | |
| 171 | + if ("netpp.intent.action.SHARE_RELEASE".equals(intent.getAction())) { | |
| 172 | + switch (intent.getType()) { | |
| 173 | + case "text/plain": //H5分享 | |
| 174 | + return ReleaseInfoEditFragment.newInstance(ShareReleaseInfoUtil.ShareConfig.parse(intent)); | |
| 175 | + default: | |
| 176 | + return null; | |
| 177 | + } | |
| 178 | + } | |
| 179 | + return null; | |
| 180 | + } | |
| 181 | + | |
| 182 | + @Override | |
| 183 | + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | |
| 184 | + super.onRequestPermissionsResult(requestCode, permissions, grantResults); | |
| 185 | + getCurrentFragment().onRequestPermissionsResult(requestCode, permissions, grantResults); | |
| 186 | + } | |
| 187 | + | |
| 188 | + @Override | |
| 189 | + public void onBackPressed() { | |
| 190 | + if (getCurrentFragment() != null && getCurrentFragment() instanceof IBackFragment && ((IBackFragment) getCurrentFragment()).onBackPressed()) | |
| 191 | + return; | |
| 192 | + super.onBackPressed(); | |
| 193 | + } | |
| 194 | + | |
| 195 | + @Override | |
| 196 | + protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
| 197 | + super.onActivityResult(requestCode, resultCode, data); | |
| 198 | + if (getCurrentFragment() != null) | |
| 199 | + getCurrentFragment().onActivityResult(requestCode, resultCode, data); | |
| 200 | + } | |
| 201 | +} | |
| 0 | 202 | \ No newline at end of file | ... | ... |
publish/src/main/java/com/cnlive/publish/fragment/ReleaseInfoEditFragment.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/fragment/ReleaseInfoEditFragment.java | |
| 1 | +package com.cnlive.publish.fragment; | |
| 2 | + | |
| 3 | +import android.Manifest; | |
| 4 | +import android.app.Activity; | |
| 5 | +import android.app.Dialog; | |
| 6 | +import android.content.Context; | |
| 7 | +import android.content.Intent; | |
| 8 | +import android.graphics.Color; | |
| 9 | +import android.graphics.Rect; | |
| 10 | +import android.graphics.drawable.GradientDrawable; | |
| 11 | +import android.net.Uri; | |
| 12 | +import android.os.Build; | |
| 13 | +import android.os.Bundle; | |
| 14 | +import android.text.Editable; | |
| 15 | +import android.text.InputFilter; | |
| 16 | +import android.text.TextUtils; | |
| 17 | +import android.text.TextWatcher; | |
| 18 | +import android.util.TypedValue; | |
| 19 | +import android.view.Gravity; | |
| 20 | +import android.view.MotionEvent; | |
| 21 | +import android.view.View; | |
| 22 | +import android.view.ViewGroup; | |
| 23 | +import android.view.inputmethod.InputMethodManager; | |
| 24 | +import android.widget.Button; | |
| 25 | +import android.widget.RelativeLayout; | |
| 26 | +import android.widget.TextView; | |
| 27 | +import android.widget.Toast; | |
| 28 | + | |
| 29 | + | |
| 30 | +import com.amap.api.location.AMapLocation; | |
| 31 | +import com.amap.api.location.AMapLocationListener; | |
| 32 | +import com.cnlive.libs.base.arouter.social.SocialLifeChangeObservable; | |
| 33 | +import com.cnlive.libs.base.observable.ShareResultObservable; | |
| 34 | +import com.cnlive.libs.base.observable.ShareWjjStateObservable; | |
| 35 | +import com.cnlive.libs.base.ui.IBackFragment; | |
| 36 | +import com.cnlive.libs.base.ui.QMUIFragment; | |
| 37 | +import com.cnlive.libs.base.util.AlertUtil; | |
| 38 | +import com.cnlive.libs.base.util.DoublePressed; | |
| 39 | +import com.cnlive.libs.base.util.FileUtils; | |
| 40 | +import com.cnlive.libs.base.util.ShareReleaseInfoUtil; | |
| 41 | +import com.cnlive.libs.base.util.SharedPreferencesHelper; | |
| 42 | + | |
| 43 | +import com.cnlive.libs.base.util.StringUtils; | |
| 44 | +import com.cnlive.libs.emoj.ExpressionGridFragment; | |
| 45 | +import com.cnlive.libs.emoj.ExpressionShowFragment; | |
| 46 | +import com.cnlive.libs.emoj.core.InputEmojiLengthFilter; | |
| 47 | +import com.cnlive.media.PickerConfig; | |
| 48 | +import com.cnlive.media.media.entity.Media; | |
| 49 | +import com.cnlive.media.model.CircleChoose; | |
| 50 | +import com.cnlive.media.model.CircleData; | |
| 51 | +import com.cnlive.media.utils.AlertDialogUtils; | |
| 52 | +import com.cnlive.media.utils.AndroidQUtil; | |
| 53 | +import com.cnlive.media.utils.PermissionChecker; | |
| 54 | + | |
| 55 | +import com.cnlive.publish.R; | |
| 56 | +import com.cnlive.publish.databinding.FragmentReleaseInfoEditBinding; | |
| 57 | +import com.cnlive.publish.frame.persenter.ReleaseInfoEditPersenter; | |
| 58 | +import com.cnlive.publish.frame.view.ReleaseInfoEditView; | |
| 59 | +import com.cnlive.publish.moudle.ReleaseMediaItem; | |
| 60 | +import com.cnlive.publish.moudle.ReleaseMediaPage; | |
| 61 | +import com.cnlive.publish.util.LocationUtil; | |
| 62 | +import com.cnlive.publish.util.UserInfoUtils; | |
| 63 | +import com.cnlive.publish.widget.RecycleViewDivider; | |
| 64 | +import com.cnlive.publish.widget.ResizeFrameLayout; | |
| 65 | +import com.cnlive.strike.ui.widget.BottomSheet; | |
| 66 | + | |
| 67 | +import com.google.gson.Gson; | |
| 68 | +import com.qmuiteam.qmui.util.QMUIDisplayHelper; | |
| 69 | +import com.qmuiteam.qmui.widget.QMUITopBar; | |
| 70 | +import com.qmuiteam.qmui.widget.dialog.QMUITipDialog; | |
| 71 | + | |
| 72 | +import org.greenrobot.eventbus.EventBus; | |
| 73 | +import org.greenrobot.eventbus.Subscribe; | |
| 74 | +import org.greenrobot.eventbus.ThreadMode; | |
| 75 | + | |
| 76 | +import java.io.File; | |
| 77 | +import java.util.ArrayList; | |
| 78 | +import java.util.List; | |
| 79 | +import java.util.concurrent.TimeUnit; | |
| 80 | + | |
| 81 | +import androidx.annotation.NonNull; | |
| 82 | +import androidx.annotation.Nullable; | |
| 83 | +import androidx.core.content.FileProvider; | |
| 84 | +import androidx.recyclerview.widget.DividerItemDecoration; | |
| 85 | +import androidx.recyclerview.widget.GridLayoutManager; | |
| 86 | +import io.reactivex.Observable; | |
| 87 | +import io.reactivex.ObservableEmitter; | |
| 88 | +import io.reactivex.ObservableOnSubscribe; | |
| 89 | +import io.reactivex.ObservableSource; | |
| 90 | +import io.reactivex.Observer; | |
| 91 | +import io.reactivex.android.schedulers.AndroidSchedulers; | |
| 92 | +import io.reactivex.disposables.Disposable; | |
| 93 | +import io.reactivex.functions.Function; | |
| 94 | +import io.reactivex.schedulers.Schedulers; | |
| 95 | + | |
| 96 | +import static android.view.View.GONE; | |
| 97 | +import static android.view.View.VISIBLE; | |
| 98 | +import static com.cnlive.libs.base.util.PixelsUtil.dip2px; | |
| 99 | +import static com.cnlive.media.PickerConfig.REQUEST_CODE_PERMISSION_CAMERA; | |
| 100 | +import static com.cnlive.media.utils.PermissionChecker.settingPermissionActivity; | |
| 101 | +import static com.cnlive.publish.activity.ReleasePublishAcityity.REQUEST_CODE_SELECT_CAMERA; | |
| 102 | +import static com.cnlive.publish.activity.ReleasePublishAcityity.REQUEST_CODE_SELECT_READ_WRITE; | |
| 103 | +import static com.cnlive.publish.activity.ReleasePublishAcityity.REQUEST_CODE_SELECT_READ_WRITE_2; | |
| 104 | + | |
| 105 | + | |
| 106 | +/** | |
| 107 | + * Created by xiansong on 2018/3/5. | |
| 108 | + */ | |
| 109 | +public class ReleaseInfoEditFragment extends QMUIFragment<ReleaseInfoEditView, ReleaseInfoEditPersenter, FragmentReleaseInfoEditBinding> | |
| 110 | + implements IBackFragment, ExpressionGridFragment.ExpressionClickListener, ExpressionGridFragment.ExpressionDeleteClickListener, | |
| 111 | + View.OnClickListener, View.OnTouchListener { | |
| 112 | + | |
| 113 | + private static final int REQUEST_CODE_LOCATION = 30009; | |
| 114 | + private int outtype; | |
| 115 | + private int type1 = 8; | |
| 116 | + private String createtime = ""; | |
| 117 | + private boolean comeevent = false; | |
| 118 | + private CircleData.ReleaseVideoTypeListBean messageCamera; | |
| 119 | + public Button buttonRRight; | |
| 120 | + | |
| 121 | + public static ReleaseInfoEditFragment newInstance(ShareReleaseInfoUtil.ShareConfig shareConfig) { | |
| 122 | + Bundle args = new Bundle(); | |
| 123 | + if (shareConfig != null) args.putSerializable("share_config", shareConfig); | |
| 124 | + ReleaseInfoEditFragment fragment = new ReleaseInfoEditFragment(); | |
| 125 | + fragment.setArguments(args); | |
| 126 | + return fragment; | |
| 127 | + } | |
| 128 | + | |
| 129 | + public static ReleaseInfoEditFragment newInstance(ArrayList<Media> medias) { | |
| 130 | + Bundle args = new Bundle(); | |
| 131 | + if (medias != null) args.putParcelableArrayList("medias", medias); | |
| 132 | + ReleaseInfoEditFragment fragment = new ReleaseInfoEditFragment(); | |
| 133 | + fragment.setArguments(args); | |
| 134 | + return fragment; | |
| 135 | + } | |
| 136 | + | |
| 137 | + public static ReleaseInfoEditFragment newInstance(ArrayList<Media> medias, String isCircle) { | |
| 138 | + Bundle args = new Bundle(); | |
| 139 | + if (medias != null) args.putParcelableArrayList("medias", medias); | |
| 140 | + args.putString("isCircle", isCircle); | |
| 141 | + ReleaseInfoEditFragment fragment = new ReleaseInfoEditFragment(); | |
| 142 | + fragment.setArguments(args); | |
| 143 | + return fragment; | |
| 144 | + } | |
| 145 | + | |
| 146 | + public static ReleaseInfoEditFragment newInstance(ArrayList<Media> medias, int outtype, String content) { | |
| 147 | + Bundle args = new Bundle(); | |
| 148 | + if (medias != null) args.putParcelableArrayList("medias", medias); | |
| 149 | + args.putInt("outtype", outtype); | |
| 150 | + args.putString("content", content); | |
| 151 | + ReleaseInfoEditFragment fragment = new ReleaseInfoEditFragment(); | |
| 152 | + fragment.setArguments(args); | |
| 153 | + return fragment; | |
| 154 | + } | |
| 155 | + | |
| 156 | + public static ReleaseInfoEditFragment newInstance(ArrayList<Media> medias, int type, String text, String img, String tag, String witContentId, String videopath, String duration, String createtime, String taglist, String jumpType, String json, String fileUri) { | |
| 157 | + Bundle args = new Bundle(); | |
| 158 | + if (medias != null) args.putParcelableArrayList("medias", medias); | |
| 159 | + args.putInt("type", type); | |
| 160 | + args.putString("text", text); | |
| 161 | + args.putString("img", img); | |
| 162 | + args.putString("tagName", tag); | |
| 163 | + args.putString("witContentId", witContentId); | |
| 164 | + args.putString("videopath", videopath); | |
| 165 | + args.putString("fileUri", fileUri); | |
| 166 | + args.putString("duration", duration); | |
| 167 | + args.putString("createtime", createtime); | |
| 168 | + args.putString("taglist", taglist); | |
| 169 | + args.putString("jumpType", jumpType); | |
| 170 | + args.putString("json", json); | |
| 171 | + ReleaseInfoEditFragment fragment = new ReleaseInfoEditFragment(); | |
| 172 | + fragment.setArguments(args); | |
| 173 | + return fragment; | |
| 174 | + } | |
| 175 | + | |
| 176 | + public Dialog deleteImageDialog; | |
| 177 | + public ReleaseMediaPage pageData; | |
| 178 | + public QMUITipDialog tipDialog, copyDialog; | |
| 179 | + public BottomSheet bottomSheet; | |
| 180 | + public BottomSheet bottomSheet1; | |
| 181 | + public BottomSheet bottomSheet2; | |
| 182 | + public BottomSheet bottomSheet3; | |
| 183 | + public BottomSheet bottomSheet4; | |
| 184 | + private Dialog dialog; | |
| 185 | + public Dialog exitDialog; | |
| 186 | + private int remainingTextSize = 10000; | |
| 187 | + private int witnessTextSize = 140; | |
| 188 | + private int defMaxTexSize = 10000; | |
| 189 | + private int witMaxTexSize = 140; | |
| 190 | + private Disposable permissionsDisposable; | |
| 191 | + // private AMapLocationListener locationCallback = null; | |
| 192 | + private View.OnClickListener toolbarClick; | |
| 193 | + private ResizeFrameLayout.KeyboardListener keyboardListener; | |
| 194 | + | |
| 195 | + @Override | |
| 196 | + protected int getToolbarId() { | |
| 197 | + return R.id.includeToolbar; | |
| 198 | + } | |
| 199 | + | |
| 200 | + @Override | |
| 201 | + public String getTitle() { | |
| 202 | + return ""; | |
| 203 | + } | |
| 204 | + | |
| 205 | + @Override | |
| 206 | + protected int getLayoutId() { | |
| 207 | + return R.layout.fragment_release_info_edit; | |
| 208 | + } | |
| 209 | + | |
| 210 | + @Override | |
| 211 | + public void onCreate(@Nullable Bundle savedInstanceState) { | |
| 212 | + super.onCreate(savedInstanceState); | |
| 213 | + EventBus.getDefault().register(this); | |
| 214 | + tipDialog = new QMUITipDialog.Builder(getContext()) | |
| 215 | + .setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING) | |
| 216 | + .setTipWord("正在上传...") | |
| 217 | + .create(); | |
| 218 | + tipDialog.setCancelable(false); | |
| 219 | + | |
| 220 | + copyDialog = new QMUITipDialog.Builder(getContext()) | |
| 221 | + .setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING) | |
| 222 | + .setTipWord("正在转码...") | |
| 223 | + .create(); | |
| 224 | + copyDialog.setCancelable(false); | |
| 225 | + | |
| 226 | + bottomSheet = new BottomSheet.BottomListSheetBuilder(getActivity()) | |
| 227 | + .addItem("拍摄") | |
| 228 | + .addItem("从相册中选取") | |
| 229 | + .addItem("取消") | |
| 230 | + .setOnSheetItemClickListener((dialog, itemView, position, tag) -> { | |
| 231 | + if (isFastDoubleClick()) { | |
| 232 | + return; | |
| 233 | + } else if (position == 0) { | |
| 234 | + getMvpView().showShoot(false); | |
| 235 | + } else if (position == 1) { | |
| 236 | + getMvpView().showAlbum(false); | |
| 237 | + } | |
| 238 | + dialog.dismiss(); | |
| 239 | + }).build(); | |
| 240 | + | |
| 241 | + bottomSheet1 = new BottomSheet.BottomListSheetBuilder(getActivity()) | |
| 242 | + //.addItem("取消") | |
| 243 | + .addItem("退出") | |
| 244 | + .setOnSheetItemClickListener((dialog, itemView, position, tag) -> { | |
| 245 | + if (DoublePressed.onDoublePressed()) return; | |
| 246 | + // if (position == 0) | |
| 247 | + // getMvpView().showdis(); | |
| 248 | + | |
| 249 | + if (position == 0) | |
| 250 | + getMvpView().showBack(); | |
| 251 | + }).build(); | |
| 252 | + bottomSheet3 = new BottomSheet.BottomListSheetBuilder(getActivity()) | |
| 253 | + // .addItem("保存此次编辑") | |
| 254 | + .addItem("保存到草稿箱") | |
| 255 | + .addItem("删除视频") | |
| 256 | + .addItem("取消") | |
| 257 | + .setOnSheetItemClickListener((dialog, itemView, position, tag) -> { | |
| 258 | + if (DoublePressed.onDoublePressed()) return; | |
| 259 | + /* if (position == 0) | |
| 260 | + getMvpView().showsave();*/ | |
| 261 | + if (position == 0) | |
| 262 | + getMvpView().showsavenow(type1, createtime); | |
| 263 | + if (position == 1) | |
| 264 | + getMvpView().showdel(); | |
| 265 | + dialog.dismiss(); | |
| 266 | + }).build(); | |
| 267 | + | |
| 268 | + bottomSheet4 = new BottomSheet.BottomListSheetBuilder(getActivity()) | |
| 269 | + .addItem("保存草稿") | |
| 270 | + .addItem("删除视频") | |
| 271 | + .addItem("不保存") | |
| 272 | + .addItem("取消") | |
| 273 | + .setOnSheetItemClickListener((dialog, itemView, position, tag) -> { | |
| 274 | + if (DoublePressed.onDoublePressed()) return; | |
| 275 | + if (position == 0) | |
| 276 | + getMvpView().showsavedraft(type1, createtime); | |
| 277 | + if (position == 1) | |
| 278 | + getMvpView().showdeldraft(getContext(), createtime); | |
| 279 | + if (position == 2) | |
| 280 | + getMvpView().showdedraft(); | |
| 281 | + dialog.dismiss(); | |
| 282 | + }).build(); | |
| 283 | + | |
| 284 | + bottomSheet2 = new BottomSheet.BottomListSheetBuilder(getActivity()) | |
| 285 | + //.addItem("保存此次编辑") | |
| 286 | + .addItem("退出此次编辑") | |
| 287 | + .addItem("取消") | |
| 288 | + .setOnSheetItemClickListener((dialog, itemView, position, tag) -> { | |
| 289 | + if (DoublePressed.onDoublePressed()) return; | |
| 290 | + /*if (position == 0) | |
| 291 | + getMvpView().showsave();*/ | |
| 292 | + if (position == 0) | |
| 293 | + getMvpView().showdellife(); | |
| 294 | + dialog.dismiss(); | |
| 295 | + }).build(); | |
| 296 | + | |
| 297 | + | |
| 298 | + keyboardListener = new ResizeFrameLayout.KeyboardListener() { | |
| 299 | + @Override | |
| 300 | + public void onKeyboardShown(int height) { | |
| 301 | + onCalculation(height); | |
| 302 | + } | |
| 303 | + | |
| 304 | + @Override | |
| 305 | + public void onKeyboardHidden(int height) { | |
| 306 | + onCalculation(0); | |
| 307 | + } | |
| 308 | + }; | |
| 309 | + permissionsDisposable = Observable.timer(1, TimeUnit.SECONDS).subscribeOn(Schedulers.io()) | |
| 310 | + .observeOn(AndroidSchedulers.mainThread()).subscribe(aLong -> initLocationPermission()); | |
| 311 | + | |
| 312 | + getChildFragmentManager().beginTransaction().add(R.id.emojicons, ExpressionShowFragment.newInstance(false, UserInfoUtils.getUid(getActivity(),""))).commit(); | |
| 313 | + } | |
| 314 | + | |
| 315 | + private static long lastClickTime = 0L; | |
| 316 | + | |
| 317 | + public static boolean isFastDoubleClick() { | |
| 318 | + long time = System.currentTimeMillis(); | |
| 319 | + long timeD = time - lastClickTime; | |
| 320 | + if (timeD < 2000) { | |
| 321 | + lastClickTime = 0L; | |
| 322 | + return true; | |
| 323 | + } | |
| 324 | + lastClickTime = time; | |
| 325 | + return false; | |
| 326 | + } | |
| 327 | + | |
| 328 | + public void showPro(double progress) { | |
| 329 | + binding.cover.setVisibility(VISIBLE); | |
| 330 | + binding.profa.setVisibility(VISIBLE); | |
| 331 | + binding.cover.setOnClickListener(new View.OnClickListener() { | |
| 332 | + @Override | |
| 333 | + public void onClick(View v) { | |
| 334 | + } | |
| 335 | + }); | |
| 336 | + if ((progress * 100) > 0) { | |
| 337 | + binding.zip.setVisibility(GONE); | |
| 338 | + binding.wenan.setVisibility(VISIBLE); | |
| 339 | + binding.progress.setVisibility(VISIBLE); | |
| 340 | + int roundProgress = binding.progress.getProgress(); | |
| 341 | + binding.progress.setProgress((int) (progress * 100)); | |
| 342 | + if (roundProgress >= 100) { | |
| 343 | + binding.cover.setVisibility(GONE); | |
| 344 | + binding.profa.setVisibility(GONE); | |
| 345 | + } | |
| 346 | + } | |
| 347 | + } | |
| 348 | + | |
| 349 | + | |
| 350 | + @Override | |
| 351 | + public void onSetupToolBar(QMUITopBar toolbar) { | |
| 352 | + if (getActivity() == null) return; | |
| 353 | + toolbar.setTitle(getTitle()); | |
| 354 | + toolbar.setBackgroundColor(getActivity().getResources().getColor(R.color.transparent)); | |
| 355 | + | |
| 356 | + Button buttonLeft = addLeftTextButton(toolbar, "取消"); | |
| 357 | + buttonLeft.setTextColor(0xff282828); | |
| 358 | + buttonLeft.setOnClickListener(v -> onBackPressed()); | |
| 359 | + | |
| 360 | + buttonRRight = addRightTextButton(toolbar, "发布"); | |
| 361 | + buttonRRight.setTextColor(parseColor("#0BBE06")); | |
| 362 | + buttonRRight.setTextSize(13); | |
| 363 | + toolbarClick = null; | |
| 364 | + toolbarClick = v -> { | |
| 365 | + if (isFastDoubleClick()) return; | |
| 366 | + buttonRRight.setClickable(false); | |
| 367 | + //友盟统计 | |
| 368 | + if (pageData == null) return; | |
| 369 | + hideSoftInput(); | |
| 370 | + /* if (pageData.isVideo()) { | |
| 371 | + //友盟统计-发现圈子发布视频 | |
| 372 | + UMProbeUtil.onEventObject(UMProbeUtil.friend_upload_video); | |
| 373 | + } else if (pageData.getAdapter().getList().size() > 1) { | |
| 374 | + //友盟统计-发现圈子发布图文 | |
| 375 | + UMProbeUtil.onEventObject(UMProbeUtil.friend_upload_photo); | |
| 376 | + } else { | |
| 377 | + //友盟统计-发现圈子发布文本 | |
| 378 | + UMProbeUtil.onEventObject(UMProbeUtil.friend_upload_text); | |
| 379 | + }*/ | |
| 380 | + //友盟统计 END | |
| 381 | + | |
| 382 | + if (hasPermission()) { | |
| 383 | + if (3 == pageData.getSource() && StringUtils.isEmpty(pageData.getLocation())) { | |
| 384 | + AlertUtil.showDeftToast(getActivity(), "获取不到您的地址信息,请稍后再试"); | |
| 385 | + buttonRRight.setClickable(true); | |
| 386 | + } else { | |
| 387 | + GradientDrawable gradientDrawable = new GradientDrawable(); | |
| 388 | + gradientDrawable.setColor(!StringUtils.isEmpty(pageData.getReleaseButtonColor()) ? parseColor("#" + pageData.getReleaseButtonColor()) : parseColor("#F0F0F0")); | |
| 389 | + gradientDrawable.setShape(GradientDrawable.RECTANGLE); | |
| 390 | + gradientDrawable.setCornerRadius(dip2px(16)); | |
| 391 | + gradientDrawable.setAlpha(255); | |
| 392 | + buttonRRight.setBackground(gradientDrawable); | |
| 393 | + getPresenter().doUploadInfo(getActivity(), | |
| 394 | + pageData.getAdapter().getList(), | |
| 395 | + TextUtils.isEmpty(pageData.getMessage()) ? "" : pageData.getMessage().trim(), | |
| 396 | + binding.closeAddress.isChecked() ? pageData.getLocation() : "", | |
| 397 | + pageData.isVideo(), | |
| 398 | + pageData.getShareConfig(), | |
| 399 | + pageData.getType(), | |
| 400 | + pageData.getGopath(), | |
| 401 | + pageData.getVideotype(), | |
| 402 | + pageData.getMultiplecategory(), | |
| 403 | + pageData.getTagtext(), | |
| 404 | + pageData.getTagId(), | |
| 405 | + type1 == 2, | |
| 406 | + pageData.getWitContentId(), | |
| 407 | + createtime, | |
| 408 | + pageData.getSource(), | |
| 409 | + binding.closeAddress.isChecked() ? pageData.getCoordinate() : "" | |
| 410 | + ); | |
| 411 | + } | |
| 412 | + } else { | |
| 413 | + dia(getActivity()); | |
| 414 | + } | |
| 415 | + }; | |
| 416 | + buttonRRight.setOnClickListener(toolbarClick); | |
| 417 | + } | |
| 418 | + | |
| 419 | + public static void dia(Activity avtivity) { | |
| 420 | + AlertDialogUtils.showTwoButtonDialog( | |
| 421 | + avtivity, | |
| 422 | + avtivity.getString(R.string.dialog_imagepicker_permission_nerver_ask_cancel), | |
| 423 | + avtivity.getString(R.string.dialog_imagepicker_permission_nerver_ask_confirm), | |
| 424 | + avtivity.getString(R.string.dialog_imagepicker_permission_share_message), | |
| 425 | + R.color.color_dialog_btn, R.color.color_ffa300, new AlertDialogUtils.DialogTwoListener() { | |
| 426 | + @Override | |
| 427 | + public void onClickLeft(Dialog dialog) { | |
| 428 | + dialog.dismiss(); | |
| 429 | + avtivity.finish(); | |
| 430 | + } | |
| 431 | + | |
| 432 | + @Override | |
| 433 | + public void onClickRight(Dialog dialog) { | |
| 434 | + dialog.dismiss(); | |
| 435 | + settingPermissionActivity((Activity) avtivity, 1007); | |
| 436 | + avtivity.finish(); | |
| 437 | + } | |
| 438 | + }); | |
| 439 | + } | |
| 440 | + | |
| 441 | + private boolean hasPermission() { | |
| 442 | + return PermissionChecker.checkPermissions(getActivity() | |
| 443 | + , new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE} | |
| 444 | + , REQUEST_CODE_PERMISSION_CAMERA, R.string.dialog_imagepicker_permission_share_message); | |
| 445 | + } | |
| 446 | + | |
| 447 | + public int parseColor(String value) { | |
| 448 | + int color = 0x00000000; | |
| 449 | + if (TextUtils.isEmpty(value)) return color; | |
| 450 | + | |
| 451 | + if (value.charAt(0) != '#') { | |
| 452 | + value = "#".concat(value); | |
| 453 | + } | |
| 454 | + | |
| 455 | + try { | |
| 456 | + color = Color.parseColor(value); | |
| 457 | + } catch (Exception ignored) { | |
| 458 | + } | |
| 459 | + return color; | |
| 460 | + } | |
| 461 | + | |
| 462 | + @Override | |
| 463 | + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | |
| 464 | + super.onViewCreated(view, savedInstanceState); | |
| 465 | + if (getActivity() == null) return; | |
| 466 | + if (pageData == null) init(); | |
| 467 | + else reset(); | |
| 468 | + input_height = (int) getActivity().getResources().getDimension(R.dimen.input_height); | |
| 469 | + input_default_height = (int) getActivity().getResources().getDimension(R.dimen.input_default_height); | |
| 470 | + input_offset = dip2px(24); | |
| 471 | + binding.calculationView.setKeyboardListener(keyboardListener); | |
| 472 | + if (view.findViewById(R.id.rightBtn) == null) return; | |
| 473 | + // ShareResultObservable.getInstance().addObserver(this); | |
| 474 | + TextView rightBtn = view.findViewById(R.id.rightBtn); | |
| 475 | + RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(dip2px(80), dip2px(30)); | |
| 476 | + layoutParams.addRule(RelativeLayout.CENTER_VERTICAL); | |
| 477 | + layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); | |
| 478 | + layoutParams.setMarginEnd(dip2px(13)); | |
| 479 | + rightBtn.setLayoutParams(layoutParams); | |
| 480 | + rightBtn.setTextColor(!StringUtils.isEmpty(pageData.getReleaseButtonColor()) ? parseColor("#FFFFFF") : parseColor("#0BBE06")); | |
| 481 | + rightBtn.setTextSize(13); | |
| 482 | + GradientDrawable gradientDrawable = new GradientDrawable(); | |
| 483 | + gradientDrawable.setColor(!StringUtils.isEmpty(pageData.getReleaseButtonColor()) ? parseColor("#" + pageData.getReleaseButtonColor()) : parseColor("#F0F0F0")); | |
| 484 | + gradientDrawable.setShape(GradientDrawable.RECTANGLE); | |
| 485 | + gradientDrawable.setCornerRadius(dip2px(16)); | |
| 486 | + gradientDrawable.setAlpha(70); | |
| 487 | + rightBtn.setBackground(gradientDrawable); | |
| 488 | + binding.layout.setBackgroundColor(!StringUtils.isEmpty(pageData.getTopColor()) ? parseColor("#" + pageData.getTopColor()) : getActivity().getResources().getColor(R.color.white)); | |
| 489 | + binding.message.setTextColor(!StringUtils.isEmpty(pageData.getBottomSrc()) ? getActivity().getResources().getColor(R.color.white) : getActivity().getResources().getColor(R.color.text_input_color)); | |
| 490 | + binding.messageCount.setTextColor(!StringUtils.isEmpty(pageData.getBottomSrc()) ? getActivity().getResources().getColor(R.color.white) : getActivity().getResources().getColor(R.color.color_989898)); | |
| 491 | + binding.tag.setTextColor(!StringUtils.isEmpty(pageData.getBottomSrc()) ? getActivity().getResources().getColor(R.color.white) : getActivity().getResources().getColor(R.color.black)); | |
| 492 | + binding.tag.setCompoundDrawablesWithIntrinsicBounds(!StringUtils.isEmpty(pageData.getBottomSrc()) ? getActivity().getResources().getDrawable(R.drawable.monkey_tag) : getActivity().getResources().getDrawable(R.drawable.mjz_bq), | |
| 493 | + null, null, null); | |
| 494 | + binding.address.setTextColor(!StringUtils.isEmpty(pageData.getBottomSrc()) ? getActivity().getResources().getColor(R.color.white) : getActivity().getResources().getColor(R.color.black)); | |
| 495 | + binding.address.setCompoundDrawablesWithIntrinsicBounds(!StringUtils.isEmpty(pageData.getBottomSrc()) ? getActivity().getResources().getDrawable(R.drawable.monkeyaddress) : getActivity().getResources().getDrawable(R.drawable.fb_weizhi), | |
| 496 | + null, null, null); | |
| 497 | + binding.adline1.setVisibility(1 == pageData.getDetailaddress() ? GONE : VISIBLE); | |
| 498 | + binding.adline.setAlpha(!StringUtils.isEmpty(pageData.getBottomSrc()) ? 0.7f : 1f); | |
| 499 | + binding.adline1.setAlpha(!StringUtils.isEmpty(pageData.getBottomSrc()) ? 0.7f : 1f); | |
| 500 | + binding.adline2.setAlpha(!StringUtils.isEmpty(pageData.getBottomSrc()) ? 0.7f : 1f); | |
| 501 | + binding.adline3.setAlpha(!StringUtils.isEmpty(pageData.getBottomSrc()) ? 0.7f : 1f); | |
| 502 | + binding.closeAddress.setBackgroundResource(!StringUtils.isEmpty(pageData.getBottomSrc()) ? R.drawable.bg_location_check_monkey : R.drawable.bg_location_check); | |
| 503 | + binding.recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 3)); | |
| 504 | + if (!TextUtils.isEmpty(pageData.getFixedTitle())) { | |
| 505 | + binding.message.setKeyListener(null); | |
| 506 | + } | |
| 507 | + for (int i = 0; i < binding.recyclerView.getItemDecorationCount(); i++) | |
| 508 | + binding.recyclerView.removeItemDecorationAt(i); | |
| 509 | + if (!StringUtils.isEmpty(pageData.getBottomSrc())) { | |
| 510 | + DividerItemDecoration divider = new DividerItemDecoration(getActivity(), DividerItemDecoration.HORIZONTAL); | |
| 511 | + divider.setDrawable(getResources().getDrawable(R.drawable.shape_circle)); | |
| 512 | + binding.recyclerView.addItemDecoration(divider); | |
| 513 | + } else { | |
| 514 | + RecycleViewDivider divider = new RecycleViewDivider(getActivity(), dip2px(8), getActivity().getResources().getColor(R.color.white)); | |
| 515 | + binding.recyclerView.addItemDecoration(divider); | |
| 516 | + } | |
| 517 | + if (StringUtils.isEmpty(pageData.getBottomSrc())) { | |
| 518 | + binding.monkey.setImageRes(R.drawable.white); | |
| 519 | + } else { | |
| 520 | + binding.monkey.setImageUrl(pageData.getBottomSrc()); | |
| 521 | + } | |
| 522 | + binding.setData(pageData); | |
| 523 | + binding.setOnClick(this); | |
| 524 | + binding.setOnTouch(this); | |
| 525 | + binding.message.setHintTextColor(!StringUtils.isEmpty(pageData.getBottomSrc()) ? getActivity().getResources().getColor(R.color.white) : getActivity().getResources().getColor(R.color.color_989898)); | |
| 526 | + binding.message.addTextChangedListener(new TextWatcher() { | |
| 527 | + //文本内容剩余字数校验 | |
| 528 | + @Override | |
| 529 | + public void beforeTextChanged(CharSequence s, int start, int count, int after) { | |
| 530 | + | |
| 531 | + } | |
| 532 | + | |
| 533 | + @Override | |
| 534 | + public void onTextChanged(CharSequence s, int start, int before, int count) { | |
| 535 | + | |
| 536 | + } | |
| 537 | + | |
| 538 | + @Override | |
| 539 | + public void afterTextChanged(Editable s) { | |
| 540 | + remainingTextSize = defMaxTexSize - s.length(); | |
| 541 | + witnessTextSize = witMaxTexSize - s.length(); | |
| 542 | + binding.message.setHint(pageData.getDefaulttext()); | |
| 543 | + binding.message.setHintTextColor(!StringUtils.isEmpty(pageData.getBottomSrc()) ? getActivity().getResources().getColor(R.color.white) : getActivity().getResources().getColor(R.color.text_input_color)); | |
| 544 | + if ("生活圈".equals(pageData.getWit())) { | |
| 545 | + binding.messageCount.setText(String.format("(%s/%s字以内)", remainingTextSize, defMaxTexSize)); | |
| 546 | + } else { | |
| 547 | + binding.messageCount.setText(!"".equals(pageData.getFixedTitle()) ? "" : String.format("(%s/%s字以内)", witnessTextSize, witMaxTexSize)); | |
| 548 | + } | |
| 549 | + getMvpView().hasDes(s.toString().trim()); | |
| 550 | + } | |
| 551 | + }); | |
| 552 | + binding.message.setHint(pageData.getDefaulttext()); | |
| 553 | + if ("生活圈".equals(pageData.getWit())) { | |
| 554 | + binding.messageCount.setText(String.format("(%s/%s字以内)", remainingTextSize, defMaxTexSize)); | |
| 555 | + binding.message.setFilters(new InputFilter[]{new InputEmojiLengthFilter(10000)}); | |
| 556 | + pageData.setTagVisibility(View.GONE); | |
| 557 | + } else { | |
| 558 | + pageData.setTagVisibility(View.VISIBLE); | |
| 559 | + pageData.setRadioGroupVisibility(View.VISIBLE); | |
| 560 | + binding.messageCount.setText(!"".equals(pageData.getFixedTitle()) ? "" : String.format("(%s/%s字以内)", witnessTextSize, witMaxTexSize)); | |
| 561 | + binding.message.setFilters(new InputFilter[]{new InputEmojiLengthFilter(140)}); | |
| 562 | + List<CircleData.indextag> categoryTag = pageData.getCategoryTag(); | |
| 563 | + binding.gp.removeAllViews(); | |
| 564 | + if (categoryTag != null) { | |
| 565 | + for (int i = 0; i < categoryTag.size(); i++) { | |
| 566 | + if (i == 0) { | |
| 567 | + addItemToFloatLayout(categoryTag.get(i).getTagName(), categoryTag.get(i).getTagId(), true); | |
| 568 | + } else { | |
| 569 | + addItemToFloatLayout(categoryTag.get(i).getTagName(), categoryTag.get(i).getTagId(), false); | |
| 570 | + } | |
| 571 | + } | |
| 572 | + int childCount = binding.gp.getChildCount(); | |
| 573 | + for (int i = 0; i < childCount; i++) { | |
| 574 | + TextView childAt = (TextView) binding.gp.getChildAt(i); | |
| 575 | + String tagName = categoryTag.get(i).getTagName(); | |
| 576 | + String tagId = categoryTag.get(i).getTagId(); | |
| 577 | + childAt.setOnClickListener(new View.OnClickListener() { | |
| 578 | + @Override | |
| 579 | + public void onClick(View v) { | |
| 580 | + if (type1 == 2 && !"".equals(pageData.getWitContentId())) { | |
| 581 | + } else { | |
| 582 | + if (pageData.getTagtext().equals(tagName)) { | |
| 583 | + childAt.setBackgroundResource(!StringUtils.isEmpty(pageData.getBottomSrc()) ? R.drawable.item_search3_history : R.drawable.item_search_history); | |
| 584 | + GradientDrawable mGradientDrawable = (GradientDrawable) childAt.getBackground(); | |
| 585 | + mGradientDrawable.setColor(parseColor("#FFFFFF")); | |
| 586 | + // childAt.setTextColor(!StringUtils.isEmpty(pageData.getBottomSrc()) ? parseColor("#" + (pageData.getLabelcolor() == null ? "666666" : pageData.getLabelcolor())) : parseColor("#666666")); | |
| 587 | + childAt.setTextColor(parseColor("#9E9E9E")); | |
| 588 | + pageData.setTagtext(""); | |
| 589 | + pageData.setTagId(""); | |
| 590 | + } else { | |
| 591 | + pageData.setTagtext(tagName); | |
| 592 | + pageData.setTagId(tagId); | |
| 593 | + for (int p = 0; p < childCount; p++) { | |
| 594 | + TextView childAt2 = (TextView) binding.gp.getChildAt(p); | |
| 595 | + childAt2.setBackgroundResource(!StringUtils.isEmpty(pageData.getBottomSrc()) ? R.drawable.item_search3_history : R.drawable.item_search_history); | |
| 596 | + GradientDrawable mGradientDrawable = (GradientDrawable) childAt2.getBackground(); | |
| 597 | + mGradientDrawable.setColor(parseColor("#FFFFFF")); | |
| 598 | + // childAt2.setTextColor(!StringUtils.isEmpty(pageData.getBottomSrc()) ? parseColor("#" + (pageData.getLabelcolor() == null ? "666666" : pageData.getLabelcolor())) : parseColor("#666666")); | |
| 599 | + childAt2.setTextColor(parseColor("#9E9E9E")); | |
| 600 | + } | |
| 601 | + childAt.setBackgroundResource(!StringUtils.isEmpty(pageData.getBottomSrc()) ? R.drawable.item_search3_history : R.drawable.item_search2_history); | |
| 602 | + if (!StringUtils.isEmpty(pageData.getBottomSrc())) { | |
| 603 | + GradientDrawable mGradientDrawable = (GradientDrawable) childAt.getBackground(); | |
| 604 | + mGradientDrawable.setColor(parseColor("#" + (pageData.getCategoryTag().get(0).getColour() == null ? "666666" : pageData.getCategoryTag().get(0).getColour()))); | |
| 605 | + } | |
| 606 | + childAt.setTextColor(!StringUtils.isEmpty(pageData.getBottomSrc()) ? parseColor("#FFFFFF") : parseColor("#9E9E9E")); | |
| 607 | + } | |
| 608 | + } | |
| 609 | + } | |
| 610 | + }); | |
| 611 | + } | |
| 612 | + } | |
| 613 | + } | |
| 614 | + initDisplayScreen(); | |
| 615 | + } | |
| 616 | + | |
| 617 | + | |
| 618 | + public void addItemToFloatLayout(String tagname, String tagId, boolean first) { | |
| 619 | + final TextView textView = new TextView(getContext()); | |
| 620 | + int textViewPadding = QMUIDisplayHelper.dp2px(getContext(), 7); | |
| 621 | + int textViewRightPadding = QMUIDisplayHelper.dp2px(getContext(), 14); | |
| 622 | + textView.setPadding(textViewRightPadding, textViewPadding, textViewRightPadding, textViewPadding); | |
| 623 | + textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); | |
| 624 | + textView.setTextColor(parseColor("#9E9E9E")); | |
| 625 | + textView.setText(tagname); | |
| 626 | + textView.setGravity(Gravity.CENTER); | |
| 627 | + textView.setMaxEms(21); | |
| 628 | + textView.setSingleLine(); | |
| 629 | + textView.setEllipsize(TextUtils.TruncateAt.MIDDLE); | |
| 630 | + textView.setMinWidth(QMUIDisplayHelper.dp2px(getContext(), 50)); | |
| 631 | + textView.setBackgroundResource(1 == pageData.getSource() ? R.drawable.item_search3_history : R.drawable.item_search_history); | |
| 632 | + if (1 == pageData.getSource()) { | |
| 633 | + GradientDrawable mGradientDrawable = (GradientDrawable) textView.getBackground(); | |
| 634 | + mGradientDrawable.setColor(getResources().getColor(R.color.white)); | |
| 635 | + } | |
| 636 | + ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); | |
| 637 | + if (first) { | |
| 638 | + binding.gp.addView(textView, 0, lp); | |
| 639 | + } else { | |
| 640 | + binding.gp.addView(textView, lp); | |
| 641 | + } | |
| 642 | + if (tagname.equals(pageData.getTagtext())) { | |
| 643 | + pageData.setTagtext(tagname); | |
| 644 | + pageData.setTagId(tagId); | |
| 645 | + textView.setBackgroundResource(1 == pageData.getSource() ? R.drawable.item_search3_history : R.drawable.item_search2_history); | |
| 646 | + /*if (1 == pageData.getSource()) { | |
| 647 | + GradientDrawable mGradientDrawable = (GradientDrawable) textView.getBackground(); | |
| 648 | + mGradientDrawable.setColor(parseColor("#" + (pageData.getLabelcolor() == null ? "666666" : pageData.getLabelcolor()))); | |
| 649 | + }*/ | |
| 650 | + textView.setTextColor(1 == pageData.getSource() ? parseColor("#FFFFFF") : parseColor("#666666")); | |
| 651 | + | |
| 652 | + } | |
| 653 | + } | |
| 654 | + | |
| 655 | + private void reset() { | |
| 656 | + if (getPresenter() != null) | |
| 657 | + getPresenter().resetViewCallback(pageData.getAdapter().getList(), outtype); | |
| 658 | + } | |
| 659 | + | |
| 660 | + public static boolean checkEndTag(String str) { | |
| 661 | + return !TextUtils.isEmpty(str) && !TextUtils.isEmpty("") && str.endsWith(""); | |
| 662 | + } | |
| 663 | + | |
| 664 | + private void init() { | |
| 665 | + if (getActivity() == null) return; | |
| 666 | + | |
| 667 | + if (pageData == null) pageData = new ReleaseMediaPage(); | |
| 668 | + boolean hasShareData = getArguments() != null && getArguments().containsKey("share_config"); | |
| 669 | + ShareReleaseInfoUtil.ShareConfig shareConfig = hasShareData ? (ShareReleaseInfoUtil.ShareConfig) getArguments().getSerializable("share_config") : null; | |
| 670 | + String type = shareConfig == null ? "witness" : shareConfig.getType() == null ? ShareReleaseInfoUtil.TYPE_HTML : shareConfig.getType(); | |
| 671 | + switch (type) { | |
| 672 | + case ShareReleaseInfoUtil.TYPE_HTML: | |
| 673 | + String title = shareConfig == null ? "" : shareConfig.getTitle(); | |
| 674 | + String shareTitle = title == null ? "" : checkEndTag(title) ? title.substring(0, title.indexOf("")) : title; | |
| 675 | + if (shareConfig != null) shareConfig.setTitle(shareTitle); | |
| 676 | + pageData.setShareConfig(shareConfig); | |
| 677 | + outtype = 5; | |
| 678 | + getPresenter().initPageData(getActivity(), null, ""); | |
| 679 | + getMvpView().hasHTML(shareConfig); | |
| 680 | + return; | |
| 681 | + case "witness": | |
| 682 | + type1 = getArguments().getInt("type"); | |
| 683 | + String isCircle = getArguments().getString("isCircle"); | |
| 684 | + if (type1 == 2 && !"cancircle".equals(isCircle)) { | |
| 685 | + String text = getArguments().getString("text"); | |
| 686 | + String img = getArguments().getString("img"); | |
| 687 | + String tag = getArguments().getString("tagName"); | |
| 688 | + String witContentId = getArguments().getString("witContentId"); | |
| 689 | + String videopath = getArguments().getString("videopath"); | |
| 690 | + String fileUri = getArguments().getString("fileUri"); | |
| 691 | + String duration = getArguments().getString("duration"); | |
| 692 | + createtime = getArguments().getString("createtime"); | |
| 693 | + String taglist = getArguments().getString("taglist"); | |
| 694 | + String jumpType = getArguments().getString("jumpType"); | |
| 695 | + String json = getArguments().getString("json"); | |
| 696 | + String sid = UserInfoUtils.getUid(getContext(),""); | |
| 697 | + String messagesp = SharedPreferencesHelper.getInstance(getContext()).getValue("SAVE_RELEASE_INFO_MESSAGE_" + sid); | |
| 698 | + String medias = SharedPreferencesHelper.getInstance(getContext()).getValue("SAVE_RELEASE_INFO_IMAGES_" + sid); | |
| 699 | + if ("draft".equals(jumpType)) { | |
| 700 | + getPresenter().WitnessLoadInfo(getActivity(), "暂无视频标题".equals(text) ? "" : text, img, tag, type1, witContentId, videopath, duration, taglist, jumpType, json, fileUri); | |
| 701 | + } else if ("auditing".equals(jumpType)) { | |
| 702 | + getPresenter().WitnessLoadInfo(getActivity(), "暂无视频标题".equals(text) ? "" : text, img, tag, type1, witContentId, "", "", "", "", json, ""); | |
| 703 | + } else if (!"".equals(messagesp) || !"".equals(medias)) { | |
| 704 | + getPresenter().doLoadInfo(getActivity()); | |
| 705 | + } else if ("html".equals(jumpType) && "".equals(messagesp) || "".equals(medias)) { | |
| 706 | + getPresenter().WitnessLoadInfo(getActivity(), text, img, tag, type1, witContentId, videopath, duration, taglist, jumpType, json, fileUri); | |
| 707 | + } else if ("myself".equals(jumpType) && "".equals(messagesp) || "".equals(medias)) { | |
| 708 | + getPresenter().WitnessLoadInfo(getActivity(), text, img, tag, type1, witContentId, videopath, duration, taglist, jumpType, json, fileUri); | |
| 709 | + } | |
| 710 | + } else if (type1 != 2 && "cancircle".equals(isCircle)) { //判断初次拍摄完进入发布页面 | |
| 711 | + List<Media> mediaList = getArguments() == null ? null : getArguments().getParcelableArrayList("medias"); | |
| 712 | + String WitnessMessage = SharedPreferencesHelper.getInstance(getActivity()).getValue("WitnessMessage"); | |
| 713 | + CircleData.ReleaseVideoTypeListBean witnessmessage = new Gson().fromJson(WitnessMessage, CircleData.ReleaseVideoTypeListBean.class); | |
| 714 | + getPresenter().comeevent(getActivity(), "", witnessmessage.getText(), 0, witnessmessage.getVideoType(), witnessmessage.getChangePath(), witnessmessage.getMultiplecategory(), mediaList, "", "", "witness".equals(witnessmessage.getText()) ? 2 : 0, "witness".equals(witnessmessage.getText()) ? String.valueOf(witnessmessage.getId()) : "" | |
| 715 | + , witnessmessage.getCategoryTag(), ""); | |
| 716 | + } else { | |
| 717 | + List<Media> mediaList = getArguments() == null ? null : getArguments().getParcelableArrayList("medias"); | |
| 718 | + String content = getArguments() == null ? "" : getArguments().getString("content"); | |
| 719 | + outtype = getArguments().getInt("outtype"); | |
| 720 | + if (outtype == 3 && mediaList != null && "".equals(content)) { | |
| 721 | + pageData.getAdapter().getList().clear(); | |
| 722 | + getPresenter().initPageData(getActivity(), mediaList, ""); | |
| 723 | + getMvpView().hasMedias(mediaList.size()); | |
| 724 | + } else if (outtype != 3 && mediaList != null) { | |
| 725 | + if (mediaList.size() > 0) { | |
| 726 | + getMvpView().showCopyView(); | |
| 727 | + Observable.fromIterable(mediaList).concatMap(new Function<Media, ObservableSource<Media>>() { | |
| 728 | + | |
| 729 | + private String path; | |
| 730 | + | |
| 731 | + @Override | |
| 732 | + public ObservableSource<Media> apply(Media media) throws Exception { | |
| 733 | + if (media.mediaType == 3) { | |
| 734 | + String name = FileUtils.getFileName(media.path); | |
| 735 | + if (AndroidQUtil.isAndroidQ()) { | |
| 736 | + if (!TextUtils.isEmpty(media.fileUri)) { | |
| 737 | + path = AndroidQUtil.copyMp4(getActivity(), media.fileUri, name); | |
| 738 | + } else { | |
| 739 | + path = media.path; | |
| 740 | + } | |
| 741 | + | |
| 742 | + } else { | |
| 743 | + if (!TextUtils.isEmpty(media.path)) { | |
| 744 | + path = media.path; | |
| 745 | + } else { | |
| 746 | + if (!TextUtils.isEmpty(media.fileUri)) | |
| 747 | + path = AndroidQUtil.copyMp4(getActivity(), media.fileUri, name); | |
| 748 | + } | |
| 749 | + | |
| 750 | + } | |
| 751 | + | |
| 752 | + } else if (media.mediaType == 1) { | |
| 753 | + if (AndroidQUtil.isAndroidQ() && getActivity() != null ) { | |
| 754 | + if (TextUtils.isEmpty(media.fileUri) && !TextUtils.isEmpty(media.path)) { | |
| 755 | + Uri imageContentUri = FileProvider.getUriForFile(getActivity(), getActivity().getPackageName() + ".fileprovider", new File(media.path)); | |
| 756 | + // Uri imageContentUri = AndroidQUtil.getImageContentUri(PickerActivity.this, new File(media.path)); | |
| 757 | + path = AndroidQUtil.copyAndroidQFile(getActivity(), imageContentUri.toString(), media.name + ""); | |
| 758 | + } else { | |
| 759 | + path = AndroidQUtil.copyAndroidQFile(getActivity(), media.fileUri, media.name + ""); | |
| 760 | + } | |
| 761 | + } else { | |
| 762 | + path = media.path; | |
| 763 | + } | |
| 764 | + } | |
| 765 | + media.path = path; | |
| 766 | + return Observable.just(media); | |
| 767 | + } | |
| 768 | + }).map(new Function<Media, Media>() { | |
| 769 | + @Override | |
| 770 | + public Media apply(Media media) throws Exception { | |
| 771 | + return media; | |
| 772 | + } | |
| 773 | + }).toList().flatMapObservable(new Function<List<Media>, ObservableSource<List<Media>>>() { | |
| 774 | + @Override | |
| 775 | + public ObservableSource<List<Media>> apply(List<Media> media) throws Exception { | |
| 776 | + return Observable.create(new ObservableOnSubscribe<List<Media>>() { | |
| 777 | + @Override | |
| 778 | + public void subscribe(ObservableEmitter<List<Media>> emitter) throws Exception { | |
| 779 | + emitter.onNext(media); | |
| 780 | + } | |
| 781 | + }); | |
| 782 | + } | |
| 783 | + }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<List<Media>>() { | |
| 784 | + @Override | |
| 785 | + public void onSubscribe(Disposable d) { | |
| 786 | + | |
| 787 | + } | |
| 788 | + | |
| 789 | + @Override | |
| 790 | + public void onNext(List<Media> media) { | |
| 791 | + getMvpView().hideCopyView(); | |
| 792 | + getPresenter().initPageData(getActivity(), media, ""); | |
| 793 | + getMvpView().hasMedias(media.size()); | |
| 794 | + } | |
| 795 | + | |
| 796 | + @Override | |
| 797 | + public void onError(Throwable e) { | |
| 798 | + Toast.makeText(getActivity(), "请选择媒体文件", Toast.LENGTH_SHORT).show(); | |
| 799 | + } | |
| 800 | + | |
| 801 | + @Override | |
| 802 | + public void onComplete() { | |
| 803 | + | |
| 804 | + } | |
| 805 | + }); | |
| 806 | + } else { | |
| 807 | + Toast.makeText(getActivity(), "请选择媒体文件", Toast.LENGTH_SHORT).show(); | |
| 808 | + } | |
| 809 | + } else if (outtype == 3 && mediaList != null) { | |
| 810 | + getPresenter().initPageData(getActivity(), mediaList, content); | |
| 811 | + } else { | |
| 812 | + getPresenter().doLoadInfo(getActivity()); | |
| 813 | + } | |
| 814 | + } | |
| 815 | + return; | |
| 816 | + default: | |
| 817 | + break; | |
| 818 | + } | |
| 819 | + } | |
| 820 | + | |
| 821 | + @Subscribe(threadMode = ThreadMode.MAIN, sticky = true) | |
| 822 | + public void onMessageEvent(CircleChoose event) { | |
| 823 | + // 更新界面 | |
| 824 | + comeevent = true; | |
| 825 | + messageCamera = event.getMessage(); | |
| 826 | + | |
| 827 | + if ("生活圈".equals(event.getMessage().getText()) && pageData.getAdapter().getItemCount() == 1 && (pageData.getAdapter().getItem(0)).getType() == ReleaseMediaItem.type_select) { | |
| 828 | + pageData.getAdapter().getItem(0).setIconRes(R.drawable.fb_tjsc); | |
| 829 | + } else if (!"生活圈".equals(event.getMessage().getText()) && pageData.getAdapter().getItemCount() == 1 && (pageData.getAdapter().getItem(0)).getType() == ReleaseMediaItem.type_select) { | |
| 830 | + pageData.getAdapter().getItem(0).setIconRes(!StringUtils.isEmpty(pageData.getBottomSrc()) ? R.drawable.circle_photo : R.drawable.fb_tjsp); | |
| 831 | + } | |
| 832 | + pageData.getAdapter().getItem(0).setNullvisiable(View.VISIBLE); | |
| 833 | + pageData.getAdapter().getItem(0).setAddvisiable(View.GONE); | |
| 834 | + | |
| 835 | + } | |
| 836 | + | |
| 837 | + @Override | |
| 838 | + public void onPause() { | |
| 839 | + super.onPause(); | |
| 840 | + hideSoftInput(); | |
| 841 | + if (dialog != null) dialog.dismiss(); | |
| 842 | + if (permissionsDisposable != null) permissionsDisposable.dispose(); | |
| 843 | + } | |
| 844 | + | |
| 845 | + @Override | |
| 846 | + public void onDestroy() { | |
| 847 | + super.onDestroy(); | |
| 848 | + EventBus.getDefault().unregister(this); | |
| 849 | + if (keyboardListener != null) keyboardListener = null; | |
| 850 | + if (toolbarClick != null) toolbarClick = null; | |
| 851 | + // if (locationCallback != null) locationCallback = null; | |
| 852 | + if (deleteImageDialog != null) deleteImageDialog.dismiss(); | |
| 853 | + if (bottomSheet != null) bottomSheet.dismiss(); | |
| 854 | + if (bottomSheet1 != null) bottomSheet1.dismiss(); | |
| 855 | + if (bottomSheet2 != null) bottomSheet2.dismiss(); | |
| 856 | + if (bottomSheet3 != null) bottomSheet3.dismiss(); | |
| 857 | + if (bottomSheet4 != null) bottomSheet4.dismiss(); | |
| 858 | + if (tipDialog != null) tipDialog.dismiss(); | |
| 859 | + if (copyDialog != null) copyDialog.dismiss(); | |
| 860 | + if (exitDialog != null) exitDialog.dismiss(); | |
| 861 | + // ShareResultObservable.getInstance().deleteObserver(this); | |
| 862 | + } | |
| 863 | + | |
| 864 | + /** | |
| 865 | + * 隐藏软键盘 | |
| 866 | + */ | |
| 867 | + private void hideSoftInput() { | |
| 868 | + if (getContext() != null){ | |
| 869 | + InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); | |
| 870 | + if (imm != null) { | |
| 871 | + imm.hideSoftInputFromWindow(binding.message.getWindowToken(), 0); | |
| 872 | + } | |
| 873 | + } | |
| 874 | + } | |
| 875 | + | |
| 876 | + private void initLocationPermission() { | |
| 877 | + if (getActivity() == null) return; | |
| 878 | + boolean hasPermission = PermissionChecker.checkPermissions(getActivity(), new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_CODE_LOCATION, R.string.permission_location); | |
| 879 | + if (hasPermission) { | |
| 880 | + initLocation(); | |
| 881 | + } | |
| 882 | + } | |
| 883 | + | |
| 884 | + @Override | |
| 885 | + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | |
| 886 | + super.onRequestPermissionsResult(requestCode, permissions, grantResults); | |
| 887 | + buttonRRight.setClickable(true); | |
| 888 | + if (requestCode == REQUEST_CODE_SELECT_READ_WRITE || requestCode == REQUEST_CODE_SELECT_READ_WRITE_2) { | |
| 889 | + if (PermissionChecker.onRequestPermissionsResult(getActivity(), requestCode, permissions, grantResults, false, R.string.dialog_imagepicker_permission_camera_message)[0]) | |
| 890 | + if (requestCode == REQUEST_CODE_SELECT_READ_WRITE) getMvpView().showAlbum(true); | |
| 891 | + else getMvpView().showSelectPage(); | |
| 892 | + } else if (requestCode == REQUEST_CODE_SELECT_CAMERA) { | |
| 893 | + if (PermissionChecker.onRequestPermissionsResult(getActivity(), requestCode, permissions, grantResults, false, R.string.dialog_imagepicker_permission_camera_nerver_ask_message)[0]) | |
| 894 | + getMvpView().showShoot(true); | |
| 895 | + } else if (requestCode == REQUEST_CODE_LOCATION) { | |
| 896 | + if (PermissionChecker.onRequestPermissionsResult(getActivity(), requestCode, permissions, grantResults, false, R.string.permission_location)[0]) { | |
| 897 | + initLocation(); | |
| 898 | + } else { | |
| 899 | + if (3 == pageData.getSource()) { | |
| 900 | + pageData.setLocationVisibility(VISIBLE); | |
| 901 | + binding.closeAddress.setVisibility(GONE); | |
| 902 | + binding.locatagain.setVisibility(VISIBLE); | |
| 903 | + binding.locationrefresh.setVisibility(VISIBLE); | |
| 904 | + binding.address.setText("位置获取失败"); | |
| 905 | + binding.address.setTextColor(getResources().getColor(R.color.address_color)); | |
| 906 | + } | |
| 907 | + } | |
| 908 | + } | |
| 909 | + } | |
| 910 | + | |
| 911 | + protected void initLocation() { | |
| 912 | + LocationUtil.uploadLocation(getActivity(), new AMapLocationListener() { | |
| 913 | + @Override | |
| 914 | + public void onLocationChanged(AMapLocation location) { | |
| 915 | + if (getActivity() == null) return; | |
| 916 | + if (location != null && location.getErrorCode() == 0) { | |
| 917 | + if (3 == pageData.getSource()) { | |
| 918 | + binding.locationrefresh.setVisibility(GONE); | |
| 919 | + binding.locatagain.setVisibility(GONE); | |
| 920 | + binding.closeAddress.setVisibility(GONE); | |
| 921 | + binding.address.setTextColor(getActivity().getResources().getColor(R.color.black)); | |
| 922 | + } | |
| 923 | + //省信息 | |
| 924 | + String province = (location.getProvince() != null && location.getProvince().length() > 0) ? location.getProvince() : "北京市"; | |
| 925 | + //城市信息 | |
| 926 | + String city = (location.getCity() != null && location.getCity().length() > 0) ? location.getCity() : "北京市"; | |
| 927 | + //城区信息 | |
| 928 | + String district = (location.getDistrict() != null && location.getDistrict().length() > 0) ? location.getDistrict() : ""; | |
| 929 | + //街道信息 | |
| 930 | + String street = (location.getStreet() != null && location.getStreet().length() > 0) ? location.getStreet() : ""; | |
| 931 | + //当前位置点 AOI信息 | |
| 932 | + String api = (location.getAoiName() != null && location.getAoiName().length() > 0) ? location.getAoiName() : ""; | |
| 933 | + //位置信息格式化 | |
| 934 | + String locationStr = "%s · %s%s%s"; | |
| 935 | + if (1 == pageData.getDetailaddress()) { | |
| 936 | + pageData.setLocationVisibility(VISIBLE); | |
| 937 | + pageData.setCoordinate(String.format(locationStr, city, district, street, api)); | |
| 938 | + pageData.setLocation(String.format(locationStr, city, district, "", "")); | |
| 939 | + binding.address.setText(pageData.getCoordinate()); | |
| 940 | + } else if ("生活圈".equals(pageData.getTitle())) { | |
| 941 | + pageData.setLocationVisibility(VISIBLE); | |
| 942 | + pageData.setCoordinate(String.format(locationStr, city, district, street, api)); | |
| 943 | + pageData.setLocation(String.format(locationStr, city, district, "", "")); | |
| 944 | + binding.address.setText(pageData.getLocation()); | |
| 945 | + } else { | |
| 946 | + pageData.setLocationVisibility(GONE); | |
| 947 | + } | |
| 948 | + } else { | |
| 949 | + if (3 == pageData.getSource()) { | |
| 950 | + pageData.setLocationVisibility(VISIBLE); | |
| 951 | + binding.locationrefresh.setVisibility(VISIBLE); | |
| 952 | + binding.locatagain.setVisibility(VISIBLE); | |
| 953 | + binding.address.setText("位置获取失败"); | |
| 954 | + binding.address.setTextColor(getActivity().getResources().getColor(R.color.address_color)); | |
| 955 | + binding.closeAddress.setVisibility(GONE); | |
| 956 | + AlertUtil.showDeftToast(getActivity(), "位置获取失败,请检查手机GPS以及位置权限是否打开"); | |
| 957 | + } else { | |
| 958 | + pageData.setLocationVisibility(GONE); | |
| 959 | + } | |
| 960 | + } | |
| 961 | + } | |
| 962 | + }); | |
| 963 | + } | |
| 964 | + | |
| 965 | + //Activity 返回事件处理 | |
| 966 | + @Override | |
| 967 | + public void onActivityResult(int requestCode, int resultCode, Intent data) { | |
| 968 | + super.onActivityResult(requestCode, resultCode, data); | |
| 969 | + //媒体数据 | |
| 970 | + buttonRRight.setClickable(true); | |
| 971 | + if ((requestCode == 200 && resultCode == PickerConfig.DEFAULT_RESULT_CODE) || resultCode == 110) { | |
| 972 | + List<Media> selects = data.getParcelableArrayListExtra(PickerConfig.EXTRA_RESULT); | |
| 973 | + if (selects != null && selects.size() > 0) { | |
| 974 | + getMvpView().showCopyView(); | |
| 975 | + Observable.fromIterable(selects).concatMap(new Function<Media, ObservableSource<Media>>() { | |
| 976 | + private String path; | |
| 977 | + | |
| 978 | + @Override | |
| 979 | + public ObservableSource<Media> apply(Media media) throws Exception { | |
| 980 | + if (media.mediaType == 3) { | |
| 981 | + String name = FileUtils.getFileName(media.path); | |
| 982 | + if (AndroidQUtil.isAndroidQ()) { | |
| 983 | + if (!TextUtils.isEmpty(media.fileUri)) { | |
| 984 | + path = AndroidQUtil.copyMp4(getActivity(), media.fileUri, name); | |
| 985 | + } else { | |
| 986 | + path = media.path; | |
| 987 | + } | |
| 988 | + | |
| 989 | + } else { | |
| 990 | + if (!TextUtils.isEmpty(media.path)) { | |
| 991 | + path = media.path; | |
| 992 | + } else { | |
| 993 | + if (!TextUtils.isEmpty(media.fileUri)) | |
| 994 | + path = AndroidQUtil.copyMp4(getActivity(), media.fileUri, name); | |
| 995 | + } | |
| 996 | + | |
| 997 | + } | |
| 998 | + | |
| 999 | + } else if (media.mediaType == 1) { | |
| 1000 | + if (AndroidQUtil.isAndroidQ() && getActivity()!=null) { | |
| 1001 | + if (TextUtils.isEmpty(media.fileUri) && !TextUtils.isEmpty(media.path)) { | |
| 1002 | + Uri imageContentUri = FileProvider.getUriForFile(getActivity(), getActivity().getPackageName() + ".fileprovider", new File(media.path)); | |
| 1003 | + // Uri imageContentUri = AndroidQUtil.getImageContentUri(PickerActivity.this, new File(media.path)); | |
| 1004 | + path = AndroidQUtil.copyAndroidQFile(getActivity(), imageContentUri.toString(), media.name + ""); | |
| 1005 | + } else { | |
| 1006 | + path = AndroidQUtil.copyAndroidQFile(getActivity(), media.fileUri, media.name + ""); | |
| 1007 | + } | |
| 1008 | + } else { | |
| 1009 | + path = media.path; | |
| 1010 | + } | |
| 1011 | + } | |
| 1012 | + media.path = path; | |
| 1013 | + return Observable.just(media); | |
| 1014 | + } | |
| 1015 | + }).map(new Function<Media, Media>() { | |
| 1016 | + @Override | |
| 1017 | + public Media apply(Media media) throws Exception { | |
| 1018 | + return media; | |
| 1019 | + } | |
| 1020 | + }).toList().flatMapObservable(new Function<List<Media>, ObservableSource<List<Media>>>() { | |
| 1021 | + @Override | |
| 1022 | + public ObservableSource<List<Media>> apply(List<Media> media) throws Exception { | |
| 1023 | + return Observable.create(new ObservableOnSubscribe<List<Media>>() { | |
| 1024 | + @Override | |
| 1025 | + public void subscribe(ObservableEmitter<List<Media>> emitter) throws Exception { | |
| 1026 | + emitter.onNext(media); | |
| 1027 | + } | |
| 1028 | + }); | |
| 1029 | + } | |
| 1030 | + }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<List<Media>>() { | |
| 1031 | + @Override | |
| 1032 | + public void onSubscribe(Disposable d) { | |
| 1033 | + | |
| 1034 | + } | |
| 1035 | + | |
| 1036 | + @Override | |
| 1037 | + public void onNext(List<Media> media) { | |
| 1038 | + getMvpView().hideCopyView(); | |
| 1039 | + getPresenter().initLocalData(getContext(), media, pageData.getWit(), pageData.getTitle(), pageData.getBottomSrc()); | |
| 1040 | + } | |
| 1041 | + | |
| 1042 | + @Override | |
| 1043 | + public void onError(Throwable e) { | |
| 1044 | + Toast.makeText(getActivity(), "请选择媒体文件", Toast.LENGTH_SHORT).show(); | |
| 1045 | + } | |
| 1046 | + | |
| 1047 | + @Override | |
| 1048 | + public void onComplete() { | |
| 1049 | + | |
| 1050 | + } | |
| 1051 | + }); | |
| 1052 | + } else { | |
| 1053 | + getPresenter().initLocalData(getContext(), selects, pageData.getWit(), pageData.getTitle(), pageData.getBottomSrc()); | |
| 1054 | + // Toast.makeText(getActivity(), "请选择媒体文件", Toast.LENGTH_SHORT).show(); | |
| 1055 | + } | |
| 1056 | + } | |
| 1057 | + } | |
| 1058 | + | |
| 1059 | + public void showReleaseResult(boolean isSuccess, boolean isshare, String url) { | |
| 1060 | + if (getActivity() == null) return; | |
| 1061 | + | |
| 1062 | + binding.progress.setProgress(0); | |
| 1063 | + binding.cover.setVisibility(GONE); | |
| 1064 | + binding.profa.setVisibility(GONE); | |
| 1065 | + | |
| 1066 | + if (isSuccess) { | |
| 1067 | + if (isshare) { | |
| 1068 | + if (pageData.getVideotype().equals("witness")) { | |
| 1069 | + // todo ReleaseSuccessAcityity.start(getActivity(), pageData.getJumpType(), "上传成功", "", pageData.getSuccessJumpType()); | |
| 1070 | + } | |
| 1071 | + getActivity().finish(); | |
| 1072 | + SocialLifeChangeObservable.getInstance().uploadMoment(); | |
| 1073 | + | |
| 1074 | + } else { | |
| 1075 | + ShareWjjStateObservable.newInstance().update(true); | |
| 1076 | + if (url != null && url.startsWith("http://wjjh5")) { | |
| 1077 | + ShareResultObservable.getInstance().update(new ShareResultObservable.ShareResultInfo(2, 1, url)); | |
| 1078 | + } | |
| 1079 | + SocialLifeChangeObservable.getInstance().uploadMoment(); | |
| 1080 | + getActivity().finish(); | |
| 1081 | + } | |
| 1082 | + } else { | |
| 1083 | + if (url != null && url.startsWith("http://wjjh5")) { | |
| 1084 | + ShareResultObservable.getInstance().update(new ShareResultObservable.ShareResultInfo(2, 2, url)); | |
| 1085 | + } | |
| 1086 | + buttonRRight.setClickable(true); | |
| 1087 | + } | |
| 1088 | + } | |
| 1089 | + | |
| 1090 | + @Override | |
| 1091 | + public boolean onBackPressed() { | |
| 1092 | + if (getActivity() == null) return false; | |
| 1093 | + if (binding.emojicons.getVisibility() == VISIBLE) { | |
| 1094 | + onClickBtn(); | |
| 1095 | + } else if (pageData.getShareConfig() == null && (exitDialog == null || !exitDialog.isShowing()) && !tipDialog.isShowing() && !copyDialog.isShowing() && binding.profa.getVisibility() != VISIBLE) { | |
| 1096 | + getMvpView().showBackDialog(); | |
| 1097 | + } else if (pageData.getShareConfig() != null) { | |
| 1098 | + getMvpView().showBackDialog(); | |
| 1099 | + } | |
| 1100 | + return true; | |
| 1101 | + } | |
| 1102 | + | |
| 1103 | + //------------------------------------------------------------------------------------------------- | |
| 1104 | + private int displayScreenHeight; | |
| 1105 | + private int input_height, input_default_height, input_offset; | |
| 1106 | + | |
| 1107 | + @Override | |
| 1108 | + public void expressionClick(String str) { | |
| 1109 | + if (str.length() <= ("目击者".equals(pageData.getWit()) ? witnessTextSize : remainingTextSize)) { | |
| 1110 | + ExpressionShowFragment.input(binding.message, str); | |
| 1111 | + } | |
| 1112 | + } | |
| 1113 | + | |
| 1114 | + @Override | |
| 1115 | + public void onResume() { | |
| 1116 | + super.onResume(); | |
| 1117 | + if (getActivity() == null) return; | |
| 1118 | + // StatusBarUtil.setStatusBarWrite(getActivity()); | |
| 1119 | + // StatusBarUtil2.setColor(getActivity(), pageData != null && !StringUtils.isEmpty(pageData.getTopColor()) ? parseColor("#" + pageData.getTopColor()) : getActivity().getResources().getColor(R.color.white), 0); | |
| 1120 | + } | |
| 1121 | + | |
| 1122 | + @Override | |
| 1123 | + public void expressionDeleteClick(View v) { | |
| 1124 | + ExpressionShowFragment.delete(binding.message); | |
| 1125 | + } | |
| 1126 | + | |
| 1127 | + @Override | |
| 1128 | + public void onClick(View v) { | |
| 1129 | + int id = v.getId(); | |
| 1130 | + if (id == R.id.emoticons_button) { | |
| 1131 | + onClickBtn(); | |
| 1132 | + } else if (id == R.id.gobutton) { | |
| 1133 | + if (type1 == 2 && !"".equals(pageData.getWitContentId())) { | |
| 1134 | + // AlertUtil.showDeftToast(getContext(),"作品审核中暂不支持修改此项."); | |
| 1135 | + } else if ("draft".equals(pageData.getJumpType())) { | |
| 1136 | + // AlertUtil.showDeftToast(getContext(),"作品审核中暂不支持修改此项."); | |
| 1137 | + } else { | |
| 1138 | + pageData.setRadioGroupVisibility(GONE); | |
| 1139 | + // startFragment(CircleFragment.newInstance(pageData.getAdapter().getList().get(0).getType())); | |
| 1140 | + } | |
| 1141 | + } else if (id == R.id.zk) { | |
| 1142 | + if (type1 == 2 && !"".equals(pageData.getWitContentId())) { | |
| 1143 | + // AlertUtil.showDeftToast(getContext(),"作品审核中暂不支持修改此项."); | |
| 1144 | + } else { | |
| 1145 | + pageData.setSqVisibility(VISIBLE); | |
| 1146 | + pageData.setZkVisibility(GONE); | |
| 1147 | + pageData.setRadioGroupVisibility(VISIBLE); | |
| 1148 | + } | |
| 1149 | + } else if (id == R.id.sq) { | |
| 1150 | + if (type1 == 2 && !"".equals(pageData.getWitContentId())) { | |
| 1151 | + // AlertUtil.showDeftToast(getContext(),"作品审核中暂不支持修改此项."); | |
| 1152 | + } else { | |
| 1153 | + pageData.setSqVisibility(GONE); | |
| 1154 | + pageData.setZkVisibility(VISIBLE); | |
| 1155 | + pageData.setRadioGroupVisibility(GONE); | |
| 1156 | + } | |
| 1157 | + } else if (id == R.id.locatagain || id == R.id.locationrefresh) { | |
| 1158 | + initLocationPermission(); | |
| 1159 | + } | |
| 1160 | + } | |
| 1161 | + | |
| 1162 | + private void initDisplayScreen() { | |
| 1163 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | |
| 1164 | + Rect r = new Rect(); | |
| 1165 | + binding.layout.getWindowVisibleDisplayFrame(r); | |
| 1166 | + displayScreenHeight = r.bottom; | |
| 1167 | + } | |
| 1168 | + } | |
| 1169 | + | |
| 1170 | + protected void onClickBtn() { | |
| 1171 | + if (getActivity() == null) return; | |
| 1172 | + if (binding.emojicons.getVisibility() == VISIBLE) { | |
| 1173 | + chengeEmojiconsVisibil(false); | |
| 1174 | + InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); | |
| 1175 | + if (imm != null) imm.showSoftInput(binding.message, 0); | |
| 1176 | + } else { | |
| 1177 | + chengeEmojiconsVisibil(true); | |
| 1178 | + InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); | |
| 1179 | + if (imm != null) imm.hideSoftInputFromWindow(binding.message.getWindowToken(), 0); | |
| 1180 | + } | |
| 1181 | + } | |
| 1182 | + | |
| 1183 | + private void chengeEmojiconsVisibil(boolean isShow) { | |
| 1184 | + binding.emojicons.setVisibility(isShow ? VISIBLE : GONE); | |
| 1185 | + binding.emoticonsButton.setImageResource( | |
| 1186 | + isShow ? R.drawable.expression_keyboard_selector : R.drawable.expression_face_selector); | |
| 1187 | + } | |
| 1188 | + | |
| 1189 | + protected void destroyInputFragment() { | |
| 1190 | + if (getActivity() == null) return; | |
| 1191 | + if (binding.message.getWindowToken() == null) return; | |
| 1192 | + InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); | |
| 1193 | + if (imm != null) imm.hideSoftInputFromWindow(binding.message.getWindowToken(), 0); | |
| 1194 | + chengeEmojiconsVisibil(false); | |
| 1195 | + } | |
| 1196 | + | |
| 1197 | + @Override | |
| 1198 | + public boolean onTouch(View v, MotionEvent event) { | |
| 1199 | + if (v.getId() == R.id.message && binding.message.canScrollVertically(-1) || binding.message.canScrollVertically(0)) { | |
| 1200 | + v.getParent().requestDisallowInterceptTouchEvent(true); | |
| 1201 | + if (event.getAction() == MotionEvent.ACTION_UP) { | |
| 1202 | + binding.message.getParent().requestDisallowInterceptTouchEvent(false); | |
| 1203 | + } | |
| 1204 | + } | |
| 1205 | + if (v.getId() == R.id.message) { | |
| 1206 | + if (event.getAction() == MotionEvent.ACTION_DOWN && binding.emojicons.getVisibility() == VISIBLE) { | |
| 1207 | + chengeEmojiconsVisibil(false); | |
| 1208 | + } | |
| 1209 | + } | |
| 1210 | + return false; | |
| 1211 | + } | |
| 1212 | + | |
| 1213 | + private void onCalculation(int heightDifference) { | |
| 1214 | + boolean isKeyBoardVisible; | |
| 1215 | + Rect r = new Rect(); | |
| 1216 | + //这里得到的是除了系统自带显示区域之外的所有区域,这里就是除了最上面的一条显示电量的状态栏之外的所有区域 | |
| 1217 | + binding.layout.getWindowVisibleDisplayFrame(r); | |
| 1218 | + | |
| 1219 | + isKeyBoardVisible = heightDifference > 100; | |
| 1220 | + binding.emoticonsButtonLayout.setVisibility((isKeyBoardVisible || binding.emojicons.getVisibility() == VISIBLE) ? VISIBLE : GONE); | |
| 1221 | + | |
| 1222 | + if (heightDifference > 0 && input_height != (input_default_height + heightDifference)) | |
| 1223 | + input_height = input_default_height + heightDifference; | |
| 1224 | + | |
| 1225 | + if (!isKeyBoardVisible && binding.emojicons.getVisibility() == VISIBLE) { | |
| 1226 | + if (binding.topView.getLayoutParams().height != (binding.layout.getHeight() - input_height - input_offset)) { | |
| 1227 | + binding.topView.getLayoutParams().height = (binding.layout.getHeight() - input_height - input_offset); | |
| 1228 | + binding.topView.setLayoutParams(binding.topView.getLayoutParams()); | |
| 1229 | + } | |
| 1230 | + } else if (binding.topView.getLayoutParams().height != (binding.layout.getHeight() - input_default_height - input_offset)) { | |
| 1231 | + binding.topView.getLayoutParams().height = (binding.layout.getHeight() - input_default_height - input_offset); | |
| 1232 | + binding.topView.setLayoutParams(binding.topView.getLayoutParams()); | |
| 1233 | + } | |
| 1234 | + } | |
| 1235 | + | |
| 1236 | + /*@Override | |
| 1237 | + public void update(java.util.Observable o, Object arg) { | |
| 1238 | + | |
| 1239 | + }*/ | |
| 1240 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/frame/persenter/ReleaseInfoEditPersenter.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/frame/persenter/ReleaseInfoEditPersenter.java | |
| 1 | +package com.cnlive.publish.frame.persenter; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.content.Intent; | |
| 5 | +import android.content.SharedPreferences; | |
| 6 | +import android.graphics.Bitmap; | |
| 7 | +import android.graphics.BitmapFactory; | |
| 8 | +import android.media.MediaMetadataRetriever; | |
| 9 | +import android.net.Uri; | |
| 10 | +import android.os.Build; | |
| 11 | +import android.os.Environment; | |
| 12 | +import android.text.TextUtils; | |
| 13 | +import android.util.Log; | |
| 14 | + | |
| 15 | +import com.cnlive.libs.base.application.AppConfig; | |
| 16 | +import com.cnlive.libs.base.logic.Event; | |
| 17 | +import com.cnlive.libs.base.logic.Logic; | |
| 18 | +import com.cnlive.libs.base.util.AlertUtil; | |
| 19 | +import com.cnlive.libs.base.util.ShareReleaseInfoUtil; | |
| 20 | +import com.cnlive.libs.base.util.SharedPreferencesHelper; | |
| 21 | +import com.cnlive.libs.base.util.StringUtils; | |
| 22 | +import com.cnlive.libs.data.network.util.NetworkUtil; | |
| 23 | +import com.cnlive.media.media.entity.Media; | |
| 24 | +import com.cnlive.media.model.CircleData; | |
| 25 | + | |
| 26 | +import com.cnlive.publish.R; | |
| 27 | +import com.cnlive.publish.frame.view.ReleaseInfoEditView; | |
| 28 | +import com.cnlive.publish.moudle.ReleaseMediaItem; | |
| 29 | +import com.cnlive.publish.moudle.Witness; | |
| 30 | +import com.cnlive.publish.network.BaseInfo; | |
| 31 | +import com.cnlive.publish.upload.CoinRainAction; | |
| 32 | +import com.cnlive.publish.upload.UploadLogic; | |
| 33 | +import com.cnlive.publish.util.UserInfoUtils; | |
| 34 | +import com.google.gson.Gson; | |
| 35 | +import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | |
| 36 | + | |
| 37 | + | |
| 38 | +import java.io.File; | |
| 39 | +import java.text.SimpleDateFormat; | |
| 40 | +import java.util.ArrayList; | |
| 41 | +import java.util.Arrays; | |
| 42 | +import java.util.Date; | |
| 43 | +import java.util.List; | |
| 44 | +import java.util.Locale; | |
| 45 | + | |
| 46 | +import static android.content.Context.MODE_PRIVATE; | |
| 47 | +import static com.cnlive.libs.base.logic.Config.STATE_IDLE; | |
| 48 | +import static com.cnlive.libs.base.logic.Config.STATE_LOAD; | |
| 49 | +import static com.cnlive.libs.base.util.DoublePressed.onDoublePressed; | |
| 50 | +import static com.cnlive.publish.moudle.ReleaseMediaItem.type_select; | |
| 51 | + | |
| 52 | +/** | |
| 53 | + * Created by xiansong on 2018/1/31. | |
| 54 | + */ | |
| 55 | + | |
| 56 | +public class ReleaseInfoEditPersenter extends MvpBasePresenter<ReleaseInfoEditView> { | |
| 57 | + | |
| 58 | + private boolean au = false; | |
| 59 | + private String witc = ""; | |
| 60 | + | |
| 61 | + public void initPageData(Context context, List<Media> medias, String content) { | |
| 62 | + initPageData(context, content, "生活圈", 2, "moment", "Daren/moment/releaseMoment.action", AppConfig.isDebug() ? 371 : 366, medias, "", "", 0, "", new ArrayList<CircleData.indextag>(), "", | |
| 63 | + "生活圈", "编辑想说的内容...", 0, "363637", 0, "", "", ""); | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void initPageData(Context context, String message, String wit, int type, String videotype, String path, int multiplecategory, List<Media> medias, String img, String tag, int iswitinfo, String witContentId, List<CircleData.indextag> indextags, String jumptype, | |
| 67 | + String title, String defaulttext, int detailaddress, String labelcolor, int source, String bottomsrc, String fixTitle, String successJumpType) { | |
| 68 | + List<ReleaseMediaItem> list = new ArrayList<>(); | |
| 69 | + boolean isVideo = false; | |
| 70 | + | |
| 71 | + if (medias != null && medias.size() > 1 && 3 == medias.get(0).mediaType) { | |
| 72 | + medias = medias.subList(0, 1); | |
| 73 | + } | |
| 74 | + | |
| 75 | + if (medias != null) for (Media media : medias) { | |
| 76 | + //媒体类型转换 | |
| 77 | + ReleaseMediaItem item = (isVideo = media.mediaType == 3) ? | |
| 78 | + ReleaseMediaItem.newLocalVideo(R.drawable.bg_image_loading, media.path, media.path, null) : | |
| 79 | + ReleaseMediaItem.newLocalImage(R.drawable.bg_image_loading, media.path, null); | |
| 80 | + item.setMedia(media); | |
| 81 | + list.add(item); | |
| 82 | + item.setListener(v -> { | |
| 83 | + if (getView() != null) getView().itemClick(v, item); | |
| 84 | + }); | |
| 85 | + } | |
| 86 | + if (list.size() < 9 && !isVideo) | |
| 87 | + list.add(new ReleaseMediaItem("生活圈".equals(title) ? R.drawable.fb_tjsc : (!StringUtils.isEmpty(bottomsrc) ? R.drawable.circle_photo : R.drawable.fb_tjsp), true, list.size() == 0, view -> { | |
| 88 | + if (getView() != null) getView().showSelectPage(); | |
| 89 | + }, wit)); | |
| 90 | + | |
| 91 | + if (getView() != null) | |
| 92 | + getView().initPageView(title, message, wit, type, videotype, path, multiplecategory, isVideo, list, img, tag, iswitinfo, witContentId, indextags, jumptype, | |
| 93 | + defaulttext, detailaddress, labelcolor, source, fixTitle, successJumpType); | |
| 94 | + | |
| 95 | + } | |
| 96 | + | |
| 97 | + public void resetViewCallback(List<ReleaseMediaItem> list, int outtype) { | |
| 98 | + if (list == null) return; | |
| 99 | + for (ReleaseMediaItem item : list) { | |
| 100 | + item.setListener(item.getType() == type_select ? | |
| 101 | + v -> { | |
| 102 | + if (getView() != null) getView().showSelectPage(); | |
| 103 | + } : | |
| 104 | + v -> { | |
| 105 | + if (getView() != null) getView().itemClick(v, item); | |
| 106 | + } | |
| 107 | + ); | |
| 108 | + } | |
| 109 | + } | |
| 110 | + | |
| 111 | + public void initLocalData(Context context, List<Media> select, String wit, String title, String bootomsrc) { | |
| 112 | + List<ReleaseMediaItem> list = new ArrayList<>(); | |
| 113 | + boolean isVideo = false; | |
| 114 | + if (select != null) for (Media media : select) { | |
| 115 | + ReleaseMediaItem item = (isVideo = media.mediaType == 3) ? | |
| 116 | + ReleaseMediaItem.newLocalVideo(R.drawable.bg_image_loading, media.path, media.path, null) : | |
| 117 | + ReleaseMediaItem.newLocalImage(R.drawable.bg_image_loading, media.path, null); | |
| 118 | + item.setMedia(media); | |
| 119 | + list.add(item); | |
| 120 | + item.setListener(v -> { | |
| 121 | + if (getView() != null) getView().itemClick(v, item); | |
| 122 | + }); | |
| 123 | + } | |
| 124 | + | |
| 125 | + if (list.size() == 0 && !isVideo) | |
| 126 | + list.add(new ReleaseMediaItem("生活圈".equals(title) ? R.drawable.fb_tjsc : (!StringUtils.isEmpty(bootomsrc) ? R.drawable.circle_photo : R.drawable.fb_tjsp), true, list.size() == 0, view -> { | |
| 127 | + if (getView() != null) getView().showSelectPage(); | |
| 128 | + }, wit)); | |
| 129 | + if (list.size() < 9 && !isVideo && list.size() > 0) | |
| 130 | + list.add(new ReleaseMediaItem(R.drawable.fb_tjsc, true, list.size() == 0, view -> { | |
| 131 | + if (getView() != null) getView().showSelectPage(); | |
| 132 | + }, wit)); | |
| 133 | + | |
| 134 | + if (getView() != null && select.size() > 0) { | |
| 135 | + getView().initSelectList(isVideo, list); | |
| 136 | + getView().hasMedias(list.size()); | |
| 137 | + } | |
| 138 | + } | |
| 139 | + | |
| 140 | + public void doUploadInfo(Context context, List<ReleaseMediaItem> list, String message, String address, boolean isVideo, ShareReleaseInfoUtil.ShareConfig shareConfig, int gotype, String gopath, String videotype, int multiplecategory, String tagname, String tagId, boolean auditing, String witContentId, String createtime, int source, String coordinate) { | |
| 141 | + //处理快速点击 | |
| 142 | + if (onDoublePressed(false, 1500)) return; | |
| 143 | + if (UserInfoUtils.getNickName(context,"") == null) | |
| 144 | + return; | |
| 145 | + | |
| 146 | + String userId = UserInfoUtils.getUid(context,""); | |
| 147 | + String nickName = UserInfoUtils.getNickName(context,""); | |
| 148 | + | |
| 149 | + | |
| 150 | + if ("witness".equals(videotype)) { | |
| 151 | + if (auditing && !"".equals(witContentId)) { | |
| 152 | + UploadLogic.uploadVideoInfo(context, userId, nickName, message, address, "", uploadVideoEvent(context, ""), gopath, videotype, multiplecategory, tagname, tagId, false, auditing, witContentId, source, coordinate); | |
| 153 | + } else { | |
| 154 | + if (!isVideo) { | |
| 155 | + AlertUtil.showDeftToast(context, "该功能暂只支持视频发布,请重新添加视频."); | |
| 156 | + if (getView() != null) getView().setButClick(); | |
| 157 | + } else { | |
| 158 | + if (!new File(list.get(0).getMedia().path).exists()) { | |
| 159 | + AlertUtil.showDeftToast(context, "文件已损坏 请重新选取."); | |
| 160 | + if (getView() != null) getView().setButClick(); | |
| 161 | + } else { | |
| 162 | + String videoPath = list.get(0).getMedia().path; | |
| 163 | + boolean compressed = list.get(0).getMedia().compressed; | |
| 164 | + au = auditing; | |
| 165 | + witc = witContentId; | |
| 166 | + UploadLogic.uploadVideoInfo(context, userId, nickName, message, address, videoPath, uploadwitnessEvent(context, createtime == null ? "" : createtime), gopath, videotype, multiplecategory, tagname, tagId, compressed, auditing, witContentId, source, coordinate); | |
| 167 | + } | |
| 168 | + } | |
| 169 | + } | |
| 170 | + } else { | |
| 171 | + if (isVideo) { //发布视频信息 | |
| 172 | + if (!new File(list.get(0).getMedia().path).exists() && !(list.get(0).getMedia().size > 0)) { | |
| 173 | + AlertUtil.showDeftToast(context, "文件已损坏 请重新选取."); | |
| 174 | + if (getView() != null) getView().setButClick(); | |
| 175 | + } else { | |
| 176 | + String videoPath = list.get(0).getMedia().path; | |
| 177 | + boolean compressed = list.get(0).getMedia().compressed; | |
| 178 | + try { | |
| 179 | + MediaMetadataRetriever mmr = new MediaMetadataRetriever(); | |
| 180 | + mmr.setDataSource(videoPath); | |
| 181 | + String duration = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); | |
| 182 | + if (Integer.parseInt(duration) < 5000) { | |
| 183 | + AlertUtil.showFailedToast(context, "视频时长太短(小于5秒),请重新选择"); | |
| 184 | + if (getView() != null) getView().setButClick(); | |
| 185 | + } else { | |
| 186 | + getView().showUploadProView(); | |
| 187 | + UploadLogic.uploadVideoInfo(context, userId, nickName, message, address, videoPath, uploadVideoEvent(context, ""), gopath, videotype, multiplecategory, tagname, tagId, compressed, auditing, witContentId, source, coordinate); | |
| 188 | + } | |
| 189 | + } catch (Exception e) { | |
| 190 | + AlertUtil.showDeftToast(context, "视频信息异常请重新选取"); | |
| 191 | + if (getView() != null) getView().setButClick(); | |
| 192 | + e.printStackTrace(); | |
| 193 | + } | |
| 194 | + } | |
| 195 | + } else if (list.size() > 1) { //发布图文信息 | |
| 196 | + ArrayList<String> imagePaths = new ArrayList<>(); | |
| 197 | + ArrayList<Long> width = new ArrayList<>(); | |
| 198 | + ArrayList<Long> height = new ArrayList<>(); | |
| 199 | + BitmapFactory.Options options = new BitmapFactory.Options(); | |
| 200 | + options.inJustDecodeBounds = true; | |
| 201 | + for (ReleaseMediaItem item : list) | |
| 202 | + if (item.getType() == type_select) { | |
| 203 | + } else if (item.getMedia() != null && new File(item.getMedia().path).exists()) { | |
| 204 | + Bitmap bitmap = BitmapFactory.decodeFile(item.getMedia().path, options); // 此时返回的bitmap为null | |
| 205 | + if (options.outWidth > 0 && options.outHeight > 0) { | |
| 206 | + width.add((long) options.outWidth); | |
| 207 | + height.add((long) options.outHeight); | |
| 208 | + imagePaths.add(item.getMedia().path); | |
| 209 | + } else { | |
| 210 | + AlertUtil.showDeftToast(context, "文件已损坏 请重新选取."); | |
| 211 | + if (getView() != null) getView().setButClick(); | |
| 212 | + return; | |
| 213 | + } | |
| 214 | + } else { | |
| 215 | + AlertUtil.showDeftToast(context, "文件已损坏 请重新选取."); | |
| 216 | + if (getView() != null) getView().setButClick(); | |
| 217 | + return; | |
| 218 | + } | |
| 219 | + UploadLogic.uploadPicInfo(context, userId, message, address, imagePaths, width, height, uploadEvent(context, ""), gopath, videotype); | |
| 220 | + // UploadLogic.uploadAddressPicInfo(context,imagePaths,uploadAddEvent(context)); | |
| 221 | + } else { //发布文本信息 | |
| 222 | + if (shareConfig == null && TextUtils.isEmpty(message)) { | |
| 223 | + AlertUtil.showDeftToast(context, "内容不能为空."); | |
| 224 | + if (getView() != null) getView().setButClick(); | |
| 225 | + return; | |
| 226 | + } | |
| 227 | + if (shareConfig != null && shareConfig.getUrl() != null && shareConfig.getUrl().startsWith("http://wjjh5")) { //网家家内部向科链接 | |
| 228 | + UploadLogic.uploadHomeInfo(context, userId, message, address, null, null, shareConfig, uploadEventNew(context), gopath, videotype); | |
| 229 | + } else if (shareConfig != null && shareConfig.getUrl() != null && shareConfig.getUrl().contains(AppConfig.getShopPath())) { //电商链接 | |
| 230 | + UploadLogic.uploadHomeInfo(context, userId, message, address, null, null, shareConfig, uploadEventNew(context), gopath, videotype); | |
| 231 | + } else if (shareConfig != null && shareConfig.getUrl() != null && !shareConfig.getUrl().startsWith("http://wjjh5") && !"https://fir.im/d35h".equals(shareConfig.getUrl()) && !"中国网++ 让生活更美好!".equals(shareConfig.getTitle()) && !"中国网家家 让生活更美好!".equals(shareConfig.getTitle()) && !shareConfig.getUrl().startsWith("https://wjjshop")) { //外部浏览器分享链接 | |
| 232 | + UploadLogic.uploadInfo(context, userId, message, address, null, null, shareConfig, uploadEventNew(context), gopath, videotype); | |
| 233 | + } else if (shareConfig != null && shareConfig.getUrl() != null && !shareConfig.getUrl().startsWith("http://wjjh5") && "https://fir.im/d35h".equals(shareConfig.getUrl()) && !shareConfig.getUrl().startsWith("https://wjjshop")) { | |
| 234 | + UploadLogic.uploadHomeInfo(context, userId, message, address, null, null, shareConfig, uploadEventNew(context), gopath, videotype); | |
| 235 | + } else if (shareConfig != null && shareConfig.getUrl() != null && !shareConfig.getUrl().startsWith("http://wjjh5") && !"https://fir.im/d35h".equals(shareConfig.getUrl()) && "中国网++ 让生活更美好!".equals(shareConfig.getSubTitle()) && !"中国网家家 让生活更美好!".equals(shareConfig.getSubTitle()) && !shareConfig.getUrl().startsWith("https://wjjshop")) { | |
| 236 | + UploadLogic.uploadHomeInfo(context, userId, message, address, null, null, shareConfig, uploadEventNew(context), gopath, videotype); | |
| 237 | + } else if (shareConfig != null && shareConfig.getUrl() != null && shareConfig.getUrl().contains("mp.weixin.qq.com")) { | |
| 238 | + UploadLogic.uploadHomeInfo(context, userId, message, address, null, null, shareConfig, uploadEventNew(context), gopath, videotype); | |
| 239 | + } else { //纯文本 | |
| 240 | + UploadLogic.uploadHomeInfo(context, userId, message, address, null, null, null, uploadEventNew(context), gopath, videotype); | |
| 241 | + } | |
| 242 | + } | |
| 243 | + } | |
| 244 | + } | |
| 245 | + | |
| 246 | + private Event<BaseInfo> uploadEventNew(Context context) { | |
| 247 | + return new Event<BaseInfo>() | |
| 248 | + .setStateCallback(state -> { | |
| 249 | + if (getView() == null) return; | |
| 250 | + if (state == STATE_LOAD) getView().showUploadView(); | |
| 251 | + else if (state == STATE_IDLE) getView().hideUploadView(); | |
| 252 | + }) | |
| 253 | + .setFailureCallback((code, message) -> { | |
| 254 | + if (NetworkUtil.isConnectInternet(context)) { | |
| 255 | + AlertUtil.showDeftToast(context, message); | |
| 256 | + } else { | |
| 257 | + AlertUtil.showDeftToast(context, "网络连接失败"); | |
| 258 | + } | |
| 259 | + if (getView() != null) getView().showResultPage(false); | |
| 260 | + }) | |
| 261 | + .setProgressCallback(progress -> Log.e("Upload", "progress " + progress)) | |
| 262 | + .setSuccessCallback(data -> { | |
| 263 | + SharedPreferences preferences = context.getSharedPreferences("publishmoment", MODE_PRIVATE); | |
| 264 | + boolean status = preferences.getBoolean(UserInfoUtils.getUid(context,""), false); | |
| 265 | + Boolean app_is_show_integral = SharedPreferencesHelper.getInstance(context).getBoolValue("APP_IS_SHOW_INTEGRAL"); | |
| 266 | + if (!status && app_is_show_integral) { | |
| 267 | + CoinRainAction.code(context, UserInfoUtils.getUid(context,""), "publish_moment", "", "publishmoment", false); | |
| 268 | + } | |
| 269 | + File file = new File(getPath(context, "/strike/cache/") + "share.jpg"); | |
| 270 | + if (file.exists()) { | |
| 271 | + file.delete(); | |
| 272 | + } | |
| 273 | + AlertUtil.showDeftToast(context, "发布成功"); | |
| 274 | + if (getView() != null) getView().showResultPage(true); | |
| 275 | + }); | |
| 276 | + } | |
| 277 | + | |
| 278 | + private static String getPath(Context context, String cachePath) { | |
| 279 | + String path = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ? context.getExternalFilesDir("") : Environment.getExternalStorageDirectory()) + cachePath; | |
| 280 | + File file = new File(path); | |
| 281 | + if (file.mkdirs()) { | |
| 282 | + return path; | |
| 283 | + } | |
| 284 | + return path; | |
| 285 | + } | |
| 286 | + | |
| 287 | + | |
| 288 | + private Event<BaseInfo> uploadEvent(Context context, String createtime) { | |
| 289 | + return new Event<BaseInfo>() | |
| 290 | + .setStateCallback(state -> { | |
| 291 | + if (getView() == null) return; | |
| 292 | + if (state == STATE_LOAD) getView().showUploadView(); | |
| 293 | + else if (state == STATE_IDLE) getView().hideUploadView(); | |
| 294 | + }) | |
| 295 | + .setFailureCallback((code, message) -> { | |
| 296 | + if (NetworkUtil.isConnectInternet(context)) { | |
| 297 | + AlertUtil.showDeftToast(context, message); | |
| 298 | + } else { | |
| 299 | + AlertUtil.showDeftToast(context, "网络连接失败"); | |
| 300 | + } | |
| 301 | + if (getView() != null) getView().showResultPage(false); | |
| 302 | + }) | |
| 303 | + .setProgressCallback(progress -> Log.e("Upload", "progress " + progress)) | |
| 304 | + .setSuccessCallback(data -> { | |
| 305 | + if (!"".equals(createtime)) { | |
| 306 | + //todo 数据库操作 DBWitnessDetailAPI.deleteWitnessItem(context, createtime); | |
| 307 | + } | |
| 308 | + SharedPreferences preferences = context.getSharedPreferences("publishmoment", MODE_PRIVATE); | |
| 309 | + boolean status = preferences.getBoolean(UserInfoUtils.getUid(context,""), false); | |
| 310 | + Boolean app_is_show_integral = SharedPreferencesHelper.getInstance(context).getBoolValue("APP_IS_SHOW_INTEGRAL"); | |
| 311 | + if (!status && app_is_show_integral) { | |
| 312 | + CoinRainAction.code(context, UserInfoUtils.getUid(context,""), "publish_moment", "", "publishmoment", false); | |
| 313 | + } | |
| 314 | + AlertUtil.showDeftToast(context, "发布成功"); | |
| 315 | + if (getView() != null) getView().showResultPage(true); | |
| 316 | + }); | |
| 317 | + } | |
| 318 | + | |
| 319 | + private Event<BaseInfo> uploadVideoEvent(Context context, String createtime) { | |
| 320 | + return new Event<BaseInfo>() | |
| 321 | + .setStateCallback(state -> { | |
| 322 | + if (getView() == null) return; | |
| 323 | + //if (state == STATE_LOAD) getView().showUploadProView(); | |
| 324 | + }) | |
| 325 | + .setFailureCallback((code, message) -> { | |
| 326 | + if (NetworkUtil.isConnectInternet(context)) { | |
| 327 | + AlertUtil.showDeftToast(context, message); | |
| 328 | + } else { | |
| 329 | + AlertUtil.showDeftToast(context, "网络连接失败"); | |
| 330 | + } | |
| 331 | + if (getView() != null) getView().showResultPage(false); | |
| 332 | + }) | |
| 333 | + .setProgressCallback(progress -> { | |
| 334 | + if (getView() != null) getView().showProgressView(progress); | |
| 335 | + }) | |
| 336 | + .setSuccessCallback(data -> { | |
| 337 | + if (!"".equals(createtime)) { | |
| 338 | + //todo 数据库操作 DBWitnessDetailAPI.deleteWitnessItem(context, createtime); | |
| 339 | + } | |
| 340 | + SharedPreferences preferences = context.getSharedPreferences("publishmoment", MODE_PRIVATE); | |
| 341 | + boolean status = preferences.getBoolean(UserInfoUtils.getUid(context,""), false); | |
| 342 | + Boolean app_is_show_integral = SharedPreferencesHelper.getInstance(context).getBoolValue("APP_IS_SHOW_INTEGRAL"); | |
| 343 | + if (!status && app_is_show_integral) { | |
| 344 | + CoinRainAction.code(context, UserInfoUtils.getUid(context,""), "publish_moment", "", "publishmoment", false); | |
| 345 | + } | |
| 346 | + AlertUtil.showDeftToast(context, "发布成功"); | |
| 347 | + if (getView() != null) getView().showResultPage(true); | |
| 348 | + }); | |
| 349 | + } | |
| 350 | + | |
| 351 | + private Event<BaseInfo> uploadwitnessEvent(Context context, String createtime) { | |
| 352 | + return new Event<BaseInfo>() | |
| 353 | + .setStateCallback(state -> { | |
| 354 | + if (getView() == null) return; | |
| 355 | + if (state == STATE_LOAD) getView().showUploadProView(); | |
| 356 | + }) | |
| 357 | + .setFailureCallback((code, message) -> { | |
| 358 | + if (NetworkUtil.isConnectInternet(context)) { | |
| 359 | + AlertUtil.showDeftToast(context, message); | |
| 360 | + } else { | |
| 361 | + AlertUtil.showDeftToast(context, "网络连接失败"); | |
| 362 | + } | |
| 363 | + if (getView() != null) getView().showResultPage(false); | |
| 364 | + }) | |
| 365 | + .setProgressCallback(progress -> { | |
| 366 | + if (getView() != null) getView().showProgressView(progress); | |
| 367 | + }) | |
| 368 | + .setSuccessCallback(data -> { | |
| 369 | + if (!"".equals(createtime)) { | |
| 370 | + //todo 数据库操作 DBWitnessDetailAPI.deleteWitnessItem(context, createtime); | |
| 371 | + } | |
| 372 | + SharedPreferences preferences = context.getSharedPreferences("publishwitness", MODE_PRIVATE); | |
| 373 | + boolean status = preferences.getBoolean(UserInfoUtils.getUid(context,""), false); | |
| 374 | + Boolean app_is_show_integral = SharedPreferencesHelper.getInstance(context).getBoolValue("APP_IS_SHOW_INTEGRAL"); | |
| 375 | + if (!status && app_is_show_integral) { | |
| 376 | + CoinRainAction.code(context, UserInfoUtils.getUid(context,""), "publish_witness", "", "publishwitness", false); | |
| 377 | + } | |
| 378 | + //AlertUtil.showDeftToast(context, "发布成功"); | |
| 379 | + if (getView() != null) getView().showResultPage(true); | |
| 380 | + }); | |
| 381 | + } | |
| 382 | + | |
| 383 | + public void doSaveInfo(Context context, List<ReleaseMediaItem> adapterList, String message, String wit, int type, String videotype, String path, int multiplecategory, String texttag, List<CircleData.indextag> listtag) { | |
| 384 | + String sid = UserInfoUtils.getUid(context,""); | |
| 385 | + ArrayList<Media> list = new ArrayList<>(); | |
| 386 | + for (ReleaseMediaItem item : adapterList) | |
| 387 | + if (item.getMedia() != null) list.add(item.getMedia()); | |
| 388 | + String medias = new Gson().toJson(list); | |
| 389 | + String taglist = new Gson().toJson(listtag); | |
| 390 | + | |
| 391 | + SharedPreferencesHelper.getInstance(context).setValue("SAVE_RELEASE_INFO_MESSAGE_" + sid, message); | |
| 392 | + SharedPreferencesHelper.getInstance(context).setValue("SAVE_RELEASE_INFO_IMAGES_" + sid, medias); | |
| 393 | + SharedPreferencesHelper.getInstance(context).setValue("SAVE_RELEASE_INFO_WIT_" + sid, wit); | |
| 394 | + SharedPreferencesHelper.getInstance(context).setValue("SAVE_RELEASE_INFO_TYPE_" + sid, type); | |
| 395 | + SharedPreferencesHelper.getInstance(context).setValue("SAVE_RELEASE_INFO_VideoType_" + sid, videotype); | |
| 396 | + SharedPreferencesHelper.getInstance(context).setValue("SAVE_RELEASE_INFO_Path_" + sid, path); | |
| 397 | + SharedPreferencesHelper.getInstance(context).setValue("SAVE_RELEASE_INFO_Multiplecategory_" + sid, multiplecategory); | |
| 398 | + SharedPreferencesHelper.getInstance(context).setValue("SAVE_RELEASE_INFO_TEXTTAG_" + sid, texttag); | |
| 399 | + SharedPreferencesHelper.getInstance(context).setValue("SAVE_RELEASE_INFO_LISTTAG_" + sid, taglist); | |
| 400 | + } | |
| 401 | + | |
| 402 | + | |
| 403 | + public void saveDatabase(Context context, List<ReleaseMediaItem> adapterList, String title, String wit, int type, String videotype, String gopath, int multiplecategory, String tag, List<CircleData.indextag> listtag, String pageDataTitle, int source, String labelcolor, int address) { | |
| 404 | + if (adapterList == null && title == null) return; | |
| 405 | + String sd =UserInfoUtils.getUid(context,""); | |
| 406 | + String id = String.valueOf(adapterList.get(0).getMedia().id); | |
| 407 | + String path = adapterList.get(0).getMedia().path; | |
| 408 | + String fileUri = adapterList.get(0).getMedia().fileUri; | |
| 409 | + String timeStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH).format(new Date()); //创建此次草稿时间 | |
| 410 | + String time = String.valueOf(adapterList.get(0).getMedia().duration);//视频市场 | |
| 411 | + if (Integer.parseInt(time) < 5000) { | |
| 412 | + AlertUtil.showFailedToast(context, "视频时长太短(小于5秒),请重新选择"); | |
| 413 | + } else { | |
| 414 | + try { | |
| 415 | + String taglist = new Gson().toJson(listtag); | |
| 416 | + Logic.process(() -> { | |
| 417 | + Witness dbData = initDBDetail(sd, id, path, title, wit, type, videotype, gopath, multiplecategory, tag, timeStamp, time, "", taglist, pageDataTitle, source, labelcolor, address, fileUri); | |
| 418 | + // DBWitnessDetailAPI.removeData(context,id ); | |
| 419 | + //todo 数据库操作 DBWitnessDetailAPI.insertData(context, dbData); | |
| 420 | + return 0; | |
| 421 | + }, null); | |
| 422 | + AlertUtil.showDeftToast(context, "已成功保存至草稿箱"); | |
| 423 | + } catch (Exception e) { | |
| 424 | + AlertUtil.showDeftToast(context, "找不到指定路径文件"); | |
| 425 | + e.printStackTrace(); | |
| 426 | + } | |
| 427 | + } | |
| 428 | + } | |
| 429 | + | |
| 430 | + public void updataDatabase(Context context, List<ReleaseMediaItem> adapterList, String title, String wit, int type, String videotype, String gopath, int multiplecategory, String tag, String createtime, List<CircleData.indextag> listtag, String pageDataTitle, int source, String labelcolor, int address) { | |
| 431 | + if (adapterList == null || title == null || adapterList.get(0) == null || adapterList.get(0).getMedia() == null || adapterList.get(0).getMedia().path == null) | |
| 432 | + return; | |
| 433 | + String sd =UserInfoUtils.getUid(context,""); | |
| 434 | + String id = String.valueOf(adapterList.get(0).getMedia().id); | |
| 435 | + String path = adapterList.get(0).getMedia().path; | |
| 436 | + String fileUri = adapterList.get(0).getMedia().fileUri; | |
| 437 | + String timeStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH).format(new Date()); //创建此次草稿时间 | |
| 438 | + try { | |
| 439 | + MediaMetadataRetriever mmr = new MediaMetadataRetriever(); | |
| 440 | + mmr.setDataSource(path); | |
| 441 | + String time = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); | |
| 442 | + String taglist = new Gson().toJson(listtag); | |
| 443 | + Logic.process(() -> { | |
| 444 | + Witness dbData = initDBDetail(sd, id, path, title, wit, type, videotype, gopath, multiplecategory, tag, timeStamp, time, "", taglist, pageDataTitle, source, labelcolor, address, fileUri); | |
| 445 | + //todo 数据库操作 DBWitnessDetailAPI.update(context, createtime, dbData); | |
| 446 | + return 0; | |
| 447 | + }, null); | |
| 448 | + } catch (Exception e) { | |
| 449 | + AlertUtil.showDeftToast(context, "找不到指定路径文件"); | |
| 450 | + e.printStackTrace(); | |
| 451 | + } | |
| 452 | + } | |
| 453 | + | |
| 454 | + public Witness initDBDetail(String sid, String id, String path, String title, String wit, int type, String videotype, String gopath, int multiplecategory, String tag, String timeStamp, String dutation, String src, String taglist, String pageDataTitle, int source, String labelcolor, int address, String fileUri) { | |
| 455 | + Witness dbData = new Witness(); | |
| 456 | + dbData.setId(id); | |
| 457 | + dbData.setSid(sid); | |
| 458 | + dbData.setMedias(path); | |
| 459 | + dbData.setTitle(title); | |
| 460 | + dbData.setWit(wit); | |
| 461 | + dbData.setType(type); | |
| 462 | + dbData.setVideotype(videotype); | |
| 463 | + dbData.setGopath(gopath); | |
| 464 | + dbData.setMultiplecategory(multiplecategory); | |
| 465 | + dbData.setTag(tag); | |
| 466 | + dbData.setTimeStamp(timeStamp); | |
| 467 | + dbData.setDutation(dutation); | |
| 468 | + dbData.setSrc(src); | |
| 469 | + dbData.setTaglist(taglist); | |
| 470 | + dbData.setPageDataTitle(pageDataTitle); | |
| 471 | + dbData.setSource(source); | |
| 472 | + dbData.setLabelcolor(labelcolor); | |
| 473 | + dbData.setDetailAddress(address); | |
| 474 | + dbData.setFileUri(fileUri); | |
| 475 | + return dbData; | |
| 476 | + } | |
| 477 | + | |
| 478 | + | |
| 479 | + public void doLoadInfo(Context context) { | |
| 480 | + String sid = UserInfoUtils.getUid(context,""); | |
| 481 | + String message = SharedPreferencesHelper.getInstance(context).getValue("SAVE_RELEASE_INFO_MESSAGE_" + sid); | |
| 482 | + String medias = SharedPreferencesHelper.getInstance(context).getValue("SAVE_RELEASE_INFO_IMAGES_" + sid); | |
| 483 | + String wit = SharedPreferencesHelper.getInstance(context).getValue("SAVE_RELEASE_INFO_WIT_" + sid); | |
| 484 | + String videotype = SharedPreferencesHelper.getInstance(context).getValue("SAVE_RELEASE_INFO_VideoType_" + sid); | |
| 485 | + String path = SharedPreferencesHelper.getInstance(context).getValue("SAVE_RELEASE_INFO_Path_" + sid); | |
| 486 | + int type = SharedPreferencesHelper.getInstance(context).getIntValue("SAVE_RELEASE_INFO_TYPE_" + sid); | |
| 487 | + int multiplecategory = SharedPreferencesHelper.getInstance(context).getIntValue("SAVE_RELEASE_INFO_Multiplecategory_" + sid); | |
| 488 | + String texttag = SharedPreferencesHelper.getInstance(context).getValue("SAVE_RELEASE_INFO_TEXTTAG_" + sid); | |
| 489 | + Media[] mediaArray = new Gson().fromJson(medias, Media[].class); | |
| 490 | + initPageData(context, message, "生活圈", 2, "moment", "Daren/moment/releaseMoment.action", AppConfig.isDebug() ? 371 : 366, mediaArray == null ? null : Arrays.asList(mediaArray), "", "", 0, "", new ArrayList<CircleData.indextag>(), "", | |
| 491 | + "生活圈", "编辑想说的内容...", 0, "363637", 0, "", "", ""); | |
| 492 | + if (getView() != null) { | |
| 493 | + getView().hasDes(message); | |
| 494 | + getView().hasMedias(mediaArray == null ? 0 : mediaArray.length); | |
| 495 | + } | |
| 496 | + } | |
| 497 | + | |
| 498 | + public void WitnessLoadInfo(Context context, String text, String img, String tag, int iswitinfo, String witContentId, String videopath, String duration, String taglist, String jumpType, String json, String fileUri) { | |
| 499 | + if (videopath.length() > 1 && !"".equals(json) && json != null && !"undefined".equals(json)) { | |
| 500 | + CircleData.ReleaseVideoTypeListBean jsontext = new Gson().fromJson(json, CircleData.ReleaseVideoTypeListBean.class); | |
| 501 | + File file = new File(videopath); | |
| 502 | + List<Media> medias = new ArrayList<>(); | |
| 503 | + Media media = new Media(file.getPath(), file.getName(), 6, 3, file.length(), 0, "", 6, fileUri); | |
| 504 | + medias.add(media); | |
| 505 | + CircleData.indextag[] tagArray = new Gson().fromJson(taglist, CircleData.indextag[].class); | |
| 506 | + if (tagArray != null) { | |
| 507 | + List<CircleData.indextag> indextags = Arrays.asList(tagArray); | |
| 508 | + initPageData(context, text, jsontext.getTitle(), 2, "witness", "Daren/witness/releaseWitness.action", AppConfig.isDebug() ? 375 : 370, medias, "", tag, iswitinfo, "", indextags, jumpType, | |
| 509 | + jsontext.getTitle(), jsontext.getDefaultText(), jsontext.getDetailAddress(), jsontext.getLabelColor(), jsontext.getSource(), jsontext.getBottomSrc(), "", jsontext.getSuccessJumpType()); | |
| 510 | + } else { | |
| 511 | + List<CircleData.indextag> indextags = new ArrayList<CircleData.indextag>(); | |
| 512 | + initPageData(context, text, "目击者", 2, "witness", "Daren/witness/releaseWitness.action", AppConfig.isDebug() ? 375 : 370, medias, "", tag, iswitinfo, "", indextags, jumpType, | |
| 513 | + jsontext.getTitle(), jsontext.getDefaultText(), jsontext.getDetailAddress(), jsontext.getLabelColor(), jsontext.getSource(), jsontext.getBottomSrc(), "", jsontext.getSuccessJumpType()); | |
| 514 | + } | |
| 515 | + | |
| 516 | + } else if ("html".equals(jumpType) && !"".equals(json) && json != null && !"undefined".equals(json)) { | |
| 517 | + SharedPreferences.Editor editor = context.getSharedPreferences("tagVideo", Context.MODE_PRIVATE).edit(); | |
| 518 | + editor.putString("videoTagList", json); | |
| 519 | + editor.apply(); | |
| 520 | + CircleData.ReleaseVideoTypeListBean jsontext = new Gson().fromJson(json, CircleData.ReleaseVideoTypeListBean.class); | |
| 521 | + initPageData(context, text, jsontext.getText(), 2, jsontext.getVideoType(), jsontext.getChangePath(), jsontext.getMultiplecategory(), null, "", tag, iswitinfo, "", jsontext.getCategoryTag(), jumpType, | |
| 522 | + jsontext.getTitle(), jsontext.getDefaultText(), jsontext.getDetailAddress(), jsontext.getLabelColor(), jsontext.getSource(), jsontext.getBottomSrc(), jsontext.getFixedTitle(), jsontext.getSuccessJumpType()); | |
| 523 | + } else if ("myself".equals(jumpType) && !"".equals(json) && json != null && !"undefined".equals(json)) { | |
| 524 | + SharedPreferences.Editor editor = context.getSharedPreferences("tagVideo", Context.MODE_PRIVATE).edit(); | |
| 525 | + editor.putString("videoTagList", json); | |
| 526 | + editor.apply(); | |
| 527 | + CircleData.ReleaseVideoTypeListBean jsontext = new Gson().fromJson(json, CircleData.ReleaseVideoTypeListBean.class); | |
| 528 | + initPageData(context, text, jsontext.getText(), 2, jsontext.getVideoType(), jsontext.getChangePath(), jsontext.getMultiplecategory(), null, "", tag, iswitinfo, "", jsontext.getCategoryTag(), jumpType, | |
| 529 | + jsontext.getTitle(), jsontext.getDefaultText(), jsontext.getDetailAddress(), jsontext.getLabelColor(), jsontext.getSource(), jsontext.getBottomSrc(), "", jsontext.getSuccessJumpType()); | |
| 530 | + } else if ("WitnessInfo".equals(jumpType)) { | |
| 531 | + SharedPreferences preferences = context.getSharedPreferences("tagVideo", MODE_PRIVATE); | |
| 532 | + String videoTagList = preferences.getString("videoTagList", ""); | |
| 533 | + CircleData.ReleaseVideoTypeListBean jsontext = new Gson().fromJson(videoTagList, CircleData.ReleaseVideoTypeListBean.class); | |
| 534 | + if (jsontext != null) { | |
| 535 | + initPageData(context, text, jsontext.getText(), 2, jsontext.getVideoType(), jsontext.getChangePath(), jsontext.getMultiplecategory(), null, "", tag, iswitinfo, "", jsontext.getCategoryTag(), jumpType, | |
| 536 | + jsontext.getTitle(), jsontext.getDefaultText(), jsontext.getDetailAddress(), jsontext.getLabelColor(), jsontext.getSource(), jsontext.getBottomSrc(), "", jsontext.getSuccessJumpType()); | |
| 537 | + } else { | |
| 538 | + | |
| 539 | + List<CircleData.indextag> indextags = new ArrayList<>(); | |
| 540 | + if (tag.length() > 1) { | |
| 541 | + CircleData.indextag indextag = new CircleData.indextag(); | |
| 542 | + indextag.setTagId("110"); | |
| 543 | + indextag.setTagName(tag); | |
| 544 | + indextags.add(indextag); | |
| 545 | + } | |
| 546 | + initPageData(context, text, "目击者", 2, "witness", "Daren/witness/releaseWitness.action", AppConfig.isDebug() ? 375 : 370, null, "", tag, iswitinfo, "", indextags, jumpType, | |
| 547 | + "目击者", | |
| 548 | + "我在现场,我要说...", 0, "666666", 0, "", "", ""); | |
| 549 | + } | |
| 550 | + } else { | |
| 551 | + List<CircleData.indextag> indextags = new ArrayList<>(); | |
| 552 | + if (tag.length() > 1) { | |
| 553 | + CircleData.indextag indextag = new CircleData.indextag(); | |
| 554 | + indextag.setTagId("110"); | |
| 555 | + indextag.setTagName(tag); | |
| 556 | + indextags.add(indextag); | |
| 557 | + } | |
| 558 | + initPageData(context, text, "目击者", 2, "witness", "Daren/witness/releaseWitness.action", AppConfig.isDebug() ? 375 : 370, null, img, tag, iswitinfo, witContentId, indextags, jumpType, "目击者", | |
| 559 | + "我在现场,我要说...", 0, "666666", 0, "", "", ""); | |
| 560 | + } | |
| 561 | + | |
| 562 | + | |
| 563 | + if (getView() != null) { | |
| 564 | + getView().hasDes(text); | |
| 565 | + getView().hasMedias(1); | |
| 566 | + } | |
| 567 | + } | |
| 568 | + | |
| 569 | + public void comeevent(Context context, String message, String wit, int type, String videotype, String path, int multiplecategory, List<Media> medias, String img, String tag, int iswitinfo, String witContentId, List<CircleData.indextag> indextags, String jumptype) { | |
| 570 | + List<ReleaseMediaItem> list = new ArrayList<>(); | |
| 571 | + String title = "目击者".equals(wit) ? "目击者" : "生活圈"; | |
| 572 | + String defaultText = "目击者".equals(wit) ? "我在现场,我要说……(字数不超过140个字)" : "编辑想说的内容..."; | |
| 573 | + int source = 0; | |
| 574 | + boolean isVideo = false; | |
| 575 | + if (medias != null) for (Media media : medias) { | |
| 576 | + //同步系统相册数据 | |
| 577 | + Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); | |
| 578 | + Uri uri = Uri.fromFile(new File(media.path)); | |
| 579 | + intent.setData(uri); | |
| 580 | + context.sendBroadcast(intent); | |
| 581 | + //媒体类型转换 | |
| 582 | + ReleaseMediaItem item = (isVideo = media.mediaType == 3) ? | |
| 583 | + ReleaseMediaItem.newLocalVideo(R.drawable.bg_image_loading, media.path, media.path, null) : | |
| 584 | + ReleaseMediaItem.newLocalImage(R.drawable.bg_image_loading, media.path, null); | |
| 585 | + item.setMedia(media); | |
| 586 | + list.add(item); | |
| 587 | + item.setListener(v -> { | |
| 588 | + if (getView() != null) getView().itemClick(v, item); | |
| 589 | + }); | |
| 590 | + } | |
| 591 | + if (list.size() < 9 && !isVideo) | |
| 592 | + list.add(new ReleaseMediaItem("生活圈".equals(title) ? R.drawable.fb_tjsc : R.drawable.fb_tjsp, true, list.size() == 0, view -> { | |
| 593 | + if (getView() != null) getView().showSelectPage(); | |
| 594 | + }, wit)); | |
| 595 | + | |
| 596 | + if (getView() != null) | |
| 597 | + getView().initPageView(title, message, wit, type, videotype, path, multiplecategory, isVideo, list, img, tag, iswitinfo, witContentId, indextags, jumptype, | |
| 598 | + defaultText, 0, "363637", source, "", ""); | |
| 599 | + | |
| 600 | + } | |
| 601 | + | |
| 602 | + public void doDeleteInfo(Context context) { | |
| 603 | + if (context == null) return; | |
| 604 | + String sid = UserInfoUtils.getUid(context,""); | |
| 605 | + SharedPreferencesHelper.getInstance(context).remove("SAVE_RELEASE_INFO_MESSAGE_" + sid); | |
| 606 | + SharedPreferencesHelper.getInstance(context).remove("SAVE_RELEASE_INFO_IMAGES_" + sid); | |
| 607 | + SharedPreferencesHelper.getInstance(context).remove("SAVE_RELEASE_INFO_WIT_" + sid); | |
| 608 | + SharedPreferencesHelper.getInstance(context).remove("SAVE_RELEASE_INFO_TYPE_" + sid); | |
| 609 | + SharedPreferencesHelper.getInstance(context).remove("SAVE_RELEASE_INFO_VideoType_" + sid); | |
| 610 | + SharedPreferencesHelper.getInstance(context).remove("SAVE_RELEASE_INFO_Path_" + sid); | |
| 611 | + SharedPreferencesHelper.getInstance(context).remove("SAVE_RELEASE_INFO_Multiplecategory_" + sid); | |
| 612 | + SharedPreferencesHelper.getInstance(context).remove("SAVE_RELEASE_INFO_TEXTTAG_" + sid); | |
| 613 | + SharedPreferencesHelper.getInstance(context).remove("SAVE_RELEASE_INFO_LISTTAG_" + sid); | |
| 614 | + } | |
| 615 | + | |
| 616 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/frame/view/MyScrollView.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/frame/view/MyScrollView.java | |
| 1 | +package com.cnlive.publish.frame.view; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.graphics.Rect; | |
| 5 | +import android.util.AttributeSet; | |
| 6 | +import android.widget.ScrollView; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Author by Yuansiwen.com, Date on 2018/9/6. | |
| 10 | + * 因发布页面“一加”手机弹出软键盘时候scrollview上移; | |
| 11 | + */ | |
| 12 | +public class MyScrollView extends ScrollView { | |
| 13 | + public MyScrollView(Context context) { | |
| 14 | + super(context); | |
| 15 | + } | |
| 16 | + | |
| 17 | + public MyScrollView(Context context, AttributeSet attrs) { | |
| 18 | + super(context, attrs); | |
| 19 | + } | |
| 20 | + | |
| 21 | + public MyScrollView(Context context, AttributeSet attrs, int defStyleAttr) { | |
| 22 | + super(context, attrs, defStyleAttr); | |
| 23 | + } | |
| 24 | + | |
| 25 | + @Override | |
| 26 | + protected int computeScrollDeltaToGetChildRectOnScreen(Rect rect) { | |
| 27 | + | |
| 28 | + return 0; | |
| 29 | + } | |
| 30 | + | |
| 31 | + | |
| 32 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/frame/view/ReleaseInfoEditView.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/frame/view/ReleaseInfoEditView.java | |
| 1 | +package com.cnlive.publish.frame.view; | |
| 2 | + | |
| 3 | +import android.Manifest; | |
| 4 | +import android.app.Activity; | |
| 5 | +import android.app.Dialog; | |
| 6 | +import android.content.Context; | |
| 7 | +import android.os.Build; | |
| 8 | +import android.os.Environment; | |
| 9 | +import android.text.TextUtils; | |
| 10 | +import android.view.View; | |
| 11 | +import android.widget.TextView; | |
| 12 | + | |
| 13 | +import com.cnlive.libs.base.application.AppConfig; | |
| 14 | +import com.cnlive.libs.base.frame.adapter.DataBindingRecyclerAdapter; | |
| 15 | +import com.cnlive.libs.base.util.AlertUtil; | |
| 16 | +import com.cnlive.libs.base.util.DoublePressed; | |
| 17 | +import com.cnlive.libs.base.util.ShareReleaseInfoUtil; | |
| 18 | +import com.cnlive.libs.base.util.SharedPreferencesHelper; | |
| 19 | +import com.cnlive.libs.base.util.StringUtils; | |
| 20 | +import com.cnlive.media.ImagePicker; | |
| 21 | +import com.cnlive.media.PickerConfig; | |
| 22 | +import com.cnlive.media.media.entity.Media; | |
| 23 | +import com.cnlive.media.model.CircleData; | |
| 24 | +import com.cnlive.media.utils.AlertDialogUtils; | |
| 25 | +import com.cnlive.media.utils.AndroidQUtil; | |
| 26 | +import com.cnlive.media.utils.PermissionChecker; | |
| 27 | + | |
| 28 | +import com.cnlive.publish.R; | |
| 29 | +import com.cnlive.publish.fragment.ReleaseInfoEditFragment; | |
| 30 | +import com.cnlive.publish.moudle.CircleMsgData; | |
| 31 | +import com.cnlive.publish.moudle.ReleaseMediaItem; | |
| 32 | +import com.cnlive.publish.moudle.ReleaseMediaPage; | |
| 33 | +import com.cnlive.publish.util.AppUtil; | |
| 34 | +import com.cnlive.publish.widget.Constant; | |
| 35 | +import com.cnlive.strike.ui.widget.BottomSheet; | |
| 36 | +import com.google.gson.Gson; | |
| 37 | +import com.google.gson.reflect.TypeToken; | |
| 38 | +import com.hannesdorfmann.mosby3.mvp.MvpView; | |
| 39 | + | |
| 40 | +import java.util.ArrayList; | |
| 41 | +import java.util.List; | |
| 42 | + | |
| 43 | +import static com.cnlive.media.PickerConfig.CAMERA_MODE_ALL; | |
| 44 | +import static com.cnlive.media.PickerConfig.CAMERA_MODE_PIC; | |
| 45 | +import static com.cnlive.media.PickerConfig.CAMERA_MODE_VIDEO; | |
| 46 | +import static com.cnlive.publish.activity.ReleasePublishAcityity.REQUEST_CODE_SELECT_CAMERA; | |
| 47 | +import static com.cnlive.publish.activity.ReleasePublishAcityity.REQUEST_CODE_SELECT_READ_WRITE; | |
| 48 | +import static com.cnlive.publish.moudle.ReleaseMediaItem.type_local_image; | |
| 49 | +import static com.cnlive.publish.moudle.ReleaseMediaItem.type_local_video; | |
| 50 | +import static com.cnlive.publish.moudle.ReleaseMediaItem.type_net_image; | |
| 51 | +import static com.cnlive.publish.moudle.ReleaseMediaItem.type_net_video; | |
| 52 | + | |
| 53 | + | |
| 54 | +/** | |
| 55 | + * Created by xiansong on 2018/1/31. | |
| 56 | + */ | |
| 57 | + | |
| 58 | +public class ReleaseInfoEditView implements MvpView { | |
| 59 | + | |
| 60 | + private ReleaseInfoEditFragment fragment; | |
| 61 | + private boolean hasHTML; | |
| 62 | + private boolean hasDes; | |
| 63 | + private boolean hasMedias; | |
| 64 | + private boolean releaseBtnClickable; | |
| 65 | + public BottomSheet bottomSheet6; | |
| 66 | + public BottomSheet bottomSheet7; | |
| 67 | + | |
| 68 | + public ReleaseInfoEditView(ReleaseInfoEditFragment fragment) { | |
| 69 | + this.fragment = fragment; | |
| 70 | + } | |
| 71 | + | |
| 72 | + private Activity getContext() { | |
| 73 | + return fragment == null ? null : fragment.getActivity(); | |
| 74 | + } | |
| 75 | + | |
| 76 | + public void initSelectList(boolean isVideo, List<ReleaseMediaItem> list) { | |
| 77 | + if (getContext() == null) return; | |
| 78 | + fragment.pageData.setVideo(isVideo); | |
| 79 | + if (3 == list.get(0).getMedia().mediaType && list.size() > 1) { | |
| 80 | + List<ReleaseMediaItem> releaseMediaItems = list.subList(0, 1); | |
| 81 | + fragment.pageData.getAdapter().updateItems(releaseMediaItems); | |
| 82 | + } else { | |
| 83 | + fragment.pageData.getAdapter().updateItems(list); | |
| 84 | + } | |
| 85 | + } | |
| 86 | + | |
| 87 | + private ArrayList<Media> getMediaList() { | |
| 88 | + List<ReleaseMediaItem> list = fragment.pageData.getAdapter().getList(); | |
| 89 | + ArrayList<Media> medias = new ArrayList<>(); | |
| 90 | + for (ReleaseMediaItem item : list) if (item.getMedia() != null) medias.add(item.getMedia()); | |
| 91 | + return medias; | |
| 92 | + } | |
| 93 | + | |
| 94 | + //根据已选媒体类型,开启相册视图 | |
| 95 | + public void showSelectPage() { | |
| 96 | + if (DoublePressed.onDoublePressed()) return; | |
| 97 | + if (getContext() == null) return; | |
| 98 | + List<ReleaseMediaItem> list = fragment.pageData.getAdapter().getList(); | |
| 99 | + fragment.bottomSheet.show(); | |
| 100 | + } | |
| 101 | + | |
| 102 | + private static String[] showAlbumPermissions = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}; | |
| 103 | + | |
| 104 | + //相册选取 | |
| 105 | + public void showAlbum(boolean checkOnly) { | |
| 106 | + if (getContext() == null) return; | |
| 107 | + List<ReleaseMediaItem> list = fragment.pageData.getAdapter().getList(); | |
| 108 | + | |
| 109 | + boolean hasPermission = checkOnly ? | |
| 110 | + AppUtil.checkPermissions(fragment.getActivity(), showAlbumPermissions) : | |
| 111 | + PermissionChecker.checkPermissions(fragment.getActivity() | |
| 112 | + , showAlbumPermissions | |
| 113 | + , REQUEST_CODE_SELECT_READ_WRITE, R.string.READ_EXTERNAL_STORAGE); | |
| 114 | + if (hasPermission) { | |
| 115 | + if ("生活圈".equals(fragment.pageData.getTitle())) { | |
| 116 | + new ImagePicker.Builder() | |
| 117 | + .needCamera(false) | |
| 118 | + .maxNum(fragment.pageData.isVideo() ? 1 : 9) | |
| 119 | + .setSelectGif(true) | |
| 120 | + .maxVideoSize(200 * 1024 * 1024) | |
| 121 | + .maxImageSize(Constant.IMAGE_MAX_SIZE) | |
| 122 | + .isReturnUri(AndroidQUtil.isAndroidQ()) | |
| 123 | + .isSinglePick(fragment.pageData.isVideo()) | |
| 124 | + .showTime(true) | |
| 125 | + .maxTime(Constant.VIDEO_MAX_TIME) | |
| 126 | + .selectMode(list.size() > 1 ? PickerConfig.PICKER_IMAGE : PickerConfig.PICKER_ONLY_ONE_TYPE) | |
| 127 | + .cachePath((Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ? getContext().getExternalFilesDir("") : Environment.getExternalStorageDirectory()) + "/strike/file/") | |
| 128 | + .defaultSelectList(getMediaList()) | |
| 129 | + .isFriendCircle(true) | |
| 130 | + .builder() | |
| 131 | + //跳转到图片选择页面 activity 请求码 结果码 | |
| 132 | + .start(fragment.getActivity(), 200, PickerConfig.DEFAULT_RESULT_CODE); | |
| 133 | + } else { | |
| 134 | + new ImagePicker.Builder() | |
| 135 | + .needCamera(false) | |
| 136 | + .maxNum(1) | |
| 137 | + .setSelectGif(true) | |
| 138 | + .maxVideoSize(500 * 1024 * 1024) | |
| 139 | + .maxImageSize(Constant.IMAGE_MAX_SIZE) | |
| 140 | + .isReturnUri(AndroidQUtil.isAndroidQ()) | |
| 141 | + .showTime(true) | |
| 142 | + .isSinglePick(true) | |
| 143 | + .maxTime(Constant.VIDEO_MAX_TIME) | |
| 144 | + .selectMode(PickerConfig.PICKER_VIDEO) | |
| 145 | + .cachePath((Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ? getContext().getExternalFilesDir("") : Environment.getExternalStorageDirectory()) + "/strike/file/") | |
| 146 | + .defaultSelectList(getMediaList()) | |
| 147 | + .isFriendCircle(true) | |
| 148 | + .builder() | |
| 149 | + //跳转到图片选择页面 activity 请求码 结果码 | |
| 150 | + .start(fragment.getActivity(), 200, PickerConfig.DEFAULT_RESULT_CODE); | |
| 151 | + } | |
| 152 | + } | |
| 153 | + } | |
| 154 | + | |
| 155 | + private static String[] showShootPermissions = new String[]{Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE}; | |
| 156 | + | |
| 157 | + //拍摄页面 | |
| 158 | + public void showShoot(boolean checkOnly) { | |
| 159 | + if (getContext() == null) return; | |
| 160 | + if (AppConfig.isIsTrtcTalking()) { | |
| 161 | + AlertUtil.showDeftToast(getContext(), getContext().getString(R.string.user_trtc_talking)); | |
| 162 | + return; | |
| 163 | + } | |
| 164 | + | |
| 165 | + boolean hasPermission = checkOnly ? | |
| 166 | + AppUtil.checkPermissions(fragment.getActivity(), showShootPermissions) : | |
| 167 | + PermissionChecker.checkPermissions(fragment.getActivity() | |
| 168 | + , showShootPermissions | |
| 169 | + , REQUEST_CODE_SELECT_CAMERA, R.string.dialog_imagepicker_permission_camera_message); | |
| 170 | + if (hasPermission) { | |
| 171 | + new ImagePicker | |
| 172 | + .Builder() | |
| 173 | + .setJumpCameraMode(getMediaList().size() > 0 ? CAMERA_MODE_PIC : "生活圈".equals(fragment.pageData.getTitle()) ? CAMERA_MODE_ALL : CAMERA_MODE_VIDEO) // 1 图片 3 视频 | |
| 174 | + .builder() | |
| 175 | + .startCamera(fragment.getActivity(), getMediaList(), 200, PickerConfig.DEFAULT_RESULT_CODE); | |
| 176 | + } | |
| 177 | + } | |
| 178 | + | |
| 179 | + public void showUploadView() { | |
| 180 | + fragment.tipDialog.show(); | |
| 181 | + } | |
| 182 | + | |
| 183 | + public void showCopyView() { | |
| 184 | + fragment.copyDialog.show(); | |
| 185 | + } | |
| 186 | + | |
| 187 | + public void setButClick() { | |
| 188 | + fragment.buttonRRight.setClickable(true); | |
| 189 | + } | |
| 190 | + | |
| 191 | + public void showUploadProView() { | |
| 192 | + fragment.showPro(0); | |
| 193 | + } | |
| 194 | + | |
| 195 | + public void hideUploadView() { | |
| 196 | + fragment.tipDialog.dismiss(); | |
| 197 | + } | |
| 198 | + | |
| 199 | + public void hideCopyView() { | |
| 200 | + fragment.copyDialog.dismiss(); | |
| 201 | + } | |
| 202 | + | |
| 203 | + public void showProgressView(double progress) { | |
| 204 | + fragment.showPro(progress); | |
| 205 | + } | |
| 206 | + | |
| 207 | + public void backMain() { | |
| 208 | + if (getContext() == null) return; | |
| 209 | + ((Activity) getContext()).finish(); | |
| 210 | + } | |
| 211 | + | |
| 212 | + public void showResultPage(boolean isSuccess) { | |
| 213 | + if (fragment.pageData.getShareConfig() == null) | |
| 214 | + fragment.getPresenter().doDeleteInfo(getContext()); | |
| 215 | + fragment.showReleaseResult(isSuccess, fragment.pageData.getShareConfig() == null, | |
| 216 | + fragment.pageData.getShareConfig() == null ? "" : fragment.pageData.getShareConfig().getUrl() == null ? "" : fragment.pageData.getShareConfig().getUrl()); | |
| 217 | + | |
| 218 | + } | |
| 219 | + | |
| 220 | + public void itemClick(View view, ReleaseMediaItem item) { | |
| 221 | + if (view.getId() == R.id.workBenchView && item.getIconVisibility() != 0) { | |
| 222 | + showSelectPage(); | |
| 223 | + } | |
| 224 | + if (view.getId() == R.id.workBenchView && item.getIconVisibility() == 0) { | |
| 225 | + DataBindingRecyclerAdapter adapter = fragment.pageData.getAdapter(); | |
| 226 | + new ImagePicker.Builder() | |
| 227 | + .builder() | |
| 228 | + .startPreview(fragment.getActivity(), adapter.getList().indexOf(item), getMediaList(), 200, PickerConfig.DEFAULT_RESULT_CODE); | |
| 229 | + } | |
| 230 | + if (view.getId() == R.id.item_delete) { | |
| 231 | + showRemoveItemDialog(item); | |
| 232 | + } | |
| 233 | + } | |
| 234 | + | |
| 235 | + public void showRemoveItemDialog(ReleaseMediaItem item) { | |
| 236 | + if (fragment.deleteImageDialog != null) fragment.deleteImageDialog.dismiss(); | |
| 237 | + | |
| 238 | + fragment.deleteImageDialog = AlertDialogUtils.showTwoButtonDialog(getContext(), "取消", "删除", deleteItemTag(item), R.color.color_dialog_btn, R.color.color_ffa300, | |
| 239 | + new AlertDialogUtils.DialogTwoListener() { | |
| 240 | + @Override | |
| 241 | + public void onClickLeft(Dialog dialog) { | |
| 242 | + dialog.dismiss(); | |
| 243 | + } | |
| 244 | + | |
| 245 | + @Override | |
| 246 | + public void onClickRight(Dialog dialog) { | |
| 247 | + removeItem(item); | |
| 248 | + dialog.dismiss(); | |
| 249 | + } | |
| 250 | + }); | |
| 251 | + } | |
| 252 | + | |
| 253 | + public String deleteItemTag(ReleaseMediaItem item) { | |
| 254 | + String message = "确认删除此项吗"; | |
| 255 | + switch (item.getType()) { | |
| 256 | + case type_net_image: | |
| 257 | + case type_local_image: | |
| 258 | + message = "确认删除图片吗?"; | |
| 259 | + break; | |
| 260 | + case type_net_video: | |
| 261 | + case type_local_video: | |
| 262 | + message = "确认删除视频吗?"; | |
| 263 | + break; | |
| 264 | + } | |
| 265 | + return message; | |
| 266 | + } | |
| 267 | + | |
| 268 | + public void removeItem(ReleaseMediaItem item) { | |
| 269 | + DataBindingRecyclerAdapter adapter = fragment.pageData.getAdapter(); | |
| 270 | + adapter.removeItem(adapter.getList().indexOf(item)); | |
| 271 | + if (adapter.getItemCount() == 0) { | |
| 272 | + adapter.addItem(new ReleaseMediaItem("生活圈".equals(fragment.pageData.getTitle()) ? R.drawable.fb_tjsc : ((!StringUtils.isEmpty(fragment.pageData.getBottomSrc()) ? R.drawable.circle_photo : R.drawable.fb_tjsp)), true, true, view -> showSelectPage(), fragment.pageData.getWit())); | |
| 273 | + fragment.pageData.setVideo(false); | |
| 274 | + } else if (adapter.getItemCount() == 1 && ((ReleaseMediaItem) adapter.getItem(0)).getType() == ReleaseMediaItem.type_select) { | |
| 275 | + ((ReleaseMediaItem) adapter.getItem(0)).setIconRes("生活圈".equals(fragment.pageData.getTitle()) ? R.drawable.fb_tjsc : ((!StringUtils.isEmpty(fragment.pageData.getBottomSrc()) ? R.drawable.circle_photo : R.drawable.fb_tjsp))); | |
| 276 | + ((ReleaseMediaItem) adapter.getItem(0)).setNullvisiable(View.VISIBLE); | |
| 277 | + ((ReleaseMediaItem) adapter.getItem(0)).setAddvisiable(View.GONE); | |
| 278 | + fragment.pageData.setVideo(false); | |
| 279 | + } else if (((ReleaseMediaItem) adapter.getItem(adapter.getItemCount() - 1)).getType() != ReleaseMediaItem.type_select) { | |
| 280 | + adapter.addItem(new ReleaseMediaItem("生活圈".equals(fragment.pageData.getTitle()) ? R.drawable.fb_tjsc : ((!StringUtils.isEmpty(fragment.pageData.getBottomSrc()) ? R.drawable.circle_photo : R.drawable.fb_tjsp)), true, adapter.getItemCount() == 0, view -> showSelectPage(), fragment.pageData.getWit())); | |
| 281 | + } | |
| 282 | + | |
| 283 | + hasMedias(adapter.getList().size() - 1); | |
| 284 | + } | |
| 285 | + | |
| 286 | + public void showBack() { | |
| 287 | + Activity activity = getContext(); | |
| 288 | + if (activity == null || activity.isDestroyed()) return; | |
| 289 | + fragment.getPresenter().doDeleteInfo(activity); | |
| 290 | + fragment.bottomSheet1.dismiss(); | |
| 291 | + activity.finish(); | |
| 292 | + } | |
| 293 | + | |
| 294 | + public void showdis() { | |
| 295 | + fragment.bottomSheet1.dismiss(); | |
| 296 | + } | |
| 297 | + | |
| 298 | + public void showsave() { | |
| 299 | + if ("目击者".equals(fragment.pageData.getWit())) { | |
| 300 | + if (fragment.pageData.isVideo()) { | |
| 301 | + /*fragment.getPresenter().saveDatabase(getContext(),fragment.pageData.getAdapter().getList(), | |
| 302 | + fragment.pageData.getMessage(),fragment.pageData.getWit(), | |
| 303 | + fragment.pageData.getType(),fragment.pageData.getVideotype(), | |
| 304 | + fragment.pageData.getGopath(),fragment.pageData.getMultiplecategory(), | |
| 305 | + fragment.pageData.getTagtext() | |
| 306 | + );*/ | |
| 307 | + fragment.getPresenter().doSaveInfo(getContext(), fragment.pageData.getAdapter().getList(), fragment.pageData.getMessage(), fragment.pageData.getWit(), fragment.pageData.getType(), fragment.pageData.getVideotype(), fragment.pageData.getGopath(), fragment.pageData.getMultiplecategory(), fragment.pageData.getTagtext(), fragment.pageData.getCategoryTag()); | |
| 308 | + getContext().finish(); | |
| 309 | + fragment.bottomSheet3.dismiss(); | |
| 310 | + } else { | |
| 311 | + AlertUtil.showDeftToast(getContext(), "该功能暂只支持视频类型保存,请重新添加视频."); | |
| 312 | + } | |
| 313 | + } else { | |
| 314 | + fragment.getPresenter().doSaveInfo(getContext(), fragment.pageData.getAdapter().getList(), fragment.pageData.getMessage(), fragment.pageData.getWit(), fragment.pageData.getType(), fragment.pageData.getVideotype(), fragment.pageData.getGopath(), fragment.pageData.getMultiplecategory(), fragment.pageData.getTagtext(), fragment.pageData.getCategoryTag()); | |
| 315 | + getContext().finish(); | |
| 316 | + fragment.bottomSheet2.dismiss(); | |
| 317 | + } | |
| 318 | + | |
| 319 | + } | |
| 320 | + | |
| 321 | + /** | |
| 322 | + * 发布编辑页面选择目击者模式保存操作 | |
| 323 | + */ | |
| 324 | + public void showsavenow(int type, String createtime) { | |
| 325 | + if (!"生活圈".equals(fragment.pageData.getTitle())) { | |
| 326 | + if (fragment.pageData.isVideo()) { | |
| 327 | + if (type == 2 && createtime.length() > 1) { | |
| 328 | + fragment.getPresenter().updataDatabase(getContext(), fragment.pageData.getAdapter().getList(), | |
| 329 | + fragment.pageData.getMessage(), fragment.pageData.getWit(), | |
| 330 | + fragment.pageData.getType(), fragment.pageData.getVideotype(), | |
| 331 | + fragment.pageData.getGopath(), fragment.pageData.getMultiplecategory(), | |
| 332 | + fragment.pageData.getTagtext(), createtime, fragment.pageData.getCategoryTag(), | |
| 333 | + fragment.pageData.getTitle(), fragment.pageData.getSource(), | |
| 334 | + fragment.pageData.getLabelcolor(), fragment.pageData.getDetailaddress() | |
| 335 | + ); | |
| 336 | + } else { | |
| 337 | + fragment.getPresenter().saveDatabase(getContext(), fragment.pageData.getAdapter().getList(), | |
| 338 | + fragment.pageData.getMessage(), fragment.pageData.getWit(), | |
| 339 | + fragment.pageData.getType(), fragment.pageData.getVideotype(), | |
| 340 | + fragment.pageData.getGopath(), fragment.pageData.getMultiplecategory(), | |
| 341 | + fragment.pageData.getTagtext(), fragment.pageData.getCategoryTag(), | |
| 342 | + fragment.pageData.getTitle(), fragment.pageData.getSource(), | |
| 343 | + fragment.pageData.getLabelcolor(), fragment.pageData.getDetailaddress() | |
| 344 | + ); | |
| 345 | + } | |
| 346 | + // fragment.getPresenter().doSaveInfo(getContext(), fragment.pageData.getAdapter().getList(), fragment.pageData.getMessage(), fragment.pageData.getWit(), fragment.pageData.getType(), fragment.pageData.getVideotype(), fragment.pageData.getGopath(), fragment.pageData.getMultiplecategory(), fragment.pageData.getTagtext(), fragment.pageData.getCategoryTag()); | |
| 347 | + getContext().finish(); | |
| 348 | + fragment.bottomSheet3.dismiss(); | |
| 349 | + } else { | |
| 350 | + AlertUtil.showDeftToast(getContext(), "该功能暂只支持视频类型保存,请重新添加视频."); | |
| 351 | + } | |
| 352 | + } else { | |
| 353 | + // fragment.getPresenter().doSaveInfo(getContext(), fragment.pageData.getAdapter().getList(), fragment.pageData.getMessage(), fragment.pageData.getWit(), fragment.pageData.getType(), fragment.pageData.getVideotype(), fragment.pageData.getGopath(), fragment.pageData.getMultiplecategory(), fragment.pageData.getTagtext(), fragment.pageData.getCategoryTag()); | |
| 354 | + getContext().finish(); | |
| 355 | + fragment.bottomSheet3.dismiss(); | |
| 356 | + } | |
| 357 | + | |
| 358 | + } | |
| 359 | + | |
| 360 | + /** | |
| 361 | + * 草稿箱进入编辑页面单纯保存至数据库 | |
| 362 | + */ | |
| 363 | + | |
| 364 | + public void showsavedraft(int type, String createtime) { | |
| 365 | + if (!"生活圈".equals(fragment.pageData.getTitle())) { | |
| 366 | + if (fragment.pageData.isVideo()) { | |
| 367 | + if (type == 2 && createtime.length() > 1) { | |
| 368 | + fragment.getPresenter().updataDatabase(getContext(), fragment.pageData.getAdapter().getList(), | |
| 369 | + fragment.pageData.getMessage(), fragment.pageData.getWit(), | |
| 370 | + fragment.pageData.getType(), fragment.pageData.getVideotype(), | |
| 371 | + fragment.pageData.getGopath(), fragment.pageData.getMultiplecategory(), | |
| 372 | + fragment.pageData.getTagtext(), createtime, fragment.pageData.getCategoryTag(), | |
| 373 | + fragment.pageData.getTitle(), fragment.pageData.getSource(), | |
| 374 | + fragment.pageData.getLabelcolor(), fragment.pageData.getDetailaddress() | |
| 375 | + ); | |
| 376 | + } else { | |
| 377 | + fragment.getPresenter().saveDatabase(getContext(), fragment.pageData.getAdapter().getList(), | |
| 378 | + fragment.pageData.getMessage(), fragment.pageData.getWit(), | |
| 379 | + fragment.pageData.getType(), fragment.pageData.getVideotype(), | |
| 380 | + fragment.pageData.getGopath(), fragment.pageData.getMultiplecategory(), | |
| 381 | + fragment.pageData.getTagtext(), fragment.pageData.getCategoryTag(), | |
| 382 | + fragment.pageData.getTitle(), fragment.pageData.getSource(), | |
| 383 | + fragment.pageData.getLabelcolor(), fragment.pageData.getDetailaddress()); | |
| 384 | + } | |
| 385 | + // fragment.getPresenter().doSaveInfo(getContext(), fragment.pageData.getAdapter().getList(), fragment.pageData.getMessage(), fragment.pageData.getWit(), fragment.pageData.getType(), fragment.pageData.getVideotype(), fragment.pageData.getGopath(), fragment.pageData.getMultiplecategory(), fragment.pageData.getTagtext(), fragment.pageData.getCategoryTag()); | |
| 386 | + getContext().finish(); | |
| 387 | + fragment.bottomSheet4.dismiss(); | |
| 388 | + } else { | |
| 389 | + AlertUtil.showDeftToast(getContext(), "该功能暂只支持视频类型保存,请重新添加视频."); | |
| 390 | + } | |
| 391 | + } else { | |
| 392 | + // fragment.getPresenter().doSaveInfo(getContext(), fragment.pageData.getAdapter().getList(), fragment.pageData.getMessage(), fragment.pageData.getWit(), fragment.pageData.getType(), fragment.pageData.getVideotype(), fragment.pageData.getGopath(), fragment.pageData.getMultiplecategory(), fragment.pageData.getTagtext(), fragment.pageData.getCategoryTag()); | |
| 393 | + getContext().finish(); | |
| 394 | + fragment.bottomSheet4.dismiss(); | |
| 395 | + } | |
| 396 | + | |
| 397 | + } | |
| 398 | + | |
| 399 | + /** | |
| 400 | + * 目击者删除当前数据 | |
| 401 | + */ | |
| 402 | + public void showdel() { | |
| 403 | + if ("目击者".equals(fragment.pageData.getWit())) { | |
| 404 | + fragment.bottomSheet3.dismiss(); | |
| 405 | + } else { | |
| 406 | + fragment.bottomSheet2.dismiss(); | |
| 407 | + } | |
| 408 | + bottomSheet6 = new BottomSheet.BottomListSheetBuilder(getContext()) | |
| 409 | + .addItem("确定删除") | |
| 410 | + .addItem("取消") | |
| 411 | + .setOnSheetItemClickListener((dialog, itemView, positio, tag) -> { | |
| 412 | + if (positio == 0) { | |
| 413 | + fragment.getPresenter().doDeleteInfo(getContext()); | |
| 414 | + bottomSheet6.dismiss(); | |
| 415 | + getContext().finish(); | |
| 416 | + } | |
| 417 | + dialog.dismiss(); | |
| 418 | + }).build(); | |
| 419 | + bottomSheet6.show(); | |
| 420 | + } | |
| 421 | + | |
| 422 | + /** | |
| 423 | + * 生活圈删除 | |
| 424 | + */ | |
| 425 | + public void showdellife() { | |
| 426 | + fragment.getPresenter().doDeleteInfo(getContext()); | |
| 427 | + getContext().finish(); | |
| 428 | + if ("目击者".equals(fragment.pageData.getWit())) { | |
| 429 | + fragment.bottomSheet3.dismiss(); | |
| 430 | + } else { | |
| 431 | + fragment.bottomSheet2.dismiss(); | |
| 432 | + } | |
| 433 | + } | |
| 434 | + | |
| 435 | + /** | |
| 436 | + * 单纯退出草稿编辑页面 | |
| 437 | + */ | |
| 438 | + public void showdedraft() { | |
| 439 | + getContext().finish(); | |
| 440 | + fragment.bottomSheet4.dismiss(); | |
| 441 | + } | |
| 442 | + | |
| 443 | + public void showdeldraft(Context context, String createtime) { | |
| 444 | + fragment.bottomSheet4.dismiss(); | |
| 445 | + bottomSheet7 = new BottomSheet.BottomListSheetBuilder(getContext()) | |
| 446 | + .addItem("确定删除") | |
| 447 | + .addItem("取消") | |
| 448 | + .setOnSheetItemClickListener((dialog, itemView, positio, tag) -> { | |
| 449 | + if (positio == 0 && !StringUtils.isEmpty(createtime)) { | |
| 450 | + //todo 删除数据库数据 DBWitnessDetailAPI.deleteWitnessItem(context, createtime); | |
| 451 | + bottomSheet7.dismiss(); | |
| 452 | + getContext().finish(); | |
| 453 | + } | |
| 454 | + dialog.dismiss(); | |
| 455 | + }).build(); | |
| 456 | + bottomSheet7.show(); | |
| 457 | + } | |
| 458 | + | |
| 459 | + public void showBackDialog() { | |
| 460 | + boolean messageEmpty = TextUtils.isEmpty(fragment.pageData.getMessage()); | |
| 461 | + boolean fileEmpty = fragment.pageData.getAdapter().getList().get(0).getType() == ReleaseMediaItem.type_select; | |
| 462 | + if (messageEmpty && fileEmpty) { | |
| 463 | + fragment.bottomSheet1.show(); | |
| 464 | + } else { | |
| 465 | + if (!"生活圈".equals(fragment.pageData.getTitle()) && "".equals(fragment.pageData.getWitContentId()) && !fileEmpty && !"draft".equals(fragment.pageData.getJumpType())) { | |
| 466 | + fragment.bottomSheet3.show(); | |
| 467 | + } else if (!"生活圈".equals(fragment.pageData.getTitle()) && !"".equals(fragment.pageData.getWitContentId()) && !"draft".equals(fragment.pageData.getJumpType())) { | |
| 468 | + fragment.bottomSheet1.show(); | |
| 469 | + } else if (!"生活圈".equals(fragment.pageData.getTitle()) && "draft".equals(fragment.pageData.getJumpType())) { | |
| 470 | + fragment.bottomSheet4.show(); | |
| 471 | + } else { | |
| 472 | + fragment.bottomSheet2.show(); | |
| 473 | + } | |
| 474 | + } | |
| 475 | + } | |
| 476 | + | |
| 477 | + public void hasHTML(ShareReleaseInfoUtil.ShareConfig shareConfig) { | |
| 478 | + if (shareConfig == null) hasHTML = false; | |
| 479 | + else hasHTML = true; | |
| 480 | + changeReleaseBtn(); | |
| 481 | + } | |
| 482 | + | |
| 483 | + public void hasDes(String message) { | |
| 484 | + if (TextUtils.isEmpty(message)) hasDes = false; | |
| 485 | + else hasDes = true; | |
| 486 | + changeReleaseBtn(); | |
| 487 | + } | |
| 488 | + | |
| 489 | + public void hasMedias(int size) { | |
| 490 | + if (size > 0) | |
| 491 | + hasMedias = true; | |
| 492 | + else hasMedias = false; | |
| 493 | + changeReleaseBtn(); | |
| 494 | + } | |
| 495 | + | |
| 496 | + private void changeReleaseBtn() { | |
| 497 | + if (fragment == null || fragment.getView() == null) return; | |
| 498 | + if (fragment.getView().findViewById(R.id.rightBtn) == null) return; | |
| 499 | + | |
| 500 | + TextView rightBtn = fragment.getView().findViewById(R.id.rightBtn); | |
| 501 | + | |
| 502 | + if (hasDes || hasMedias || hasHTML) { | |
| 503 | + // rightBtn.setTextColor(0xffffa300); | |
| 504 | + releaseBtnClickable = true; | |
| 505 | + } else { | |
| 506 | + // if (releaseBtnClickable) rightBtn.setTextColor(0xff282828); | |
| 507 | + releaseBtnClickable = false; | |
| 508 | + } | |
| 509 | + } | |
| 510 | + | |
| 511 | + public void initPageView(String title, String message, String wit, int type, String videotype, String path, int multiplecategory, boolean isVideo, List<ReleaseMediaItem> list, String img, String tag, int iswitinfo, | |
| 512 | + String witContentId, List<CircleData.indextag> indextags, String jumpType, String defaulttext, int detailaddress, String labelcolor, int source, String fixTitle, String successJumpType) { | |
| 513 | + ReleaseMediaPage pageData = fragment.pageData; | |
| 514 | + pageData.setTitle(title); | |
| 515 | + pageData.setMessage("".equals(fixTitle) ? message : fixTitle); | |
| 516 | + pageData.setFixedTitle(fixTitle); | |
| 517 | + pageData.setSuccessJumpType(successJumpType); | |
| 518 | + pageData.setWit(wit); | |
| 519 | + pageData.setType(type); | |
| 520 | + pageData.setVideo(isVideo); | |
| 521 | + pageData.setVideotype(videotype); | |
| 522 | + pageData.setGopath(path); | |
| 523 | + pageData.setMultiplecategory(multiplecategory); | |
| 524 | + pageData.getAdapter().updateItems(list); | |
| 525 | + pageData.setTagtext(tag); | |
| 526 | + pageData.setJumpType(jumpType); | |
| 527 | + pageData.setDefaulttext(defaulttext); | |
| 528 | + pageData.setDetailaddress(detailaddress); | |
| 529 | + pageData.setLabelcolor(labelcolor); | |
| 530 | + pageData.setSource(source); | |
| 531 | + String circleMesg = SharedPreferencesHelper.getInstance(fragment.getActivity()).getValue("CIRCLE_MESG"); | |
| 532 | + List<CircleMsgData.ReleaseVideoTypeListBean> circleList = new Gson().fromJson(circleMesg, new TypeToken<List<CircleMsgData.ReleaseVideoTypeListBean>>() { | |
| 533 | + }.getType()); | |
| 534 | + if (!"生活圈".equals(title) && circleList != null && circleList.size() > 0) { | |
| 535 | + for (int i = 0; i < circleList.size(); i++) { | |
| 536 | + if (circleList.get(i).getSource() == source) { | |
| 537 | + pageData.setBottomSrc(circleList.get(i).getBottomSrc()); | |
| 538 | + pageData.setReleaseButtonColor(circleList.get(i).getReleaseButtonColor()); | |
| 539 | + pageData.setTopColor(circleList.get(i).getTopColor()); | |
| 540 | + if (circleList.get(i).getCategoryTag() != null && circleList.get(i).getCategoryTag().size() > 0 && circleList.get(i).getCategoryTag().get(0).getColour() != null) { | |
| 541 | + pageData.setLabelcolor(circleList.get(i).getCategoryTag().get(0).getColour()); | |
| 542 | + } else { | |
| 543 | + pageData.setLabelcolor("666666"); | |
| 544 | + } | |
| 545 | + } | |
| 546 | + } | |
| 547 | + } | |
| 548 | + | |
| 549 | + if ("生活圈".equals(title) && pageData.getAdapter().getItemCount() == 1 && (pageData.getAdapter().getItem(0)).getType() == ReleaseMediaItem.type_select) { | |
| 550 | + pageData.getAdapter().getItem(0).setIconRes(R.drawable.fb_tjsc); | |
| 551 | + } else if (!"生活圈".equals(title) && pageData.getAdapter().getItemCount() == 1 && (pageData.getAdapter().getItem(0)).getType() == ReleaseMediaItem.type_select) { | |
| 552 | + pageData.getAdapter().getItem(0).setIconRes(((!StringUtils.isEmpty(fragment.pageData.getBottomSrc()) ? R.drawable.circle_photo : R.drawable.fb_tjsp))); | |
| 553 | + } | |
| 554 | + if (indextags != null && indextags.size() > 0) { | |
| 555 | + pageData.setCategoryTag(indextags); | |
| 556 | + } | |
| 557 | + | |
| 558 | + | |
| 559 | + if (iswitinfo == 2 && !"".equals(img)) { | |
| 560 | + pageData.setWitimg(img); | |
| 561 | + pageData.setWitContentId(witContentId); | |
| 562 | + pageData.setShareVisibility(View.GONE); | |
| 563 | + pageData.setRecyclerVisibility(View.GONE); | |
| 564 | + pageData.setIsWitVisibility(View.VISIBLE); | |
| 565 | + } else if (iswitinfo == 2 && "".equals(img)) { | |
| 566 | + pageData.setWitContentId(""); | |
| 567 | + pageData.setShareVisibility(View.GONE); | |
| 568 | + pageData.setRecyclerVisibility(View.VISIBLE); | |
| 569 | + pageData.setIsWitVisibility(View.GONE); | |
| 570 | + } else if (iswitinfo == 0 && "".equals(img)) { | |
| 571 | + pageData.setWitContentId(""); | |
| 572 | + } | |
| 573 | + | |
| 574 | + | |
| 575 | + if (pageData.getShareConfig() != null && iswitinfo != 2) { | |
| 576 | + pageData.setSharetit(pageData.getShareConfig().getTitle()); | |
| 577 | + pageData.setSharepic(pageData.getShareConfig().getImage()); | |
| 578 | + pageData.setShareVisibility(View.VISIBLE); | |
| 579 | + pageData.setRecyclerVisibility(View.GONE); | |
| 580 | + } | |
| 581 | + } | |
| 582 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/moudle/AddIntegration.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/moudle/AddIntegration.java | |
| 1 | +package com.cnlive.publish.moudle; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | + | |
| 5 | +public class AddIntegration implements Serializable { | |
| 6 | + | |
| 7 | + | |
| 8 | + public static class DataBean { | |
| 9 | + /** | |
| 10 | + * status : false | |
| 11 | + * score : 100 | |
| 12 | + */ | |
| 13 | + | |
| 14 | + private boolean status; | |
| 15 | + private String score; | |
| 16 | + private String desc; | |
| 17 | + private String descEnd; | |
| 18 | + | |
| 19 | + public String getDescEnd() { | |
| 20 | + return descEnd; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public void setDescEnd(String descEnd) { | |
| 24 | + this.descEnd = descEnd; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public String getDesc() { | |
| 28 | + return desc; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public void setDesc(String desc) { | |
| 32 | + this.desc = desc; | |
| 33 | + } | |
| 34 | + | |
| 35 | + | |
| 36 | + public boolean isStatus() { | |
| 37 | + return status; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void setStatus(boolean status) { | |
| 41 | + this.status = status; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public String getScore() { | |
| 45 | + return score; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setScore(String score) { | |
| 49 | + this.score = score; | |
| 50 | + } | |
| 51 | + } | |
| 52 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/moudle/CheckApplyResultInfo.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/moudle/CheckApplyResultInfo.java | |
| 1 | +package com.cnlive.publish.moudle; | |
| 2 | + | |
| 3 | +import com.cnlive.publish.network.BaseInfo; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Created by cnlive20080010 on 2018/10/10. | |
| 7 | + */ | |
| 8 | + | |
| 9 | +public class CheckApplyResultInfo extends BaseInfo<CheckApplyResultInfo> { | |
| 10 | + | |
| 11 | + private boolean isNotRecorded;//是否提交了身份审核,true:是 false:否.为true时 witnessBean才有数据 | |
| 12 | + private WitnessBeanBean witnessBean; | |
| 13 | + | |
| 14 | + public boolean isIsNotRecorded() { | |
| 15 | + return isNotRecorded; | |
| 16 | + } | |
| 17 | + | |
| 18 | + public void setIsNotRecorded(boolean isNotRecorded) { | |
| 19 | + this.isNotRecorded = isNotRecorded; | |
| 20 | + } | |
| 21 | + | |
| 22 | + public WitnessBeanBean getWitnessBean() { | |
| 23 | + return witnessBean; | |
| 24 | + } | |
| 25 | + | |
| 26 | + public void setWitnessBean(WitnessBeanBean witnessBean) { | |
| 27 | + this.witnessBean = witnessBean; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public static class WitnessBeanBean { | |
| 31 | + /** | |
| 32 | + * nick : 哈哈哈 | |
| 33 | + * realName : 徐 | |
| 34 | + * face : https://wjj.ys1.cnliveimg.com/769/img/2018/0416/head_c.png | |
| 35 | + * address : | |
| 36 | + * idCardNo : 210681********6732 | |
| 37 | + * mobile : 188****4578 | |
| 38 | + * status : 0 | |
| 39 | + * auditFailureReason : | |
| 40 | + * updateTime : 1539054682000 | |
| 41 | + */ | |
| 42 | + | |
| 43 | + private String nick; | |
| 44 | + private String realName; | |
| 45 | + private String face; | |
| 46 | + private String address; | |
| 47 | + private String idCardNo; | |
| 48 | + private String mobile; | |
| 49 | + private int status;//审核状态 0-审核中,1-申请失败,2申请成功 | |
| 50 | + private String auditFailureReason;//审核失败原因 | |
| 51 | + private long updateTime;//审核通过或失败时间 | |
| 52 | + | |
| 53 | + public String getNick() { | |
| 54 | + return nick; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public void setNick(String nick) { | |
| 58 | + this.nick = nick; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public String getRealName() { | |
| 62 | + return realName; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public void setRealName(String realName) { | |
| 66 | + this.realName = realName; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public String getFace() { | |
| 70 | + return face; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public void setFace(String face) { | |
| 74 | + this.face = face; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public String getAddress() { | |
| 78 | + return address; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public void setAddress(String address) { | |
| 82 | + this.address = address; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public String getIdCardNo() { | |
| 86 | + return idCardNo; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public void setIdCardNo(String idCardNo) { | |
| 90 | + this.idCardNo = idCardNo; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public String getMobile() { | |
| 94 | + return mobile; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public void setMobile(String mobile) { | |
| 98 | + this.mobile = mobile; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public int getStatus() { | |
| 102 | + return status; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public void setStatus(int status) { | |
| 106 | + this.status = status; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public String getAuditFailureReason() { | |
| 110 | + return auditFailureReason; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public void setAuditFailureReason(String auditFailureReason) { | |
| 114 | + this.auditFailureReason = auditFailureReason; | |
| 115 | + } | |
| 116 | + | |
| 117 | + public long getUpdateTime() { | |
| 118 | + return updateTime; | |
| 119 | + } | |
| 120 | + | |
| 121 | + public void setUpdateTime(long updateTime) { | |
| 122 | + this.updateTime = updateTime; | |
| 123 | + } | |
| 124 | + | |
| 125 | + @Override | |
| 126 | + public String toString() { | |
| 127 | + return "WitnessBeanBean{" + | |
| 128 | + "nick='" + nick + '\'' + | |
| 129 | + ", realName='" + realName + '\'' + | |
| 130 | + ", face='" + face + '\'' + | |
| 131 | + ", address='" + address + '\'' + | |
| 132 | + ", idCardNo='" + idCardNo + '\'' + | |
| 133 | + ", mobile='" + mobile + '\'' + | |
| 134 | + ", status=" + status + | |
| 135 | + ", auditFailureReason='" + auditFailureReason + '\'' + | |
| 136 | + ", updateTime=" + updateTime + | |
| 137 | + '}'; | |
| 138 | + } | |
| 139 | + } | |
| 140 | + | |
| 141 | + @Override | |
| 142 | + public String toString() { | |
| 143 | + return "DarenInfo{" + | |
| 144 | + "isNotRecorded=" + isNotRecorded + | |
| 145 | + ", witnessBean=" + witnessBean + | |
| 146 | + '}'; | |
| 147 | + } | |
| 148 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/moudle/CheckData.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/moudle/CheckData.java | |
| 1 | +package com.cnlive.publish.moudle; | |
| 2 | + | |
| 3 | +public class CheckData { | |
| 4 | + private int ban; | |
| 5 | + private int edit; | |
| 6 | + | |
| 7 | + public int getBan() { | |
| 8 | + return ban; | |
| 9 | + } | |
| 10 | + | |
| 11 | + public void setBan(int ban) { | |
| 12 | + this.ban = ban; | |
| 13 | + } | |
| 14 | + | |
| 15 | + public int getEdit() { | |
| 16 | + return edit; | |
| 17 | + } | |
| 18 | + | |
| 19 | + public void setEdit(int edit) { | |
| 20 | + this.edit = edit; | |
| 21 | + } | |
| 22 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/moudle/CircleMsgData.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/moudle/CircleMsgData.java | |
| 1 | +package com.cnlive.publish.moudle; | |
| 2 | + | |
| 3 | + | |
| 4 | +import android.text.TextUtils; | |
| 5 | + | |
| 6 | +import java.io.Serializable; | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 视频圈子信息,与发现页面圈子信息不一致,若要相同找产品重新确认业务逻辑 | |
| 11 | + */ | |
| 12 | + | |
| 13 | +public class CircleMsgData implements Serializable { | |
| 14 | + | |
| 15 | + | |
| 16 | + private List<ReleaseVideoTypeListBean> releaseVideoTypeList; | |
| 17 | + private List<SnowVideoTypeListBean> snowVideoTypeList; | |
| 18 | + | |
| 19 | + public List<ReleaseVideoTypeListBean> getReleaseVideoTypeList() { | |
| 20 | + return releaseVideoTypeList; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public void setReleaseVideoTypeList(List<ReleaseVideoTypeListBean> releaseVideoTypeList) { | |
| 24 | + this.releaseVideoTypeList = releaseVideoTypeList; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public List<SnowVideoTypeListBean> getSnowVideoTypeList() { | |
| 28 | + return snowVideoTypeList; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public void setSnowVideoTypeList(List<SnowVideoTypeListBean> snowVideoTypeList) { | |
| 32 | + this.snowVideoTypeList = snowVideoTypeList; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public static class ReleaseVideoTypeListBean implements Serializable { | |
| 36 | + /** | |
| 37 | + * id : 111 | |
| 38 | + * path : http://apiwjjtest.cnlive.com/Daren/witness/releaseWitness.action | |
| 39 | + * pic : https://wjj.ys1.cnliveimg.com/769/img/2018/0129/grzx_mjz.png | |
| 40 | + * text : 目击者 | |
| 41 | + * videoType : witness | |
| 42 | + * multiplecategory:888 | |
| 43 | + * multipleCategory | |
| 44 | + */ | |
| 45 | + | |
| 46 | + private int id; | |
| 47 | + private String path; | |
| 48 | + private String pic; | |
| 49 | + private String text; | |
| 50 | + private String videoType; | |
| 51 | + private String changePath; | |
| 52 | + private int multipleCategory; | |
| 53 | + private List<indextag> categoryTag; | |
| 54 | + private String defaultText; | |
| 55 | + private String defaultTitle; | |
| 56 | + private int detailAddress; | |
| 57 | + private String labelColor; | |
| 58 | + private int source; | |
| 59 | + private String title; | |
| 60 | + private String bottomSrc; | |
| 61 | + private String protocolAddress; | |
| 62 | + private String releaseButtonColor; | |
| 63 | + private String topColor; | |
| 64 | + private String jumpAddress; | |
| 65 | + private String describes; | |
| 66 | + private String channelName; | |
| 67 | + private String signPic; | |
| 68 | + private String signText; | |
| 69 | + | |
| 70 | + public String getSignPic() { | |
| 71 | + return signPic; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setSignPic(String signPic) { | |
| 75 | + this.signPic = signPic; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public String getSignText() { | |
| 79 | + return signText; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public void setSignText(String signText) { | |
| 83 | + this.signText = signText; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public String getChannelName() { | |
| 87 | + return channelName; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public void setChannelName(String channelName) { | |
| 91 | + this.channelName = channelName; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public String getDescribes() { | |
| 95 | + return describes; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public void setDescribes(String describes) { | |
| 99 | + this.describes = describes; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public String getJumpAddress() { | |
| 103 | + return jumpAddress; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public void setJumpAddress(String jumpAddress) { | |
| 107 | + this.jumpAddress = jumpAddress; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public String getBottomSrc() { | |
| 111 | + return bottomSrc; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public void setBottomSrc(String bottomSrc) { | |
| 115 | + this.bottomSrc = bottomSrc; | |
| 116 | + } | |
| 117 | + | |
| 118 | + public String getProtocolAddress() { | |
| 119 | + return protocolAddress; | |
| 120 | + } | |
| 121 | + | |
| 122 | + public void setProtocolAddress(String protocolAddress) { | |
| 123 | + this.protocolAddress = protocolAddress; | |
| 124 | + } | |
| 125 | + | |
| 126 | + public String getReleaseButtonColor() { | |
| 127 | + return releaseButtonColor; | |
| 128 | + } | |
| 129 | + | |
| 130 | + public void setReleaseButtonColor(String releaseButtonColor) { | |
| 131 | + this.releaseButtonColor = releaseButtonColor; | |
| 132 | + } | |
| 133 | + | |
| 134 | + public String getTopColor() { | |
| 135 | + return topColor; | |
| 136 | + } | |
| 137 | + | |
| 138 | + public void setTopColor(String topColor) { | |
| 139 | + this.topColor = topColor; | |
| 140 | + } | |
| 141 | + | |
| 142 | + | |
| 143 | + public String getDefaultTitle() { | |
| 144 | + return defaultTitle; | |
| 145 | + } | |
| 146 | + | |
| 147 | + public void setDefaultTitle(String defaultTitle) { | |
| 148 | + this.defaultTitle = defaultTitle; | |
| 149 | + } | |
| 150 | + | |
| 151 | + public int getMultipleCategory() { | |
| 152 | + return multipleCategory; | |
| 153 | + } | |
| 154 | + | |
| 155 | + public void setMultipleCategory(int multipleCategory) { | |
| 156 | + this.multipleCategory = multipleCategory; | |
| 157 | + } | |
| 158 | + | |
| 159 | + public String getDefaultText() { | |
| 160 | + return defaultText; | |
| 161 | + } | |
| 162 | + | |
| 163 | + public void setDefaultText(String defaultText) { | |
| 164 | + this.defaultText = defaultText; | |
| 165 | + } | |
| 166 | + | |
| 167 | + public int getDetailAddress() { | |
| 168 | + return detailAddress; | |
| 169 | + } | |
| 170 | + | |
| 171 | + public void setDetailAddress(int detailAddress) { | |
| 172 | + this.detailAddress = detailAddress; | |
| 173 | + } | |
| 174 | + | |
| 175 | + public String getLabelColor() { | |
| 176 | + return labelColor; | |
| 177 | + } | |
| 178 | + | |
| 179 | + public void setLabelColor(String labelColor) { | |
| 180 | + this.labelColor = labelColor; | |
| 181 | + } | |
| 182 | + | |
| 183 | + public int getSource() { | |
| 184 | + return source; | |
| 185 | + } | |
| 186 | + | |
| 187 | + public void setSource(int source) { | |
| 188 | + this.source = source; | |
| 189 | + } | |
| 190 | + | |
| 191 | + public String getTitle() { | |
| 192 | + return title; | |
| 193 | + } | |
| 194 | + | |
| 195 | + public void setTitle(String title) { | |
| 196 | + this.title = title; | |
| 197 | + } | |
| 198 | + | |
| 199 | + /* public ReleaseVideoTypeListBean(Parcel in) { | |
| 200 | + id = in.readInt(); | |
| 201 | + path = in.readString(); | |
| 202 | + pic = in.readString(); | |
| 203 | + text = in.readString(); | |
| 204 | + videoType = in.readString(); | |
| 205 | + changePath = in.readString(); | |
| 206 | + multipleCategory = in.readInt(); | |
| 207 | + }*/ | |
| 208 | + | |
| 209 | + /* public static final Parcelable.Creator<ReleaseVideoTypeListBean> CREATOR = new Parcelable.Creator<ReleaseVideoTypeListBean>() { | |
| 210 | + @Override | |
| 211 | + public ReleaseVideoTypeListBean createFromParcel(Parcel in) { | |
| 212 | + return new ReleaseVideoTypeListBean(in); | |
| 213 | + } | |
| 214 | + | |
| 215 | + @Override | |
| 216 | + public ReleaseVideoTypeListBean[] newArray(int size) { | |
| 217 | + return new ReleaseVideoTypeListBean[size]; | |
| 218 | + } | |
| 219 | + };*/ | |
| 220 | + | |
| 221 | + public List<indextag> getCategoryTag() { | |
| 222 | + return categoryTag; | |
| 223 | + } | |
| 224 | + | |
| 225 | + public void setCategoryTag(List<indextag> categoryTag) { | |
| 226 | + this.categoryTag = categoryTag; | |
| 227 | + } | |
| 228 | + | |
| 229 | + | |
| 230 | + public int getMultiplecategory() { | |
| 231 | + return multipleCategory; | |
| 232 | + } | |
| 233 | + | |
| 234 | + public void setMultiplecategory(int multipleCategory) { | |
| 235 | + this.multipleCategory = multipleCategory; | |
| 236 | + } | |
| 237 | + | |
| 238 | + | |
| 239 | + public String getChangePath() { | |
| 240 | + return changePath; | |
| 241 | + } | |
| 242 | + | |
| 243 | + public void setChangePath(String changePath) { | |
| 244 | + this.changePath = changePath; | |
| 245 | + } | |
| 246 | + | |
| 247 | + | |
| 248 | + public int getId() { | |
| 249 | + return id; | |
| 250 | + } | |
| 251 | + | |
| 252 | + public void setId(int id) { | |
| 253 | + this.id = id; | |
| 254 | + } | |
| 255 | + | |
| 256 | + public String getPath() { | |
| 257 | + return TextUtils.isEmpty(path) ? "Daren/moment/releaseMoment.action" : path; | |
| 258 | + } | |
| 259 | + | |
| 260 | + public void setPath(String path) { | |
| 261 | + this.path = path; | |
| 262 | + } | |
| 263 | + | |
| 264 | + public String getPic() { | |
| 265 | + return TextUtils.isEmpty(pic) ? "https://wjj.ys1.cnliveimg.com/769/img/2018/0129/grzx_shq.png" : pic; | |
| 266 | + } | |
| 267 | + | |
| 268 | + public void setPic(String pic) { | |
| 269 | + this.pic = pic; | |
| 270 | + } | |
| 271 | + | |
| 272 | + public String getText() { | |
| 273 | + return TextUtils.isEmpty(text) ? "生活圈" : text; | |
| 274 | + } | |
| 275 | + | |
| 276 | + public void setText(String text) { | |
| 277 | + this.text = text; | |
| 278 | + } | |
| 279 | + | |
| 280 | + public String getVideoType() { | |
| 281 | + return videoType; | |
| 282 | + } | |
| 283 | + | |
| 284 | + public void setVideoType(String videoType) { | |
| 285 | + this.videoType = videoType; | |
| 286 | + } | |
| 287 | + | |
| 288 | + /* @Override | |
| 289 | + public int describeContents() { | |
| 290 | + return 0; | |
| 291 | + } | |
| 292 | + | |
| 293 | + @Override | |
| 294 | + public void writeToParcel(Parcel dest, int flags) { | |
| 295 | + dest.writeInt(id); | |
| 296 | + dest.writeString(path); | |
| 297 | + dest.writeString(pic); | |
| 298 | + dest.writeString(text); | |
| 299 | + dest.writeString(videoType); | |
| 300 | + dest.writeString(changePath); | |
| 301 | + dest.writeInt(multipleCategory); | |
| 302 | + }*/ | |
| 303 | + } | |
| 304 | + | |
| 305 | + public static class indextag { | |
| 306 | + private String tagId; | |
| 307 | + private String tagName; | |
| 308 | + private String colour; | |
| 309 | + | |
| 310 | + public String getColour() { | |
| 311 | + return colour; | |
| 312 | + } | |
| 313 | + | |
| 314 | + public void setColour(String colour) { | |
| 315 | + this.colour = colour; | |
| 316 | + } | |
| 317 | + | |
| 318 | + public String getTagId() { | |
| 319 | + return tagId; | |
| 320 | + } | |
| 321 | + | |
| 322 | + public void setTagId(String tagId) { | |
| 323 | + this.tagId = tagId; | |
| 324 | + } | |
| 325 | + | |
| 326 | + public String getTagName() { | |
| 327 | + return tagName; | |
| 328 | + } | |
| 329 | + | |
| 330 | + public void setTagName(String tagName) { | |
| 331 | + this.tagName = tagName; | |
| 332 | + } | |
| 333 | + } | |
| 334 | + | |
| 335 | + public static class SnowVideoTypeListBean { | |
| 336 | + /** | |
| 337 | + * id : 333 | |
| 338 | + * pic : https://wjj.ys1.cnliveimg.com/769/img/2018/0129/882612314493918438.jpg | |
| 339 | + * text : 上冰雪 | |
| 340 | + * videoType : snow | |
| 341 | + * path : http://apiwjjtest.cnlive.com/Daren/snow/releaseSnow.action | |
| 342 | + */ | |
| 343 | + | |
| 344 | + private int id; | |
| 345 | + private String pic; | |
| 346 | + private String text; | |
| 347 | + private String videoType; | |
| 348 | + private String path; | |
| 349 | + private String changePath; | |
| 350 | + private int multipleCategory; | |
| 351 | + | |
| 352 | + public int getMultiplecategory() { | |
| 353 | + return multipleCategory; | |
| 354 | + } | |
| 355 | + | |
| 356 | + public void setMultiplecategory(int multipleCategory) { | |
| 357 | + this.multipleCategory = multipleCategory; | |
| 358 | + } | |
| 359 | + | |
| 360 | + public String getChangePath() { | |
| 361 | + return changePath; | |
| 362 | + } | |
| 363 | + | |
| 364 | + public void setChangePath(String changePath) { | |
| 365 | + this.changePath = changePath; | |
| 366 | + } | |
| 367 | + | |
| 368 | + public int getId() { | |
| 369 | + return id; | |
| 370 | + } | |
| 371 | + | |
| 372 | + public void setId(int id) { | |
| 373 | + this.id = id; | |
| 374 | + } | |
| 375 | + | |
| 376 | + public String getPic() { | |
| 377 | + return pic; | |
| 378 | + } | |
| 379 | + | |
| 380 | + public void setPic(String pic) { | |
| 381 | + this.pic = pic; | |
| 382 | + } | |
| 383 | + | |
| 384 | + public String getText() { | |
| 385 | + return text; | |
| 386 | + } | |
| 387 | + | |
| 388 | + public void setText(String text) { | |
| 389 | + this.text = text; | |
| 390 | + } | |
| 391 | + | |
| 392 | + public String getVideoType() { | |
| 393 | + return videoType; | |
| 394 | + } | |
| 395 | + | |
| 396 | + public void setVideoType(String videoType) { | |
| 397 | + this.videoType = videoType; | |
| 398 | + } | |
| 399 | + | |
| 400 | + public String getPath() { | |
| 401 | + return path; | |
| 402 | + } | |
| 403 | + | |
| 404 | + public void setPath(String path) { | |
| 405 | + this.path = path; | |
| 406 | + } | |
| 407 | + } | |
| 408 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/moudle/DarenApplyModel.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/moudle/DarenApplyModel.java | |
| 1 | +package com.cnlive.publish.moudle; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.cnlive.publish.network.BaseInfo; | |
| 5 | + | |
| 6 | +public class DarenApplyModel extends BaseInfo<DarenApplyModel> { | |
| 7 | + /** | |
| 8 | + * address : 中国 | |
| 9 | + * auditFailureReason : | |
| 10 | + * auditor : | |
| 11 | + * createTime : 2018-10-09 11:30:30 | |
| 12 | + * id : 5761e330f9844edaa08fa82eb8908ad8 | |
| 13 | + * idCardNo : 210681199407146732 | |
| 14 | + * idCardObv : http://wjjtest.ys2.cnliveimg.com/802/img/2018/1009/1539055830171.png | |
| 15 | + * idCardRev : http://wjjtest.ys2.cnliveimg.com/802/img/2018/1009/1539055830581.png | |
| 16 | + * mobile : 18856894578 | |
| 17 | + * realName : 徐 | |
| 18 | + * sid : 10510277 | |
| 19 | + * status : 0 | |
| 20 | + * updateTime : | |
| 21 | + */ | |
| 22 | + | |
| 23 | + private String address; | |
| 24 | + private String auditFailureReason; | |
| 25 | + private String auditor; | |
| 26 | + private String createTime; | |
| 27 | + private String id; | |
| 28 | + private String idCardNo; | |
| 29 | + private String idCardObv; | |
| 30 | + private String idCardRev; | |
| 31 | + private String mobile; | |
| 32 | + private String realName; | |
| 33 | + private String sid; | |
| 34 | + private int status; | |
| 35 | + private String updateTime; | |
| 36 | + | |
| 37 | + public String getAddress() { | |
| 38 | + return address; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public void setAddress(String address) { | |
| 42 | + this.address = address; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public String getAuditFailureReason() { | |
| 46 | + return auditFailureReason; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public void setAuditFailureReason(String auditFailureReason) { | |
| 50 | + this.auditFailureReason = auditFailureReason; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public String getAuditor() { | |
| 54 | + return auditor; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public void setAuditor(String auditor) { | |
| 58 | + this.auditor = auditor; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public String getCreateTime() { | |
| 62 | + return createTime; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public void setCreateTime(String createTime) { | |
| 66 | + this.createTime = createTime; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public String getId() { | |
| 70 | + return id; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public void setId(String id) { | |
| 74 | + this.id = id; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public String getIdCardNo() { | |
| 78 | + return idCardNo; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public void setIdCardNo(String idCardNo) { | |
| 82 | + this.idCardNo = idCardNo; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public String getIdCardObv() { | |
| 86 | + return idCardObv; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public void setIdCardObv(String idCardObv) { | |
| 90 | + this.idCardObv = idCardObv; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public String getIdCardRev() { | |
| 94 | + return idCardRev; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public void setIdCardRev(String idCardRev) { | |
| 98 | + this.idCardRev = idCardRev; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public String getMobile() { | |
| 102 | + return mobile; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public void setMobile(String mobile) { | |
| 106 | + this.mobile = mobile; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public String getRealName() { | |
| 110 | + return realName; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public void setRealName(String realName) { | |
| 114 | + this.realName = realName; | |
| 115 | + } | |
| 116 | + | |
| 117 | + public String getSid() { | |
| 118 | + return sid; | |
| 119 | + } | |
| 120 | + | |
| 121 | + public void setSid(String sid) { | |
| 122 | + this.sid = sid; | |
| 123 | + } | |
| 124 | + | |
| 125 | + public int getStatus() { | |
| 126 | + return status; | |
| 127 | + } | |
| 128 | + | |
| 129 | + public void setStatus(int status) { | |
| 130 | + this.status = status; | |
| 131 | + } | |
| 132 | + | |
| 133 | + public String getUpdateTime() { | |
| 134 | + return updateTime; | |
| 135 | + } | |
| 136 | + | |
| 137 | + public void setUpdateTime(String updateTime) { | |
| 138 | + this.updateTime = updateTime; | |
| 139 | + } | |
| 140 | + | |
| 141 | + @Override | |
| 142 | + public String toString() { | |
| 143 | + return "DarenApplyModel{" + | |
| 144 | + "address='" + address + '\'' + | |
| 145 | + ", auditFailureReason='" + auditFailureReason + '\'' + | |
| 146 | + ", auditor='" + auditor + '\'' + | |
| 147 | + ", createTime='" + createTime + '\'' + | |
| 148 | + ", id='" + id + '\'' + | |
| 149 | + ", idCardNo='" + idCardNo + '\'' + | |
| 150 | + ", idCardObv='" + idCardObv + '\'' + | |
| 151 | + ", idCardRev='" + idCardRev + '\'' + | |
| 152 | + ", mobile='" + mobile + '\'' + | |
| 153 | + ", realName='" + realName + '\'' + | |
| 154 | + ", sid='" + sid + '\'' + | |
| 155 | + ", status=" + status + | |
| 156 | + ", updateTime='" + updateTime + '\'' + | |
| 157 | + '}'; | |
| 158 | + } | |
| 159 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/moudle/FeedBackInfo.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/moudle/FeedBackInfo.java | |
| 1 | +package com.cnlive.publish.moudle; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by Lynn on 2018/9/4. | |
| 5 | + */ | |
| 6 | + | |
| 7 | +public class FeedBackInfo { | |
| 8 | + private String imageUrl; | |
| 9 | + private long imageWidth; | |
| 10 | + private long imageHeight; | |
| 11 | + | |
| 12 | + public String getImageUrl() { | |
| 13 | + return imageUrl; | |
| 14 | + } | |
| 15 | + | |
| 16 | + public void setImageUrl(String imageUrl) { | |
| 17 | + this.imageUrl = imageUrl; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public long getImageWidth() { | |
| 21 | + return imageWidth; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public void setImageWidth(long imageWidth) { | |
| 25 | + this.imageWidth = imageWidth; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public long getImageHeight() { | |
| 29 | + return imageHeight; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public void setImageHeight(long imageHeight) { | |
| 33 | + this.imageHeight = imageHeight; | |
| 34 | + } | |
| 35 | + | |
| 36 | + @Override | |
| 37 | + public String toString() { | |
| 38 | + return "FeedBackInfo{" + | |
| 39 | + "imageUrl='" + imageUrl + '\'' + | |
| 40 | + ", imageWidth=" + imageWidth + | |
| 41 | + ", imageHeight=" + imageHeight + | |
| 42 | + '}'; | |
| 43 | + } | |
| 44 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/moudle/FriendCircleNewMessage.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/moudle/FriendCircleNewMessage.java | |
| 1 | +package com.cnlive.publish.moudle; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by xiansong on 2018/3/24. | |
| 5 | + */ | |
| 6 | + | |
| 7 | +public class FriendCircleNewMessage { | |
| 8 | + private String userIcon; | |
| 9 | + private String userName; | |
| 10 | + private String message; | |
| 11 | + private String momentId; | |
| 12 | + private String time; | |
| 13 | + private String contentImage; | |
| 14 | + private String contentType; | |
| 15 | + private String contentTitle; | |
| 16 | + | |
| 17 | + public String getUserIcon() { | |
| 18 | + return userIcon; | |
| 19 | + } | |
| 20 | + | |
| 21 | + public void setUserIcon(String userIcon) { | |
| 22 | + this.userIcon = userIcon; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public String getUserName() { | |
| 26 | + return userName; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public void setUserName(String userName) { | |
| 30 | + this.userName = userName; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public String getMessage() { | |
| 34 | + return message; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public void setMessage(String message) { | |
| 38 | + this.message = message; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public String getTime() { | |
| 42 | + return time; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setTime(String time) { | |
| 46 | + this.time = time; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public String getContentImage() { | |
| 50 | + return contentImage; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setContentImage(String contentImage) { | |
| 54 | + this.contentImage = contentImage; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public String getContentType() { | |
| 58 | + return contentType; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public void setContentType(String contentType) { | |
| 62 | + this.contentType = contentType; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public String getContentTitle() { | |
| 66 | + return contentTitle; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setContentTitle(String contentTitle) { | |
| 70 | + this.contentTitle = contentTitle; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public String getMomentId() { | |
| 74 | + return momentId; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public void setMomentId(String momentId) { | |
| 78 | + this.momentId = momentId; | |
| 79 | + } | |
| 80 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/moudle/MomentData.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/moudle/MomentData.java | |
| 1 | +package com.cnlive.publish.moudle; | |
| 2 | + | |
| 3 | +import com.cnlive.libs.base.application.AppConfig; | |
| 4 | +import com.cnlive.libs.base.util.StringUtils; | |
| 5 | +import com.cnlive.publish.network.BaseInfo; | |
| 6 | + | |
| 7 | +import java.io.Serializable; | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * Created by xiansong on 2018/3/9. | |
| 12 | + */ | |
| 13 | + | |
| 14 | +public class MomentData extends BaseInfo implements Serializable { | |
| 15 | + | |
| 16 | + private boolean lastPage = true; | |
| 17 | + //新消息提醒 | |
| 18 | + private MomentIcon icon; | |
| 19 | + //朋友圈列表 | |
| 20 | + private List<FriendItem> moments; | |
| 21 | + //个人相册列表 | |
| 22 | + private List<PhotoItem> items; | |
| 23 | + | |
| 24 | + public static class MomentIcon implements Serializable { | |
| 25 | + private String nickName; | |
| 26 | + private String userId; | |
| 27 | + private String image; | |
| 28 | + | |
| 29 | + public String getNickName() { | |
| 30 | + return nickName; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public void setNickName(String nickName) { | |
| 34 | + this.nickName = nickName; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public String getUserId() { | |
| 38 | + return userId; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public void setUserId(String userId) { | |
| 42 | + this.userId = userId; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public String getImage() { | |
| 46 | + return image; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public void setImage(String image) { | |
| 50 | + this.image = image; | |
| 51 | + } | |
| 52 | + } | |
| 53 | + | |
| 54 | + public static class MomentVideo implements Serializable { | |
| 55 | + private String time; | |
| 56 | + private String imageUrl; | |
| 57 | + private String videoId; | |
| 58 | + private String videoPlayUrl; | |
| 59 | + private int height; | |
| 60 | + private int width; | |
| 61 | + private String strageType; | |
| 62 | + | |
| 63 | + public String getStrageType() { | |
| 64 | + return strageType; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public void setStrageType(String strageType) { | |
| 68 | + this.strageType = strageType; | |
| 69 | + } | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + public String getTime() { | |
| 74 | + return time; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public void setTime(String time) { | |
| 78 | + this.time = time; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public String getImageUrl() { | |
| 82 | + return imageUrl; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public void setImageUrl(String imageUrl) { | |
| 86 | + this.imageUrl = imageUrl; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public String getVideoPlayUrl() { | |
| 90 | + return videoPlayUrl; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public void setVideoPlayUrl(String videoPlayUrl) { | |
| 94 | + this.videoPlayUrl = videoPlayUrl; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public String getVideoId() { | |
| 98 | + return videoId; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public void setVideoId(String videoId) { | |
| 102 | + this.videoId = videoId; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public int getHeight() { | |
| 106 | + return height; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public void setHeight(int height) { | |
| 110 | + this.height = height; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public int getWidth() { | |
| 114 | + return width; | |
| 115 | + } | |
| 116 | + | |
| 117 | + public void setWidth(int width) { | |
| 118 | + this.width = width; | |
| 119 | + } | |
| 120 | + } | |
| 121 | + | |
| 122 | + public static class ShareItem implements Serializable { | |
| 123 | + private String desc; | |
| 124 | + private String icon; | |
| 125 | + private String title; | |
| 126 | + private String url; | |
| 127 | + private String shareType; | |
| 128 | + private String shareExtInfo; | |
| 129 | + | |
| 130 | + public String getShareType() { | |
| 131 | + return shareType; | |
| 132 | + } | |
| 133 | + | |
| 134 | + public void setShareType(String shareType) { | |
| 135 | + this.shareType = shareType; | |
| 136 | + } | |
| 137 | + | |
| 138 | + public String getShareExtInfo() { | |
| 139 | + return shareExtInfo; | |
| 140 | + } | |
| 141 | + | |
| 142 | + public void setShareExtInfo(String shareExtInfo) { | |
| 143 | + this.shareExtInfo = shareExtInfo; | |
| 144 | + } | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + public String getDesc() { | |
| 149 | + return desc; | |
| 150 | + } | |
| 151 | + | |
| 152 | + public void setDesc(String desc) { | |
| 153 | + this.desc = desc; | |
| 154 | + } | |
| 155 | + | |
| 156 | + public String getIcon() { | |
| 157 | + return StringUtils.isEmpty(icon) ? AppConfig.getShareLink() : icon; | |
| 158 | + } | |
| 159 | + | |
| 160 | + public void setIcon(String icon) { | |
| 161 | + this.icon = icon; | |
| 162 | + } | |
| 163 | + | |
| 164 | + public String getTitle() { | |
| 165 | + return title; | |
| 166 | + } | |
| 167 | + | |
| 168 | + public void setTitle(String title) { | |
| 169 | + this.title = title; | |
| 170 | + } | |
| 171 | + | |
| 172 | + public String getUrl() { | |
| 173 | + return url; | |
| 174 | + } | |
| 175 | + | |
| 176 | + public void setUrl(String url) { | |
| 177 | + this.url = url; | |
| 178 | + } | |
| 179 | + } | |
| 180 | + | |
| 181 | + public static class PhotoItem implements Serializable { | |
| 182 | + | |
| 183 | + public static class Image { | |
| 184 | + private int height; | |
| 185 | + private int width; | |
| 186 | + private String imagePath; | |
| 187 | + private String thumbnailPath; | |
| 188 | + private String thumbnailsFirstPic; | |
| 189 | + | |
| 190 | + public String getImagePath() { | |
| 191 | + return imagePath; | |
| 192 | + } | |
| 193 | + | |
| 194 | + public void setImagePath(String imagePath) { | |
| 195 | + this.imagePath = imagePath; | |
| 196 | + } | |
| 197 | + | |
| 198 | + public String getThumbnailPath() { | |
| 199 | + return thumbnailPath; | |
| 200 | + } | |
| 201 | + | |
| 202 | + public void setThumbnailPath(String thumbnailPath) { | |
| 203 | + this.thumbnailPath = thumbnailPath; | |
| 204 | + } | |
| 205 | + | |
| 206 | + public String getThumbnailsFirstPic() { | |
| 207 | + return thumbnailsFirstPic; | |
| 208 | + } | |
| 209 | + | |
| 210 | + public void setThumbnailsFirstPic(String thumbnailsFirstPic) { | |
| 211 | + this.thumbnailsFirstPic = thumbnailsFirstPic; | |
| 212 | + } | |
| 213 | + | |
| 214 | + public int getHeight() { | |
| 215 | + return height; | |
| 216 | + } | |
| 217 | + | |
| 218 | + public void setHeight(int height) { | |
| 219 | + this.height = height; | |
| 220 | + } | |
| 221 | + | |
| 222 | + public int getWidth() { | |
| 223 | + return width; | |
| 224 | + } | |
| 225 | + | |
| 226 | + public void setWidth(int width) { | |
| 227 | + this.width = width; | |
| 228 | + } | |
| 229 | + } | |
| 230 | + | |
| 231 | + private String sid; | |
| 232 | + private String text; | |
| 233 | + private long ts; | |
| 234 | + private String address; | |
| 235 | + private ShareItem share; | |
| 236 | + private List<Image> images; | |
| 237 | + private String itemId; | |
| 238 | + private int type; | |
| 239 | + private MomentVideo video; | |
| 240 | + private String pageUrl; | |
| 241 | + public String getPageUrl() { | |
| 242 | + return pageUrl; | |
| 243 | + } | |
| 244 | + | |
| 245 | + public void setPageUrl(String pageUrl) { | |
| 246 | + this.pageUrl = pageUrl; | |
| 247 | + } | |
| 248 | + | |
| 249 | + public ShareItem getShare() { | |
| 250 | + return share; | |
| 251 | + } | |
| 252 | + | |
| 253 | + public void setShare(ShareItem share) { | |
| 254 | + this.share = share; | |
| 255 | + } | |
| 256 | + | |
| 257 | + public String getSid() { | |
| 258 | + return sid; | |
| 259 | + } | |
| 260 | + | |
| 261 | + public void setSid(String sid) { | |
| 262 | + this.sid = sid; | |
| 263 | + } | |
| 264 | + | |
| 265 | + public String getText() { | |
| 266 | + return text; | |
| 267 | + } | |
| 268 | + | |
| 269 | + public void setText(String text) { | |
| 270 | + this.text = text; | |
| 271 | + } | |
| 272 | + | |
| 273 | + public long getTs() { | |
| 274 | + return ts; | |
| 275 | + } | |
| 276 | + | |
| 277 | + public void setTs(long ts) { | |
| 278 | + this.ts = ts; | |
| 279 | + } | |
| 280 | + | |
| 281 | + public String getAddress() { | |
| 282 | + return address; | |
| 283 | + } | |
| 284 | + | |
| 285 | + public void setAddress(String address) { | |
| 286 | + this.address = address; | |
| 287 | + } | |
| 288 | + | |
| 289 | + public List<Image> getImages() { | |
| 290 | + return images; | |
| 291 | + } | |
| 292 | + | |
| 293 | + public void setImages(List<Image> images) { | |
| 294 | + this.images = images; | |
| 295 | + } | |
| 296 | + | |
| 297 | + public String getItemId() { | |
| 298 | + return itemId; | |
| 299 | + } | |
| 300 | + | |
| 301 | + public void setItemId(String itemId) { | |
| 302 | + this.itemId = itemId; | |
| 303 | + } | |
| 304 | + | |
| 305 | + public int getType() { | |
| 306 | + return type; | |
| 307 | + } | |
| 308 | + | |
| 309 | + public void setType(int type) { | |
| 310 | + this.type = type; | |
| 311 | + } | |
| 312 | + | |
| 313 | + public MomentVideo getVideo() { | |
| 314 | + return video; | |
| 315 | + } | |
| 316 | + | |
| 317 | + public void setVideo(MomentVideo video) { | |
| 318 | + this.video = video; | |
| 319 | + } | |
| 320 | + } | |
| 321 | + | |
| 322 | + public static class FriendItem implements Serializable { | |
| 323 | + private PhotoItem item; | |
| 324 | + private MomentIcon icon; | |
| 325 | + | |
| 326 | + public PhotoItem getItem() { | |
| 327 | + return item; | |
| 328 | + } | |
| 329 | + | |
| 330 | + public void setItem(PhotoItem item) { | |
| 331 | + this.item = item; | |
| 332 | + } | |
| 333 | + | |
| 334 | + public MomentIcon getIcon() { | |
| 335 | + return icon; | |
| 336 | + } | |
| 337 | + | |
| 338 | + public void setIcon(MomentIcon icon) { | |
| 339 | + this.icon = icon; | |
| 340 | + } | |
| 341 | + } | |
| 342 | + | |
| 343 | + public MomentIcon getIcon() { | |
| 344 | + return icon; | |
| 345 | + } | |
| 346 | + | |
| 347 | + public void setIcon(MomentIcon icon) { | |
| 348 | + this.icon = icon; | |
| 349 | + } | |
| 350 | + | |
| 351 | + public List<PhotoItem> getItems() { | |
| 352 | + return items; | |
| 353 | + } | |
| 354 | + | |
| 355 | + public void setItems(List<PhotoItem> items) { | |
| 356 | + this.items = items; | |
| 357 | + } | |
| 358 | + | |
| 359 | + public List<FriendItem> getMoments() { | |
| 360 | + return moments; | |
| 361 | + } | |
| 362 | + | |
| 363 | + public void setMoments(List<FriendItem> moments) { | |
| 364 | + this.moments = moments; | |
| 365 | + } | |
| 366 | + | |
| 367 | + public boolean isLastPage() { | |
| 368 | + return lastPage; | |
| 369 | + } | |
| 370 | + | |
| 371 | + public void setLastPage(boolean lastPage) { | |
| 372 | + this.lastPage = lastPage; | |
| 373 | + } | |
| 374 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/moudle/ReleaseMediaItem.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/moudle/ReleaseMediaItem.java | |
| 1 | +package com.cnlive.publish.moudle; | |
| 2 | + | |
| 3 | +import android.view.View; | |
| 4 | + | |
| 5 | +import com.cnlive.media.media.entity.Media; | |
| 6 | +import com.cnlive.publish.BR; | |
| 7 | + | |
| 8 | +import androidx.databinding.BaseObservable; | |
| 9 | +import androidx.databinding.Bindable; | |
| 10 | + | |
| 11 | +import static android.view.View.GONE; | |
| 12 | +import static android.view.View.VISIBLE; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * Created by xiansong on 2018/1/30. | |
| 16 | + */ | |
| 17 | + | |
| 18 | +public class ReleaseMediaItem extends BaseObservable { | |
| 19 | + public static final int type_default = -1; | |
| 20 | + public static final int type_select = 0; | |
| 21 | + public static final int type_local_video = 1; | |
| 22 | + public static final int type_local_image = 2; | |
| 23 | + public static final int type_net_video = 3; | |
| 24 | + public static final int type_net_image = 4; | |
| 25 | + | |
| 26 | + private int type = type_default; | |
| 27 | + private int iconRes; | |
| 28 | + //本地资源(需要提交) | |
| 29 | + private String imagePath; | |
| 30 | + private String videoPath; | |
| 31 | + //网络资源 | |
| 32 | + private String imageUrl; | |
| 33 | + private String videoId; | |
| 34 | + | |
| 35 | + private String addTag = ""; | |
| 36 | + private Media media; | |
| 37 | + private View.OnClickListener listener; | |
| 38 | + private int tagVisibility = GONE; | |
| 39 | + private int iconVisibility = VISIBLE; | |
| 40 | + private int addvisiable = GONE; | |
| 41 | + private int nullvisiable = VISIBLE; | |
| 42 | + private int bofangvisiable = GONE; | |
| 43 | + | |
| 44 | + //默认添加媒体按钮 | |
| 45 | + public ReleaseMediaItem(int iconRes, View.OnClickListener listener) { | |
| 46 | + this.iconRes = iconRes; | |
| 47 | + this.listener = listener; | |
| 48 | + } | |
| 49 | + | |
| 50 | + | |
| 51 | + public ReleaseMediaItem(int iconRes, boolean select, boolean isNull, View.OnClickListener listener , String wit) { | |
| 52 | + this.iconRes = iconRes; | |
| 53 | + this.listener = listener; | |
| 54 | + this.addTag = ""; | |
| 55 | + this.type = select ? type_select : type_default; | |
| 56 | + this.tagVisibility = select ? VISIBLE : GONE; | |
| 57 | + this.iconVisibility = select ? GONE : VISIBLE; | |
| 58 | + this.nullvisiable = isNull ? VISIBLE : GONE; | |
| 59 | + this.addvisiable = isNull ? GONE : VISIBLE; | |
| 60 | + } | |
| 61 | + | |
| 62 | + //本地资源视频 | |
| 63 | + public static ReleaseMediaItem newLocalVideo(int iconRes, String imagePath, String videoPath, View.OnClickListener listener) { | |
| 64 | + ReleaseMediaItem item = new ReleaseMediaItem(iconRes, listener); | |
| 65 | + item.setImagePath(imagePath); | |
| 66 | + item.setVideoPath(videoPath); | |
| 67 | + item.setType(type_local_video); | |
| 68 | + item.setBofangvisiable(VISIBLE); | |
| 69 | + return item; | |
| 70 | + } | |
| 71 | + | |
| 72 | + //网络资源视频 | |
| 73 | + public static ReleaseMediaItem newNetVideo(int iconRes, String imageUrl, String videoId, View.OnClickListener listener) { | |
| 74 | + ReleaseMediaItem item = new ReleaseMediaItem(iconRes, listener); | |
| 75 | + item.setImageUrl(imageUrl); | |
| 76 | + item.setVideoId(videoId); | |
| 77 | + item.setType(type_net_video); | |
| 78 | + return item; | |
| 79 | + } | |
| 80 | + | |
| 81 | + //本地资源图片 | |
| 82 | + public static ReleaseMediaItem newLocalImage(int iconRes, String imagePath, View.OnClickListener listener) { | |
| 83 | + ReleaseMediaItem item = new ReleaseMediaItem(iconRes, listener); | |
| 84 | + item.setImagePath(imagePath); | |
| 85 | + item.setType(type_local_image); | |
| 86 | + item.setBofangvisiable(GONE); | |
| 87 | + return item; | |
| 88 | + } | |
| 89 | + | |
| 90 | + //网络资源图片 | |
| 91 | + public static ReleaseMediaItem newNetImage(int iconRes, String imageUrl, View.OnClickListener listener) { | |
| 92 | + ReleaseMediaItem item = new ReleaseMediaItem(iconRes, listener); | |
| 93 | + item.setImageUrl(imageUrl); | |
| 94 | + item.setType(type_net_image); | |
| 95 | + return item; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public int getType() { | |
| 99 | + return type; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public void setType(int type) { | |
| 103 | + this.type = type; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public Media getMedia() { | |
| 107 | + return media; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public void setMedia(Media media) { | |
| 111 | + this.media = media; | |
| 112 | + } | |
| 113 | + | |
| 114 | + @Bindable | |
| 115 | + public int getIconVisibility() { | |
| 116 | + return iconVisibility; | |
| 117 | + } | |
| 118 | + | |
| 119 | + public void setIconVisibility(int iconVisibility) { | |
| 120 | + this.iconVisibility = iconVisibility; | |
| 121 | + notifyPropertyChanged(BR.iconVisibility); | |
| 122 | + } | |
| 123 | + | |
| 124 | + @Bindable | |
| 125 | + public int getTagVisibility() { | |
| 126 | + return tagVisibility; | |
| 127 | + } | |
| 128 | + | |
| 129 | + public void setTagVisibility(int tagVisibility) { | |
| 130 | + this.tagVisibility = tagVisibility; | |
| 131 | + notifyPropertyChanged(BR.tagVisibility); | |
| 132 | + } | |
| 133 | + @Bindable | |
| 134 | + public int getBofangvisiable() { | |
| 135 | + return bofangvisiable; | |
| 136 | + } | |
| 137 | + | |
| 138 | + public void setBofangvisiable(int bofangvisiable) { | |
| 139 | + this.bofangvisiable = bofangvisiable; | |
| 140 | + notifyPropertyChanged(BR.bofangvisiable); | |
| 141 | + } | |
| 142 | + | |
| 143 | + @Bindable | |
| 144 | + public int getAddvisiable() { | |
| 145 | + return addvisiable; | |
| 146 | + } | |
| 147 | + | |
| 148 | + public void setAddvisiable(int addvisiable) { | |
| 149 | + this.addvisiable = addvisiable; | |
| 150 | + notifyPropertyChanged(BR.addvisiable); | |
| 151 | + } | |
| 152 | + | |
| 153 | + @Bindable | |
| 154 | + public int getNullvisiable() { | |
| 155 | + return nullvisiable; | |
| 156 | + } | |
| 157 | + | |
| 158 | + public void setNullvisiable(int nullvisiable) { | |
| 159 | + this.nullvisiable = nullvisiable; | |
| 160 | + notifyPropertyChanged(BR.nullvisiable); | |
| 161 | + } | |
| 162 | + | |
| 163 | + @Bindable | |
| 164 | + public String getAddTag() { | |
| 165 | + return addTag; | |
| 166 | + } | |
| 167 | + | |
| 168 | + public void setAddTag(String addTag) { | |
| 169 | + this.addTag = addTag; | |
| 170 | + notifyPropertyChanged(BR.addTag); | |
| 171 | + } | |
| 172 | + | |
| 173 | + @Bindable | |
| 174 | + public String getImagePath() { | |
| 175 | + return imagePath; | |
| 176 | + } | |
| 177 | + | |
| 178 | + public void setImagePath(String imagePath) { | |
| 179 | + this.imagePath = imagePath; | |
| 180 | + notifyPropertyChanged(BR.imagePath); | |
| 181 | + } | |
| 182 | + | |
| 183 | + @Bindable | |
| 184 | + public String getVideoPath() { | |
| 185 | + return videoPath; | |
| 186 | + } | |
| 187 | + | |
| 188 | + public void setVideoPath(String videoPath) { | |
| 189 | + this.videoPath = videoPath; | |
| 190 | + notifyPropertyChanged(BR.videoPath); | |
| 191 | + } | |
| 192 | + | |
| 193 | + @Bindable | |
| 194 | + public String getImageUrl() { | |
| 195 | + return imageUrl; | |
| 196 | + } | |
| 197 | + | |
| 198 | + public void setImageUrl(String imageUrl) { | |
| 199 | + this.imageUrl = imageUrl; | |
| 200 | + notifyPropertyChanged(BR.imageUrl); | |
| 201 | + } | |
| 202 | + | |
| 203 | + @Bindable | |
| 204 | + public String getVideoId() { | |
| 205 | + return videoId; | |
| 206 | + } | |
| 207 | + | |
| 208 | + public void setVideoId(String videoId) { | |
| 209 | + this.videoId = videoId; | |
| 210 | + notifyPropertyChanged(BR.videoId); | |
| 211 | + } | |
| 212 | + | |
| 213 | + @Bindable | |
| 214 | + public int getIconRes() { | |
| 215 | + return iconRes; | |
| 216 | + } | |
| 217 | + | |
| 218 | + public void setIconRes(int iconRes) { | |
| 219 | + | |
| 220 | + this.iconRes = iconRes; | |
| 221 | + notifyPropertyChanged(BR.iconRes); | |
| 222 | + } | |
| 223 | + | |
| 224 | + @Bindable | |
| 225 | + public View.OnClickListener getListener() { | |
| 226 | + return listener; | |
| 227 | + } | |
| 228 | + | |
| 229 | + public void setListener(View.OnClickListener listener) { | |
| 230 | + this.listener = listener; | |
| 231 | + notifyPropertyChanged(BR.listener); | |
| 232 | + } | |
| 233 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/moudle/ReleaseMediaPage.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/moudle/ReleaseMediaPage.java | |
| 1 | +package com.cnlive.publish.moudle; | |
| 2 | + | |
| 3 | +import android.os.Parcel; | |
| 4 | +import android.view.View; | |
| 5 | + | |
| 6 | +import com.cnlive.libs.base.application.AppConfig; | |
| 7 | +import com.cnlive.libs.base.frame.model.ViewStateListData; | |
| 8 | +import com.cnlive.libs.base.util.ShareReleaseInfoUtil; | |
| 9 | +import com.cnlive.media.model.CircleData; | |
| 10 | +import com.cnlive.publish.BR; | |
| 11 | +import com.cnlive.publish.R; | |
| 12 | +import com.cnlive.publish.databinding.ListItemReleaseMediaBinding; | |
| 13 | + | |
| 14 | + | |
| 15 | +import java.util.List; | |
| 16 | + | |
| 17 | +import androidx.databinding.Bindable; | |
| 18 | +import androidx.recyclerview.widget.RecyclerView; | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * Created by xiansong on 2018/1/30. | |
| 22 | + */ | |
| 23 | + | |
| 24 | +public class ReleaseMediaPage extends ViewStateListData<ReleaseMediaItem, ListItemReleaseMediaBinding> { | |
| 25 | + | |
| 26 | + private boolean isVideo; | |
| 27 | + private String title; | |
| 28 | + private String message; | |
| 29 | + private ShareReleaseInfoUtil.ShareConfig shareConfig; | |
| 30 | + private String location = ""; //发布页面短地址(精确到区) | |
| 31 | + private int locationVisibility = View.GONE; | |
| 32 | + private int shareVisibility = View.GONE; | |
| 33 | + private int recyclerVisibility = View.VISIBLE; | |
| 34 | + private int tagVisibility = View.GONE; | |
| 35 | + private int radioGroupVisibility = View.GONE; | |
| 36 | + private int isWitVisibility = View.GONE; | |
| 37 | + | |
| 38 | + private int zkVisibility = View.GONE; | |
| 39 | + private int sqVisibility = View.VISIBLE; | |
| 40 | + private String tagtext = ""; | |
| 41 | + private String tagId = ""; | |
| 42 | + private String witimg; | |
| 43 | + private String gopath = "Daren/moment/releaseMoment.action"; | |
| 44 | + | |
| 45 | + private String witContentId; | |
| 46 | + | |
| 47 | + private String videotype = "moment"; | |
| 48 | + private String sharetit; | |
| 49 | + private String sharepic; | |
| 50 | + private int type = 2; | |
| 51 | + private String wit = "生活圈"; | |
| 52 | + private int multiplecategory = AppConfig.isDebug() ? 371 : 366; | |
| 53 | + private List<CircleData.indextag> categoryTag; | |
| 54 | + private String jumpType; | |
| 55 | + private String defaulttext; | |
| 56 | + private int detailaddress; | |
| 57 | + private String labelcolor; | |
| 58 | + private int source; | |
| 59 | + private String bottomSrc; | |
| 60 | + private String releaseButtonColor; | |
| 61 | + private String topColor = "FFFFFF"; | |
| 62 | + private String fixedTitle; | |
| 63 | + private String coordinate = ""; //短视频详细地址 (精确到小区大厦) | |
| 64 | + private String successJumpType = "";//发布成功跳转类型,1->跳转分类二级频道 | |
| 65 | + | |
| 66 | + | |
| 67 | + @Bindable | |
| 68 | + public String getSuccessJumpType() { | |
| 69 | + return successJumpType; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public void setSuccessJumpType(String successJumpType) { | |
| 73 | + this.successJumpType = successJumpType; | |
| 74 | + notifyPropertyChanged(BR.successJumpType); | |
| 75 | + } | |
| 76 | + | |
| 77 | + @Bindable | |
| 78 | + public String getCoordinate() { | |
| 79 | + return coordinate; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public void setCoordinate(String coordinate) { | |
| 83 | + this.coordinate = coordinate; | |
| 84 | + notifyPropertyChanged(BR.coordinate); | |
| 85 | + } | |
| 86 | + | |
| 87 | + @Bindable | |
| 88 | + public String getFixedTitle() { | |
| 89 | + return fixedTitle; | |
| 90 | + } | |
| 91 | + | |
| 92 | + public void setFixedTitle(String fixedTitle) { | |
| 93 | + this.fixedTitle = fixedTitle; | |
| 94 | + notifyPropertyChanged(BR.fixedTitle); | |
| 95 | + } | |
| 96 | + | |
| 97 | + | |
| 98 | + @Bindable | |
| 99 | + public String getBottomSrc() { | |
| 100 | + return bottomSrc; | |
| 101 | + } | |
| 102 | + | |
| 103 | + public void setBottomSrc(String bottomSrc) { | |
| 104 | + this.bottomSrc = bottomSrc; | |
| 105 | + notifyPropertyChanged(BR.bottomSrc); | |
| 106 | + } | |
| 107 | + | |
| 108 | + @Bindable | |
| 109 | + public String getReleaseButtonColor() { | |
| 110 | + return releaseButtonColor; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public void setReleaseButtonColor(String releaseButtonColor) { | |
| 114 | + this.releaseButtonColor = releaseButtonColor; | |
| 115 | + notifyPropertyChanged(BR.releaseButtonColor); | |
| 116 | + } | |
| 117 | + | |
| 118 | + @Bindable | |
| 119 | + public String getTopColor() { | |
| 120 | + return topColor; | |
| 121 | + } | |
| 122 | + | |
| 123 | + public void setTopColor(String topColor) { | |
| 124 | + this.topColor = topColor; | |
| 125 | + notifyPropertyChanged(BR.topColor); | |
| 126 | + } | |
| 127 | + | |
| 128 | + @Bindable | |
| 129 | + public String getDefaulttext() { | |
| 130 | + return defaulttext; | |
| 131 | + } | |
| 132 | + | |
| 133 | + public void setDefaulttext(String defaulttext) { | |
| 134 | + this.defaulttext = defaulttext; | |
| 135 | + notifyPropertyChanged(BR.defaulttext); | |
| 136 | + } | |
| 137 | + | |
| 138 | + @Bindable | |
| 139 | + public int getDetailaddress() { | |
| 140 | + return detailaddress; | |
| 141 | + } | |
| 142 | + | |
| 143 | + public void setDetailaddress(int detailaddress) { | |
| 144 | + this.detailaddress = detailaddress; | |
| 145 | + notifyPropertyChanged(BR.detailaddress); | |
| 146 | + } | |
| 147 | + | |
| 148 | + @Bindable | |
| 149 | + public String getLabelcolor() { | |
| 150 | + return labelcolor; | |
| 151 | + } | |
| 152 | + | |
| 153 | + public void setLabelcolor(String labelcolor) { | |
| 154 | + this.labelcolor = labelcolor; | |
| 155 | + notifyPropertyChanged(BR.labelcolor); | |
| 156 | + } | |
| 157 | + | |
| 158 | + @Bindable | |
| 159 | + public int getSource() { | |
| 160 | + return source; | |
| 161 | + } | |
| 162 | + | |
| 163 | + public void setSource(int source) { | |
| 164 | + this.source = source; | |
| 165 | + notifyPropertyChanged(BR.source); | |
| 166 | + } | |
| 167 | + | |
| 168 | + | |
| 169 | + @Bindable | |
| 170 | + public String getJumpType() { | |
| 171 | + return jumpType; | |
| 172 | + } | |
| 173 | + | |
| 174 | + public void setJumpType(String jumpType) { | |
| 175 | + this.jumpType = jumpType; | |
| 176 | + notifyPropertyChanged(BR.jumpType); | |
| 177 | + } | |
| 178 | + | |
| 179 | + | |
| 180 | + public List<CircleData.indextag> getCategoryTag() { | |
| 181 | + return categoryTag; | |
| 182 | + } | |
| 183 | + | |
| 184 | + public void setCategoryTag(List<CircleData.indextag> categoryTag) { | |
| 185 | + this.categoryTag = categoryTag; | |
| 186 | + } | |
| 187 | + | |
| 188 | + @Bindable | |
| 189 | + public int getMultiplecategory() { | |
| 190 | + return multiplecategory; | |
| 191 | + } | |
| 192 | + | |
| 193 | + public void setMultiplecategory(int multiplecategory) { | |
| 194 | + this.multiplecategory = multiplecategory; | |
| 195 | + notifyPropertyChanged(BR.multiplecategory); | |
| 196 | + } | |
| 197 | + | |
| 198 | + | |
| 199 | + @Bindable | |
| 200 | + public String getVideotype() { | |
| 201 | + return videotype; | |
| 202 | + } | |
| 203 | + | |
| 204 | + public void setVideotype(String videotype) { | |
| 205 | + this.videotype = videotype; | |
| 206 | + notifyPropertyChanged(BR.gopath); | |
| 207 | + } | |
| 208 | + | |
| 209 | + | |
| 210 | + @Bindable | |
| 211 | + public String getGopath() { | |
| 212 | + return gopath; | |
| 213 | + } | |
| 214 | + | |
| 215 | + public void setGopath(String gopath) { | |
| 216 | + this.gopath = gopath; | |
| 217 | + notifyPropertyChanged(BR.gopath); | |
| 218 | + } | |
| 219 | + | |
| 220 | + @Bindable | |
| 221 | + public String getWit() { | |
| 222 | + return wit; | |
| 223 | + } | |
| 224 | + | |
| 225 | + public void setWit(String wit) { | |
| 226 | + this.wit = wit; | |
| 227 | + notifyPropertyChanged(BR.wit); | |
| 228 | + } | |
| 229 | + | |
| 230 | + @Bindable | |
| 231 | + public int getType() { | |
| 232 | + return type; | |
| 233 | + } | |
| 234 | + | |
| 235 | + public void setType(int type) { | |
| 236 | + this.type = type; | |
| 237 | + notifyPropertyChanged(BR.type); | |
| 238 | + } | |
| 239 | + | |
| 240 | + | |
| 241 | + @Bindable | |
| 242 | + public String getSharepic() { | |
| 243 | + return sharepic; | |
| 244 | + } | |
| 245 | + | |
| 246 | + public void setSharepic(String sharepic) { | |
| 247 | + this.sharepic = sharepic; | |
| 248 | + notifyPropertyChanged(BR.sharepic); | |
| 249 | + } | |
| 250 | + | |
| 251 | + | |
| 252 | + @Bindable | |
| 253 | + public String getSharetit() { | |
| 254 | + return sharetit; | |
| 255 | + } | |
| 256 | + | |
| 257 | + public void setSharetit(String sharetit) { | |
| 258 | + this.sharetit = sharetit; | |
| 259 | + notifyPropertyChanged(BR.sharetit); | |
| 260 | + } | |
| 261 | + | |
| 262 | + @Bindable | |
| 263 | + public int getShareVisibility() { | |
| 264 | + return shareVisibility; | |
| 265 | + } | |
| 266 | + | |
| 267 | + public void setShareVisibility(int shareVisibility) { | |
| 268 | + this.shareVisibility = shareVisibility; | |
| 269 | + notifyPropertyChanged(BR.shareVisibility); | |
| 270 | + } | |
| 271 | + | |
| 272 | + @Bindable | |
| 273 | + public int getZkVisibility() { | |
| 274 | + return zkVisibility; | |
| 275 | + } | |
| 276 | + | |
| 277 | + public void setZkVisibility(int zkVisibility) { | |
| 278 | + this.zkVisibility = zkVisibility; | |
| 279 | + notifyPropertyChanged(BR.zkVisibility); | |
| 280 | + } | |
| 281 | + | |
| 282 | + @Bindable | |
| 283 | + public int getSqVisibility() { | |
| 284 | + return sqVisibility; | |
| 285 | + } | |
| 286 | + | |
| 287 | + public void setSqVisibility(int sqVisibility) { | |
| 288 | + this.sqVisibility = sqVisibility; | |
| 289 | + notifyPropertyChanged(BR.sqVisibility); | |
| 290 | + } | |
| 291 | + | |
| 292 | + @Bindable | |
| 293 | + public int getRecyclerVisibility() { | |
| 294 | + return recyclerVisibility; | |
| 295 | + } | |
| 296 | + | |
| 297 | + public void setRecyclerVisibility(int recyclerVisibility) { | |
| 298 | + this.recyclerVisibility = recyclerVisibility; | |
| 299 | + notifyPropertyChanged(BR.recyclerVisibility); | |
| 300 | + } | |
| 301 | + | |
| 302 | + public ReleaseMediaPage() { | |
| 303 | + } | |
| 304 | + | |
| 305 | + @Override | |
| 306 | + public int getLayoutId() { | |
| 307 | + return R.layout.list_item_release_media; | |
| 308 | + } | |
| 309 | + | |
| 310 | + @Override | |
| 311 | + public RecyclerView.LayoutManager getLayoutManager() { | |
| 312 | + return null; | |
| 313 | + } | |
| 314 | + | |
| 315 | + public boolean isVideo() { | |
| 316 | + return isVideo; | |
| 317 | + } | |
| 318 | + | |
| 319 | + public void setVideo(boolean video) { | |
| 320 | + isVideo = video; | |
| 321 | + } | |
| 322 | + | |
| 323 | + @Bindable | |
| 324 | + public String getLocation() { | |
| 325 | + return location; | |
| 326 | + } | |
| 327 | + | |
| 328 | + public void setLocation(String location) { | |
| 329 | + this.location = location; | |
| 330 | + // setLocationVisibility(TextUtils.isEmpty(location) ? View.GONE : View.VISIBLE); | |
| 331 | + notifyPropertyChanged(BR.location); | |
| 332 | + } | |
| 333 | + | |
| 334 | + @Bindable | |
| 335 | + public String getTagtext() { | |
| 336 | + return tagtext; | |
| 337 | + } | |
| 338 | + | |
| 339 | + public void setTagtext(String tagtext) { | |
| 340 | + this.tagtext = tagtext; | |
| 341 | + notifyPropertyChanged(BR.tagtext); | |
| 342 | + } | |
| 343 | + | |
| 344 | + @Bindable | |
| 345 | + public String getTagId() { | |
| 346 | + return tagId; | |
| 347 | + } | |
| 348 | + | |
| 349 | + public void setTagId(String tagId) { | |
| 350 | + this.tagId = tagId; | |
| 351 | + notifyPropertyChanged(BR.tagId); | |
| 352 | + } | |
| 353 | + | |
| 354 | + public ShareReleaseInfoUtil.ShareConfig getShareConfig() { | |
| 355 | + return shareConfig; | |
| 356 | + } | |
| 357 | + | |
| 358 | + public void setShareConfig(ShareReleaseInfoUtil.ShareConfig shareConfig) { | |
| 359 | + this.shareConfig = shareConfig; | |
| 360 | + } | |
| 361 | + | |
| 362 | + @Bindable | |
| 363 | + public int getLocationVisibility() { | |
| 364 | + return locationVisibility; | |
| 365 | + } | |
| 366 | + | |
| 367 | + public void setLocationVisibility(int locationVisibility) { | |
| 368 | + this.locationVisibility = locationVisibility; | |
| 369 | + notifyPropertyChanged(BR.locationVisibility); | |
| 370 | + } | |
| 371 | + | |
| 372 | + @Bindable | |
| 373 | + public int getTagVisibility() { | |
| 374 | + return tagVisibility; | |
| 375 | + } | |
| 376 | + | |
| 377 | + public void setTagVisibility(int tagVisibility) { | |
| 378 | + this.tagVisibility = tagVisibility; | |
| 379 | + notifyPropertyChanged(BR.tagVisibility); | |
| 380 | + } | |
| 381 | + | |
| 382 | + @Bindable | |
| 383 | + public int getIsWitVisibility() { | |
| 384 | + return isWitVisibility; | |
| 385 | + } | |
| 386 | + | |
| 387 | + public void setIsWitVisibility(int isWitVisibility) { | |
| 388 | + this.isWitVisibility = isWitVisibility; | |
| 389 | + notifyPropertyChanged(BR.isWitVisibility); | |
| 390 | + } | |
| 391 | + | |
| 392 | + @Bindable | |
| 393 | + public int getRadioGroupVisibility() { | |
| 394 | + return radioGroupVisibility; | |
| 395 | + } | |
| 396 | + | |
| 397 | + public void setRadioGroupVisibility(int radioGroupVisibility) { | |
| 398 | + this.radioGroupVisibility = radioGroupVisibility; | |
| 399 | + notifyPropertyChanged(BR.radioGroupVisibility); | |
| 400 | + } | |
| 401 | + | |
| 402 | + @Bindable | |
| 403 | + public String getWitimg() { | |
| 404 | + return witimg; | |
| 405 | + } | |
| 406 | + | |
| 407 | + public void setWitimg(String witimg) { | |
| 408 | + this.witimg = witimg; | |
| 409 | + notifyPropertyChanged(BR.witimg); | |
| 410 | + } | |
| 411 | + | |
| 412 | + @Bindable | |
| 413 | + public String getWitContentId() { | |
| 414 | + return witContentId; | |
| 415 | + } | |
| 416 | + | |
| 417 | + public void setWitContentId(String witContentId) { | |
| 418 | + this.witContentId = witContentId; | |
| 419 | + notifyPropertyChanged(BR.witContentId); | |
| 420 | + } | |
| 421 | + | |
| 422 | + @Bindable | |
| 423 | + public String getTitle() { | |
| 424 | + return title; | |
| 425 | + } | |
| 426 | + | |
| 427 | + public void setTitle(String title) { | |
| 428 | + this.title = title; | |
| 429 | + notifyPropertyChanged(BR.title); | |
| 430 | + } | |
| 431 | + | |
| 432 | + @Bindable | |
| 433 | + public String getMessage() { | |
| 434 | + return message; | |
| 435 | + } | |
| 436 | + | |
| 437 | + public void setMessage(String message) { | |
| 438 | + this.message = message; | |
| 439 | + notifyPropertyChanged(BR.message); | |
| 440 | + } | |
| 441 | + | |
| 442 | + @Override | |
| 443 | + public void writeToParcel(Parcel parcel, int i) { | |
| 444 | + super.writeToParcel(parcel, i); | |
| 445 | + } | |
| 446 | + | |
| 447 | + @Override | |
| 448 | + public void createFromParcel(Parcel in) { | |
| 449 | + super.createFromParcel(in); | |
| 450 | + } | |
| 451 | + | |
| 452 | + public static final Creator<ReleaseMediaPage> CREATOR = new Creator<ReleaseMediaPage>() { | |
| 453 | + @Override | |
| 454 | + public ReleaseMediaPage createFromParcel(Parcel in) { | |
| 455 | + return ViewStateListData.newInstance(ReleaseMediaPage.class, in); | |
| 456 | + } | |
| 457 | + | |
| 458 | + @Override | |
| 459 | + public ReleaseMediaPage[] newArray(int size) { | |
| 460 | + return new ReleaseMediaPage[size]; | |
| 461 | + } | |
| 462 | + }; | |
| 463 | + | |
| 464 | + @Override | |
| 465 | + public String toString() { | |
| 466 | + return "ReleaseMediaPage{" + | |
| 467 | + "isVideo=" + isVideo + | |
| 468 | + ", title='" + title + '\'' + | |
| 469 | + ", message='" + message + '\'' + | |
| 470 | + '}'; | |
| 471 | + } | |
| 472 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/moudle/SnowBannerData.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/moudle/SnowBannerData.java | |
| 1 | +package com.cnlive.publish.moudle; | |
| 2 | + | |
| 3 | +public class SnowBannerData { | |
| 4 | + private String create_time; | |
| 5 | + private String id; | |
| 6 | + private String image; | |
| 7 | + private String path; | |
| 8 | + private String sid; | |
| 9 | + private String sign; | |
| 10 | + private String sort; | |
| 11 | + private String type; | |
| 12 | + private String update_time; | |
| 13 | + | |
| 14 | + public String getCreate_time() { | |
| 15 | + return create_time; | |
| 16 | + } | |
| 17 | + | |
| 18 | + public void setCreate_time(String create_time) { | |
| 19 | + this.create_time = create_time; | |
| 20 | + } | |
| 21 | + | |
| 22 | + public String getId() { | |
| 23 | + return id; | |
| 24 | + } | |
| 25 | + | |
| 26 | + public void setId(String id) { | |
| 27 | + this.id = id; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public String getImage() { | |
| 31 | + return image; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public void setImage(String image) { | |
| 35 | + this.image = image; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public String getPath() { | |
| 39 | + return path; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void setPath(String path) { | |
| 43 | + this.path = path; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public String getSid() { | |
| 47 | + return sid; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public void setSid(String sid) { | |
| 51 | + this.sid = sid; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public String getSign() { | |
| 55 | + return sign; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setSign(String sign) { | |
| 59 | + this.sign = sign; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public String getSort() { | |
| 63 | + return sort; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setSort(String sort) { | |
| 67 | + this.sort = sort; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public String getType() { | |
| 71 | + return type; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setType(String type) { | |
| 75 | + this.type = type; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public String getUpdate_time() { | |
| 79 | + return update_time; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public void setUpdate_time(String update_time) { | |
| 83 | + this.update_time = update_time; | |
| 84 | + } | |
| 85 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/moudle/StorageInfoData.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/moudle/StorageInfoData.java | |
| 1 | +package com.cnlive.publish.moudle; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by cnlive201803 on 2018/5/31. | |
| 5 | + */ | |
| 6 | + | |
| 7 | +public class StorageInfoData { | |
| 8 | + private int storageId; | |
| 9 | + private String storageName; | |
| 10 | + private int storageType; | |
| 11 | + private int state; | |
| 12 | + private int contentType; | |
| 13 | + private int profile; | |
| 14 | + private String domain; | |
| 15 | + | |
| 16 | + | |
| 17 | + public int getStorageId() { | |
| 18 | + return storageId; | |
| 19 | + } | |
| 20 | + | |
| 21 | + public void setStorageId(int storageId) { | |
| 22 | + this.storageId = storageId; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public String getStorageName() { | |
| 26 | + return storageName; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public void setStorageName(String storageName) { | |
| 30 | + this.storageName = storageName; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public int getStorageType() { | |
| 34 | + return storageType; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public void setStorageType(int storageType) { | |
| 38 | + this.storageType = storageType; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public int getState() { | |
| 42 | + return state; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setState(int state) { | |
| 46 | + this.state = state; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public int getContentType() { | |
| 50 | + return contentType; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setContentType(int contentType) { | |
| 54 | + this.contentType = contentType; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public int getProfile() { | |
| 58 | + return profile; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public void setProfile(int profile) { | |
| 62 | + this.profile = profile; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public String getDomain() { | |
| 66 | + return domain; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setDomain(String domain) { | |
| 70 | + this.domain = domain; | |
| 71 | + } | |
| 72 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/moudle/TopicAllTag.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/moudle/TopicAllTag.java | |
| 1 | +package com.cnlive.publish.moudle; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +public class TopicAllTag { | |
| 6 | + | |
| 7 | + /** | |
| 8 | + * errorCode : 0 | |
| 9 | + * errorMessage : success | |
| 10 | + * data : [{"name":"养殖/种植","tags":[{"tagId":1,"name":"禽类养殖","interested":false},{"tagId":2,"name":"家畜养殖","interested":false},{"tagId":3,"name":"其他养殖","interested":false},{"tagId":4,"name":"粮油种植","interested":false},{"tagId":5,"name":"果蔬种植","interested":false},{"tagId":6,"name":"菌类种植","interested":false},{"tagId":7,"name":"药材种植","interested":false},{"tagId":8,"name":"其他种植","interested":false}]},{"name":"营销/技巧","tags":[{"tagId":10,"name":"电商技巧","interested":false},{"tagId":11,"name":"营销策划","interested":false},{"tagId":13,"name":"经营管理问题","interested":false},{"tagId":14,"name":"农产品加工","interested":false},{"tagId":18,"name":"农村基层治理","interested":false}]},{"name":"其他","tags":[{"tagId":9,"name":"政策信息","interested":false},{"tagId":12,"name":"农旅及休闲农业","interested":false},{"tagId":15,"name":"法律相关","interested":false},{"tagId":16,"name":"金融相关","interested":false},{"tagId":17,"name":"物资采购","interested":false},{"tagId":19,"name":"销售渠道共享","interested":false},{"tagId":20,"name":"交流活动","interested":false},{"tagId":21,"name":"学习培训","interested":false}]}] | |
| 11 | + */ | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + /** | |
| 16 | + * name : 养殖/种植 | |
| 17 | + * tags : [{"tagId":1,"name":"禽类养殖","interested":false},{"tagId":2,"name":"家畜养殖","interested":false},{"tagId":3,"name":"其他养殖","interested":false},{"tagId":4,"name":"粮油种植","interested":false},{"tagId":5,"name":"果蔬种植","interested":false},{"tagId":6,"name":"菌类种植","interested":false},{"tagId":7,"name":"药材种植","interested":false},{"tagId":8,"name":"其他种植","interested":false}] | |
| 18 | + */ | |
| 19 | + | |
| 20 | + private String name; | |
| 21 | + private List<TagsBean> tags; | |
| 22 | + | |
| 23 | + public String getName() { | |
| 24 | + return name; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public void setName(String name) { | |
| 28 | + this.name = name; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public List<TagsBean> getTags() { | |
| 32 | + return tags; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void setTags(List<TagsBean> tags) { | |
| 36 | + this.tags = tags; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public static class TagsBean { | |
| 40 | + /** | |
| 41 | + * tagId : 1 | |
| 42 | + * name : 禽类养殖 | |
| 43 | + * interested : false | |
| 44 | + */ | |
| 45 | + | |
| 46 | + private int tagId; | |
| 47 | + private String name; | |
| 48 | + private boolean interested; | |
| 49 | + | |
| 50 | + public int getTagId() { | |
| 51 | + return tagId; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public void setTagId(int tagId) { | |
| 55 | + this.tagId = tagId; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public String getName() { | |
| 59 | + return name; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public void setName(String name) { | |
| 63 | + this.name = name; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public boolean isInterested() { | |
| 67 | + return interested; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public void setInterested(boolean interested) { | |
| 71 | + this.interested = interested; | |
| 72 | + } | |
| 73 | + } | |
| 74 | + | |
| 75 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/moudle/UploadAuthData.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/moudle/UploadAuthData.java | |
| 1 | +package com.cnlive.publish.moudle; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by cnlive201803 on 2018/5/9. | |
| 5 | + */ | |
| 6 | + | |
| 7 | +public class UploadAuthData { | |
| 8 | + private String Authorization; | |
| 9 | + private String Date; | |
| 10 | + private String token; | |
| 11 | + | |
| 12 | + public String getAuthorization() { | |
| 13 | + return Authorization; | |
| 14 | + } | |
| 15 | + | |
| 16 | + public void setAuthorization(String authorization) { | |
| 17 | + Authorization = authorization; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public String getDate() { | |
| 21 | + return Date; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public void setDate(String date) { | |
| 25 | + Date = date; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public String getToken() { | |
| 29 | + return token; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public void setToken(String token) { | |
| 33 | + this.token = token; | |
| 34 | + } | |
| 35 | + | |
| 36 | + @Override | |
| 37 | + public String toString() { | |
| 38 | + return "UploadAuthData{" + | |
| 39 | + "Authorization='" + Authorization + '\'' + | |
| 40 | + ", Date='" + Date + '\'' + | |
| 41 | + ", token='" + token + '\'' + | |
| 42 | + '}'; | |
| 43 | + } | |
| 44 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/moudle/VideoUploadResult.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/moudle/VideoUploadResult.java | |
| 1 | +package com.cnlive.publish.moudle; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by xiansong on 2018/3/28. | |
| 5 | + */ | |
| 6 | + | |
| 7 | +public class VideoUploadResult { | |
| 8 | + private String videoId; | |
| 9 | + | |
| 10 | + public String getVideoId() { | |
| 11 | + return videoId; | |
| 12 | + } | |
| 13 | + | |
| 14 | + public void setVideoId(String videoId) { | |
| 15 | + this.videoId = videoId; | |
| 16 | + } | |
| 17 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/moudle/Witness.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/moudle/Witness.java | |
| 1 | +package com.cnlive.publish.moudle; | |
| 2 | + | |
| 3 | +import org.greenrobot.greendao.annotation.Entity; | |
| 4 | +import org.greenrobot.greendao.annotation.Generated; | |
| 5 | +import org.greenrobot.greendao.annotation.Id; | |
| 6 | +import org.greenrobot.greendao.annotation.NotNull; | |
| 7 | + | |
| 8 | +// THIS CODE IS GENERATED BY greenDAO, EDIT ONLY INSIDE THE "KEEP"-SECTIONS | |
| 9 | + | |
| 10 | +// KEEP INCLUDES - put your custom includes here | |
| 11 | +// KEEP INCLUDES END | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * Entity mapped to table "WITNESS". | |
| 15 | + */ | |
| 16 | +@Entity | |
| 17 | +public class Witness { | |
| 18 | + private String id; | |
| 19 | + private String sid; | |
| 20 | + private String medias; | |
| 21 | + private String title; | |
| 22 | + private String wit; | |
| 23 | + private Integer type; | |
| 24 | + private String videotype; | |
| 25 | + private String gopath; | |
| 26 | + private Integer multiplecategory; | |
| 27 | + private String tag; | |
| 28 | + | |
| 29 | + @Id | |
| 30 | + @NotNull | |
| 31 | + private String timeStamp; | |
| 32 | + private String dutation; | |
| 33 | + private String src; | |
| 34 | + private String taglist; | |
| 35 | + private String pageDataTitle; | |
| 36 | + private Integer source; | |
| 37 | + private String labelcolor; | |
| 38 | + private Integer detailAddress; | |
| 39 | + private String fileUri; | |
| 40 | + | |
| 41 | + // KEEP FIELDS - put your custom fields here | |
| 42 | + // KEEP FIELDS END | |
| 43 | + | |
| 44 | + @Generated | |
| 45 | + public Witness() { | |
| 46 | + } | |
| 47 | + | |
| 48 | + public Witness(String timeStamp) { | |
| 49 | + this.timeStamp = timeStamp; | |
| 50 | + } | |
| 51 | + | |
| 52 | + @Generated | |
| 53 | + public Witness(String id, String sid, String medias, String title, String wit, Integer type, String videotype, String gopath, Integer multiplecategory, String tag, String timeStamp, String dutation, String src, String taglist, String pageDataTitle, Integer source, String labelcolor, Integer detailAddress, String fileUri) { | |
| 54 | + this.id = id; | |
| 55 | + this.sid = sid; | |
| 56 | + this.medias = medias; | |
| 57 | + this.title = title; | |
| 58 | + this.wit = wit; | |
| 59 | + this.type = type; | |
| 60 | + this.videotype = videotype; | |
| 61 | + this.gopath = gopath; | |
| 62 | + this.multiplecategory = multiplecategory; | |
| 63 | + this.tag = tag; | |
| 64 | + this.timeStamp = timeStamp; | |
| 65 | + this.dutation = dutation; | |
| 66 | + this.src = src; | |
| 67 | + this.taglist = taglist; | |
| 68 | + this.pageDataTitle = pageDataTitle; | |
| 69 | + this.source = source; | |
| 70 | + this.labelcolor = labelcolor; | |
| 71 | + this.detailAddress = detailAddress; | |
| 72 | + this.fileUri = fileUri; | |
| 73 | + } | |
| 74 | + | |
| 75 | + public String getId() { | |
| 76 | + return id; | |
| 77 | + } | |
| 78 | + | |
| 79 | + public void setId(String id) { | |
| 80 | + this.id = id; | |
| 81 | + } | |
| 82 | + | |
| 83 | + public String getSid() { | |
| 84 | + return sid; | |
| 85 | + } | |
| 86 | + | |
| 87 | + public void setSid(String sid) { | |
| 88 | + this.sid = sid; | |
| 89 | + } | |
| 90 | + | |
| 91 | + public String getMedias() { | |
| 92 | + return medias; | |
| 93 | + } | |
| 94 | + | |
| 95 | + public void setMedias(String medias) { | |
| 96 | + this.medias = medias; | |
| 97 | + } | |
| 98 | + | |
| 99 | + public String getTitle() { | |
| 100 | + return title; | |
| 101 | + } | |
| 102 | + | |
| 103 | + public void setTitle(String title) { | |
| 104 | + this.title = title; | |
| 105 | + } | |
| 106 | + | |
| 107 | + public String getWit() { | |
| 108 | + return wit; | |
| 109 | + } | |
| 110 | + | |
| 111 | + public void setWit(String wit) { | |
| 112 | + this.wit = wit; | |
| 113 | + } | |
| 114 | + | |
| 115 | + public Integer getType() { | |
| 116 | + return type; | |
| 117 | + } | |
| 118 | + | |
| 119 | + public void setType(Integer type) { | |
| 120 | + this.type = type; | |
| 121 | + } | |
| 122 | + | |
| 123 | + public String getVideotype() { | |
| 124 | + return videotype; | |
| 125 | + } | |
| 126 | + | |
| 127 | + public void setVideotype(String videotype) { | |
| 128 | + this.videotype = videotype; | |
| 129 | + } | |
| 130 | + | |
| 131 | + public String getGopath() { | |
| 132 | + return gopath; | |
| 133 | + } | |
| 134 | + | |
| 135 | + public void setGopath(String gopath) { | |
| 136 | + this.gopath = gopath; | |
| 137 | + } | |
| 138 | + | |
| 139 | + public Integer getMultiplecategory() { | |
| 140 | + return multiplecategory; | |
| 141 | + } | |
| 142 | + | |
| 143 | + public void setMultiplecategory(Integer multiplecategory) { | |
| 144 | + this.multiplecategory = multiplecategory; | |
| 145 | + } | |
| 146 | + | |
| 147 | + public String getTag() { | |
| 148 | + return tag; | |
| 149 | + } | |
| 150 | + | |
| 151 | + public void setTag(String tag) { | |
| 152 | + this.tag = tag; | |
| 153 | + } | |
| 154 | + | |
| 155 | + @NotNull | |
| 156 | + public String getTimeStamp() { | |
| 157 | + return timeStamp; | |
| 158 | + } | |
| 159 | + | |
| 160 | + /** | |
| 161 | + * Not-null value; ensure this value is available before it is saved to the database. | |
| 162 | + */ | |
| 163 | + public void setTimeStamp(@NotNull String timeStamp) { | |
| 164 | + this.timeStamp = timeStamp; | |
| 165 | + } | |
| 166 | + | |
| 167 | + public String getDutation() { | |
| 168 | + return dutation; | |
| 169 | + } | |
| 170 | + | |
| 171 | + public void setDutation(String dutation) { | |
| 172 | + this.dutation = dutation; | |
| 173 | + } | |
| 174 | + | |
| 175 | + public String getSrc() { | |
| 176 | + return src; | |
| 177 | + } | |
| 178 | + | |
| 179 | + public void setSrc(String src) { | |
| 180 | + this.src = src; | |
| 181 | + } | |
| 182 | + | |
| 183 | + public String getTaglist() { | |
| 184 | + return taglist; | |
| 185 | + } | |
| 186 | + | |
| 187 | + public void setTaglist(String taglist) { | |
| 188 | + this.taglist = taglist; | |
| 189 | + } | |
| 190 | + | |
| 191 | + public String getPageDataTitle() { | |
| 192 | + return pageDataTitle; | |
| 193 | + } | |
| 194 | + | |
| 195 | + public void setPageDataTitle(String pageDataTitle) { | |
| 196 | + this.pageDataTitle = pageDataTitle; | |
| 197 | + } | |
| 198 | + | |
| 199 | + public Integer getSource() { | |
| 200 | + return source; | |
| 201 | + } | |
| 202 | + | |
| 203 | + public void setSource(Integer source) { | |
| 204 | + this.source = source; | |
| 205 | + } | |
| 206 | + | |
| 207 | + public String getLabelcolor() { | |
| 208 | + return labelcolor; | |
| 209 | + } | |
| 210 | + | |
| 211 | + public void setLabelcolor(String labelcolor) { | |
| 212 | + this.labelcolor = labelcolor; | |
| 213 | + } | |
| 214 | + | |
| 215 | + public Integer getDetailAddress() { | |
| 216 | + return detailAddress; | |
| 217 | + } | |
| 218 | + | |
| 219 | + public void setDetailAddress(Integer detailAddress) { | |
| 220 | + this.detailAddress = detailAddress; | |
| 221 | + } | |
| 222 | + | |
| 223 | + public String getFileUri() { | |
| 224 | + return fileUri; | |
| 225 | + } | |
| 226 | + | |
| 227 | + public void setFileUri(String fileUri) { | |
| 228 | + this.fileUri = fileUri; | |
| 229 | + } | |
| 230 | + | |
| 231 | + // KEEP METHODS - put your custom methods here | |
| 232 | + // KEEP METHODS END | |
| 233 | + | |
| 234 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/network/ApiRequest.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/network/ApiRequest.java | |
| 1 | +package com.cnlive.publish.network; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.util.Log; | |
| 5 | + | |
| 6 | +import com.cnlive.libs.base.application.AppConfig; | |
| 7 | +import com.cnlive.libs.base.logic.callback.DataCallback; | |
| 8 | +import com.cnlive.libs.data.network.ApiBuild; | |
| 9 | +import com.cnlive.libs.data.network.Subscriber; | |
| 10 | +import com.cnlive.libs.data.network.interceptor.DESEncryptInterceptor; | |
| 11 | +import com.cnlive.libs.data.network.interceptor.DefaultEncryptInterceptor; | |
| 12 | +import com.cnlive.libs.data.network.interceptor.NetPPEncryptInterceptor; | |
| 13 | +import com.cnlive.libs.data.network.interceptor.NetPPPayEncryptInterceptor; | |
| 14 | +import com.cnlive.libs.data.network.interceptor.SignEncrypt2Interceptor; | |
| 15 | +import com.cnlive.libs.data.network.interceptor.SignEncryptInterceptor; | |
| 16 | + | |
| 17 | +import io.reactivex.android.schedulers.AndroidSchedulers; | |
| 18 | +import io.reactivex.disposables.Disposable; | |
| 19 | +import io.reactivex.schedulers.Schedulers; | |
| 20 | +import okhttp3.Interceptor; | |
| 21 | +import okhttp3.OkHttpClient; | |
| 22 | +import okhttp3.Request; | |
| 23 | +import okhttp3.Response; | |
| 24 | +import retrofit2.adapter.rxjava2.Result; | |
| 25 | + | |
| 26 | +import static com.cnlive.libs.base.logic.Config.SUCCESS; | |
| 27 | + | |
| 28 | + | |
| 29 | +/** | |
| 30 | + * Created by xiansong on 2017/9/8. | |
| 31 | + */ | |
| 32 | + | |
| 33 | +public class ApiRequest<Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> { | |
| 34 | + | |
| 35 | + private static final int OKHTTP_KEEP_ALIVE_DURATION_SECONDS = 10; | |
| 36 | + | |
| 37 | + //网家家 接口域名 | |
| 38 | + public static final String BASE_URL = "https://apiwjj.cnlive.com/"; | |
| 39 | + //网家家 测试环境 接口域名 | |
| 40 | + public static final String DEBUG_URL = "http://apiwjjtest.cnlive.com/"; | |
| 41 | + //IM 接口域名 | |
| 42 | + private static final String IM_URL = "https://wjjim.cnlive.com/"; | |
| 43 | + //IM 测试环境 接口域名 | |
| 44 | + public static final String IM_DEBUG_URL = "http://imtest.cnlive.com/"; | |
| 45 | + //OPEN API 接口域名 | |
| 46 | + public static final String OPEN_URL = "https://api.cnlive.com/"; | |
| 47 | + //WJJ JSON | |
| 48 | + private static final String JSON_URL = "https://wjj.ys1.cnliveimg.com/"; | |
| 49 | + | |
| 50 | + private static final String DEBUG_CMS_URL = "http://cmstest.cnlive.com:8768/"; | |
| 51 | + // TODO: 2018/11/27 cms正式地址 | |
| 52 | + private static final String CMS_URL = "http://cms.cnlive.com:8768/"; | |
| 53 | + //个人认证图片上传 | |
| 54 | + private static final String ITYADMIN = "http://ltyadmin.cnlive.com"; | |
| 55 | + | |
| 56 | + private static final String DEBUG_ITYADMIN = "http://ltyadmintest.cnlive.com"; | |
| 57 | + | |
| 58 | + public static <T> String baseEndpoint() { | |
| 59 | + return AppConfig.isDebug() ? DEBUG_URL : BASE_URL; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public static <T> String baseIMEndpoint() { | |
| 63 | + return AppConfig.isDebug() ? IM_DEBUG_URL : IM_URL; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public static <T> String baseCMSEndpoint() { | |
| 67 | + return AppConfig.isDebug() ? DEBUG_CMS_URL : CMS_URL; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public static <T> String baseItyadmin(){ | |
| 71 | + return AppConfig.isDebug() ? DEBUG_ITYADMIN : ITYADMIN; | |
| 72 | + } | |
| 73 | + private static <T> String serviceEndpoint(Class<T> clazz) { | |
| 74 | + if (clazz == ApiServiceCms.class) return baseCMSEndpoint(); | |
| 75 | + else return baseEndpoint(); | |
| 76 | + } | |
| 77 | + | |
| 78 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 79 | + ApiRequest<Observable, BaseData> observable(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 80 | + return observable(clazz, false, api, null); | |
| 81 | + } | |
| 82 | + | |
| 83 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 84 | + ApiRequest<Observable, BaseData> observable(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api, Interceptor interceptor) { | |
| 85 | + return observable(clazz, false, api, interceptor); | |
| 86 | + } | |
| 87 | + | |
| 88 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 89 | + ApiRequest<Observable, BaseData> observable(Class<Service> clazz, boolean decode, ApiBuild.Api<Service, Observable, BaseData> api, Interceptor interceptor) { | |
| 90 | + ApiRequest<Observable, BaseData> request = new ApiRequest<>(); | |
| 91 | + ApiBuild<Service, Observable, BaseData> build = ApiBuild.service(clazz, api); | |
| 92 | + build.setEndpoint(serviceEndpoint(clazz)); | |
| 93 | + if (interceptor != null) build.addInterceptor(interceptor); | |
| 94 | + request.observable = build.build(decode, OKHTTP_KEEP_ALIVE_DURATION_SECONDS); | |
| 95 | + return request; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public static <Service> Service serviceNoSign(Class<Service> clazz) { | |
| 99 | + return service(clazz, (Interceptor) new DefaultEncryptInterceptor()); | |
| 100 | + } | |
| 101 | + | |
| 102 | + public static <Service> Service service(Class<Service> clazz) { | |
| 103 | + return service(clazz, new SignEncryptInterceptor()); | |
| 104 | + // return service(clazz, new PublishInterceptor()); | |
| 105 | + } | |
| 106 | + | |
| 107 | + public static <Service> Service service(Class<Service> clazz, boolean valueUrlencode, boolean responseUrldecode) { | |
| 108 | + return service(clazz, responseUrldecode, new SignEncryptInterceptor(valueUrlencode)); | |
| 109 | + } | |
| 110 | + | |
| 111 | + public static <Service> Service serviceDES(Class<Service> clazz) { | |
| 112 | + return service(clazz, new DESEncryptInterceptor()); | |
| 113 | + } | |
| 114 | + | |
| 115 | + public static <Service> Service serviceNetPP(Class<Service> clazz) { | |
| 116 | + return service(clazz, new NetPPEncryptInterceptor()); | |
| 117 | + } | |
| 118 | + | |
| 119 | + public static <Service> Service serviceNetPPPay(Class<Service> clazz) { | |
| 120 | + return service(clazz, new NetPPPayEncryptInterceptor()); | |
| 121 | + } | |
| 122 | + | |
| 123 | + | |
| 124 | + private static <Service> Service service(Class<Service> clazz, Interceptor... interceptor) { | |
| 125 | + return service(clazz, false, interceptor); | |
| 126 | + } | |
| 127 | + | |
| 128 | + private static <Service> Service service(Class<Service> clazz, boolean decode, Interceptor... interceptor) { | |
| 129 | + return ApiBuild.service(clazz, null) | |
| 130 | + .setEndpoint(serviceEndpoint(clazz)) | |
| 131 | + .addInterceptor(interceptor) | |
| 132 | + .service(decode, OKHTTP_KEEP_ALIVE_DURATION_SECONDS); | |
| 133 | + } | |
| 134 | + | |
| 135 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 136 | + ApiRequest<Observable, BaseData> serviceNoSign(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 137 | + return service(clazz, api, new DefaultEncryptInterceptor()); | |
| 138 | + } | |
| 139 | + | |
| 140 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 141 | + ApiRequest<Observable, BaseData> service(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 142 | + return service(clazz, api, new SignEncryptInterceptor()); | |
| 143 | + } | |
| 144 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 145 | + ApiRequest<Observable, BaseData> serviceNewVersion(Class<Service> clazz, long connectTimeout , long readTimeout, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 146 | + return serviceNewVersion(clazz,false, api, connectTimeout,readTimeout,new SignEncryptInterceptor()); | |
| 147 | + } | |
| 148 | + | |
| 149 | + | |
| 150 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 151 | + ApiRequest<Observable, BaseData> service(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api, boolean valueUrlencode, boolean responseUrldecode) { | |
| 152 | + return service(clazz, responseUrldecode, api, new SignEncryptInterceptor(valueUrlencode)); | |
| 153 | + } | |
| 154 | + | |
| 155 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 156 | + ApiRequest<Observable, BaseData> serviceDES(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 157 | + return service(clazz, api, new DESEncryptInterceptor()); | |
| 158 | + } | |
| 159 | + | |
| 160 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 161 | + ApiRequest<Observable, BaseData> service2encode(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 162 | + return service(clazz, api, new SignEncrypt2Interceptor()); | |
| 163 | + } | |
| 164 | + | |
| 165 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 166 | + ApiRequest<Observable, BaseData> serviceNetPP(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 167 | + return service(clazz, api, new NetPPEncryptInterceptor()); | |
| 168 | + } | |
| 169 | + | |
| 170 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 171 | + ApiRequest<Observable, BaseData> serviceNetPPPay(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 172 | + return service(clazz, api, new NetPPPayEncryptInterceptor()); | |
| 173 | + } | |
| 174 | + | |
| 175 | + private static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 176 | + ApiRequest<Observable, BaseData> service(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api, Interceptor... interceptor) { | |
| 177 | + return service(clazz, false, api, interceptor); | |
| 178 | + } | |
| 179 | + | |
| 180 | + private static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 181 | + ApiRequest<Observable, BaseData> service(Class<Service> clazz, boolean decode, ApiBuild.Api<Service, Observable, BaseData> api, Interceptor... interceptor) { | |
| 182 | + | |
| 183 | + ApiRequest<Observable, BaseData> request = new ApiRequest<>(); | |
| 184 | + | |
| 185 | + request.observable = ApiBuild.service(clazz, api) | |
| 186 | + .setEndpoint(serviceEndpoint(clazz)) | |
| 187 | + .addInterceptor(interceptor) | |
| 188 | + .build(decode, OKHTTP_KEEP_ALIVE_DURATION_SECONDS); | |
| 189 | + | |
| 190 | + return request; | |
| 191 | + } | |
| 192 | + | |
| 193 | + | |
| 194 | + private static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 195 | + ApiRequest<Observable, BaseData> serviceNewVersion(Class<Service> clazz, boolean decode, ApiBuild.Api<Service, Observable, BaseData> api, long connectTimeout , long readTimeout, Interceptor... interceptor) { | |
| 196 | + | |
| 197 | + ApiRequest<Observable, BaseData> request = new ApiRequest<>(); | |
| 198 | + | |
| 199 | + request.observable = ApiBuild.service(clazz, api) | |
| 200 | + .setEndpoint(serviceEndpoint(clazz)) | |
| 201 | + .setConnectTimeout(connectTimeout) | |
| 202 | + .setReadTimeout(readTimeout) | |
| 203 | + .addInterceptor(interceptor) | |
| 204 | + .build(decode); | |
| 205 | + | |
| 206 | + return request; | |
| 207 | + } | |
| 208 | + | |
| 209 | + private Observable observable; | |
| 210 | + | |
| 211 | + private ApiRequest() { | |
| 212 | + } | |
| 213 | + | |
| 214 | + public static <Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 215 | + Disposable subscribe(Observable observable, Subscriber<BaseData> subscriber) { | |
| 216 | + return observable.take(1) | |
| 217 | + .subscribeOn(Schedulers.io()) | |
| 218 | + .observeOn(AndroidSchedulers.mainThread()) | |
| 219 | + .subscribe(subscriber.next, subscriber.error, subscriber.complete, subscriber.subscribe); | |
| 220 | + } | |
| 221 | + | |
| 222 | + public Disposable subscribe(Subscriber<BaseData> subscriber) { | |
| 223 | + return observable.take(1) | |
| 224 | + .subscribeOn(Schedulers.io()) | |
| 225 | + .observeOn(AndroidSchedulers.mainThread()) | |
| 226 | + .subscribe(subscriber.next, subscriber.error, subscriber.complete, subscriber.subscribe); | |
| 227 | + } | |
| 228 | + | |
| 229 | + public Disposable subscribe(Context context, DataCallback<BaseData> callback) { | |
| 230 | + Subscriber<BaseData> subscriber = new Subscriber<BaseData>(context) { | |
| 231 | + @Override | |
| 232 | + public void onCompleted(String s, String s1, BaseData data) { | |
| 233 | + if (callback == null) return; | |
| 234 | + callback.callback(SUCCESS, "", data); | |
| 235 | + } | |
| 236 | + | |
| 237 | + @Override | |
| 238 | + public void onError(String code, String message) { | |
| 239 | + if (callback == null) return; | |
| 240 | + int errorCode = -1; | |
| 241 | + try { | |
| 242 | + errorCode = Integer.valueOf(code); | |
| 243 | + } catch (Exception ignored) { | |
| 244 | + } | |
| 245 | + | |
| 246 | + Log.e("LynnTest read", code + " \n " + message); | |
| 247 | + callback.callback(errorCode, message, null); | |
| 248 | + } | |
| 249 | + }; | |
| 250 | + | |
| 251 | + return observable.take(1) | |
| 252 | + .subscribeOn(Schedulers.io()) | |
| 253 | + .observeOn(AndroidSchedulers.mainThread()) | |
| 254 | + .subscribe(subscriber.next, subscriber.error, subscriber.complete, subscriber.subscribe); | |
| 255 | + } | |
| 256 | + | |
| 257 | + public static Disposable loadData(String url, DataCallback<String> callback) { | |
| 258 | + return io.reactivex.Observable | |
| 259 | + .just(url) | |
| 260 | + .map(s -> { | |
| 261 | + Response response = null; | |
| 262 | + String data = null; | |
| 263 | + try { | |
| 264 | + OkHttpClient client = new OkHttpClient();//创建OkHttpClient对象 | |
| 265 | + Request request = new Request.Builder().url(url).build(); | |
| 266 | + response = client.newCall(request).execute();//得到Response 对 | |
| 267 | + if (response.isSuccessful()) data = response.body().string(); | |
| 268 | + } catch (Exception e) { | |
| 269 | + Log.e("Api", "", e); | |
| 270 | + } | |
| 271 | + | |
| 272 | + return data; | |
| 273 | + }) | |
| 274 | + .subscribeOn(Schedulers.io()) | |
| 275 | + .observeOn(AndroidSchedulers.mainThread()) | |
| 276 | + .subscribe(s -> callback.callback(0, "", s)); | |
| 277 | + } | |
| 278 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/network/ApiServiceCms.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/network/ApiServiceCms.java | |
| 1 | +package com.cnlive.publish.network; | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | +import com.cnlive.publish.moudle.CheckData; | |
| 6 | +import com.cnlive.publish.moudle.TopicAllTag; | |
| 7 | + | |
| 8 | +import java.util.List; | |
| 9 | +import java.util.Map; | |
| 10 | + | |
| 11 | +import io.reactivex.Observable; | |
| 12 | +import retrofit2.adapter.rxjava2.Result; | |
| 13 | +import retrofit2.http.GET; | |
| 14 | +import retrofit2.http.POST; | |
| 15 | +import retrofit2.http.QueryMap; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * Created by Lynn on 2018/11/27. | |
| 19 | + */ | |
| 20 | + | |
| 21 | +public interface ApiServiceCms { | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 发布话题鉴权 | |
| 25 | + */ | |
| 26 | + @GET("ltyApi/certification") | |
| 27 | + Observable<Result<BaseInfo<CheckData>>> checkTopic(@QueryMap() Map<String, String> map); | |
| 28 | + | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 发布话题获取全部标签 | |
| 32 | + */ | |
| 33 | + @GET("ltyApi/interestedTags") | |
| 34 | + Observable<Result<BaseInfo<List<TopicAllTag>>>> getAllTag(@QueryMap() Map<String, Object> map); | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 话题发布 | |
| 38 | + * | |
| 39 | + * @return | |
| 40 | + */ | |
| 41 | + @POST("ltyApi/createTopic") | |
| 42 | + Observable<Result<BaseInfo<Object>>> postTopic(@QueryMap Map<String, Object> body); | |
| 43 | + | |
| 44 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/network/ApiServiceDaren.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/network/ApiServiceDaren.java | |
| 1 | +package com.cnlive.publish.network; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.cnlive.publish.moudle.CheckApplyResultInfo; | |
| 5 | +import com.cnlive.publish.moudle.DarenApplyModel; | |
| 6 | + | |
| 7 | +import java.util.List; | |
| 8 | +import java.util.Map; | |
| 9 | + | |
| 10 | +import io.reactivex.Observable; | |
| 11 | +import okhttp3.MultipartBody; | |
| 12 | +import okhttp3.RequestBody; | |
| 13 | +import retrofit2.adapter.rxjava2.Result; | |
| 14 | +import retrofit2.http.Multipart; | |
| 15 | +import retrofit2.http.POST; | |
| 16 | +import retrofit2.http.Part; | |
| 17 | +import retrofit2.http.PartMap; | |
| 18 | +import retrofit2.http.QueryMap; | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * 达人有关的接口 | |
| 22 | + */ | |
| 23 | +public interface ApiServiceDaren { | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 检查达人审核状态 | |
| 27 | + */ | |
| 28 | + @POST("Daren/witness/checkWitness.action") | |
| 29 | + Observable<Result<CheckApplyResultInfo>> checkApplyWitness(@QueryMap() Map<String, String> maps); | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 达人申请接口 | |
| 33 | + */ | |
| 34 | + @Multipart | |
| 35 | + @POST("Daren/witness/applyWitness.action") | |
| 36 | + Observable<Result<DarenApplyModel>> applyWitness(@PartMap() Map<String, RequestBody> maps, | |
| 37 | + @Part List<MultipartBody.Part> params); | |
| 38 | + | |
| 39 | +} | |
| 40 | + | ... | ... |
publish/src/main/java/com/cnlive/publish/network/ApiServiceEyewitness.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/network/ApiServiceEyewitness.java | |
| 1 | +package com.cnlive.publish.network; | |
| 2 | + | |
| 3 | +import java.util.Map; | |
| 4 | + | |
| 5 | +import io.reactivex.Observable; | |
| 6 | +import retrofit2.adapter.rxjava2.Result; | |
| 7 | +import retrofit2.http.POST; | |
| 8 | +import retrofit2.http.QueryMap; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 作者: 吴奎庆 | |
| 12 | + * <p> | |
| 13 | + * 时间: 2018/10/12 | |
| 14 | + * <p> | |
| 15 | + * 简介: | |
| 16 | + */ | |
| 17 | + | |
| 18 | +public interface ApiServiceEyewitness { | |
| 19 | + //删除or修改目击者发布内容 | |
| 20 | + @POST("Daren/witness/deleteOrUpdateWitnessPublish.action") | |
| 21 | + Observable<Result<BaseInfo>> deleteOrUpdateWitnessPublish(@QueryMap Map<String, String> maps); | |
| 22 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/network/ApiServiceIntegra.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/network/ApiServiceIntegra.java | |
| 1 | +package com.cnlive.publish.network; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.cnlive.publish.moudle.AddIntegration; | |
| 5 | + | |
| 6 | +import java.util.Map; | |
| 7 | + | |
| 8 | +import io.reactivex.Observable; | |
| 9 | +import retrofit2.adapter.rxjava2.Result; | |
| 10 | +import retrofit2.http.GET; | |
| 11 | +import retrofit2.http.POST; | |
| 12 | +import retrofit2.http.QueryMap; | |
| 13 | + | |
| 14 | +public interface ApiServiceIntegra { | |
| 15 | + | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 增加积分 | |
| 19 | + */ | |
| 20 | + @POST("Daren/integral/addTask.action") | |
| 21 | + Observable<Result<BaseInfo<AddIntegration.DataBean>>> addIntegration(@QueryMap() Map<String, String> map); | |
| 22 | + | |
| 23 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/network/ApiServiceMoment.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/network/ApiServiceMoment.java | |
| 1 | +package com.cnlive.publish.network; | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | +import com.cnlive.media.model.CircleData; | |
| 6 | +import com.cnlive.publish.moudle.FriendCircleNewMessage; | |
| 7 | +import com.cnlive.publish.moudle.MomentData; | |
| 8 | +import com.cnlive.publish.moudle.SnowBannerData; | |
| 9 | + | |
| 10 | +import java.util.List; | |
| 11 | +import java.util.Map; | |
| 12 | + | |
| 13 | +import io.reactivex.Observable; | |
| 14 | +import okhttp3.MultipartBody; | |
| 15 | +import okhttp3.RequestBody; | |
| 16 | +import retrofit2.adapter.rxjava2.Result; | |
| 17 | +import retrofit2.http.FieldMap; | |
| 18 | +import retrofit2.http.FormUrlEncoded; | |
| 19 | +import retrofit2.http.Headers; | |
| 20 | +import retrofit2.http.Multipart; | |
| 21 | +import retrofit2.http.POST; | |
| 22 | +import retrofit2.http.Part; | |
| 23 | +import retrofit2.http.PartMap; | |
| 24 | +import retrofit2.http.Path; | |
| 25 | +import retrofit2.http.QueryMap; | |
| 26 | + | |
| 27 | +/** | |
| 28 | + * 达人有关的接口 | |
| 29 | + */ | |
| 30 | +public interface ApiServiceMoment { | |
| 31 | + | |
| 32 | + /* *//** | |
| 33 | + * 上传发布内容 | |
| 34 | + *//* | |
| 35 | + @POST("Daren/moment/releaseMoment.action") | |
| 36 | + @Multipart | |
| 37 | + Observable<Result<BaseInfo>> releaseMoment(@PartMap Map<String, RequestBody> maps, | |
| 38 | + @Part List<MultipartBody.Part> params); | |
| 39 | + | |
| 40 | + *//** | |
| 41 | + * 上传发布内容(图片传七牛) | |
| 42 | + *//* | |
| 43 | + @POST("Daren/moment/releaseMoment.action") | |
| 44 | + Observable<Result<BaseInfo>> releaseMomentNew(@QueryMap Map<String, Object> maps); | |
| 45 | +*/ | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * 上传发布内容(图片传七牛) | |
| 49 | + */ | |
| 50 | + @POST("{user}") | |
| 51 | + Observable<Result<BaseInfo>> releaseMomentNe(@Path(value = "user", encoded = true) String path, @QueryMap Map<String, Object> maps); | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 上传发布内容(不含图片) | |
| 59 | + */ | |
| 60 | + @POST("{user}") | |
| 61 | + Observable<Result<BaseInfo>> releaseMomentText(@Path(value = "user", encoded = true) String path, @QueryMap() Map<String, String> maps); | |
| 62 | + | |
| 63 | + /* *//** | |
| 64 | + * 上传目击者发布内容(图片传七牛) | |
| 65 | + *//* | |
| 66 | + @POST("Daren/witness/releaseWitness.action") | |
| 67 | + Observable<Result<BaseInfo>> releaseWitness(@QueryMap Map<String, Object> maps);*/ | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * 上传目击者发布内容(图片传七牛) | |
| 71 | + */ | |
| 72 | + @POST("Daren/witness/releaseWitness.action") | |
| 73 | + Observable<Result<BaseInfo>> releaseWitnessnew(@QueryMap Map<String, String> maps); | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * 获取生活圈渠道列表 | |
| 77 | + */ | |
| 78 | + @POST("Daren/publishType/getPublishTypeList.action") | |
| 79 | + Observable<Result<BaseInfo<CircleData>>> releaseCirclePath(@QueryMap() Map<String, String> maps); | |
| 80 | + | |
| 81 | + /** | |
| 82 | + * 冰雪活动上传发布内容 | |
| 83 | + */ | |
| 84 | + @POST("Daren/snow/releaseSnow.action") | |
| 85 | + @Multipart | |
| 86 | + Observable<Result<BaseInfo>> releaseSnow(@PartMap Map<String, RequestBody> maps, | |
| 87 | + @Part List<MultipartBody.Part> params); | |
| 88 | + | |
| 89 | + /** | |
| 90 | + * 冰雪活动上传发布内容(图片新接口格式) | |
| 91 | + */ | |
| 92 | + @POST("Daren/snow/releaseSnow.action") | |
| 93 | + Observable<Result<BaseInfo>> releaseSnow(@QueryMap() Map<String, Object> maps); | |
| 94 | + /** | |
| 95 | + * 冰雪活动上传发布内容(图片新接口格式) | |
| 96 | + */ | |
| 97 | + @POST("Daren/snow/releaseSnow.action") | |
| 98 | + Observable<Result<BaseInfo>> releaseSnowNew(@QueryMap() Map<String, String> maps); | |
| 99 | + | |
| 100 | + /** | |
| 101 | + * 冰雪活动上传发布内容(不含图片) | |
| 102 | + */ | |
| 103 | + @POST("Daren/snow/getSnowBanner.action") | |
| 104 | + Observable<Result<BaseInfo<List<SnowBannerData>>>> getSnowBanner(@QueryMap() Map<String, String> maps); | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * 获取相册内容 | |
| 108 | + */ | |
| 109 | + @Headers("cache:5") | |
| 110 | + @POST("Daren/moment/myMoment.action") | |
| 111 | + Observable<Result<BaseInfo<MomentData>>> myMoment(@QueryMap() Map<String, String> maps); | |
| 112 | + | |
| 113 | + /** | |
| 114 | + * 获取朋友圈内容 | |
| 115 | + */ | |
| 116 | + @Headers("cache:5") | |
| 117 | + @POST("Daren/moment/friendMoment.action") | |
| 118 | + Observable<Result<BaseInfo<MomentData>>> friendMoment(@QueryMap() Map<String, String> maps); | |
| 119 | + | |
| 120 | + @POST("Daren/moment/deleteMyMoment.action") | |
| 121 | + Observable<Result<BaseInfo>> deleteMyMoment(@QueryMap() Map<String, String> maps); | |
| 122 | + | |
| 123 | + /** | |
| 124 | + * 获取新消息列表 | |
| 125 | + * | |
| 126 | + * @param maps sid 用户ID | |
| 127 | + * @return | |
| 128 | + */ | |
| 129 | + @POST("Daren/moment/getNewMsgList.action") | |
| 130 | + Observable<Result<BaseInfo<List<FriendCircleNewMessage>>>> getNewMsgList(@QueryMap() Map<String, String> maps); | |
| 131 | + | |
| 132 | + | |
| 133 | + @POST("Daren/moment/deleteNewMsg.action") | |
| 134 | + Observable<Result<BaseInfo>> deleteNewMsg(@QueryMap() Map<String, String> maps); | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + /** | |
| 140 | + * 点赞 | |
| 141 | + */ | |
| 142 | + @POST("Daren/moment/praiseMoment.action") | |
| 143 | + Observable<Result<BaseInfo>> praiseMoment(@QueryMap() Map<String, String> maps); | |
| 144 | + | |
| 145 | + /** | |
| 146 | + * 获取朋友圈内容 | |
| 147 | + * momentId | |
| 148 | + */ | |
| 149 | + @POST("Daren/moment/getMomentDetail.action") | |
| 150 | + Observable<Result<BaseInfo<MomentData.FriendItem>>> getMomentDetail(@QueryMap() Map<String, String> maps); | |
| 151 | + | |
| 152 | + /** | |
| 153 | + * 设置陌生人生活圈权限 | |
| 154 | + */ | |
| 155 | + @FormUrlEncoded | |
| 156 | + @POST("Daren/moment/strangerSwitch.action") | |
| 157 | + Observable<Result<BaseInfo>> setStrangerAccessMoment(@FieldMap() Map<String, String> maps); | |
| 158 | + | |
| 159 | + | |
| 160 | +} | |
| 161 | + | ... | ... |
publish/src/main/java/com/cnlive/publish/network/ApiServiceOpen.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/network/ApiServiceOpen.java | |
| 1 | +package com.cnlive.publish.network; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.cnlive.publish.moudle.StorageInfoData; | |
| 5 | +import com.cnlive.publish.moudle.UploadAuthData; | |
| 6 | +import com.cnlive.publish.moudle.VideoUploadResult; | |
| 7 | + | |
| 8 | +import java.util.List; | |
| 9 | +import java.util.Map; | |
| 10 | + | |
| 11 | +import io.reactivex.Observable; | |
| 12 | +import retrofit2.adapter.rxjava2.Result; | |
| 13 | +import retrofit2.http.POST; | |
| 14 | +import retrofit2.http.QueryMap; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * Created by xiansong on 2018/3/22. | |
| 18 | + */ | |
| 19 | + | |
| 20 | +public interface ApiServiceOpen { | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 短视频入库点播云接口for app | |
| 24 | + * 创建短视频信息进行存储 | |
| 25 | + * | |
| 26 | + * @param maps md5 string true MD5 | |
| 27 | + * appId string true APPID | |
| 28 | + * videoKey string true 短视频相对路径(支持金山云存储) | |
| 29 | + * name string false 短视频名称 | |
| 30 | + * description string false 短视频的信息描述 | |
| 31 | + * isHorizontalScreen int true 屏幕方向,0:垂直即竖屏 /1:水平即横屏 ,默认为1 | |
| 32 | + * userId string false 短视频的信息用户标识 | |
| 33 | + * callBackUrl string false 短视频信息回调地址 | |
| 34 | + * platform_id string true APP bundleID 或者是包名,平台鉴权使用 | |
| 35 | + * extensions string false 扩展字段,格式 | |
| 36 | + * timestamp int true 精确到秒,当前Unix时间戳,请保证请求服务器时间正确 | |
| 37 | + * sign String true 签名规则 | |
| 38 | + * @return | |
| 39 | + */ | |
| 40 | + | |
| 41 | + @POST("open/api2/vod_epg/svInputMamForAPP") | |
| 42 | + Observable<Result<BaseInfo<VideoUploadResult>>> svInputMamForAPP(@QueryMap() Map<String, String> maps); | |
| 43 | + | |
| 44 | + /** | |
| 45 | + * 在线答题短视频入库 新街口 | |
| 46 | + * */ | |
| 47 | + | |
| 48 | + @POST("open/api2/vod_epg/svInputMamForAPPV2") | |
| 49 | + Observable<Result<BaseInfo<VideoUploadResult>>> svInputMamForAPPV2(@QueryMap() Map<String, String> maps); | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 上传鉴权 | |
| 53 | + * | |
| 54 | + * @param maps | |
| 55 | + * @return | |
| 56 | + */ | |
| 57 | + @POST("open/api2/vod_epg/getUploadAuthForApp") | |
| 58 | + Observable<Result<BaseInfo<UploadAuthData>>> getUploadAuthForApp(@QueryMap Map<String, String> maps); | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * 获取存储信息 | |
| 62 | + * | |
| 63 | + * @param map | |
| 64 | + * @return | |
| 65 | + */ | |
| 66 | + @POST("open/api2/storage/getStorageInfo") | |
| 67 | + Observable<Result<BaseInfo<List<StorageInfoData>>>> getStorageInfo(@QueryMap Map<String, String> map); | |
| 68 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/network/ApiSubscriber.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/network/ApiSubscriber.java | |
| 1 | +package com.cnlive.publish.network; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.cnlive.libs.data.network.Subscriber; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * Created by xiansong on 2017/9/8. | |
| 8 | + */ | |
| 9 | + | |
| 10 | +public class ApiSubscriber { | |
| 11 | + | |
| 12 | + private static final String success_code = "0"; | |
| 13 | + private static final String success_message = "数据加载成功"; | |
| 14 | + | |
| 15 | + public static final Subscriber.Config subscriberBuild = Subscriber.newConfig() | |
| 16 | + .putInfo(Subscriber.Config.response_success, success_code, success_message) ; | |
| 17 | + | |
| 18 | + public static String getSuccessCode(){ | |
| 19 | + return success_code; | |
| 20 | + } | |
| 21 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/network/BaseInfo.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/network/BaseInfo.java | |
| 1 | +package com.cnlive.publish.network; | |
| 2 | + | |
| 3 | +import com.cnlive.libs.data.network.model.IBaseInfo; | |
| 4 | + | |
| 5 | + | |
| 6 | +public class BaseInfo<T> implements IBaseInfo { | |
| 7 | + //TODO 接口错误信息 需要自定义 | |
| 8 | + private String errorCode = ApiSubscriber.getSuccessCode(); | |
| 9 | + private String errorMessage = ""; | |
| 10 | + | |
| 11 | + //TODO 接口内容数据 需要自定义 | |
| 12 | + private T data; | |
| 13 | + | |
| 14 | + public void setCode(String status_code) { | |
| 15 | + this.errorCode = status_code; | |
| 16 | + } | |
| 17 | + | |
| 18 | + @Override | |
| 19 | + public String getCode() { | |
| 20 | + return errorCode; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public void setMessage(String errorMessage) { | |
| 24 | + this.errorMessage = errorMessage; | |
| 25 | + } | |
| 26 | + | |
| 27 | + @Override | |
| 28 | + public String getMessage() { | |
| 29 | + return errorMessage; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public void setData(T data) { | |
| 33 | + this.data = data; | |
| 34 | + } | |
| 35 | + | |
| 36 | + public T getData() { | |
| 37 | + return data; | |
| 38 | + } | |
| 39 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/network/PublishInterceptor.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/network/PublishInterceptor.java | |
| 1 | +// | |
| 2 | +// Source code recreated from a .class file by IntelliJ IDEA | |
| 3 | +// (powered by Fernflower decompiler) | |
| 4 | +// | |
| 5 | + | |
| 6 | +package com.cnlive.publish.network; | |
| 7 | + | |
| 8 | +import android.text.TextUtils; | |
| 9 | + | |
| 10 | +import com.cnlive.libs.base.application.AppConfig; | |
| 11 | +import com.cnlive.libs.base.util.StringUtils; | |
| 12 | +import com.cnlive.libs.data.network.interceptor.SignEncryptInterceptor; | |
| 13 | +import com.cnlive.libs.data.network.util.SHA1Util; | |
| 14 | + | |
| 15 | +import java.io.IOException; | |
| 16 | +import java.util.ArrayList; | |
| 17 | +import java.util.Collections; | |
| 18 | +import java.util.HashMap; | |
| 19 | +import java.util.Iterator; | |
| 20 | +import java.util.LinkedHashMap; | |
| 21 | +import java.util.List; | |
| 22 | +import java.util.Locale; | |
| 23 | +import java.util.Map; | |
| 24 | +import java.util.Map.Entry; | |
| 25 | + | |
| 26 | +import okhttp3.FormBody; | |
| 27 | +import okhttp3.FormBody.Builder; | |
| 28 | +import okhttp3.MultipartBody; | |
| 29 | +import okhttp3.Request; | |
| 30 | +import okhttp3.Response; | |
| 31 | + | |
| 32 | +import static com.cnlive.libs.data.network.util.SignUtil.getTime; | |
| 33 | +import static com.cnlive.libs.data.network.util.SignUtil.mapJoin; | |
| 34 | + | |
| 35 | +public class PublishInterceptor extends SignEncryptInterceptor { | |
| 36 | + | |
| 37 | + private static final String | |
| 38 | + APP_ID = "802_jhbqccxw08", | |
| 39 | + APP_KEY = "9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f", | |
| 40 | + DEBUG_APP_ID = "802_jhbqccxw08", | |
| 41 | + DEBUG_APP_KEY = "9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f"; | |
| 42 | + | |
| 43 | + public PublishInterceptor() { | |
| 44 | + } | |
| 45 | + | |
| 46 | + | |
| 47 | + public static Map<String, String> getOpenSignMap(Map<String, String> params, boolean valueUrlencode) { | |
| 48 | + if (params == null) return new HashMap<>(); | |
| 49 | + | |
| 50 | + boolean replace = false; | |
| 51 | + if (!params.containsKey("platform_id")) { | |
| 52 | + params.put("platform_id", AppConfig.getAppPackeg()); | |
| 53 | + } | |
| 54 | + if (AppConfig.isDebug() && !params.containsKey("test")) { | |
| 55 | + params.put("test", "0"); | |
| 56 | + } | |
| 57 | + params.put("appId", AppConfig.isDebug() ? DEBUG_APP_ID : APP_ID); | |
| 58 | + if (!params.containsKey("plat")) { | |
| 59 | + params.put("plat", "a"); | |
| 60 | + } | |
| 61 | + if (!params.containsKey("app_channel_id")) { | |
| 62 | + params.put("app_channel_id", AppConfig.getAppChannel()); | |
| 63 | + } | |
| 64 | + if (!params.containsKey("timestamp")) { | |
| 65 | + long time = getTime(); | |
| 66 | + params.put("timestamp", String.valueOf(time / 1000)); | |
| 67 | + } | |
| 68 | + if (!params.containsKey("ver")) { | |
| 69 | + params.put("ver", AppConfig.getAppVersion()); | |
| 70 | + } | |
| 71 | + if (!params.containsKey("uuid")) { | |
| 72 | + params.put("uuid", AppConfig.getAppUUID()); | |
| 73 | + } | |
| 74 | + if (!params.containsKey("loginSid")) { | |
| 75 | + params.put("loginSid", AppConfig.getSid()); | |
| 76 | + } | |
| 77 | + | |
| 78 | + //拼接推广渠道 | |
| 79 | + if (!params.containsKey("promoFrom")) { | |
| 80 | + if (!TextUtils.isEmpty(AppConfig.getPromoFrom())) { | |
| 81 | + params.put("promoFrom", AppConfig.getPromoFrom()); | |
| 82 | + } | |
| 83 | + } | |
| 84 | + | |
| 85 | + Map<String, String> map = order(params, valueUrlencode); | |
| 86 | + | |
| 87 | + if (map.containsKey("sign")) { | |
| 88 | + map.remove("sign"); | |
| 89 | + } | |
| 90 | + | |
| 91 | + String signValue = SHA1Util | |
| 92 | + .SHA1Digest(mapJoin(map, valueUrlencode) | |
| 93 | + .concat("&key=") | |
| 94 | + .concat(AppConfig.isDebug() ? DEBUG_APP_KEY : APP_KEY)) | |
| 95 | + .toUpperCase(Locale.getDefault()); | |
| 96 | + map.put("sign", signValue); | |
| 97 | + return map; | |
| 98 | + } | |
| 99 | + | |
| 100 | + private static Map<String, String> order(Map<String, String> map, boolean valueUrlencode) { | |
| 101 | + HashMap<String, String> tempMap = new LinkedHashMap<>(); | |
| 102 | + List<Entry<String, String>> infoIds = new ArrayList<>(map.entrySet()); | |
| 103 | + | |
| 104 | + Collections.sort(infoIds, (o1, o2) -> o1.getKey().compareTo(o2.getKey())); | |
| 105 | + | |
| 106 | + for (int i = 0; i < infoIds.size(); i++) { | |
| 107 | + Entry<String, String> item = infoIds.get(i); | |
| 108 | + tempMap.put(item.getKey(), valueUrlencode ? StringUtils.encode(item.getValue()) : item.getValue()); | |
| 109 | + } | |
| 110 | + return tempMap; | |
| 111 | + } | |
| 112 | + | |
| 113 | + @Override | |
| 114 | + public Response intercept(Chain var1) throws IOException { | |
| 115 | + Request var2 = var1.request(); | |
| 116 | + Entry var7; | |
| 117 | + Builder var11; | |
| 118 | + Iterator var13; | |
| 119 | + FormBody var14; | |
| 120 | + Request var15; | |
| 121 | + boolean valueUrlencode = false; | |
| 122 | + if (var2.body() instanceof FormBody) { | |
| 123 | + HashMap var8 = new HashMap(); | |
| 124 | + FormBody var9 = (FormBody) var2.body(); | |
| 125 | + var11 = new Builder(); | |
| 126 | + | |
| 127 | + for (int var16 = 0; var16 < var9.size(); ++var16) { | |
| 128 | + var8.put(var9.name(var16), var9.value(var16)); | |
| 129 | + } | |
| 130 | + | |
| 131 | + var13 = getOpenSignMap(var8, valueUrlencode).entrySet().iterator(); | |
| 132 | + | |
| 133 | + while (var13.hasNext()) { | |
| 134 | + var7 = (Entry) var13.next(); | |
| 135 | + var11.add((String) var7.getKey(), (String) var7.getValue()); | |
| 136 | + } | |
| 137 | + | |
| 138 | + var14 = var11.build(); | |
| 139 | + var15 = var2.newBuilder().method(var2.method(), var14).url(var2.url()).build(); | |
| 140 | + return var1.proceed(var15); | |
| 141 | + } else if (var2.body() instanceof MultipartBody) { | |
| 142 | + return var1.proceed(var2); | |
| 143 | + } else { | |
| 144 | + okhttp3.HttpUrl.Builder var3; | |
| 145 | + HashMap var4; | |
| 146 | + Iterator var5; | |
| 147 | + String var6; | |
| 148 | + if ("POST".equals(var2.method())) { | |
| 149 | + var3 = var2.url().newBuilder(); | |
| 150 | + var4 = new HashMap(); | |
| 151 | + var5 = var2.url().queryParameterNames().iterator(); | |
| 152 | + | |
| 153 | + while (var5.hasNext()) { | |
| 154 | + var6 = (String) var5.next(); | |
| 155 | + var4.put(var6, var2.url().queryParameter(var6)); | |
| 156 | + var3.removeAllQueryParameters(var6); | |
| 157 | + } | |
| 158 | + | |
| 159 | + var11 = new Builder(); | |
| 160 | + var13 = getOpenSignMap(var4, valueUrlencode).entrySet().iterator(); | |
| 161 | + | |
| 162 | + while (var13.hasNext()) { | |
| 163 | + var7 = (Entry) var13.next(); | |
| 164 | + var11.add((String) var7.getKey(), (String) var7.getValue()); | |
| 165 | + } | |
| 166 | + | |
| 167 | + var14 = var11.build(); | |
| 168 | + var15 = var2.newBuilder().method(var2.method(), var14).url(var3.build()).build(); | |
| 169 | + return var1.proceed(var15); | |
| 170 | + } else { | |
| 171 | + var3 = var2.url().newBuilder(); | |
| 172 | + var4 = new HashMap(); | |
| 173 | + var5 = var2.url().queryParameterNames().iterator(); | |
| 174 | + | |
| 175 | + while (var5.hasNext()) { | |
| 176 | + var6 = (String) var5.next(); | |
| 177 | + var4.put(var6, var2.url().queryParameter(var6)); | |
| 178 | + var3.removeAllQueryParameters(var6); | |
| 179 | + } | |
| 180 | + | |
| 181 | + var5 = getOpenSignMap(var4, valueUrlencode).entrySet().iterator(); | |
| 182 | + | |
| 183 | + while (var5.hasNext()) { | |
| 184 | + Entry var12 = (Entry) var5.next(); | |
| 185 | + var3.addQueryParameter((String) var12.getKey(), (String) var12.getValue()); | |
| 186 | + } | |
| 187 | + | |
| 188 | + var3.scheme(var2.url().scheme()); | |
| 189 | + var3.host(var2.url().host()); | |
| 190 | + Request var10 = var2.newBuilder().method(var2.method(), var2.body()).url(var3.build()).build(); | |
| 191 | + return var1.proceed(var10); | |
| 192 | + } | |
| 193 | + } | |
| 194 | + } | |
| 195 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/upload/CoinRainAction.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/upload/CoinRainAction.java | |
| 1 | +package com.cnlive.publish.upload; | |
| 2 | + | |
| 3 | +import android.annotation.SuppressLint; | |
| 4 | +import android.content.Context; | |
| 5 | +import android.content.SharedPreferences; | |
| 6 | +import android.text.TextUtils; | |
| 7 | + | |
| 8 | +import com.alibaba.android.arouter.launcher.ARouter; | |
| 9 | +import com.cnlive.libs.base.logic.Logic; | |
| 10 | +import com.cnlive.publish.moudle.AddIntegration; | |
| 11 | +import com.cnlive.publish.network.ApiRequest; | |
| 12 | +import com.cnlive.publish.network.ApiServiceIntegra; | |
| 13 | +import com.cnlive.publish.network.BaseInfo; | |
| 14 | + | |
| 15 | +import java.text.SimpleDateFormat; | |
| 16 | +import java.util.Calendar; | |
| 17 | +import java.util.HashMap; | |
| 18 | +import java.util.Map; | |
| 19 | + | |
| 20 | +public class CoinRainAction { | |
| 21 | + | |
| 22 | + @SuppressLint("SimpleDateFormat") | |
| 23 | + private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | |
| 24 | + public static boolean isGo = true; | |
| 25 | + | |
| 26 | + public static void code(Context context, String uid, String taskId, String contentId, String addtype, Boolean isDouyin) { | |
| 27 | + if (context == null) return; | |
| 28 | + | |
| 29 | + Map<String, String> maps = new HashMap<>(); | |
| 30 | + maps.put("sid", uid); | |
| 31 | + maps.put("taskId", taskId); | |
| 32 | + maps.put("contentId", contentId); | |
| 33 | + if (uid != null && !TextUtils.isEmpty(uid)) { | |
| 34 | + Logic.create(maps) | |
| 35 | + .action((Logic.Action<Map<String, String>, BaseInfo<AddIntegration.DataBean>>) (data, callback) -> ApiRequest.service(ApiServiceIntegra.class, api -> api.addIntegration(data)).subscribe(context, callback)) | |
| 36 | + .<BaseInfo<AddIntegration.DataBean>>event() | |
| 37 | + .setSuccessCallback(data -> { | |
| 38 | + if (!isDouyin) { | |
| 39 | + startCoinRain(context, uid, addtype, data); | |
| 40 | + } | |
| 41 | + }) | |
| 42 | + .start(); | |
| 43 | + } | |
| 44 | + } | |
| 45 | + | |
| 46 | + private static void startCoinRain(Context context, String uid, String addtype, BaseInfo<AddIntegration.DataBean> data) { | |
| 47 | + if (data == null) return; | |
| 48 | + if (data.getData() == null) return; | |
| 49 | + if (TextUtils.isEmpty(data.getData().getScore())) return; | |
| 50 | + | |
| 51 | + String score = data.getData().getScore(); | |
| 52 | + String desc = data.getData().getDesc(); | |
| 53 | + String descEnd = data.getData().getDescEnd(); | |
| 54 | + String currentTime = getCurrentTime(); | |
| 55 | + | |
| 56 | + SharedPreferences.Editor editor = context.getSharedPreferences(addtype, Context.MODE_PRIVATE).edit(); | |
| 57 | + | |
| 58 | + editor.putBoolean(uid, data.getData().isStatus()); | |
| 59 | + editor.putString(uid + "time", currentTime); | |
| 60 | + editor.apply(); | |
| 61 | + isGo = false; | |
| 62 | + if (!"first_login".equals(addtype)) { | |
| 63 | + ARouter.getInstance().build("/add/CoinRainActivity") | |
| 64 | + .withString("type", "addintegration") | |
| 65 | + .withString("score", score) | |
| 66 | + .withString("desc", desc) | |
| 67 | + .withString("descend", descEnd) | |
| 68 | + .navigation(context); | |
| 69 | + } | |
| 70 | + } | |
| 71 | + | |
| 72 | + public static String getCurrentTime() { | |
| 73 | + return format.format(Calendar.getInstance().getTime()); | |
| 74 | + } | |
| 75 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/upload/UploadLogic.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/upload/UploadLogic.java | |
| 1 | +package com.cnlive.publish.upload; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.graphics.Bitmap; | |
| 5 | +import android.media.MediaMetadataRetriever; | |
| 6 | +import android.os.Build; | |
| 7 | +import android.os.Environment; | |
| 8 | +import android.text.TextUtils; | |
| 9 | +import android.util.Log; | |
| 10 | + | |
| 11 | +import com.cnlive.libs.base.application.AppConfig; | |
| 12 | +import com.cnlive.libs.base.logic.Config; | |
| 13 | +import com.cnlive.libs.base.logic.Event; | |
| 14 | +import com.cnlive.libs.base.logic.Logic; | |
| 15 | +import com.cnlive.libs.base.logic.callback.DataCallback; | |
| 16 | +import com.cnlive.libs.base.util.AlertUtil; | |
| 17 | +import com.cnlive.libs.base.util.ProbeUtils; | |
| 18 | +import com.cnlive.libs.base.util.ShareReleaseInfoUtil; | |
| 19 | +import com.cnlive.libs.base.util.SharedPreferencesHelper; | |
| 20 | +import com.cnlive.libs.base.util.StringUtils; | |
| 21 | + | |
| 22 | +import com.cnlive.media.model.CircleData; | |
| 23 | +import com.cnlive.publish.moudle.FeedBackInfo; | |
| 24 | +import com.cnlive.publish.moudle.SnowBannerData; | |
| 25 | +import com.cnlive.publish.moudle.StorageInfoData; | |
| 26 | +import com.cnlive.publish.moudle.UploadAuthData; | |
| 27 | +import com.cnlive.publish.moudle.VideoUploadResult; | |
| 28 | +import com.cnlive.publish.network.ApiRequest; | |
| 29 | +import com.cnlive.publish.network.ApiServiceCms; | |
| 30 | +import com.cnlive.publish.network.ApiServiceEyewitness; | |
| 31 | +import com.cnlive.publish.network.ApiServiceMoment; | |
| 32 | +import com.cnlive.publish.network.ApiServiceOpen; | |
| 33 | +import com.cnlive.publish.network.BaseInfo; | |
| 34 | +import com.cnlive.publish.upload.utils.FileUtil; | |
| 35 | +import com.cnlive.publish.upload.utils.IDUtils; | |
| 36 | +import com.cnlive.publish.upload.utils.MD5; | |
| 37 | +import com.google.gson.Gson; | |
| 38 | + | |
| 39 | + | |
| 40 | +import org.json.JSONArray; | |
| 41 | +import org.json.JSONException; | |
| 42 | +import org.json.JSONObject; | |
| 43 | + | |
| 44 | +import java.io.File; | |
| 45 | +import java.util.ArrayList; | |
| 46 | +import java.util.Date; | |
| 47 | +import java.util.HashMap; | |
| 48 | +import java.util.List; | |
| 49 | +import java.util.Map; | |
| 50 | + | |
| 51 | +import static com.cnlive.libs.base.logic.Config.ERROR_DEF; | |
| 52 | +import static com.cnlive.libs.base.logic.Config.SUCCESS; | |
| 53 | + | |
| 54 | +/** | |
| 55 | + * Created by xiansong on 2018/2/6. | |
| 56 | + */ | |
| 57 | + | |
| 58 | +public class UploadLogic { | |
| 59 | + private static final String TEST_OBJECT_KEY = "802/wjj/video/%s/%s/%s.%s"; | |
| 60 | + private static final String RELEASE_OBJECT_KEY = "769/wjj/video/%s/%s/%s.%s"; | |
| 61 | + private static final String TEST_OBJECT_PIC__KEY = "802/img/%s/%s.%s"; | |
| 62 | + private static final String RELEASE_OBJECT_PIC__KEY = "769/img/%s/%s.%s"; | |
| 63 | + private static final String TEST_SEVEN = "http://wjjtest.ys2.cnliveimg.com/"; | |
| 64 | + private static final String RELEASE_SEVEN = "https://wjj.ys2.cnliveimg.com/"; | |
| 65 | + private static final String SEVEN = AppConfig.isDebug() ? TEST_SEVEN : RELEASE_SEVEN; | |
| 66 | + private static final String OBJECT_KEY = AppConfig.isDebug() ? TEST_OBJECT_KEY : RELEASE_OBJECT_KEY; | |
| 67 | + private static final String OBJECT_PIC_KEY = AppConfig.isDebug() ? TEST_OBJECT_PIC__KEY : RELEASE_OBJECT_PIC__KEY; | |
| 68 | + private static final String TEST_VIDEO_NAME = "802_%s_%s_%s_%s"; | |
| 69 | + private static final String RELEASE_VIDEO_NAME = "769_%s_%s_%s_%s"; | |
| 70 | + private static final String VIDEO_NAME = AppConfig.isDebug() ? TEST_VIDEO_NAME : RELEASE_VIDEO_NAME; | |
| 71 | + private static final String TAG = "UploadLogic"; | |
| 72 | + private static String src; | |
| 73 | + | |
| 74 | + | |
| 75 | + private static String isHorizontalScreen(String videoPath) { | |
| 76 | + try { | |
| 77 | + if (TextUtils.isEmpty(videoPath)) return "0"; | |
| 78 | + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { | |
| 79 | + MediaMetadataRetriever retr = new MediaMetadataRetriever(); | |
| 80 | + retr.setDataSource(videoPath); | |
| 81 | + String r = retr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION); | |
| 82 | + if (TextUtils.isEmpty(r)) return "0"; | |
| 83 | + return (r.equals("90") || r.equals("270")) ? "0" : "1"; | |
| 84 | + } | |
| 85 | + } catch (Exception e) { | |
| 86 | + e.printStackTrace(); | |
| 87 | + } | |
| 88 | + return "0"; | |
| 89 | + } | |
| 90 | + /*public static void uploadVideoInfo(Context context, String userId, String text, String address, String videoPath, Event<BaseInfo> event,int gotype) { | |
| 91 | + uploadVideoInfo(context, userId, text, address, videoPath, event,gotype); | |
| 92 | + }*/ | |
| 93 | + | |
| 94 | + public static void uploadVideoInfo(Context context, String userId, String nickName, String | |
| 95 | + text, String address, String videoPath, Event<BaseInfo> event, String gopath, String | |
| 96 | + videotype, int multiplecategory, String tagname, String tagId, boolean compressed, | |
| 97 | + boolean audditing, String witContentId, int source, String coordinate) { | |
| 98 | + if (!"".equals(videoPath)) { | |
| 99 | + try { | |
| 100 | + MediaMetadataRetriever mmr = new MediaMetadataRetriever(); | |
| 101 | + mmr.setDataSource(videoPath); | |
| 102 | + String duration = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); | |
| 103 | + if (Integer.parseInt(duration) < 5000) { | |
| 104 | + AlertUtil.showFailedToast(context, "视频时长太短(小于5秒),请重新选择"); | |
| 105 | + } else { | |
| 106 | + //统计 | |
| 107 | + ProbeUtils.probeUploadVideo(); | |
| 108 | + Date date = new Date(); | |
| 109 | + String date1 = StringUtils.formatDate(date, "yyyy/MM/dd"); | |
| 110 | + String date2 = StringUtils.formatDate(date, "yyyyMMdd"); | |
| 111 | + String id = IDUtils.createID(); | |
| 112 | + String extName = FileUtil.getExtensionName(videoPath); | |
| 113 | + //正式环境:769/wjj/video/"达人ID"/2018/01/29/"时间戳+随机数".mp4 | |
| 114 | + //测试环境:802/wjj/video/"达人ID"/2018/01/29/"时间戳+随机数".mp4 | |
| 115 | + String objectKey = String.format(OBJECT_KEY, userId, date1, id, extName); | |
| 116 | + if (audditing && !witContentId.equals("")) { | |
| 117 | + HashMap<String, String> map = new HashMap<>(); | |
| 118 | + map.put("sid", userId); | |
| 119 | + map.put("reviewStatus", "0"); | |
| 120 | + map.put("witContentId", witContentId); | |
| 121 | + map.put("text", TextUtils.isEmpty(text) ? "" : text); | |
| 122 | + map.put("type", "update"); | |
| 123 | + | |
| 124 | + Logic.create() | |
| 125 | + .action((Object data, DataCallback<BaseInfo> callback) -> { | |
| 126 | + ApiRequest.service(ApiServiceEyewitness.class, api -> api.deleteOrUpdateWitnessPublish(map)).subscribe(context, callback); | |
| 127 | + callback.callback(SUCCESS, "", new BaseInfo()); | |
| 128 | + return null; | |
| 129 | + }).start(event); | |
| 130 | + | |
| 131 | + } else { | |
| 132 | + String isHorizontalScreen = isHorizontalScreen(videoPath); | |
| 133 | + MediaMetadataRetriever media = new MediaMetadataRetriever(); | |
| 134 | + Logic.create() | |
| 135 | + .action((Object data, DataCallback<BaseInfo<List<StorageInfoData>>> callback) -> | |
| 136 | + UploadProvider.getStorageInfo(context, callback)) | |
| 137 | + .action((BaseInfo<List<StorageInfoData>> data, DataCallback<BaseInfo<UploadAuthData>> callback) -> | |
| 138 | + UploadProvider.uploadAuth(context, data.getData().get(0).getStorageName(), callback)) | |
| 139 | + .action((BaseInfo<UploadAuthData> data, DataCallback<Integer> callback) -> { | |
| 140 | + UploadProvider.doUpload(context, new File(videoPath), objectKey, data.getData().getToken(), callback, | |
| 141 | + progress -> { | |
| 142 | + if (event.active) event.onProgress(progress); | |
| 143 | + }); | |
| 144 | + return null; | |
| 145 | + }) | |
| 146 | + .action((Object data, DataCallback<Map<String, String>> callback) -> | |
| 147 | + Logic.process(() -> { | |
| 148 | + String url = ApiRequest.baseEndpoint(); | |
| 149 | + | |
| 150 | + Map<String, String> requestData = new HashMap<>(); | |
| 151 | + //文件MD5 | |
| 152 | + // requestData.put("md5", MD5Utils.getFileMD5(new File(videoPath))); | |
| 153 | + requestData.put("md5", MD5.getFileMD5(new File(videoPath))); | |
| 154 | + requestData.put("appId", AppConfig.getAppId()); | |
| 155 | + requestData.put("videoKey", objectKey); | |
| 156 | + requestData.put("isHorizontalScreen", isHorizontalScreen); | |
| 157 | + requestData.put("userId", userId); | |
| 158 | + requestData.put("name", String.format(VIDEO_NAME, videotype, userId, date2, id)); | |
| 159 | + requestData.put("userName", nickName); | |
| 160 | + requestData.put("storageType", "2"); | |
| 161 | + requestData.put("multipleCategory", String.valueOf(multiplecategory)); | |
| 162 | + requestData.put("callBackUrl", url + "Daren/stock/stockDarenVideo.action"); | |
| 163 | + requestData.put("extensions", new Gson().toJson(new SendMoment(videotype, userId, text, address, AppConfig.getAppVersion(), "a", tagId, tagname, source, coordinate))); | |
| 164 | + return requestData; | |
| 165 | + }, callback)) | |
| 166 | + .action((Map<String, String> data, DataCallback<BaseInfo<VideoUploadResult>> callback) -> | |
| 167 | + ApiRequest.service(ApiServiceOpen.class, service -> service.svInputMamForAPP(data)).subscribe(context, callback) | |
| 168 | + ) | |
| 169 | + .action((data, callback) -> | |
| 170 | + Logic.process(() -> { | |
| 171 | + String videoId = ((BaseInfo<VideoUploadResult>) data).getData().getVideoId(); | |
| 172 | + media.setDataSource(videoPath);// videoPath 本地视频的路径 | |
| 173 | + Bitmap bitmap = media.getFrameAtTime(1, MediaMetadataRetriever.OPTION_CLOSEST_SYNC); | |
| 174 | + String s = FileUtil.saveBitmap(context, bitmap); | |
| 175 | + SharedPreferencesHelper.getInstance(context).setValue(videoId + "pic", s); | |
| 176 | + SharedPreferencesHelper.getInstance(context).setValue(videoId, videoPath); | |
| 177 | + return data; | |
| 178 | + }, callback)) | |
| 179 | + .start(event); | |
| 180 | + } | |
| 181 | + } | |
| 182 | + } catch (Exception e) { | |
| 183 | + AlertUtil.showDeftToast(context, "找不到指定路径文件"); | |
| 184 | + e.printStackTrace(); | |
| 185 | + } | |
| 186 | + } else { | |
| 187 | + //统计 | |
| 188 | + ProbeUtils.probeUploadVideo(); | |
| 189 | + Date date = new Date(); | |
| 190 | + String date1 = StringUtils.formatDate(date, "yyyy/MM/dd"); | |
| 191 | + String date2 = StringUtils.formatDate(date, "yyyyMMdd"); | |
| 192 | + String id = IDUtils.createID(); | |
| 193 | + String extName = FileUtil.getExtensionName(videoPath); | |
| 194 | + //正式环境:769/wjj/video/"达人ID"/2018/01/29/"时间戳+随机数".mp4 | |
| 195 | + //测试环境:802/wjj/video/"达人ID"/2018/01/29/"时间戳+随机数".mp4 | |
| 196 | + String objectKey = String.format(OBJECT_KEY, userId, date1, id, extName); | |
| 197 | + if (audditing && !witContentId.equals("")) { | |
| 198 | + HashMap<String, String> map = new HashMap<>(); | |
| 199 | + map.put("sid", userId); | |
| 200 | + map.put("reviewStatus", "0"); | |
| 201 | + map.put("witContentId", witContentId); | |
| 202 | + map.put("text", TextUtils.isEmpty(text) ? "" : text); | |
| 203 | + map.put("type", "update"); | |
| 204 | + | |
| 205 | + Logic.create() | |
| 206 | + .action((Object data, DataCallback<BaseInfo> callback) -> { | |
| 207 | + ApiRequest.service(ApiServiceEyewitness.class, api -> api.deleteOrUpdateWitnessPublish(map)).subscribe(context, callback); | |
| 208 | + callback.callback(SUCCESS, "", new BaseInfo()); | |
| 209 | + return null; | |
| 210 | + }).start(event); | |
| 211 | + | |
| 212 | + } else { | |
| 213 | + String isHorizontalScreen = isHorizontalScreen(videoPath); | |
| 214 | + MediaMetadataRetriever media = new MediaMetadataRetriever(); | |
| 215 | + Logic.create() | |
| 216 | + .action((Object data, DataCallback<BaseInfo<List<StorageInfoData>>> callback) -> | |
| 217 | + UploadProvider.getStorageInfo(context, callback)) | |
| 218 | + .action((BaseInfo<List<StorageInfoData>> data, DataCallback<BaseInfo<UploadAuthData>> callback) -> | |
| 219 | + UploadProvider.uploadAuth(context, data.getData().get(0).getStorageName(), callback)) | |
| 220 | + .action((BaseInfo<UploadAuthData> data, DataCallback<Integer> callback) -> { | |
| 221 | + UploadProvider.doUpload(context, new File(videoPath), objectKey, data.getData().getToken(), callback, | |
| 222 | + progress -> { | |
| 223 | + if (event.active) event.onProgress(progress); | |
| 224 | + }); | |
| 225 | + return null; | |
| 226 | + }) | |
| 227 | + .action((Object data, DataCallback<Map<String, String>> callback) -> | |
| 228 | + Logic.process(() -> { | |
| 229 | + String url = ApiRequest.baseEndpoint(); | |
| 230 | + | |
| 231 | + Map<String, String> requestData = new HashMap<>(); | |
| 232 | + //文件MD5 | |
| 233 | + // requestData.put("md5", MD5Utils.getFileMD5(new File(videoPath))); | |
| 234 | + requestData.put("md5", MD5.getFileMD5(new File(videoPath))); | |
| 235 | + requestData.put("appId", AppConfig.getAppId()); | |
| 236 | + requestData.put("videoKey", objectKey); | |
| 237 | + requestData.put("isHorizontalScreen", isHorizontalScreen); | |
| 238 | + requestData.put("userId", userId); | |
| 239 | + requestData.put("name", String.format(VIDEO_NAME, videotype, userId, date2, id)); | |
| 240 | + requestData.put("userName", nickName); | |
| 241 | + requestData.put("storageType", "2"); | |
| 242 | + requestData.put("multipleCategory", String.valueOf(multiplecategory)); | |
| 243 | + requestData.put("callBackUrl", url + "Daren/stock/stockDarenVideo.action"); | |
| 244 | + requestData.put("extensions", new Gson().toJson(new SendMoment(videotype, userId, text, address, AppConfig.getAppVersion(), "a", tagId, tagname, source, coordinate))); | |
| 245 | + | |
| 246 | + return requestData; | |
| 247 | + }, callback)) | |
| 248 | + .action((Map<String, String> data, DataCallback<BaseInfo<VideoUploadResult>> callback) -> | |
| 249 | + ApiRequest.service(ApiServiceOpen.class, service -> service.svInputMamForAPP(data)).subscribe(context, callback) | |
| 250 | + ) | |
| 251 | + .action((data, callback) -> | |
| 252 | + Logic.process(() -> { | |
| 253 | + String videoId = ((BaseInfo<VideoUploadResult>) data).getData().getVideoId(); | |
| 254 | + media.setDataSource(videoPath);// videoPath 本地视频的路径 | |
| 255 | + Bitmap bitmap = media.getFrameAtTime(1, MediaMetadataRetriever.OPTION_CLOSEST_SYNC); | |
| 256 | + String s = FileUtil.saveBitmap(context, bitmap); | |
| 257 | + SharedPreferencesHelper.getInstance(context).setValue(videoId + "pic", s); | |
| 258 | + SharedPreferencesHelper.getInstance(context).setValue(videoId, videoPath); | |
| 259 | + return data; | |
| 260 | + }, callback)) | |
| 261 | + .start(event); | |
| 262 | + } | |
| 263 | + } | |
| 264 | + } | |
| 265 | + | |
| 266 | + public static void uploadTopicVideoInfo(Context context, String userId, String | |
| 267 | + nickName, String text, String videoPath, Event<BaseInfo> event, int topicType, String | |
| 268 | + tagId, String title) { | |
| 269 | + if (!"".equals(videoPath)) { | |
| 270 | + try { | |
| 271 | + MediaMetadataRetriever mmr = new MediaMetadataRetriever(); | |
| 272 | + mmr.setDataSource(videoPath); | |
| 273 | + String duration = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); | |
| 274 | + if (Integer.parseInt(duration) < 5000) { | |
| 275 | + AlertUtil.showFailedToast(context, "视频时长太短(小于5秒),请重新选择"); | |
| 276 | + } else { | |
| 277 | + //统计 | |
| 278 | + ProbeUtils.probeUploadVideo(); | |
| 279 | + Date date = new Date(); | |
| 280 | + String date1 = StringUtils.formatDate(date, "yyyy/MM/dd"); | |
| 281 | + String date2 = StringUtils.formatDate(date, "yyyyMMdd"); | |
| 282 | + String id = IDUtils.createID(); | |
| 283 | + String extName = FileUtil.getExtensionName(videoPath); | |
| 284 | + //正式环境:769/wjj/video/"达人ID"/2018/01/29/"时间戳+随机数".mp4 | |
| 285 | + //测试环境:802/wjj/video/"达人ID"/2018/01/29/"时间戳+随机数".mp4 | |
| 286 | + String objectKey = String.format(OBJECT_KEY, userId, date1, id, extName); | |
| 287 | + String isHorizontalScreen = isHorizontalScreen(videoPath); | |
| 288 | + MediaMetadataRetriever media = new MediaMetadataRetriever(); | |
| 289 | + Logic.create() | |
| 290 | + .action((Object data, DataCallback<BaseInfo<List<StorageInfoData>>> callback) -> | |
| 291 | + UploadProvider.getStorageInfo(context, callback)) | |
| 292 | + .action((BaseInfo<List<StorageInfoData>> data, DataCallback<BaseInfo<UploadAuthData>> callback) -> | |
| 293 | + UploadProvider.uploadAuth(context, data.getData().get(0).getStorageName(), callback)) | |
| 294 | + .action((BaseInfo<UploadAuthData> data, DataCallback<Integer> callback) -> { | |
| 295 | + UploadProvider.doUpload(context, new File(videoPath), objectKey, data.getData().getToken(), callback, | |
| 296 | + progress -> { | |
| 297 | + if (event.active) event.onProgress(progress); | |
| 298 | + }); | |
| 299 | + return null; | |
| 300 | + }) | |
| 301 | + .action((Object data, DataCallback<Map<String, String>> callback) -> | |
| 302 | + Logic.process(() -> { | |
| 303 | + String url = ApiRequest.baseCMSEndpoint(); | |
| 304 | + | |
| 305 | + Map<String, String> requestData = new HashMap<>(); | |
| 306 | + //文件MD5 | |
| 307 | + // requestData.put("md5", MD5Utils.getFileMD5(new File(videoPath))); | |
| 308 | + requestData.put("md5", MD5.getFileMD5(new File(videoPath))); | |
| 309 | + requestData.put("appId", AppConfig.getAppId()); | |
| 310 | + requestData.put("videoKey", objectKey); | |
| 311 | + requestData.put("isHorizontalScreen", isHorizontalScreen); | |
| 312 | + requestData.put("userId", userId); | |
| 313 | + requestData.put("name", String.format(VIDEO_NAME, "topic", userId, date2, id)); | |
| 314 | + requestData.put("userName", nickName); | |
| 315 | + requestData.put("storageType", "2"); | |
| 316 | + requestData.put("multipleCategory", AppConfig.isDebug() ? "487" : "488"); | |
| 317 | + requestData.put("callBackUrl", url + "callback/stockDarenVideo"); | |
| 318 | + requestData.put("extensions", new Gson().toJson(new TopicField(title, userId, text, topicType, tagId))); | |
| 319 | + return requestData; | |
| 320 | + }, callback)) | |
| 321 | + .action((Map<String, String> data, DataCallback<BaseInfo<VideoUploadResult>> callback) -> | |
| 322 | + ApiRequest.service(ApiServiceOpen.class, service -> service.svInputMamForAPP(data)).subscribe(context, callback) | |
| 323 | + ) | |
| 324 | + .action((data, callback) -> { | |
| 325 | + /*String videoId = ((BaseInfo<VideoUploadResult>) data).getData().getVideoId(); | |
| 326 | + media.setDataSource(videoPath);// videoPath 本地视频的路径 | |
| 327 | + Bitmap bitmap = media.getFrameAtTime(1, MediaMetadataRetriever.OPTION_CLOSEST_SYNC); | |
| 328 | + String s = FileUtil.saveBitmap(context, bitmap); | |
| 329 | + SharedPreferencesHelper.getInstance(context).setValue(videoId + "pic", s); | |
| 330 | + SharedPreferencesHelper.getInstance(context).setValue(videoId, videoPath);*/ | |
| 331 | + callback.callback(SUCCESS, "", data); | |
| 332 | + return null; | |
| 333 | + }) | |
| 334 | + .start(event); | |
| 335 | + } | |
| 336 | + } catch (Exception e) { | |
| 337 | + AlertUtil.showDeftToast(context, "找不到指定路径文件"); | |
| 338 | + e.printStackTrace(); | |
| 339 | + } | |
| 340 | + } else { | |
| 341 | + //统计 | |
| 342 | + ProbeUtils.probeUploadVideo(); | |
| 343 | + Date date = new Date(); | |
| 344 | + String date1 = StringUtils.formatDate(date, "yyyy/MM/dd"); | |
| 345 | + String date2 = StringUtils.formatDate(date, "yyyyMMdd"); | |
| 346 | + String id = IDUtils.createID(); | |
| 347 | + String extName = FileUtil.getExtensionName(videoPath); | |
| 348 | + //正式环境:769/wjj/video/"达人ID"/2018/01/29/"时间戳+随机数".mp4 | |
| 349 | + //测试环境:802/wjj/video/"达人ID"/2018/01/29/"时间戳+随机数".mp4 | |
| 350 | + String objectKey = String.format(OBJECT_KEY, userId, date1, id, extName); | |
| 351 | + | |
| 352 | + String isHorizontalScreen = isHorizontalScreen(videoPath); | |
| 353 | + MediaMetadataRetriever media = new MediaMetadataRetriever(); | |
| 354 | + Logic.create() | |
| 355 | + .action((Object data, DataCallback<BaseInfo<List<StorageInfoData>>> callback) -> | |
| 356 | + UploadProvider.getStorageInfo(context, callback)) | |
| 357 | + .action((BaseInfo<List<StorageInfoData>> data, DataCallback<BaseInfo<UploadAuthData>> callback) -> | |
| 358 | + UploadProvider.uploadAuth(context, data.getData().get(0).getStorageName(), callback)) | |
| 359 | + .action((BaseInfo<UploadAuthData> data, DataCallback<Integer> callback) -> { | |
| 360 | + UploadProvider.doUpload(context, new File(videoPath), objectKey, data.getData().getToken(), callback, | |
| 361 | + progress -> { | |
| 362 | + if (event.active) event.onProgress(progress); | |
| 363 | + }); | |
| 364 | + return null; | |
| 365 | + }) | |
| 366 | + .action((Object data, DataCallback<Map<String, String>> callback) -> | |
| 367 | + Logic.process(() -> { | |
| 368 | + String url = ApiRequest.baseEndpoint(); | |
| 369 | + | |
| 370 | + Map<String, String> requestData = new HashMap<>(); | |
| 371 | + //文件MD5 | |
| 372 | + // requestData.put("md5", MD5Utils.getFileMD5(new File(videoPath))); | |
| 373 | + requestData.put("md5", MD5.getFileMD5(new File(videoPath))); | |
| 374 | + requestData.put("appId", AppConfig.getAppId()); | |
| 375 | + requestData.put("videoKey", objectKey); | |
| 376 | + requestData.put("isHorizontalScreen", isHorizontalScreen); | |
| 377 | + requestData.put("userId", userId); | |
| 378 | + requestData.put("name", String.format(VIDEO_NAME, "topic", userId, date2, id)); | |
| 379 | + requestData.put("userName", nickName); | |
| 380 | + requestData.put("storageType", "2"); | |
| 381 | + requestData.put("multipleCategory", AppConfig.isDebug() ? "487" : "488"); | |
| 382 | + requestData.put("callBackUrl", url + "callback/stockDarenVideo"); | |
| 383 | + requestData.put("extensions", new Gson().toJson(new TopicField(title, userId, text, topicType, tagId))); | |
| 384 | + return requestData; | |
| 385 | + }, callback)) | |
| 386 | + .action((Map<String, String> data, DataCallback<BaseInfo<VideoUploadResult>> callback) -> | |
| 387 | + ApiRequest.service(ApiServiceOpen.class, service -> service.svInputMamForAPP(data)).subscribe(context, callback) | |
| 388 | + ) | |
| 389 | + .action((data, callback) -> { | |
| 390 | + /*String videoId = ((BaseInfo<VideoUploadResult>) data).getData().getVideoId(); | |
| 391 | + media.setDataSource(videoPath);// videoPath 本地视频的路径 | |
| 392 | + Bitmap bitmap = media.getFrameAtTime(1, MediaMetadataRetriever.OPTION_CLOSEST_SYNC); | |
| 393 | + String s = FileUtil.saveBitmap(context, bitmap); | |
| 394 | + SharedPreferencesHelper.getInstance(context).setValue(videoId + "pic", s); | |
| 395 | + SharedPreferencesHelper.getInstance(context).setValue(videoId, videoPath);*/ | |
| 396 | + callback.callback(SUCCESS, "", data); | |
| 397 | + return null; | |
| 398 | + }) | |
| 399 | + .start(event); | |
| 400 | + } | |
| 401 | + } | |
| 402 | + | |
| 403 | + | |
| 404 | + /** | |
| 405 | + * 在线答题视频上传 | |
| 406 | + */ | |
| 407 | + public static void uploadOnLineVideoInfo(Context context, String userId, String | |
| 408 | + nickName, String text, String videoPath, Event<BaseInfo> event, String videotype, | |
| 409 | + int multiplecategory, boolean audditing, String witContentId, String contentId, String | |
| 410 | + userNum) { | |
| 411 | + if (!"".equals(videoPath)) { | |
| 412 | + Date date = new Date(); | |
| 413 | + String date1 = StringUtils.formatDate(date, "yyyy/MM/dd"); | |
| 414 | + String date2 = StringUtils.formatDate(date, "yyyyMMdd"); | |
| 415 | + String id = IDUtils.createID(); | |
| 416 | + String extName = FileUtil.getExtensionName(videoPath); | |
| 417 | + //正式环境:769/wjj/video/"达人ID"/2018/01/29/"时间戳+随机数".mp4 | |
| 418 | + //测试环境:802/wjj/video/"达人ID"/2018/01/29/"时间戳+随机数".mp4 | |
| 419 | + String objectKey = String.format(OBJECT_KEY, userId, date1, id, extName); | |
| 420 | + | |
| 421 | + String isHorizontalScreen = isHorizontalScreen(videoPath); | |
| 422 | + MediaMetadataRetriever media = new MediaMetadataRetriever(); | |
| 423 | + Logic.create() | |
| 424 | + .action((Object data, DataCallback<BaseInfo<List<StorageInfoData>>> callback) -> | |
| 425 | + UploadProvider.getStorageInfo(context, callback)) | |
| 426 | + .action((BaseInfo<List<StorageInfoData>> data, DataCallback<BaseInfo<UploadAuthData>> callback) -> | |
| 427 | + UploadProvider.uploadAuth(context, data.getData().get(0).getStorageName(), callback)) | |
| 428 | + .action((BaseInfo<UploadAuthData> data, DataCallback<Integer> callback) -> { | |
| 429 | + UploadProvider.doUpload(context, new File(videoPath), objectKey, data.getData().getToken(), callback, | |
| 430 | + progress -> { | |
| 431 | + if (event.active) event.onProgress(progress); | |
| 432 | + }); | |
| 433 | + return null; | |
| 434 | + }) | |
| 435 | + .action((Object data, DataCallback<Map<String, String>> callback) -> | |
| 436 | + Logic.process(() -> { | |
| 437 | + String url = ApiRequest.baseCMSEndpoint(); | |
| 438 | + | |
| 439 | + Map<String, String> requestData = new HashMap<>(); | |
| 440 | + //文件MD5 | |
| 441 | + // requestData.put("md5", MD5Utils.getFileMD5(new File(videoPath))); | |
| 442 | + requestData.put("md5", MD5.getFileMD5(new File(videoPath))); | |
| 443 | + requestData.put("appId", AppConfig.getAppId()); | |
| 444 | + requestData.put("videoKey", objectKey); | |
| 445 | + requestData.put("isHorizontalScreen", isHorizontalScreen); | |
| 446 | + requestData.put("userId", userId); | |
| 447 | + requestData.put("name", String.format(VIDEO_NAME, videotype, userId, date2, id)); | |
| 448 | + requestData.put("userName", nickName); | |
| 449 | + requestData.put("storageType", "2"); | |
| 450 | + requestData.put("multipleCategory", String.valueOf(multiplecategory)); | |
| 451 | + requestData.put("callBackUrl", url + "callback/insertAnswer"); | |
| 452 | + requestData.put("extensions", new Gson().toJson(new OnLineMes(contentId))); | |
| 453 | + return requestData; | |
| 454 | + }, callback)) | |
| 455 | + .action((Map<String, String> data, DataCallback<BaseInfo<VideoUploadResult>> callback) -> | |
| 456 | + ApiRequest.service(ApiServiceOpen.class, service -> service.svInputMamForAPPV2(data)).subscribe(context, callback) | |
| 457 | + ) | |
| 458 | + .action((data, callback) -> { | |
| 459 | + callback.callback(SUCCESS, "", data); | |
| 460 | + return null; | |
| 461 | + }) | |
| 462 | + .start(event); | |
| 463 | + } else { | |
| 464 | + Date date = new Date(); | |
| 465 | + String date1 = StringUtils.formatDate(date, "yyyy/MM/dd"); | |
| 466 | + String date2 = StringUtils.formatDate(date, "yyyyMMdd"); | |
| 467 | + String id = IDUtils.createID(); | |
| 468 | + String extName = FileUtil.getExtensionName(videoPath); | |
| 469 | + //正式环境:769/wjj/video/"达人ID"/2018/01/29/"时间戳+随机数".mp4 | |
| 470 | + //测试环境:802/wjj/video/"达人ID"/2018/01/29/"时间戳+随机数".mp4 | |
| 471 | + String objectKey = String.format(OBJECT_KEY, userId, date1, id, extName); | |
| 472 | + if (audditing && !witContentId.equals("")) { | |
| 473 | + HashMap<String, String> map = new HashMap<>(); | |
| 474 | + map.put("sid", userId); | |
| 475 | + map.put("reviewStatus", "0"); | |
| 476 | + map.put("witContentId", witContentId); | |
| 477 | + map.put("text", TextUtils.isEmpty(text) ? "" : text); | |
| 478 | + map.put("type", "update"); | |
| 479 | + | |
| 480 | + Logic.create() | |
| 481 | + .action((Object data, DataCallback<BaseInfo> callback) -> { | |
| 482 | + ApiRequest.service(ApiServiceEyewitness.class, api -> api.deleteOrUpdateWitnessPublish(map)).subscribe(context, callback); | |
| 483 | + callback.callback(SUCCESS, "", new BaseInfo()); | |
| 484 | + return null; | |
| 485 | + }).start(event); | |
| 486 | + | |
| 487 | + } else { | |
| 488 | + String isHorizontalScreen = isHorizontalScreen(videoPath); | |
| 489 | + MediaMetadataRetriever media = new MediaMetadataRetriever(); | |
| 490 | + Logic.create() | |
| 491 | + .action((Object data, DataCallback<BaseInfo<List<StorageInfoData>>> callback) -> | |
| 492 | + UploadProvider.getStorageInfo(context, callback)) | |
| 493 | + .action((BaseInfo<List<StorageInfoData>> data, DataCallback<BaseInfo<UploadAuthData>> callback) -> | |
| 494 | + UploadProvider.uploadAuth(context, data.getData().get(0).getStorageName(), callback)) | |
| 495 | + .action((BaseInfo<UploadAuthData> data, DataCallback<Integer> callback) -> { | |
| 496 | + UploadProvider.doUpload(context, new File(videoPath), objectKey, data.getData().getToken(), callback, | |
| 497 | + progress -> { | |
| 498 | + if (event.active) event.onProgress(progress); | |
| 499 | + }); | |
| 500 | + return null; | |
| 501 | + }) | |
| 502 | + .action((Object data, DataCallback<Map<String, String>> callback) -> | |
| 503 | + Logic.process(() -> { | |
| 504 | + String url = ApiRequest.baseCMSEndpoint(); | |
| 505 | + | |
| 506 | + Map<String, String> requestData = new HashMap<>(); | |
| 507 | + //文件MD5 | |
| 508 | + // requestData.put("md5", MD5Utils.getFileMD5(new File(videoPath))); | |
| 509 | + requestData.put("md5", MD5.getFileMD5(new File(videoPath))); | |
| 510 | + requestData.put("appId", AppConfig.getAppId()); | |
| 511 | + requestData.put("videoKey", objectKey); | |
| 512 | + requestData.put("isHorizontalScreen", isHorizontalScreen); | |
| 513 | + requestData.put("userId", userId); | |
| 514 | + requestData.put("name", String.format(VIDEO_NAME, videotype, userId, date2, id)); | |
| 515 | + requestData.put("userName", nickName); | |
| 516 | + requestData.put("storageType", "2"); | |
| 517 | + requestData.put("multipleCategory", String.valueOf(multiplecategory)); | |
| 518 | + requestData.put("callBackUrl", url + "callback/insertAnswer"); | |
| 519 | + requestData.put("extensions", new Gson().toJson(new OnLineMes(contentId))); | |
| 520 | + | |
| 521 | + return requestData; | |
| 522 | + }, callback)) | |
| 523 | + .action((Map<String, String> data, DataCallback<BaseInfo<VideoUploadResult>> callback) -> | |
| 524 | + ApiRequest.service(ApiServiceOpen.class, service -> service.svInputMamForAPPV2(data)).subscribe(context, callback) | |
| 525 | + ) | |
| 526 | + .action((data, callback) -> { | |
| 527 | + callback.callback(SUCCESS, "", data); | |
| 528 | + return null; | |
| 529 | + }) | |
| 530 | + .start(event); | |
| 531 | + } | |
| 532 | + } | |
| 533 | + } | |
| 534 | + | |
| 535 | + public static void uploadPicInfo(Context context, String userId, String text, String | |
| 536 | + address, List<String> picPath, ArrayList width, ArrayList | |
| 537 | + height, Event<BaseInfo> event, String gopath, String videotype) { | |
| 538 | + | |
| 539 | + uploadPicInfo(context, userId, "moment", text, address, picPath, width, height, event, gopath, videotype); | |
| 540 | + } | |
| 541 | + | |
| 542 | + public static void uploadTopic(Context context, String title, List<String> pic, String | |
| 543 | + msg, int topicType, boolean videoType, String | |
| 544 | + tags, Event<BaseInfo<Object>> event, ArrayList widt, ArrayList heigt, String uid) { | |
| 545 | + Logic.create() | |
| 546 | + .action((Object data, DataCallback<BaseInfo<List<StorageInfoData>>> callback) -> | |
| 547 | + UploadProvider.getStorageInfo(context, callback)) | |
| 548 | + .action((BaseInfo<List<StorageInfoData>> data, DataCallback<BaseInfo<UploadAuthData>> callback) -> | |
| 549 | + UploadProvider.uploadAuth(context, data.getData().get(0).getStorageName(), callback) | |
| 550 | + ) | |
| 551 | + .action((data, callback) -> UploadProvider.zipFiles(context, pic, (code, message, imgsa) -> { | |
| 552 | + Map map = new HashMap(); | |
| 553 | + map.put("image", imgsa); | |
| 554 | + map.put("tocken", ((BaseInfo<UploadAuthData>) data).getData().getToken()); | |
| 555 | + if (event.active) callback.callback(code, "", map); | |
| 556 | + })) | |
| 557 | + .action((Map<String, Object> map, DataCallback<ArrayList<String>> callback) -> { | |
| 558 | + UploadProvider.doUploadPic(context, (List<String>) map.get("image"), (String) (map.get("tocken")), callback, | |
| 559 | + progress -> { | |
| 560 | + if (event.active) event.onProgress(progress); | |
| 561 | + }); | |
| 562 | + return null; | |
| 563 | + }) | |
| 564 | + .action((ArrayList<String> data, DataCallback<Map<String, Object>> callback) -> | |
| 565 | + Logic.process(() -> { | |
| 566 | + JSONArray jsonArray = new JSONArray(); | |
| 567 | + String piclist = ""; | |
| 568 | + for (int i = 0; i < ((ArrayList) data).size(); i++) { | |
| 569 | + JSONObject picobj = new JSONObject(); | |
| 570 | + int index = Integer.parseInt(data.get(i).substring(8, 9)); | |
| 571 | + try { | |
| 572 | + if (i == ((ArrayList) data).size() - 1) { | |
| 573 | + piclist = piclist + (SEVEN + ((ArrayList) data).get(i)); | |
| 574 | + } else { | |
| 575 | + piclist = piclist + (SEVEN + ((ArrayList) data).get(i)) + ","; | |
| 576 | + } | |
| 577 | + picobj.put("imageUrl", SEVEN + ((ArrayList) data).get(i)); | |
| 578 | + picobj.put("imageWidth", widt.get(i)); | |
| 579 | + picobj.put("imageHeight", heigt.get(i)); | |
| 580 | + } catch (JSONException e) { | |
| 581 | + e.printStackTrace(); | |
| 582 | + } | |
| 583 | + try { | |
| 584 | + jsonArray.put(index, picobj); | |
| 585 | + } catch (JSONException e) { | |
| 586 | + e.printStackTrace(); | |
| 587 | + } | |
| 588 | + } | |
| 589 | + if (jsonArray.length() == ((ArrayList) data).size()) { | |
| 590 | + Map<String, Object> requestData = new HashMap<>(); | |
| 591 | + requestData.put("sid", uid); | |
| 592 | + requestData.put("title", StringUtils.encode(title)); | |
| 593 | + requestData.put("imgs", piclist); | |
| 594 | + requestData.put("msg", StringUtils.encode(msg)); | |
| 595 | + requestData.put("topicType", topicType); | |
| 596 | + requestData.put("pic", SEVEN + ((ArrayList) data).get(0)); | |
| 597 | + requestData.put("videoType", videoType); | |
| 598 | + requestData.put("tags", tags); | |
| 599 | + return requestData; | |
| 600 | + } else { | |
| 601 | + return null; | |
| 602 | + | |
| 603 | + } | |
| 604 | + }, callback)) | |
| 605 | + .action((Map<String, Object> data, DataCallback<BaseInfo<Object>> callback) -> | |
| 606 | + ApiRequest.service(ApiServiceCms.class, service -> service.postTopic(data)) | |
| 607 | + .subscribe(context, callback)) | |
| 608 | + .start(event); | |
| 609 | + } | |
| 610 | + | |
| 611 | + | |
| 612 | + /** | |
| 613 | + * 话题纯文字类型发布 | |
| 614 | + */ | |
| 615 | + public static void uploadTopicInfo(Context context, String title, | |
| 616 | + String msg, int topicType, boolean videoType, String tags, | |
| 617 | + Event<BaseInfo<Object>> event, | |
| 618 | + String uid) { | |
| 619 | + Logic.create() | |
| 620 | + .action((ArrayList<String> data, DataCallback<Map<String, Object>> callback) -> | |
| 621 | + Logic.process(() -> { | |
| 622 | + Map<String, Object> requestData = new HashMap<>(); | |
| 623 | + requestData.put("sid", uid); | |
| 624 | + requestData.put("title", StringUtils.encode(title)); | |
| 625 | + requestData.put("pic", ""); | |
| 626 | + requestData.put("msg", StringUtils.encode(msg)); | |
| 627 | + requestData.put("topicType", topicType); | |
| 628 | + requestData.put("imgs", ""); | |
| 629 | + requestData.put("videoType", videoType); | |
| 630 | + requestData.put("tags", tags); | |
| 631 | + return requestData; | |
| 632 | + }, callback)) | |
| 633 | + .action((Map<String, Object> data, DataCallback<BaseInfo<Object>> callback) -> | |
| 634 | + ApiRequest.service(ApiServiceCms.class, service -> service.postTopic(data)) | |
| 635 | + .subscribe(context, callback)) | |
| 636 | + .start(event); | |
| 637 | + } | |
| 638 | + | |
| 639 | + | |
| 640 | + /** | |
| 641 | + * 文件上传到七牛(webview 帮助反馈在用) | |
| 642 | + * | |
| 643 | + * @param context | |
| 644 | + * @param picPath | |
| 645 | + * @param width | |
| 646 | + * @param height | |
| 647 | + * @param event | |
| 648 | + */ | |
| 649 | + public static void uploadPic(Context context, boolean isZip, List< | |
| 650 | + String> picPath, ArrayList width, ArrayList height, Event<List<FeedBackInfo>> event) { | |
| 651 | + Logic.create() | |
| 652 | + .action((Object data, DataCallback<BaseInfo<List<StorageInfoData>>> callback) -> | |
| 653 | + UploadProvider.getStorageInfo(context, callback)) | |
| 654 | + .action((BaseInfo<List<StorageInfoData>> data, DataCallback<BaseInfo<UploadAuthData>> callback) -> | |
| 655 | + UploadProvider.uploadAuth(context, data.getData().get(0).getStorageName(), callback) | |
| 656 | + ) | |
| 657 | + .action((BaseInfo<UploadAuthData> data, DataCallback<Map<String, Object>> callback) -> | |
| 658 | + isZip ? UploadProvider.zipFiles(context, picPath, (code, message, imgs) -> { | |
| 659 | + Map map = new HashMap(); | |
| 660 | + map.put("image", imgs); | |
| 661 | + map.put("tocken", data.getData().getToken()); | |
| 662 | + if (event.active) callback.callback(code, "", map); | |
| 663 | + }) : Logic.process(() -> { | |
| 664 | + Map map = new HashMap(); | |
| 665 | + map.put("image", picPath); | |
| 666 | + map.put("tocken", data.getData().getToken()); | |
| 667 | + return map; | |
| 668 | + }, callback)) | |
| 669 | + .action((Map<String, Object> map, DataCallback<ArrayList<String>> callback) -> { | |
| 670 | + UploadProvider.doUploadPic(context, (List<String>) map.get("image"), (String) (map.get("tocken")), callback, | |
| 671 | + progress -> { | |
| 672 | + if (event.active) event.onProgress(progress); | |
| 673 | + }); | |
| 674 | + return null; | |
| 675 | + }) | |
| 676 | + .action((ArrayList<String> data, DataCallback<List<FeedBackInfo>> callback) -> | |
| 677 | + Logic.process(() -> { | |
| 678 | + List<FeedBackInfo> list = new ArrayList<>(); | |
| 679 | + for (int i = 0; i < ((ArrayList) data).size(); i++) { | |
| 680 | + FeedBackInfo info = new FeedBackInfo(); | |
| 681 | + info.setImageUrl(SEVEN + ((ArrayList) data).get(i)); | |
| 682 | + info.setImageWidth((Long) width.get(i)); | |
| 683 | + info.setImageHeight((Long) height.get(i)); | |
| 684 | + list.add(info); | |
| 685 | + } | |
| 686 | + return list; | |
| 687 | + }, callback)) | |
| 688 | + .start(event); | |
| 689 | + } | |
| 690 | + | |
| 691 | + public static void uploadPicInfo(Context context, String userId, String type, String | |
| 692 | + text, String address, List<String> picPath, ArrayList width, ArrayList | |
| 693 | + height, Event<BaseInfo> event, String gopath, String videotype) { | |
| 694 | + Logic.create() | |
| 695 | + .action((Object data, DataCallback<BaseInfo<List<StorageInfoData>>> callback) -> | |
| 696 | + UploadProvider.getStorageInfo(context, callback)) | |
| 697 | + .action((BaseInfo<List<StorageInfoData>> data, DataCallback<BaseInfo<UploadAuthData>> callback) -> | |
| 698 | + UploadProvider.uploadAuth(context, data.getData().get(0).getStorageName(), callback) | |
| 699 | + ) | |
| 700 | + .action((data, callback) -> UploadProvider.zipFiles(context, picPath, (code, message, imgs) -> { | |
| 701 | + Map map = new HashMap(); | |
| 702 | + map.put("image", imgs); | |
| 703 | + map.put("tocken", ((BaseInfo<UploadAuthData>) data).getData().getToken()); | |
| 704 | + if (event.active) callback.callback(code, "", map); | |
| 705 | + })) | |
| 706 | + .action((Map<String, Object> map, DataCallback<ArrayList<String>> callback) -> { | |
| 707 | + UploadProvider.doUploadPic(context, (List<String>) map.get("image"), (String) (map.get("tocken")), callback, | |
| 708 | + progress -> { | |
| 709 | + if (event.active) event.onProgress(progress); | |
| 710 | + }); | |
| 711 | + return null; | |
| 712 | + }) | |
| 713 | + .action((ArrayList<String> data, DataCallback<Map<String, Object>> callback) -> | |
| 714 | + Logic.process(() -> { | |
| 715 | + JSONArray jsonArray = new JSONArray(); | |
| 716 | + for (int i = 0; i < ((ArrayList) data).size(); i++) { | |
| 717 | + JSONObject picobj = new JSONObject(); | |
| 718 | + int index = Integer.parseInt(data.get(i).substring(8, 9)); | |
| 719 | + try { | |
| 720 | + picobj.put("imageUrl", SEVEN + ((ArrayList) data).get(i)); | |
| 721 | + picobj.put("imageWidth", width.get(i)); | |
| 722 | + picobj.put("imageHeight", height.get(i)); | |
| 723 | + } catch (JSONException e) { | |
| 724 | + e.printStackTrace(); | |
| 725 | + } | |
| 726 | + try { | |
| 727 | + jsonArray.put(index, picobj); | |
| 728 | + } catch (JSONException e) { | |
| 729 | + e.printStackTrace(); | |
| 730 | + } | |
| 731 | + } | |
| 732 | + if (jsonArray.length() == ((ArrayList) data).size()) { | |
| 733 | + Map<String, Object> requestData = new HashMap<>(); | |
| 734 | + requestData.put("appId", AppConfig.getAppId()); | |
| 735 | + requestData.put("sid", userId); | |
| 736 | + requestData.put("text", StringUtils.encode(text)); | |
| 737 | + requestData.put("address", address); | |
| 738 | + requestData.put("type", "1"); | |
| 739 | + requestData.put("picArray", jsonArray); | |
| 740 | + return requestData; | |
| 741 | + } else { | |
| 742 | + return null; | |
| 743 | + } | |
| 744 | + }, callback)) | |
| 745 | + .action((Map<String, Object> data, DataCallback<BaseInfo> callback) -> | |
| 746 | + ApiRequest.service(ApiServiceMoment.class, service -> service.releaseMomentNe(gopath, data)) | |
| 747 | + .subscribe(context, callback)) | |
| 748 | + | |
| 749 | + /* ApiRequest.service(ApiServiceMoment.class, service -> gotype == 2 ? | |
| 750 | + service.releaseMomentNew(data) : service.releaseWitness(data)) | |
| 751 | + .subscribe(context, callback))*/ | |
| 752 | + .start(event); | |
| 753 | + } | |
| 754 | + | |
| 755 | + | |
| 756 | + /** | |
| 757 | + * 张楠上传地图信息用 | |
| 758 | + */ | |
| 759 | + public static void uploadAddressPicInfo(Context | |
| 760 | + context, List<String> picPath, Event<String> event) { | |
| 761 | + Logic.create() | |
| 762 | + .action((Object data, DataCallback<BaseInfo<List<StorageInfoData>>> callback) -> | |
| 763 | + UploadProvider.getStorageInfo(context, callback)) | |
| 764 | + .action((BaseInfo<List<StorageInfoData>> data, DataCallback<BaseInfo<UploadAuthData>> callback) -> | |
| 765 | + UploadProvider.uploadAuth(context, data.getData().get(0).getStorageName(), callback) | |
| 766 | + ) | |
| 767 | + .action((data, callback) -> UploadProvider.zipFiles(context, picPath, (code, message, imgs) -> { | |
| 768 | + Map map = new HashMap(); | |
| 769 | + map.put("image", imgs); | |
| 770 | + map.put("tocken", ((BaseInfo<UploadAuthData>) data).getData().getToken()); | |
| 771 | + if (event.active) callback.callback(code, "", map); | |
| 772 | + })) | |
| 773 | + .action((Map<String, Object> map, DataCallback<ArrayList<String>> callback) -> { | |
| 774 | + UploadProvider.doUploadPic(context, (List<String>) map.get("image"), (String) (map.get("tocken")), callback, | |
| 775 | + progress -> { | |
| 776 | + if (event.active) event.onProgress(progress); | |
| 777 | + }); | |
| 778 | + return null; | |
| 779 | + }) | |
| 780 | + .action((ArrayList<String> data, DataCallback<String> callback) -> | |
| 781 | + Logic.process(() -> { | |
| 782 | + String addressImageUrl = SEVEN + ((ArrayList) data).get(0); | |
| 783 | + return addressImageUrl; | |
| 784 | + }, callback)) | |
| 785 | + | |
| 786 | + .start(event); | |
| 787 | + } | |
| 788 | + | |
| 789 | + public static void uploadSnowPicInfo(Context context, String userId, String text, String | |
| 790 | + address, ArrayList picPath, ArrayList width, ArrayList | |
| 791 | + height, Event<BaseInfo> event, String path, String videotype) { | |
| 792 | + //统计 | |
| 793 | + //Probe.probeUploadVideo(); | |
| 794 | + | |
| 795 | + Logic.create() | |
| 796 | + .action((Object data, DataCallback<BaseInfo<List<StorageInfoData>>> callback) -> | |
| 797 | + UploadProvider.getStorageInfo(context, callback)) | |
| 798 | + .action((BaseInfo<List<StorageInfoData>> data, DataCallback<BaseInfo<UploadAuthData>> callback) -> | |
| 799 | + UploadProvider.uploadAuth(context, data.getData().get(0).getStorageName(), callback)) | |
| 800 | + .action((BaseInfo<UploadAuthData> data, DataCallback<Map<String, Object>> callback) -> UploadProvider.zipFiles(context, (List<String>) picPath, (code, message, imgs) -> { | |
| 801 | + Map map = new HashMap(); | |
| 802 | + map.put("image", imgs); | |
| 803 | + map.put("tocken", data.getData().getToken()); | |
| 804 | + if (event.active) callback.callback(code, "", map); | |
| 805 | + })) | |
| 806 | + .action((Map<String, Object> map, DataCallback<ArrayList<String>> callback) -> { | |
| 807 | + UploadProvider.doUploadPic(context, (List<String>) map.get("image"), (String) (map.get("tocken")), callback, | |
| 808 | + progress -> { | |
| 809 | + if (event.active) event.onProgress(progress); | |
| 810 | + }); | |
| 811 | + return null; | |
| 812 | + }) | |
| 813 | + .action((ArrayList<String> data, DataCallback<Map<String, Object>> callback) -> | |
| 814 | + Logic.process(() -> { | |
| 815 | + JSONArray jsonArray = new JSONArray(); | |
| 816 | + for (int i = 0; i < ((ArrayList) data).size(); i++) { | |
| 817 | + JSONObject picobj = new JSONObject(); | |
| 818 | + int index = Integer.parseInt(data.get(i).substring(8, 9)); | |
| 819 | + try { | |
| 820 | + picobj.put("imageUrl", SEVEN + ((ArrayList) data).get(i)); | |
| 821 | + picobj.put("imageWidth", width.get(i)); | |
| 822 | + picobj.put("imageHeight", height.get(i)); | |
| 823 | + } catch (JSONException e) { | |
| 824 | + e.printStackTrace(); | |
| 825 | + } | |
| 826 | + try { | |
| 827 | + jsonArray.put(index, picobj); | |
| 828 | + } catch (JSONException e) { | |
| 829 | + e.printStackTrace(); | |
| 830 | + } | |
| 831 | + } | |
| 832 | + if (jsonArray.length() == ((ArrayList) data).size()) { | |
| 833 | + Log.e("werwwwwwwwwwwww123", jsonArray.toString() + " " + AppConfig.getAppId() + " " + userId); | |
| 834 | + Map<String, Object> requestData = new HashMap<>(); | |
| 835 | + requestData.put("appId", AppConfig.getAppId()); | |
| 836 | + requestData.put("sid", userId); | |
| 837 | + requestData.put("text", StringUtils.encode(text)); | |
| 838 | + requestData.put("address", address); | |
| 839 | + requestData.put("type", "1"); | |
| 840 | + requestData.put("picArray", jsonArray); | |
| 841 | + return requestData; | |
| 842 | + } else { | |
| 843 | + return null; | |
| 844 | + } | |
| 845 | +// return null; | |
| 846 | + }, callback)) | |
| 847 | + .action((Map<String, Object> data, DataCallback<BaseInfo> callback) -> | |
| 848 | + ApiRequest.service(ApiServiceMoment.class, service -> service.releaseMomentNe(path, data)) | |
| 849 | + .subscribe(context, callback)) | |
| 850 | + .start(event); | |
| 851 | + } | |
| 852 | + | |
| 853 | + private static class SendMoment { | |
| 854 | + private String appId = AppConfig.getAppId(); | |
| 855 | + private String text; | |
| 856 | + private String sid; | |
| 857 | + private String type; | |
| 858 | + private String address; | |
| 859 | + private String debug; | |
| 860 | + private String ver; | |
| 861 | + private String plat; | |
| 862 | + private String tagId; | |
| 863 | + private String tagName; | |
| 864 | + private int source; | |
| 865 | + private String coordinate; | |
| 866 | + | |
| 867 | + public SendMoment(String type, String sid, String text, String address, String ver, String plat, String tagId, String tagName, int source, String coordinate) { | |
| 868 | + this.sid = sid; | |
| 869 | + this.text = StringUtils.encode(text); | |
| 870 | + this.address = address; | |
| 871 | + this.debug = AppConfig.isDebug() ? "0" : ""; | |
| 872 | + this.type = type; | |
| 873 | + this.ver = ver; | |
| 874 | + this.plat = plat; | |
| 875 | + this.tagId = tagId; | |
| 876 | + this.tagName = tagName; | |
| 877 | + this.source = source; | |
| 878 | + this.coordinate = coordinate; | |
| 879 | + } | |
| 880 | + } | |
| 881 | + | |
| 882 | + private static class TopicField { | |
| 883 | + private String title; | |
| 884 | + private String sid; | |
| 885 | + private String msg; | |
| 886 | + private int topicType; | |
| 887 | + private String tags; | |
| 888 | + | |
| 889 | + public TopicField(String title, String sid, String msg, int topicType, String tags) { | |
| 890 | + this.sid = sid; | |
| 891 | + this.title = StringUtils.encode(title); | |
| 892 | + this.msg = StringUtils.encode(msg); | |
| 893 | + this.topicType = topicType; | |
| 894 | + this.tags = tags; | |
| 895 | + } | |
| 896 | + } | |
| 897 | + | |
| 898 | + private static class OnLineMes { | |
| 899 | + private String questionId; | |
| 900 | + | |
| 901 | + public OnLineMes(String questionId) { | |
| 902 | + this.questionId = questionId; | |
| 903 | + } | |
| 904 | + } | |
| 905 | + | |
| 906 | + private static class SendImage { | |
| 907 | + private String imageUrl; | |
| 908 | + private Long imageWidth; | |
| 909 | + private Long imageHeight; | |
| 910 | + | |
| 911 | + | |
| 912 | + public SendImage(String imageUrl, Long imageWidth, Long imageHeight) { | |
| 913 | + this.imageUrl = imageUrl; | |
| 914 | + this.imageWidth = imageWidth; | |
| 915 | + this.imageHeight = imageHeight; | |
| 916 | + } | |
| 917 | + } | |
| 918 | + | |
| 919 | + private static String getPath(Context context, String cachePath) { | |
| 920 | + String path = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ? context.getExternalFilesDir("") : Environment.getExternalStorageDirectory()) + cachePath; | |
| 921 | + File file = new File(path); | |
| 922 | + if (file.mkdirs()) { | |
| 923 | + return path; | |
| 924 | + } | |
| 925 | + return path; | |
| 926 | + } | |
| 927 | + | |
| 928 | + public static void uploadInfo(Context context, String sid, String text, String address, | |
| 929 | + String key, List<String> imageFiles, ShareReleaseInfoUtil.ShareConfig | |
| 930 | + shareConfig, | |
| 931 | + Event<BaseInfo> event, String gopath, String videotype) { | |
| 932 | + | |
| 933 | + Logic.create(imageFiles) | |
| 934 | + .action((Object data, DataCallback<BaseInfo<List<StorageInfoData>>> callback) -> | |
| 935 | + UploadProvider.getStorageInfo(context, callback)) | |
| 936 | + .action((BaseInfo<List<StorageInfoData>> data, DataCallback<BaseInfo<UploadAuthData>> callback) -> | |
| 937 | + UploadProvider.uploadAuth(context, data.getData().get(0).getStorageName(), callback) | |
| 938 | + ) | |
| 939 | + .action((BaseInfo<UploadAuthData> data, DataCallback<Map<String, Object>> callback) -> | |
| 940 | + Logic.process(() -> { | |
| 941 | + Map map = new HashMap(); | |
| 942 | + File file = new File(getPath(context, "/strike/cache/") + "share.jpg"); | |
| 943 | + if (file.exists()) { | |
| 944 | + src = getPath(context, "/strike/cache/") + "share.jpg"; | |
| 945 | + } else { | |
| 946 | + src = getPath(context, "/strike/cache/") + "sharefirst.jpg"; | |
| 947 | + } | |
| 948 | + map.put("image", src); | |
| 949 | + map.put("tocken", data.getData().getToken()); | |
| 950 | + return map; | |
| 951 | + }, callback)) | |
| 952 | + .action((Map<String, Object> map, DataCallback<ArrayList<String>> callback) -> { | |
| 953 | + ArrayList<String> objects = new ArrayList<>(); | |
| 954 | + objects.add(map.get("image") + ""); | |
| 955 | + UploadProvider.doUploadPic(context, objects, (String) (map.get("tocken")), callback, | |
| 956 | + progress -> { | |
| 957 | + if (event.active) event.onProgress(progress); | |
| 958 | + }); | |
| 959 | + return null; | |
| 960 | + }) | |
| 961 | + .action((ArrayList<String> data1, DataCallback<String> callback) -> | |
| 962 | + UploadProvider.uploadInfo(context, sid, text, address, key, null, shareConfig, gopath, SEVEN + ((ArrayList) data1).get(0), | |
| 963 | + (progress) -> { | |
| 964 | + if (!event.active) return; | |
| 965 | + event.onProgress(progress); | |
| 966 | + }, | |
| 967 | + (code, message, data) -> { | |
| 968 | + if (!event.active) return; | |
| 969 | + | |
| 970 | + event.onState(Config.STATE_IDLE); | |
| 971 | + if (code == 0) event.onSuccess(data); | |
| 972 | + else event.onFailure(code, message); | |
| 973 | + }) | |
| 974 | + ) | |
| 975 | + .start(event); | |
| 976 | + } | |
| 977 | + | |
| 978 | + | |
| 979 | + public static void uploadHomeInfo(Context context, String sid, String text, String address, | |
| 980 | + String key, List<String> imageFiles, ShareReleaseInfoUtil.ShareConfig | |
| 981 | + shareConfig, | |
| 982 | + Event<BaseInfo> event, String gopath, String videotype) { | |
| 983 | + Logic.create(imageFiles) | |
| 984 | + .action((List<String> data, DataCallback<List<String>> callback) -> | |
| 985 | + UploadProvider.zipFiles(context, data, callback)) | |
| 986 | + .action((List<String> list, DataCallback<String> callback) -> | |
| 987 | + UploadProvider.uploadInfo(context, sid, text, address, key, list, shareConfig, gopath, videotype, | |
| 988 | + (progress) -> { | |
| 989 | + if (!event.active) return; | |
| 990 | + event.onProgress(progress); | |
| 991 | + }, | |
| 992 | + (code, message, data) -> { | |
| 993 | + if (!event.active) return; | |
| 994 | + | |
| 995 | + event.onState(Config.STATE_IDLE); | |
| 996 | + if (code == 0) event.onSuccess(data); | |
| 997 | + else event.onFailure(code, message); | |
| 998 | + }) | |
| 999 | + ) | |
| 1000 | + .start(event); | |
| 1001 | + } | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + public static void getCircleList(Context context, String sid, | |
| 1005 | + Event<BaseInfo<CircleData>> event) { | |
| 1006 | + Logic.create() | |
| 1007 | + .action((List<String> list, DataCallback<String> callback) -> | |
| 1008 | + UploadProvider.dogetList(context, sid, | |
| 1009 | + (code, message, data) -> { | |
| 1010 | + if (!event.active) return; | |
| 1011 | + | |
| 1012 | + event.onState(Config.STATE_IDLE); | |
| 1013 | + if (code == 0) event.onSuccess(data); | |
| 1014 | + else event.onFailure(code, message); | |
| 1015 | + }) | |
| 1016 | + ) | |
| 1017 | + .start(event); | |
| 1018 | + } | |
| 1019 | + | |
| 1020 | + public static void getBannerList(Context context, | |
| 1021 | + Event<BaseInfo<List<SnowBannerData>>> event) { | |
| 1022 | + Logic.create() | |
| 1023 | + .action((List<String> list, DataCallback<String> callback) -> | |
| 1024 | + UploadProvider.dogetBannerList(context, | |
| 1025 | + (code, message, data) -> { | |
| 1026 | + if (!event.active) return; | |
| 1027 | + | |
| 1028 | + event.onState(Config.STATE_IDLE); | |
| 1029 | + if (code == 0) event.onSuccess(data); | |
| 1030 | + else event.onFailure(code, message); | |
| 1031 | + }) | |
| 1032 | + ) | |
| 1033 | + .start(event); | |
| 1034 | + } | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + private static void onError(String tag, int stateCode, int code, String message, Event event) { | |
| 1039 | + if (event.active) { | |
| 1040 | + event.onState(Config.STATE_IDLE); | |
| 1041 | + if (code == -3) | |
| 1042 | + event.onFailure(code, message); | |
| 1043 | + else | |
| 1044 | + event.onFailure(stateCode, message); | |
| 1045 | + } | |
| 1046 | + Log.d(TAG, String.format(ERROR_DEF, tag, stateCode, code, message)); | |
| 1047 | + } | |
| 1048 | + | |
| 1049 | + /** | |
| 1050 | + * Im收藏的时候图片单张上传的方法 | |
| 1051 | + * | |
| 1052 | + * @param context | |
| 1053 | + * @param isZip | |
| 1054 | + * @param picPath | |
| 1055 | + * @param event | |
| 1056 | + */ | |
| 1057 | + public static void uploadonePic(Context context, boolean isZip, List< | |
| 1058 | + String> picPath, Event<List<FeedBackInfo>> event) { | |
| 1059 | + | |
| 1060 | + Logic.create() | |
| 1061 | + .action((Object data, DataCallback<BaseInfo<List<StorageInfoData>>> callback) -> | |
| 1062 | + UploadProvider.getStorageInfo(context, callback)) | |
| 1063 | + .action((BaseInfo<List<StorageInfoData>> data, DataCallback<BaseInfo<UploadAuthData>> callback) -> | |
| 1064 | + UploadProvider.uploadAuth(context, data.getData().get(0).getStorageName(), callback) | |
| 1065 | + ) | |
| 1066 | + .action((BaseInfo<UploadAuthData> data, DataCallback<Map<String, Object>> callback) -> | |
| 1067 | + isZip ? UploadProvider.zipFiles(context, picPath, (code, message, imgs) -> { | |
| 1068 | + Map map = new HashMap(); | |
| 1069 | + map.put("image", imgs); | |
| 1070 | + map.put("tocken", data.getData().getToken()); | |
| 1071 | + if (event.active) callback.callback(code, "", map); | |
| 1072 | + }) : Logic.process(() -> { | |
| 1073 | + Map map = new HashMap(); | |
| 1074 | + map.put("image", picPath); | |
| 1075 | + map.put("tocken", data.getData().getToken()); | |
| 1076 | + return map; | |
| 1077 | + }, callback)) | |
| 1078 | + .action((Map<String, Object> map, DataCallback<ArrayList<String>> callback) -> { | |
| 1079 | + UploadProvider.doUploadPic(context, (List<String>) map.get("image"), (String) (map.get("tocken")), callback, | |
| 1080 | + progress -> { | |
| 1081 | + if (event.active) event.onProgress(progress); | |
| 1082 | + }); | |
| 1083 | + return null; | |
| 1084 | + }) | |
| 1085 | + .action((ArrayList<String> data, DataCallback<List<FeedBackInfo>> callback) -> | |
| 1086 | + Logic.process(() -> { | |
| 1087 | + List<FeedBackInfo> list = new ArrayList<>(); | |
| 1088 | + for (int i = 0; i < ((ArrayList) data).size(); i++) { | |
| 1089 | + FeedBackInfo info = new FeedBackInfo(); | |
| 1090 | + info.setImageUrl(SEVEN + ((ArrayList) data).get(i)); | |
| 1091 | + list.add(info); | |
| 1092 | + } | |
| 1093 | + return list; | |
| 1094 | + }, callback)) | |
| 1095 | + .start(event); | |
| 1096 | + | |
| 1097 | + } | |
| 1098 | + | |
| 1099 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/upload/UploadProvider.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/upload/UploadProvider.java | |
| 1 | +package com.cnlive.publish.upload; | |
| 2 | + | |
| 3 | +import android.app.Activity; | |
| 4 | +import android.content.Context; | |
| 5 | +import android.graphics.Bitmap; | |
| 6 | +import android.graphics.BitmapFactory; | |
| 7 | +import android.media.MediaMetadataRetriever; | |
| 8 | +import android.net.Uri; | |
| 9 | +import android.os.Build; | |
| 10 | +import android.os.Environment; | |
| 11 | +import android.text.TextUtils; | |
| 12 | +import android.util.Log; | |
| 13 | + | |
| 14 | +import com.cnlive.libs.base.application.AppConfig; | |
| 15 | +import com.cnlive.libs.base.logic.Config; | |
| 16 | +import com.cnlive.libs.base.logic.callback.DataCallback; | |
| 17 | +import com.cnlive.libs.base.logic.callback.ProgressCallback; | |
| 18 | +import com.cnlive.libs.base.util.AlertUtil; | |
| 19 | +import com.cnlive.libs.base.util.LogUtil; | |
| 20 | +import com.cnlive.libs.base.util.ShareReleaseInfoUtil; | |
| 21 | +import com.cnlive.libs.base.util.StringUtils; | |
| 22 | +import com.cnlive.libs.data.network.Subscriber; | |
| 23 | +import com.cnlive.libs.data.network.body.CountingRequestBody; | |
| 24 | +import com.cnlive.libs.data.network.util.SignUtil; | |
| 25 | +import com.cnlive.libs.data.network.util.UriUtil; | |
| 26 | +import com.cnlive.media.model.CircleData; | |
| 27 | +import com.cnlive.media.utils.FileTypeUtil; | |
| 28 | + | |
| 29 | +import com.cnlive.publish.moudle.CheckApplyResultInfo; | |
| 30 | +import com.cnlive.publish.moudle.DarenApplyModel; | |
| 31 | +import com.cnlive.publish.moudle.SnowBannerData; | |
| 32 | +import com.cnlive.publish.moudle.StorageInfoData; | |
| 33 | +import com.cnlive.publish.moudle.UploadAuthData; | |
| 34 | +import com.cnlive.publish.network.ApiRequest; | |
| 35 | +import com.cnlive.publish.network.ApiServiceDaren; | |
| 36 | +import com.cnlive.publish.network.ApiServiceMoment; | |
| 37 | +import com.cnlive.publish.network.ApiServiceOpen; | |
| 38 | +import com.cnlive.publish.network.ApiSubscriber; | |
| 39 | +import com.cnlive.publish.network.BaseInfo; | |
| 40 | +import com.cnlive.publish.upload.utils.FileUtil; | |
| 41 | +import com.cnlive.publish.upload.utils.IDUtils; | |
| 42 | +import com.cnlive.publish.upload.utils.MD5; | |
| 43 | +import com.qiniu.android.http.ResponseInfo; | |
| 44 | +import com.qiniu.android.storage.UpCompletionHandler; | |
| 45 | +import com.qiniu.android.storage.UpProgressHandler; | |
| 46 | +import com.qiniu.android.storage.UploadManager; | |
| 47 | +import com.qiniu.android.storage.UploadOptions; | |
| 48 | +import com.qiniu.pili.droid.shortvideo.PLShortVideoTranscoder; | |
| 49 | +import com.qiniu.pili.droid.shortvideo.PLVideoSaveListener; | |
| 50 | + | |
| 51 | + | |
| 52 | +import org.json.JSONException; | |
| 53 | +import org.json.JSONObject; | |
| 54 | + | |
| 55 | +import java.io.File; | |
| 56 | +import java.util.ArrayList; | |
| 57 | +import java.util.Date; | |
| 58 | +import java.util.HashMap; | |
| 59 | +import java.util.List; | |
| 60 | +import java.util.Map; | |
| 61 | + | |
| 62 | +import io.reactivex.Observable; | |
| 63 | +import io.reactivex.disposables.Disposable; | |
| 64 | +import okhttp3.MediaType; | |
| 65 | +import okhttp3.MultipartBody; | |
| 66 | +import okhttp3.RequestBody; | |
| 67 | +import retrofit2.adapter.rxjava2.Result; | |
| 68 | +import top.zibin.luban.Luban; | |
| 69 | +import top.zibin.luban.OnCompressListener; | |
| 70 | + | |
| 71 | +import static com.cnlive.libs.base.logic.Config.ERROR_UPLOAD; | |
| 72 | +import static com.cnlive.libs.base.logic.Config.SUCCESS; | |
| 73 | + | |
| 74 | + | |
| 75 | +/** | |
| 76 | + * Created by xiansong on 2018/2/1. | |
| 77 | + */ | |
| 78 | + | |
| 79 | +public class UploadProvider { | |
| 80 | + | |
| 81 | + private static final String TAG = "UploadProvider"; | |
| 82 | + private static final String TEST_OBJECT_PIC__KEY = "802/img/%s/%s/%s.%s"; | |
| 83 | + private static final String RELEASE_OBJECT_PIC__KEY = "769/img/%s/%s/%s.%s"; | |
| 84 | + private static final String OBJECT_PIC_KEY = AppConfig.isDebug() ? TEST_OBJECT_PIC__KEY : RELEASE_OBJECT_PIC__KEY; | |
| 85 | + private static final String TYPE_IMAGE_PATH = "/strike/image/"; | |
| 86 | + private static final String TYPE_VIDEO_PATH = "/strike/cache/"; | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * @param context | |
| 90 | + * @param callback | |
| 91 | + * @return | |
| 92 | + */ | |
| 93 | + public static Disposable uploadAuth(Context context, String bucketName, DataCallback<BaseInfo<UploadAuthData>> callback) { | |
| 94 | + Map<String, String> map = new HashMap<>(); | |
| 95 | + map.put("appId", AppConfig.getAppId()); | |
| 96 | + map.put("verb", "POST"); | |
| 97 | + map.put("md5", ""); | |
| 98 | + map.put("bucket", bucketName); | |
| 99 | + map.put("type", ""); | |
| 100 | + map.put("res", ""); | |
| 101 | + map.put("headers", ""); | |
| 102 | + map.put("date", ""); | |
| 103 | + map.put("storageType", "2"); | |
| 104 | + Subscriber<BaseInfo<UploadAuthData>> subscriber = new Subscriber<BaseInfo<UploadAuthData>>(context, ApiSubscriber.subscriberBuild) { | |
| 105 | + @Override | |
| 106 | + public void onCompleted(String s, String s1, BaseInfo<UploadAuthData> uploadAuthDataBaseInfo) { | |
| 107 | + if (callback == null) return; | |
| 108 | + callback.callback(SUCCESS, "", uploadAuthDataBaseInfo); | |
| 109 | + } | |
| 110 | + | |
| 111 | + @Override | |
| 112 | + public void onError(String s, String s1) { | |
| 113 | + if (callback == null) return; | |
| 114 | + int errorCode = -1; | |
| 115 | + try { | |
| 116 | + errorCode = Integer.valueOf(s); | |
| 117 | + } catch (Exception ignored) { | |
| 118 | + } finally { | |
| 119 | + callback.callback(errorCode, s1, null); | |
| 120 | + } | |
| 121 | + } | |
| 122 | + }; | |
| 123 | + Observable<Result<BaseInfo<UploadAuthData>>> observable = ApiRequest.service(ApiServiceOpen.class).getUploadAuthForApp(map); | |
| 124 | + return ApiRequest.subscribe(observable, subscriber); | |
| 125 | + } | |
| 126 | + | |
| 127 | + /** | |
| 128 | + * 获取存储信息 | |
| 129 | + * | |
| 130 | + * @param context | |
| 131 | + * @param callback | |
| 132 | + * @return | |
| 133 | + */ | |
| 134 | + public static Disposable getStorageInfo(Context context, DataCallback<BaseInfo<List<StorageInfoData>>> callback) { | |
| 135 | + Map<String, String> map = new HashMap<>(); | |
| 136 | + map.put("appId", AppConfig.getAppId()); | |
| 137 | + map.put("storageType", "2"); | |
| 138 | + map.put("state", "1"); | |
| 139 | + map.put("contentType", "1"); | |
| 140 | +// map.put("profile", AppConfig.isDebug() ? "2" : "1");//暂时不传这个参数 | |
| 141 | + Subscriber<BaseInfo<List<StorageInfoData>>> subscriber = new Subscriber<BaseInfo<List<StorageInfoData>>>(context, ApiSubscriber.subscriberBuild) { | |
| 142 | + @Override | |
| 143 | + public void onCompleted(String code, String message, BaseInfo<List<StorageInfoData>> data) { | |
| 144 | + if (callback == null) return; | |
| 145 | + if (data.getData().size() > 0 || data.getData() != null) { | |
| 146 | + callback.callback(SUCCESS, "", data); | |
| 147 | + } else { | |
| 148 | + callback.callback(-1, "storage info null", null); | |
| 149 | + } | |
| 150 | + } | |
| 151 | + | |
| 152 | + @Override | |
| 153 | + public void onError(String code, String message) { | |
| 154 | + if (callback == null) return; | |
| 155 | + int errorCode = -1; | |
| 156 | + try { | |
| 157 | + errorCode = Integer.valueOf(code); | |
| 158 | + } catch (Exception ignored) { | |
| 159 | + } finally { | |
| 160 | + callback.callback(errorCode, message, null); | |
| 161 | + } | |
| 162 | + } | |
| 163 | + }; | |
| 164 | + Observable<Result<BaseInfo<List<StorageInfoData>>>> observable = ApiRequest.service(ApiServiceOpen.class).getStorageInfo(map); | |
| 165 | + return ApiRequest.subscribe(observable, subscriber); | |
| 166 | + } | |
| 167 | + | |
| 168 | + // /** | |
| 169 | +// * 视频发布 - 视讯云数据同步接口 | |
| 170 | +// * | |
| 171 | +// * @param context | |
| 172 | +// * @param sid | |
| 173 | +// * @param text | |
| 174 | +// * @param address | |
| 175 | +// * @param key | |
| 176 | +// * @param callback | |
| 177 | +// * @return | |
| 178 | +// */ | |
| 179 | +// public static Disposable uploadInfo(Context context, String sid, String text, String address, String key, DataCallback<BaseInfo> callback) { | |
| 180 | +// svInputMamForAPP | |
| 181 | +// } | |
| 182 | + public static Disposable zipFiles(Context context, List<String> imageFiles, DataCallback<List<String>> callback) { | |
| 183 | + if (imageFiles == null || imageFiles.size() == 0) { | |
| 184 | + callback.callback(0, "", imageFiles); | |
| 185 | + } else { | |
| 186 | + List<String> files = new ArrayList<>(); | |
| 187 | + Luban.with(context) | |
| 188 | + .load(imageFiles) | |
| 189 | + .ignoreBy(20 * 1024) | |
| 190 | + .setTargetDir(getPath(context, TYPE_IMAGE_PATH)) | |
| 191 | + .filter(path -> !TextUtils.isEmpty(path) | |
| 192 | + && !FileTypeUtil.isGif(path) && Checkwidth(path)) | |
| 193 | + .setCompressListener(new OnCompressListener() { | |
| 194 | + @Override | |
| 195 | + public void onStart() { | |
| 196 | + } | |
| 197 | + | |
| 198 | + @Override | |
| 199 | + public void onSuccess(File file) { | |
| 200 | + files.add(file.getPath()); | |
| 201 | + if (files.size() == imageFiles.size()) { | |
| 202 | + callback.callback(0, "", files); | |
| 203 | + } | |
| 204 | + } | |
| 205 | + | |
| 206 | + @Override | |
| 207 | + public void onError(Throwable e) { | |
| 208 | + callback.callback(0, "", imageFiles); | |
| 209 | + AlertUtil.showDeftToast(context, "图片压缩失败"); | |
| 210 | + } | |
| 211 | + }).launch(); | |
| 212 | + } | |
| 213 | + return null; | |
| 214 | + } | |
| 215 | + | |
| 216 | + | |
| 217 | + private static boolean Checkwidth(String path) { | |
| 218 | + BitmapFactory.Options options = new BitmapFactory.Options(); | |
| 219 | + options.inJustDecodeBounds = true; | |
| 220 | + if (path != null && new File(path).exists()) { | |
| 221 | + Bitmap bitmap = BitmapFactory.decodeFile(path, options); // 此时返回的bitmap为null | |
| 222 | + return options.outWidth > 0 && options.outHeight > 0; | |
| 223 | + } else { | |
| 224 | + return false; | |
| 225 | + } | |
| 226 | + } | |
| 227 | + | |
| 228 | + | |
| 229 | + public static boolean isHUAWEI() { | |
| 230 | + String manufacturer = Build.MANUFACTURER; | |
| 231 | + if ("huawei".equalsIgnoreCase(manufacturer)) { | |
| 232 | + return true; | |
| 233 | + } | |
| 234 | + return false; | |
| 235 | + } | |
| 236 | + | |
| 237 | + | |
| 238 | + public static Disposable zipVideo(Context context, String path, boolean compressed, DataCallback<String> callback) { | |
| 239 | + boolean huawei = isHUAWEI(); | |
| 240 | + if (TextUtils.isEmpty(path) || compressed) { | |
| 241 | + callback.callback(Config.FAIL, "", path); | |
| 242 | + } else { | |
| 243 | + try { | |
| 244 | + // String outPath = getPath(TYPE_VIDEO_PATH) + MD5Utils.getFileMD5(new File(path)) + ".mp4"; | |
| 245 | + // String outPath = getPath(TYPE_VIDEO_PATH) + MD5.getFileMD5(new File(path)) + ".mp4"; | |
| 246 | + compressVideoResouce(context, path, callback); | |
| 247 | + // TranscoderUtil.doTranscode(context, path, outPath, callback); | |
| 248 | + } catch (Exception e) { | |
| 249 | + callback.callback(0, "", path); | |
| 250 | + } | |
| 251 | + } | |
| 252 | + return null; | |
| 253 | + } | |
| 254 | + | |
| 255 | + | |
| 256 | + /** | |
| 257 | + * 压缩视频 | |
| 258 | + * | |
| 259 | + * @param mContext | |
| 260 | + * @param filepath | |
| 261 | + */ | |
| 262 | + public static void compressVideoResouce(Context mContext, String filepath, DataCallback<String> callback) { | |
| 263 | + if (TextUtils.isEmpty(filepath)) { | |
| 264 | + AlertUtil.showDeftToast(mContext, "请先选择转码文件!"); | |
| 265 | + return; | |
| 266 | + } | |
| 267 | + //PLShortVideoTranscoder初始化,三个参数,第一个context,第二个要压缩文件的路径,第三个视频压缩后输出的路径 | |
| 268 | + PLShortVideoTranscoder mShortVideoTranscoder = new PLShortVideoTranscoder(mContext, filepath, getPath(mContext, TYPE_VIDEO_PATH) + MD5.getFileMD5(new File(filepath)) + ".mp4"); | |
| 269 | + MediaMetadataRetriever retr = new MediaMetadataRetriever(); | |
| 270 | + retr.setDataSource(filepath); | |
| 271 | + String height = retr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT); // 视频高度 | |
| 272 | + String width = retr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH); // 视频宽度 | |
| 273 | + String rotation = retr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION); // 视频旋转方向 | |
| 274 | + int transcodingBitrateLevel = 7;//我这里选择的4000*1000压缩,这里可以自己选择合适的压缩比例 | |
| 275 | + mShortVideoTranscoder.transcode(Integer.parseInt(width), Integer.parseInt(height), getEncodingBitrateLevel(transcodingBitrateLevel), new PLVideoSaveListener() { | |
| 276 | + @Override | |
| 277 | + public void onSaveVideoSuccess(String s) { | |
| 278 | + if (callback != null) | |
| 279 | + callback.callback(Config.SUCCESS, "success", s); | |
| 280 | + } | |
| 281 | + | |
| 282 | + @Override | |
| 283 | + public void onSaveVideoFailed(final int errorCode) { | |
| 284 | + if (callback != null) | |
| 285 | + callback.callback(Config.FAIL, "", filepath); | |
| 286 | + | |
| 287 | + /* runOnUiThread(new Runnable() { | |
| 288 | + @Override | |
| 289 | + public void run() { | |
| 290 | + switch (errorCode) { | |
| 291 | + case ERROR_NO_VIDEO_TRACK: | |
| 292 | + ToastUtils.getInstance().showToast("该文件没有视频信息!"); | |
| 293 | + break; | |
| 294 | + case ERROR_SRC_DST_SAME_FILE_PATH: | |
| 295 | + ToastUtils.getInstance().showToast("源文件路径和目标路径不能相同!"); | |
| 296 | + break; | |
| 297 | + case ERROR_LOW_MEMORY: | |
| 298 | + ToastUtils.getInstance().showToast("手机内存不足,无法对该视频进行时光倒流!"); | |
| 299 | + break; | |
| 300 | + default: | |
| 301 | + ToastUtils.getInstance().showToast("transcode failed: " + errorCode); | |
| 302 | + } | |
| 303 | + } | |
| 304 | + });*/ | |
| 305 | + } | |
| 306 | + | |
| 307 | + @Override | |
| 308 | + public void onSaveVideoCanceled() { | |
| 309 | +// LogUtil.e("onSaveVideoCanceled"); | |
| 310 | + } | |
| 311 | + | |
| 312 | + @Override | |
| 313 | + public void onProgressUpdate(float percentage) { | |
| 314 | + LogUtil.e("sjsSSasS1111", "" + percentage); | |
| 315 | + } | |
| 316 | + }); | |
| 317 | + } | |
| 318 | + | |
| 319 | + /** | |
| 320 | + * 设置压缩质量 | |
| 321 | + * | |
| 322 | + * @param position | |
| 323 | + * @return | |
| 324 | + */ | |
| 325 | + private static int getEncodingBitrateLevel(int position) { | |
| 326 | + return ENCODING_BITRATE_LEVEL_ARRAY[position]; | |
| 327 | + } | |
| 328 | + | |
| 329 | + /** | |
| 330 | + * 选的越高文件质量越大,质量越好 | |
| 331 | + */ | |
| 332 | + public static final int[] ENCODING_BITRATE_LEVEL_ARRAY = { | |
| 333 | + 500 * 1000, | |
| 334 | + 800 * 1000, | |
| 335 | + 1000 * 1000, | |
| 336 | + 1200 * 1000, | |
| 337 | + 1600 * 1000, | |
| 338 | + 2000 * 1000, | |
| 339 | + 2500 * 1000, | |
| 340 | + 4000 * 1000, | |
| 341 | + 8000 * 1000, | |
| 342 | + }; | |
| 343 | + | |
| 344 | + | |
| 345 | + private static String getPath(Context context, String cachePath) { | |
| 346 | + String path = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ? context.getExternalFilesDir("") : Environment.getExternalStorageDirectory()) + cachePath; | |
| 347 | + File file = new File(path); | |
| 348 | + if (file.mkdirs()) { | |
| 349 | + return path; | |
| 350 | + } | |
| 351 | + return path; | |
| 352 | + } | |
| 353 | + | |
| 354 | + public static Disposable uploadInfo(Context context, String sid, String text, String address, | |
| 355 | + String key, List<String> imageFiles, ShareReleaseInfoUtil.ShareConfig shareConfig, String gopath, String videotype, | |
| 356 | + ProgressCallback progressCallback, DataCallback<BaseInfo> callback) { | |
| 357 | + Map<String, String> map = new HashMap<>(); | |
| 358 | + // if (imageFiles != null && imageFiles.size() > 0) map.put("type", "1"); | |
| 359 | + if (!TextUtils.isEmpty(key)) map.put("type", "2"); | |
| 360 | + else if (shareConfig != null) map.put("type", "3"); | |
| 361 | + else map.put("type", "0"); | |
| 362 | + map.put("appId", AppConfig.getAppId()); | |
| 363 | + map.put("sid", sid); | |
| 364 | + map.put("text", StringUtils.encode(text)); | |
| 365 | + if (!TextUtils.isEmpty(key)) map.put("key", key); | |
| 366 | + //if (!TextUtils.isEmpty(address)) map.put("address", StringUtils.encode(address)); | |
| 367 | + if (!TextUtils.isEmpty(address)) map.put("address", address); | |
| 368 | + if (shareConfig != null) { | |
| 369 | + map.put("title", (StringUtils.isEmpty(shareConfig.getTitle()) ? "链接" : StringUtils.encode(shareConfig.getTitle()))); | |
| 370 | + if (shareConfig.getImage().contains("mmbiz.qpic")) { | |
| 371 | + map.put("icon", shareConfig.getImage()); | |
| 372 | + } else { | |
| 373 | + map.put("icon", videotype.startsWith("http") ? videotype : shareConfig.getImage()); | |
| 374 | + } | |
| 375 | + // map.put("icon",shareConfig.getImage().contains("/favicon.ico") || shareConfig.getImage().contains("toutiao") ? shareConfig.getImage() : videotype.startsWith("http") ? videotype : shareConfig.getImage()); | |
| 376 | + map.put("url", processUrlData(shareConfig.getUrl())); | |
| 377 | + map.put("desc", shareConfig.getSubTitle() == null ? "" : StringUtils.encode(shareConfig.getSubTitle())); | |
| 378 | + map.put("shareType", "3"); | |
| 379 | + map.put("shareExtInfo", ""); | |
| 380 | + } | |
| 381 | + | |
| 382 | + Subscriber<BaseInfo> subscriber = new Subscriber<BaseInfo>(context, ApiSubscriber.subscriberBuild) { | |
| 383 | + @Override | |
| 384 | + public void onCompleted(String s, String s1, BaseInfo darenApplyModel) { | |
| 385 | + if (callback == null) return; | |
| 386 | + callback.callback(SUCCESS, "", darenApplyModel); | |
| 387 | + } | |
| 388 | + | |
| 389 | + @Override | |
| 390 | + public void onError(String code, String message) { | |
| 391 | + if (callback == null) return; | |
| 392 | + int errorCode = -1; | |
| 393 | + try { | |
| 394 | + errorCode = Integer.valueOf(code); | |
| 395 | + } catch (Exception ignored) { | |
| 396 | + } finally { | |
| 397 | + callback.callback(errorCode, message, null); | |
| 398 | + } | |
| 399 | + } | |
| 400 | + | |
| 401 | + }; | |
| 402 | + | |
| 403 | + return SignUtil.getRequestBodySignMapObservable(map).subscribe(requestBodyMap -> { | |
| 404 | + ApiServiceMoment service = ApiRequest.service(ApiServiceMoment.class); | |
| 405 | + ApiRequest.subscribe(service.releaseMomentText(gopath, map), subscriber); | |
| 406 | + }); | |
| 407 | + } | |
| 408 | + | |
| 409 | + public static String processUrlData(String shareInfoUrl) { | |
| 410 | + | |
| 411 | + Uri uri = Uri.parse(shareInfoUrl); | |
| 412 | + if (uri.toString().contains("?")) { | |
| 413 | + int i = uri.toString().indexOf("?"); | |
| 414 | + if (uri.toString().substring(0, i).contains("#")) { | |
| 415 | + return shareInfoUrl; | |
| 416 | + } else { | |
| 417 | + String[] urls = shareInfoUrl.split("\\?"); | |
| 418 | + String url = urls[0]; | |
| 419 | + StringBuilder pageUrl = new StringBuilder(url); | |
| 420 | + pageUrl.append("?"); | |
| 421 | + for (String key : uri.getQueryParameterNames()) { | |
| 422 | + String value = UriUtil.getQueryParameterWithDecode(uri.getEncodedQuery(), key); | |
| 423 | + pageUrl.append(key).append("=").append(Uri.encode(TextUtils.isEmpty(value) ? "" : value)).append("&"); | |
| 424 | + } | |
| 425 | + pageUrl = deleteCharOfEnd(pageUrl, "&", true); | |
| 426 | + shareInfoUrl = pageUrl.toString(); | |
| 427 | + return shareInfoUrl; | |
| 428 | + } | |
| 429 | + } else { | |
| 430 | + return shareInfoUrl; | |
| 431 | + } | |
| 432 | + } | |
| 433 | + | |
| 434 | + public static StringBuilder deleteCharOfEnd(StringBuilder strBud, String item, boolean asLast) { | |
| 435 | + if (strBud == null) return null; | |
| 436 | + int index = asLast ? strBud.lastIndexOf(item) : strBud.indexOf(item); | |
| 437 | + if (index == strBud.length() - 1) strBud.deleteCharAt(index); | |
| 438 | + return strBud; | |
| 439 | + } | |
| 440 | + | |
| 441 | + | |
| 442 | + public static Disposable dogetList(Context context, String sid, DataCallback<BaseInfo<CircleData>> callback) { | |
| 443 | + Map<String, String> map = new HashMap<>(); | |
| 444 | + map.put("appId", AppConfig.getAppId()); | |
| 445 | + map.put("sid", sid); | |
| 446 | + | |
| 447 | + Subscriber<BaseInfo<CircleData>> subscriber = new Subscriber<BaseInfo<CircleData>>(context, ApiSubscriber.subscriberBuild) { | |
| 448 | + | |
| 449 | + @Override | |
| 450 | + public void onCompleted(String code, String message, BaseInfo<CircleData> data) { | |
| 451 | + if (callback == null) return; | |
| 452 | + callback.callback(SUCCESS, "", data); | |
| 453 | + } | |
| 454 | + | |
| 455 | + @Override | |
| 456 | + public void onError(String code, String message) { | |
| 457 | + if (callback == null) return; | |
| 458 | + int errorCode = -1; | |
| 459 | + try { | |
| 460 | + errorCode = Integer.valueOf(code); | |
| 461 | + } catch (Exception ignored) { | |
| 462 | + } finally { | |
| 463 | + callback.callback(errorCode, message, null); | |
| 464 | + } | |
| 465 | + } | |
| 466 | + | |
| 467 | + }; | |
| 468 | + return SignUtil.getRequestBodySignMapObservable(map).subscribe(requestBodyMap -> { | |
| 469 | + ApiServiceMoment service = ApiRequest.service(ApiServiceMoment.class); | |
| 470 | + ApiRequest.subscribe(service.releaseCirclePath(map), subscriber); | |
| 471 | + }); | |
| 472 | + } | |
| 473 | + | |
| 474 | + public static Disposable dogetBannerList(Context context, DataCallback<BaseInfo<List<SnowBannerData>>> callback) { | |
| 475 | + Map<String, String> map = new HashMap<>(); | |
| 476 | + map.put("appId", AppConfig.getAppId()); | |
| 477 | + | |
| 478 | + Subscriber<BaseInfo<List<SnowBannerData>>> subscriber = new Subscriber<BaseInfo<List<SnowBannerData>>>(context, ApiSubscriber.subscriberBuild) { | |
| 479 | + | |
| 480 | + @Override | |
| 481 | + public void onCompleted(String code, String message, BaseInfo<List<SnowBannerData>> data) { | |
| 482 | + if (callback == null) return; | |
| 483 | + callback.callback(SUCCESS, "", data); | |
| 484 | + } | |
| 485 | + | |
| 486 | + @Override | |
| 487 | + public void onError(String code, String message) { | |
| 488 | + if (callback == null) return; | |
| 489 | + int errorCode = -1; | |
| 490 | + try { | |
| 491 | + errorCode = Integer.valueOf(code); | |
| 492 | + } catch (Exception ignored) { | |
| 493 | + } finally { | |
| 494 | + callback.callback(errorCode, message, null); | |
| 495 | + } | |
| 496 | + } | |
| 497 | + | |
| 498 | + }; | |
| 499 | + return SignUtil.getRequestBodySignMapObservable(map).subscribe(requestBodyMap -> { | |
| 500 | + ApiServiceMoment service = ApiRequest.service(ApiServiceMoment.class); | |
| 501 | + ApiRequest.subscribe(service.getSnowBanner(map), subscriber); | |
| 502 | + }); | |
| 503 | + } | |
| 504 | + | |
| 505 | + private static List<MultipartBody.Part> getImageParams(List<String> imageFiles, ProgressCallback callback) { | |
| 506 | + List<MultipartBody.Part> imageParams = new ArrayList<>(); | |
| 507 | + | |
| 508 | + if (imageFiles != null) for (String path : imageFiles) { | |
| 509 | + File file = new File(path); | |
| 510 | + RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); | |
| 511 | + int index = imageFiles.indexOf(path); | |
| 512 | + int size = imageFiles.size(); | |
| 513 | + CountingRequestBody countingRequestBody = new CountingRequestBody(requestBody, (byteWrited, contentLength, done) -> { | |
| 514 | + float p = (float) index / (float) size + (float) byteWrited / (float) contentLength / (float) size; | |
| 515 | + if (callback != null) callback.onProgress((int) (p * 100)); | |
| 516 | + }); | |
| 517 | + imageParams.add(MultipartBody.Part.createFormData("Image" + (imageFiles.indexOf(path) + 1), file.getName(), countingRequestBody)); | |
| 518 | + } | |
| 519 | + return imageParams; | |
| 520 | + } | |
| 521 | + | |
| 522 | + public static void doUpload(Context context, File file, String objectKey, String uploadToken, DataCallback<Integer> callback, ProgressCallback progressCallback) { | |
| 523 | + UploadManager uploadManager = new UploadManager(); | |
| 524 | + uploadManager.put(file, objectKey, uploadToken, new UpCompletionHandler() { | |
| 525 | + @Override | |
| 526 | + public void complete(String key, ResponseInfo info, JSONObject response) { | |
| 527 | + ((Activity) context).runOnUiThread(() -> { | |
| 528 | + if (info.isOK()) { | |
| 529 | + callback.callback(0, "", SUCCESS); | |
| 530 | + } else { | |
| 531 | + callback.callback(info.statusCode, info.error, ERROR_UPLOAD); | |
| 532 | + } | |
| 533 | + }); | |
| 534 | + } | |
| 535 | + }, new UploadOptions(null, null, false, new UpProgressHandler() { | |
| 536 | + @Override | |
| 537 | + public void progress(String key, double percent) { | |
| 538 | + progressCallback.onProgress(percent); | |
| 539 | + } | |
| 540 | + }, null)); | |
| 541 | + } | |
| 542 | + | |
| 543 | + public static void doUploadPic(Context context, List<String> file, String uploadToken, DataCallback<ArrayList<String>> callback, ProgressCallback progressCallback) { | |
| 544 | + ArrayList<String> netpiclist = new ArrayList<>(); | |
| 545 | + UploadManager uploadManager = new UploadManager(); | |
| 546 | + //正式环境:769/img/2018/01/29/"时间戳".jpg | |
| 547 | + //测试环境:802/img/2018/01/29/"时间戳".jpg | |
| 548 | + if (file.size() == 1 && new File(file.get(0)).length() == 0) { | |
| 549 | + netpiclist.add(AppConfig.getShareLink()); | |
| 550 | + callback.callback(0, "", netpiclist); | |
| 551 | + } else { | |
| 552 | + for (int i = 0; i < file.size(); i++) { | |
| 553 | + Date date = new Date(); | |
| 554 | + String date1 = StringUtils.formatDate(date, "yyyy/MM/dd"); | |
| 555 | + String id = IDUtils.createID(); | |
| 556 | + String extName = FileUtil.getExtensionName((String) file.get(0)); | |
| 557 | + String objectKey = String.format(OBJECT_PIC_KEY, i, date1, id, extName); | |
| 558 | + uploadManager.put(new File(file.get(i)), objectKey, uploadToken, new UpCompletionHandler() { | |
| 559 | + @Override | |
| 560 | + public void complete(String key, ResponseInfo info, JSONObject response) { | |
| 561 | + ((Activity) context).runOnUiThread(() -> { | |
| 562 | + | |
| 563 | + if (info.isOK()) { | |
| 564 | + try { | |
| 565 | + netpiclist.add((String) info.response.get("key")); | |
| 566 | + } catch (JSONException e) { | |
| 567 | + e.printStackTrace(); | |
| 568 | + } | |
| 569 | + if (netpiclist.size() == file.size()) { | |
| 570 | + callback.callback(0, "", netpiclist); | |
| 571 | + } | |
| 572 | + } else { | |
| 573 | + callback.callback(info.statusCode, info.error, null); | |
| 574 | + } | |
| 575 | + }); | |
| 576 | + } | |
| 577 | + }, new UploadOptions(null, null, false, new UpProgressHandler() { | |
| 578 | + @Override | |
| 579 | + public void progress(String key, double percent) { | |
| 580 | + progressCallback.onProgress(percent); | |
| 581 | + } | |
| 582 | + }, null)); | |
| 583 | + } | |
| 584 | + } | |
| 585 | + } | |
| 586 | + | |
| 587 | + /** | |
| 588 | + * 身份认证 | |
| 589 | + */ | |
| 590 | + public static Disposable addApplyWitness(Context context, String userId, String mobile, String realName, String idCardNo, File idCardObv, File idCardRev, DataCallback<BaseInfo<DarenApplyModel>> callback) { | |
| 591 | + Map<String, String> params = new HashMap<>(); | |
| 592 | + params.put("witSid", (userId)); | |
| 593 | + params.put("realName", (realName)); | |
| 594 | + params.put("idCardNo", (idCardNo)); | |
| 595 | + params.put("mobile", (mobile)); | |
| 596 | + | |
| 597 | + List<MultipartBody.Part> parts = new ArrayList<>(); | |
| 598 | + | |
| 599 | + if (idCardObv.exists() && idCardRev.exists()) { | |
| 600 | + BitmapFactory.Options optionsObv = new BitmapFactory.Options(); | |
| 601 | + optionsObv.inJustDecodeBounds = true; | |
| 602 | + Bitmap bitmapObv = BitmapFactory.decodeFile(idCardObv.getAbsolutePath(), optionsObv); // 此时返回的bitmap为null | |
| 603 | + | |
| 604 | + BitmapFactory.Options optionsRev = new BitmapFactory.Options(); | |
| 605 | + optionsRev.inJustDecodeBounds = true; | |
| 606 | + Bitmap bitmapRev = BitmapFactory.decodeFile(idCardRev.getAbsolutePath(), optionsRev); // 此时返回的bitmap为null | |
| 607 | + | |
| 608 | + JSONObject picobjObv = new JSONObject(); | |
| 609 | + JSONObject picobjRev = new JSONObject(); | |
| 610 | + try { | |
| 611 | + picobjObv.put("height", optionsObv.outHeight); | |
| 612 | + picobjObv.put("with", optionsObv.outWidth); | |
| 613 | + picobjRev.put("height", optionsRev.outHeight); | |
| 614 | + picobjRev.put("with", optionsRev.outWidth); | |
| 615 | + } catch (JSONException e) { | |
| 616 | + e.printStackTrace(); | |
| 617 | + } | |
| 618 | + | |
| 619 | + params.put("idCardObvInfo", (picobjObv.toString())); | |
| 620 | + params.put("idCardRevInfo", (picobjRev.toString())); | |
| 621 | + | |
| 622 | + RequestBody requestIdCardObv = RequestBody.create(MediaType.parse("multipart/form-data"), idCardObv); | |
| 623 | + MultipartBody.Part idCardObvBody = | |
| 624 | + MultipartBody.Part.createFormData("idCardObv", idCardObv.getName(), requestIdCardObv); | |
| 625 | + | |
| 626 | + RequestBody requestIdCardRev = RequestBody.create(MediaType.parse("multipart/form-data"), idCardRev); | |
| 627 | + MultipartBody.Part idCardRevBody = | |
| 628 | + MultipartBody.Part.createFormData("idCardRev", idCardRev.getName(), requestIdCardRev); | |
| 629 | + | |
| 630 | + parts.add(idCardObvBody); | |
| 631 | + parts.add(idCardRevBody); | |
| 632 | + } | |
| 633 | + Map<String, String> map1 = SignUtil.getOpenSignMap(params, false); | |
| 634 | + Map<String, RequestBody> map2 = SignUtil.orderRequestBody(map1); | |
| 635 | + return ApiRequest.subscribe(ApiRequest.service(ApiServiceDaren.class).applyWitness(map2, parts), | |
| 636 | + new Subscriber<DarenApplyModel>(context, ApiSubscriber.subscriberBuild) { | |
| 637 | + @Override | |
| 638 | + public void onCompleted(String s, String s1, DarenApplyModel darenApplyModel) { | |
| 639 | + if (callback == null) return; | |
| 640 | + callback.callback(SUCCESS, "", darenApplyModel); | |
| 641 | + } | |
| 642 | + | |
| 643 | + @Override | |
| 644 | + public void onError(String code, String message) { | |
| 645 | + if (callback == null) return; | |
| 646 | + int errorCode = -1; | |
| 647 | + try { | |
| 648 | + errorCode = Integer.valueOf(code); | |
| 649 | + } catch (Exception ignored) { | |
| 650 | + } finally { | |
| 651 | + callback.callback(errorCode, message, null); | |
| 652 | + } | |
| 653 | + } | |
| 654 | + }); | |
| 655 | + } | |
| 656 | + | |
| 657 | + | |
| 658 | + public static Disposable checkApplyWitness(Context context, String userId, DataCallback<BaseInfo<CheckApplyResultInfo>> callback) { | |
| 659 | + Map<String, String> map = new HashMap<>(); | |
| 660 | + map.put("witSid", userId); | |
| 661 | + //签名请求 | |
| 662 | + return ApiRequest.subscribe(ApiRequest.service(ApiServiceDaren.class).checkApplyWitness(map), | |
| 663 | + new Subscriber<CheckApplyResultInfo>(context, ApiSubscriber.subscriberBuild) { | |
| 664 | + @Override | |
| 665 | + public void onCompleted(String s, String s1, CheckApplyResultInfo darenInfo) { | |
| 666 | + if (callback == null) return; | |
| 667 | + callback.callback(SUCCESS, "", darenInfo); | |
| 668 | + } | |
| 669 | + | |
| 670 | + @Override | |
| 671 | + public void onError(String code, String message) { | |
| 672 | + if (callback == null) return; | |
| 673 | + int errorCode = -1; | |
| 674 | + try { | |
| 675 | + errorCode = Integer.valueOf(code); | |
| 676 | + } catch (Exception ignored) { | |
| 677 | + } | |
| 678 | + | |
| 679 | + callback.callback(errorCode, message, null); | |
| 680 | + } | |
| 681 | + }); | |
| 682 | + } | |
| 683 | + | |
| 684 | + private static RequestBody getRequestString(String value) { | |
| 685 | + RequestBody requestString = RequestBody.create(MediaType.parse("text/plain"), value); | |
| 686 | + return requestString; | |
| 687 | + } | |
| 688 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/upload/utils/FileUtil.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/upload/utils/FileUtil.java | |
| 1 | +package com.cnlive.publish.upload.utils; | |
| 2 | + | |
| 3 | +import android.content.ContentValues; | |
| 4 | +import android.content.Context; | |
| 5 | +import android.database.Cursor; | |
| 6 | +import android.graphics.Bitmap; | |
| 7 | +import android.net.Uri; | |
| 8 | +import android.os.Environment; | |
| 9 | +import android.provider.MediaStore; | |
| 10 | +import android.util.Log; | |
| 11 | + | |
| 12 | +import java.io.File; | |
| 13 | +import java.io.FileInputStream; | |
| 14 | +import java.io.FileOutputStream; | |
| 15 | +import java.io.IOException; | |
| 16 | +import java.io.InputStream; | |
| 17 | +import java.io.OutputStream; | |
| 18 | +import java.util.UUID; | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * Created by xiansong on 2017/9/20. | |
| 22 | + */ | |
| 23 | + | |
| 24 | +public class FileUtil { | |
| 25 | + /** | |
| 26 | + * Java文件操作 获取文件扩展名 | |
| 27 | + */ | |
| 28 | + public static String getExtensionName(String filename) { | |
| 29 | + if ((filename != null) && (filename.length() > 0)) { | |
| 30 | + int dot = filename.lastIndexOf('.'); | |
| 31 | + if ((dot > -1) && (dot < (filename.length() - 1))) { | |
| 32 | + return filename.substring(dot + 1); | |
| 33 | + } | |
| 34 | + } | |
| 35 | + return ""; | |
| 36 | + } | |
| 37 | + | |
| 38 | + | |
| 39 | + public static String getExternalStorageDirctory(Context context, String folderName) { | |
| 40 | + File storageDir = new File(Environment.getExternalStorageDirectory() + File.separator + context.getPackageName() + File.separator); | |
| 41 | + File folderDir = new File(Environment.getExternalStorageDirectory() + File.separator + context.getPackageName() + File.separator + folderName + File.separator); | |
| 42 | + if (!storageDir.exists()) storageDir.mkdirs(); | |
| 43 | + if (!folderDir.exists()) folderDir.mkdirs(); | |
| 44 | + return Environment.getExternalStorageDirectory() + File.separator + | |
| 45 | + context.getPackageName() + File.separator + | |
| 46 | + folderName + File.separator; | |
| 47 | + } | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 拷贝Logo 到 SD卡 | |
| 51 | + * | |
| 52 | + * @param context | |
| 53 | + * @param filename | |
| 54 | + */ | |
| 55 | + public static String copyAssetsFile(Context context, String folderName, String filename) { | |
| 56 | + String uri = getExternalStorageDirctory(context, folderName) + filename; | |
| 57 | + if (!new File(uri).exists()) { | |
| 58 | + try { | |
| 59 | + InputStream in = context.getAssets().open(filename); | |
| 60 | + OutputStream out = new FileOutputStream(uri); | |
| 61 | + byte[] buffer = new byte[1024]; | |
| 62 | + int read; | |
| 63 | + while ((read = in.read(buffer)) != -1) out.write(buffer, 0, read); | |
| 64 | + in.close(); | |
| 65 | + out.flush(); | |
| 66 | + out.close(); | |
| 67 | + } catch (Exception e) { | |
| 68 | + Log.e("tag", e.getMessage()); | |
| 69 | + } | |
| 70 | + } | |
| 71 | + return uri; | |
| 72 | + } | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * 转换 content:// uri | |
| 76 | + * | |
| 77 | + * @param imageFile | |
| 78 | + * @return | |
| 79 | + */ | |
| 80 | + public static Uri getImageContentUri(Context context, File imageFile) { | |
| 81 | + String filePath = imageFile.getAbsolutePath(); | |
| 82 | + Cursor cursor = context.getContentResolver().query( | |
| 83 | + MediaStore.Images.Media.EXTERNAL_CONTENT_URI, | |
| 84 | + new String[]{MediaStore.Images.Media._ID}, | |
| 85 | + MediaStore.Images.Media.DATA + "=? ", | |
| 86 | + new String[]{filePath}, null); | |
| 87 | + | |
| 88 | + if (cursor != null && cursor.moveToFirst()) { | |
| 89 | + int id = cursor.getInt(cursor | |
| 90 | + .getColumnIndex(MediaStore.MediaColumns._ID)); | |
| 91 | + Uri baseUri = Uri.parse("content://media/external/images/media"); | |
| 92 | + return Uri.withAppendedPath(baseUri, "" + id); | |
| 93 | + } else { | |
| 94 | + if (imageFile.exists()) { | |
| 95 | + ContentValues values = new ContentValues(); | |
| 96 | + values.put(MediaStore.Images.Media.DATA, filePath); | |
| 97 | + return context.getContentResolver().insert( | |
| 98 | + MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); | |
| 99 | + } else { | |
| 100 | + return null; | |
| 101 | + } | |
| 102 | + } | |
| 103 | + } | |
| 104 | + | |
| 105 | + /** | |
| 106 | + * 复制单个文件 | |
| 107 | + * @param oldPath String 原文件路径 如:c:/fqf.txt | |
| 108 | + * @param newPath String 复制后路径 如:f:/fqf.txt | |
| 109 | + * @return boolean | |
| 110 | + */ | |
| 111 | + public static void copyFile(String oldPath, String newPath) { | |
| 112 | + try { | |
| 113 | + int bytesum = 0; | |
| 114 | + int byteread = 0; | |
| 115 | + File oldfile = new File(oldPath); | |
| 116 | + if (oldfile.exists()) { //文件存在时 | |
| 117 | + InputStream inStream = new FileInputStream(oldPath); //读入原文件 | |
| 118 | + FileOutputStream fs = new FileOutputStream(newPath); | |
| 119 | + byte[] buffer = new byte[1444]; | |
| 120 | + int length; | |
| 121 | + while ( (byteread = inStream.read(buffer)) != -1) { | |
| 122 | + bytesum += byteread; //字节数 文件大小 | |
| 123 | + System.out.println(bytesum); | |
| 124 | + fs.write(buffer, 0, byteread); | |
| 125 | + } | |
| 126 | + inStream.close(); | |
| 127 | + } | |
| 128 | + } | |
| 129 | + catch (Exception e) { | |
| 130 | + System.out.println("复制单个文件操作出错"); | |
| 131 | + e.printStackTrace(); | |
| 132 | + | |
| 133 | + } | |
| 134 | + | |
| 135 | + } | |
| 136 | + | |
| 137 | + public static String isExistDir(String saveDir) throws IOException { | |
| 138 | + File downloadFile = new File(saveDir); | |
| 139 | + if (!downloadFile.mkdirs()) { | |
| 140 | + downloadFile.createNewFile(); | |
| 141 | + } | |
| 142 | + String savePath = downloadFile.getAbsolutePath(); | |
| 143 | + return savePath; | |
| 144 | + } | |
| 145 | + | |
| 146 | + public static String getRootPath(Context context, String filePath) { | |
| 147 | + File cacheRootFile = !isExternalStorageWritable() ? context.getFilesDir() : context.getExternalCacheDir(); | |
| 148 | + return cacheRootFile.getAbsolutePath()+ File.separator+filePath+ File.separator; | |
| 149 | + } | |
| 150 | + | |
| 151 | + | |
| 152 | + public static boolean isExternalStorageWritable() { | |
| 153 | + String state = Environment.getExternalStorageState(); | |
| 154 | + if (Environment.MEDIA_MOUNTED.equals(state)) { | |
| 155 | + return true; | |
| 156 | + } | |
| 157 | + return false; | |
| 158 | + } | |
| 159 | + | |
| 160 | + /* | |
| 161 | + * 保存bitmap到本地 | |
| 162 | + * */ | |
| 163 | + public static String saveBitmap(Context context, Bitmap mBitmap) { | |
| 164 | + String savePath; | |
| 165 | + File filePic; | |
| 166 | + savePath = context.getCacheDir().getAbsolutePath(); | |
| 167 | + try { | |
| 168 | + filePic = new File(savePath + UUID.randomUUID().toString() + ".jpg"); | |
| 169 | + if (!filePic.exists()) { | |
| 170 | + filePic.getParentFile().mkdirs(); | |
| 171 | + filePic.createNewFile(); | |
| 172 | + } | |
| 173 | + FileOutputStream fos = new FileOutputStream(filePic); | |
| 174 | + mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos); | |
| 175 | + fos.flush(); | |
| 176 | + fos.close(); | |
| 177 | + } catch (IOException e) { | |
| 178 | + e.printStackTrace(); | |
| 179 | + return null; | |
| 180 | + } | |
| 181 | + | |
| 182 | + return filePic.getAbsolutePath(); | |
| 183 | + } | |
| 184 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/upload/utils/IDUtils.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/upload/utils/IDUtils.java | |
| 1 | +package com.cnlive.publish.upload.utils; | |
| 2 | + | |
| 3 | +public class IDUtils { | |
| 4 | + private static byte[] lock = new byte[0]; | |
| 5 | + | |
| 6 | + // 位数,默认是8位 | |
| 7 | + private final static long w = 100000000; | |
| 8 | + | |
| 9 | + public static String createID() { | |
| 10 | + long r = 0; | |
| 11 | + synchronized (lock) { | |
| 12 | + r = (long) ((Math.random() + 1) * w); | |
| 13 | + } | |
| 14 | + | |
| 15 | + return System.currentTimeMillis() + String.valueOf(r).substring(1); | |
| 16 | + } | |
| 17 | +} | |
| 0 | 18 | \ No newline at end of file | ... | ... |
publish/src/main/java/com/cnlive/publish/upload/utils/MD5.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/upload/utils/MD5.java | |
| 1 | +package com.cnlive.publish.upload.utils; | |
| 2 | + | |
| 3 | +import android.app.Activity; | |
| 4 | +import android.os.Bundle; | |
| 5 | +import android.util.Log; | |
| 6 | + | |
| 7 | +import java.io.File; | |
| 8 | +import java.io.FileInputStream; | |
| 9 | +import java.math.BigInteger; | |
| 10 | +import java.security.MessageDigest; | |
| 11 | +import java.util.HashMap; | |
| 12 | +import java.util.Map; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * Author by Yuansiwen.com, Date on 2018/11/29. | |
| 16 | + * PS: Not easy to write code, please indicate. | |
| 17 | + */ | |
| 18 | +public class MD5 extends Activity { | |
| 19 | + | |
| 20 | + @Override | |
| 21 | + protected void onCreate(Bundle savedInstanceState) { | |
| 22 | + // TODO Auto-generated method stub | |
| 23 | + super.onCreate(savedInstanceState); | |
| 24 | + File file = new File("/mnt/sdcard/123.txt"); | |
| 25 | + Log.e("MD5", getFileMD5(file)); | |
| 26 | + } | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 获取单个文件的MD5值! | |
| 30 | + | |
| 31 | + * @param file | |
| 32 | + * @return | |
| 33 | + */ | |
| 34 | + | |
| 35 | + public static String getFileMD5(File file) { | |
| 36 | + if (!file.isFile()) { | |
| 37 | + return null; | |
| 38 | + } | |
| 39 | + MessageDigest digest = null; | |
| 40 | + FileInputStream in = null; | |
| 41 | + byte buffer[] = new byte[1024]; | |
| 42 | + int len; | |
| 43 | + try { | |
| 44 | + digest = MessageDigest.getInstance("MD5"); | |
| 45 | + in = new FileInputStream(file); | |
| 46 | + while ((len = in.read(buffer, 0, 1024)) != -1) { | |
| 47 | + digest.update(buffer, 0, len); | |
| 48 | + } | |
| 49 | + in.close(); | |
| 50 | + } catch (Exception e) { | |
| 51 | + e.printStackTrace(); | |
| 52 | + return null; | |
| 53 | + } | |
| 54 | + BigInteger bigInt = new BigInteger(1, digest.digest()); | |
| 55 | + return bigInt.toString(16); | |
| 56 | + } | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * 获取文件夹中文件的MD5值 | |
| 60 | + * | |
| 61 | + * @param file | |
| 62 | + * @param listChild | |
| 63 | + * ;true递归子目录中的文件 | |
| 64 | + * @return | |
| 65 | + */ | |
| 66 | + public static Map<String, String> getDirMD5(File file, boolean listChild) { | |
| 67 | + if (!file.isDirectory()) { | |
| 68 | + return null; | |
| 69 | + } | |
| 70 | + Map<String, String> map = new HashMap<String, String>(); | |
| 71 | + String md5; | |
| 72 | + File files[] = file.listFiles(); | |
| 73 | + for (int i = 0; i < files.length; i++) { | |
| 74 | + File f = files[i]; | |
| 75 | + if (f.isDirectory() && listChild) { | |
| 76 | + map.putAll(getDirMD5(f, listChild)); | |
| 77 | + } else { | |
| 78 | + md5 = getFileMD5(f); | |
| 79 | + if (md5 != null) { | |
| 80 | + map.put(f.getPath(), md5); | |
| 81 | + } | |
| 82 | + } | |
| 83 | + } | |
| 84 | + return map; | |
| 85 | + } | |
| 86 | + | |
| 87 | +} | |
| 88 | + | ... | ... |
publish/src/main/java/com/cnlive/publish/upload/utils/MD5Utils.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/upload/utils/MD5Utils.java | |
| 1 | +package com.cnlive.publish.upload.utils; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by xiansong on 2018/3/28. | |
| 5 | + */ | |
| 6 | + | |
| 7 | +import java.io.File; | |
| 8 | +import java.io.FileInputStream; | |
| 9 | +import java.io.FileNotFoundException; | |
| 10 | +import java.io.IOException; | |
| 11 | +import java.nio.ByteBuffer; | |
| 12 | +import java.nio.channels.FileChannel; | |
| 13 | +import java.security.MessageDigest; | |
| 14 | +import java.security.NoSuchAlgorithmException; | |
| 15 | +import java.util.Arrays; | |
| 16 | + | |
| 17 | +import androidx.annotation.NonNull; | |
| 18 | + | |
| 19 | +/** | |
| 20 | + * Created by Lynn on 6/28/2017. | |
| 21 | + */ | |
| 22 | + | |
| 23 | +public class MD5Utils { | |
| 24 | + | |
| 25 | + private static final char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', | |
| 26 | + 'a', 'b', 'c', 'd', 'e', 'f'}; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * Get MD5 of a file (lower case) | |
| 30 | + * | |
| 31 | + * @return empty string if I/O error when get MD5 | |
| 32 | + */ | |
| 33 | + @NonNull | |
| 34 | + public static String getFileMD5(@NonNull File file) { | |
| 35 | + | |
| 36 | + FileInputStream in = null; | |
| 37 | + try { | |
| 38 | + in = new FileInputStream(file); | |
| 39 | + FileChannel ch = in.getChannel(); | |
| 40 | + return MD5(ch.map(FileChannel.MapMode.READ_ONLY, 0, file.length())); | |
| 41 | + } catch (FileNotFoundException e) { | |
| 42 | + return ""; | |
| 43 | + } catch (IOException e) { | |
| 44 | + return ""; | |
| 45 | + } finally { | |
| 46 | + if (in != null) { | |
| 47 | + try { | |
| 48 | + in.close(); | |
| 49 | + } catch (IOException e) { | |
| 50 | + // 关闭流产生的错误一般都可以忽略 | |
| 51 | + } | |
| 52 | + } | |
| 53 | + } | |
| 54 | + | |
| 55 | + } | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * MD5校验字符串 | |
| 59 | + * | |
| 60 | + * @param s String to be MD5 | |
| 61 | + * @return 'null' if cannot get MessageDigest | |
| 62 | + */ | |
| 63 | + @NonNull | |
| 64 | + public static String getStringMD5(@NonNull String s) { | |
| 65 | + MessageDigest mdInst; | |
| 66 | + try { | |
| 67 | + // 获得MD5摘要算法的 MessageDigest 对象 | |
| 68 | + mdInst = MessageDigest.getInstance("MD5"); | |
| 69 | + } catch (NoSuchAlgorithmException e) { | |
| 70 | + e.printStackTrace(); | |
| 71 | + return ""; | |
| 72 | + } | |
| 73 | + | |
| 74 | + byte[] btInput = s.getBytes(); | |
| 75 | + // 使用指定的字节更新摘要 | |
| 76 | + mdInst.update(btInput); | |
| 77 | + // 获得密文 | |
| 78 | + byte[] md = mdInst.digest(); | |
| 79 | + // 把密文转换成十六进制的字符串形式 | |
| 80 | + int length = md.length; | |
| 81 | + char str[] = new char[length * 2]; | |
| 82 | + int k = 0; | |
| 83 | + for (byte b : md) { | |
| 84 | + str[k++] = hexDigits[b >>> 4 & 0xf]; | |
| 85 | + str[k++] = hexDigits[b & 0xf]; | |
| 86 | + } | |
| 87 | + return new String(str); | |
| 88 | + } | |
| 89 | + | |
| 90 | + @NonNull | |
| 91 | + private static String getSubStr(@NonNull String str, int subNu, char replace) { | |
| 92 | + int length = str.length(); | |
| 93 | + if (length > subNu) { | |
| 94 | + str = str.substring(length - subNu, length); | |
| 95 | + } else if (length < subNu) { | |
| 96 | + // NOTE: padding字符填充在字符串的右侧,和服务器的算法是一致的 | |
| 97 | + str += createPaddingString(subNu - length, replace); | |
| 98 | + } | |
| 99 | + return str; | |
| 100 | + } | |
| 101 | + | |
| 102 | + @NonNull | |
| 103 | + private static String createPaddingString(int n, char pad) { | |
| 104 | + if (n <= 0) { | |
| 105 | + return ""; | |
| 106 | + } | |
| 107 | + | |
| 108 | + char[] paddingArray = new char[n]; | |
| 109 | + Arrays.fill(paddingArray, pad); | |
| 110 | + return new String(paddingArray); | |
| 111 | + } | |
| 112 | + | |
| 113 | + /** | |
| 114 | + * 计算MD5校验 | |
| 115 | + * | |
| 116 | + * @param buffer | |
| 117 | + * @return 空串,如果无法获得 MessageDigest实例 | |
| 118 | + */ | |
| 119 | + @NonNull | |
| 120 | + private static String MD5(ByteBuffer buffer) { | |
| 121 | + String s = ""; | |
| 122 | + try { | |
| 123 | + MessageDigest md = MessageDigest.getInstance("MD5"); | |
| 124 | + md.update(buffer); | |
| 125 | + byte tmp[] = md.digest(); // MD5 的计算结果是一个 128 位的长整数, | |
| 126 | + // 用字节表示就是 16 个字节 | |
| 127 | + char str[] = new char[16 * 2]; // 每个字节用 16 进制表示的话,使用两个字符, | |
| 128 | + // 所以表示成 16 进制需要 32 个字符 | |
| 129 | + int k = 0; // 表示转换结果中对应的字符位置 | |
| 130 | + for (int i = 0; i < 16; i++) { // 从第一个字节开始,对 MD5 的每一个字节 | |
| 131 | + // 转换成 16 进制字符的转换 | |
| 132 | + byte byte0 = tmp[i]; // 取第 i 个字节 | |
| 133 | + str[k++] = hexDigits[byte0 >>> 4 & 0xf]; // 取字节中高 4 位的数字转换, >>>, | |
| 134 | + // 逻辑右移,将符号位一起右移 | |
| 135 | + str[k++] = hexDigits[byte0 & 0xf]; // 取字节中低 4 位的数字转换 | |
| 136 | + } | |
| 137 | + s = new String(str); // 换后的结果转换为字符串 | |
| 138 | + | |
| 139 | + } catch (NoSuchAlgorithmException e) { | |
| 140 | + e.printStackTrace(); | |
| 141 | + } | |
| 142 | + return s; | |
| 143 | + } | |
| 144 | +} | |
| 145 | + | ... | ... |
publish/src/main/java/com/cnlive/publish/util/AppUtil.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/util/AppUtil.java | |
| 1 | +package com.cnlive.publish.util; | |
| 2 | + | |
| 3 | +import android.app.Activity; | |
| 4 | +import android.app.ActivityManager; | |
| 5 | +import android.content.ComponentName; | |
| 6 | +import android.content.Context; | |
| 7 | +import android.content.pm.ApplicationInfo; | |
| 8 | +import android.content.pm.PackageInfo; | |
| 9 | +import android.content.pm.PackageManager; | |
| 10 | +import android.os.Build; | |
| 11 | +import android.text.TextUtils; | |
| 12 | +import android.util.Log; | |
| 13 | + | |
| 14 | +import java.util.List; | |
| 15 | + | |
| 16 | +import androidx.core.app.ActivityCompat; | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * Created by gujun on 2017/10/9. | |
| 20 | + */ | |
| 21 | + | |
| 22 | +public class AppUtil { | |
| 23 | + | |
| 24 | + private static final String TAG = "vlion AppUtil"; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 判断某个界面是否在前台 | |
| 28 | + * | |
| 29 | + * @param activity 要判断的Activity | |
| 30 | + * @return 是否在前台显示 | |
| 31 | + */ | |
| 32 | + public static boolean isForeground(Activity activity) { | |
| 33 | + return isForeground(activity, activity.getClass().getName()); | |
| 34 | + } | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 判断某个界面是否在前台 | |
| 38 | + * | |
| 39 | + * @param context Context | |
| 40 | + * @param className 界面的类名 | |
| 41 | + * @return 是否在前台显示 | |
| 42 | + */ | |
| 43 | + public static boolean isForeground(Context context, String className) { | |
| 44 | + if (context == null || TextUtils.isEmpty(className)) | |
| 45 | + return false; | |
| 46 | + ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); | |
| 47 | + List<ActivityManager.RunningTaskInfo> list = am.getRunningTasks(1); | |
| 48 | + if (list != null && list.size() > 0) { | |
| 49 | + ComponentName cpn = list.get(0).topActivity; | |
| 50 | + if (className.equals(cpn.getClassName())) | |
| 51 | + return true; | |
| 52 | + } | |
| 53 | + return false; | |
| 54 | + } | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 获取包名 | |
| 58 | + * | |
| 59 | + * @param context | |
| 60 | + * @return | |
| 61 | + */ | |
| 62 | + public static String getPackageName(Context context) { | |
| 63 | + return context.getPackageName(); | |
| 64 | + } | |
| 65 | + | |
| 66 | + /** | |
| 67 | + * get App versionName | |
| 68 | + * | |
| 69 | + * @param context | |
| 70 | + * @return | |
| 71 | + */ | |
| 72 | + public static String getVersionName(Context context) { | |
| 73 | + PackageManager packageManager = context.getPackageManager(); | |
| 74 | + PackageInfo packageInfo; | |
| 75 | + String versionName = ""; | |
| 76 | + try { | |
| 77 | + packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0); | |
| 78 | + versionName = packageInfo.versionName; | |
| 79 | + } catch (PackageManager.NameNotFoundException e) { | |
| 80 | + e.printStackTrace(); | |
| 81 | + } | |
| 82 | + if (TextUtils.isEmpty(versionName)) { | |
| 83 | + Log.e(TAG, "getVersionNameError: version name is null"); | |
| 84 | + } | |
| 85 | + return versionName; | |
| 86 | + } | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * 判断当前应用是否是debug状态 | |
| 90 | + */ | |
| 91 | + public static boolean isApkInDebug(Context context) { | |
| 92 | + try { | |
| 93 | + ApplicationInfo info = context.getApplicationInfo(); | |
| 94 | + return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; | |
| 95 | + } catch (Exception e) { | |
| 96 | + return false; | |
| 97 | + } | |
| 98 | + } | |
| 99 | + | |
| 100 | + | |
| 101 | + /** | |
| 102 | + * get App versionName | |
| 103 | + * | |
| 104 | + * @param context | |
| 105 | + * @return | |
| 106 | + */ | |
| 107 | + public static int getVersionCode(Context context) { | |
| 108 | + PackageManager packageManager = context.getPackageManager(); | |
| 109 | + PackageInfo packageInfo; | |
| 110 | + int versionCode = -1; | |
| 111 | + try { | |
| 112 | + packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0); | |
| 113 | + versionCode = packageInfo.versionCode; | |
| 114 | + } catch (PackageManager.NameNotFoundException e) { | |
| 115 | + e.printStackTrace(); | |
| 116 | + } | |
| 117 | + | |
| 118 | + return versionCode; | |
| 119 | + } | |
| 120 | + | |
| 121 | + public static boolean checkPermissions(Context context, String[] PERMISSION) { | |
| 122 | + if (Build.VERSION.SDK_INT >= 23) for (String permisson : PERMISSION) { | |
| 123 | + if (TextUtils.isEmpty(permisson)) continue; | |
| 124 | + if (ActivityCompat.checkSelfPermission(context, permisson) == 0) continue; | |
| 125 | + return false; | |
| 126 | + } | |
| 127 | + return true; | |
| 128 | + } | |
| 129 | + | |
| 130 | + /** | |
| 131 | + * 判定Content是否即将被销毁销毁 | |
| 132 | + * | |
| 133 | + * @param context 上下文 | |
| 134 | + * @return true 将被销毁 false 正常运行 | |
| 135 | + */ | |
| 136 | + public static boolean isContextDestroyed(Context context) { | |
| 137 | + if (context == null) return true; | |
| 138 | + return context instanceof Activity && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && ((Activity) context).isDestroyed(); | |
| 139 | + } | |
| 140 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/util/LocationUtil.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/util/LocationUtil.java | |
| 1 | +package com.cnlive.publish.util; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | + | |
| 5 | +import com.amap.api.location.AMapLocationClient; | |
| 6 | +import com.amap.api.location.AMapLocationClientOption; | |
| 7 | +import com.amap.api.location.AMapLocationListener; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * Created by xiansong on 2018/2/3. | |
| 11 | + */ | |
| 12 | + | |
| 13 | +public class LocationUtil { | |
| 14 | + public static void uploadLocation(Context context, AMapLocationListener callback) { | |
| 15 | + //初始化AMapLocationClientOption对象 | |
| 16 | + AMapLocationClientOption mLocationOption = new AMapLocationClientOption(); | |
| 17 | + mLocationOption.setNeedAddress(true); | |
| 18 | + //设置定位模式为高精度模式,Battery_Saving为低功耗模式,Device_Sensors是仅设备模式 | |
| 19 | + mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy); | |
| 20 | + mLocationOption.setLocationPurpose(AMapLocationClientOption.AMapLocationPurpose.SignIn); | |
| 21 | + //设置定位间隔,单位毫秒,默认为2000ms | |
| 22 | + mLocationOption.setInterval(2000); | |
| 23 | + mLocationOption.setOnceLocation(true); | |
| 24 | + mLocationOption.setOnceLocationLatest(true); | |
| 25 | + //初始化定位 | |
| 26 | + AMapLocationClient mLocationClient = new AMapLocationClient(context); | |
| 27 | + //设置定位参数 | |
| 28 | + mLocationClient.setLocationOption(mLocationOption); | |
| 29 | + //设置定位监听 | |
| 30 | + mLocationClient.setLocationListener(callback); | |
| 31 | + mLocationClient.stopLocation(); | |
| 32 | + mLocationClient.startLocation(); | |
| 33 | + } | |
| 34 | + | |
| 35 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/util/StatusBarUtil.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/util/StatusBarUtil.java | |
| 1 | +package com.cnlive.publish.util; | |
| 2 | + | |
| 3 | +import android.annotation.TargetApi; | |
| 4 | +import android.app.Activity; | |
| 5 | + | |
| 6 | +import com.qmuiteam.qmui.util.QMUIStatusBarHelper; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 修改状态栏颜色 和字体颜色的方法 | |
| 10 | + */ | |
| 11 | + | |
| 12 | +@SuppressWarnings("unused") | |
| 13 | +public class StatusBarUtil { | |
| 14 | + | |
| 15 | + /** | |
| 16 | + * 设置状态栏黑色色字体图标 | |
| 17 | + * 支持 4.4 以上版本 MIUI 和 Flyme,以及 6.0 以上版本的其他 Android | |
| 18 | + */ | |
| 19 | + public static void setStatusBarWrite(Activity activity) { | |
| 20 | + //修改背景色颜色 | |
| 21 | + QMUIStatusBarHelper.setStatusBarLightMode(activity); | |
| 22 | + | |
| 23 | + } | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 设置状态栏白色字体图标 | |
| 27 | + * 支持 4.4 以上版本 MIUI 和 Flyme,以及 6.0 以上版本的其他 Android | |
| 28 | + */ | |
| 29 | + public static void setStatusBarDarkMode(Activity activity) { | |
| 30 | + QMUIStatusBarHelper.setStatusBarDarkMode(activity); | |
| 31 | + | |
| 32 | + } | |
| 33 | + | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * @param activity | |
| 37 | + * @param | |
| 38 | + */ | |
| 39 | + @TargetApi(19) | |
| 40 | + public static void setStatusBar(Activity activity, int colorOn5x) { | |
| 41 | + //修改背景色颜色 | |
| 42 | + QMUIStatusBarHelper.translucent(activity, activity.getResources().getColor(colorOn5x)); | |
| 43 | + //设置 字体颜色为深色字体 | |
| 44 | + QMUIStatusBarHelper.setStatusBarLightMode(activity); | |
| 45 | + | |
| 46 | + } | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/util/UserInfoUtils.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/util/UserInfoUtils.java | |
| 1 | +package com.cnlive.publish.util; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.text.TextUtils; | |
| 5 | + | |
| 6 | +import com.cnlive.libs.base.application.AppConfig; | |
| 7 | +import com.cnlive.libs.base.arouter.user.CNLiveUserService; | |
| 8 | +import com.cnlive.libs.base.util.OpenServiceHelpUtil; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 用户信息工具 | |
| 12 | + */ | |
| 13 | +public class UserInfoUtils { | |
| 14 | + public static String DEFAULT_UID = "";//默认用户id | |
| 15 | + public static String DEFAULT_NICK_NAME = "";//默认用户昵称 | |
| 16 | + public static String DEFAULT_FACE_URL = "";//默认用户头像 | |
| 17 | + | |
| 18 | + /**获取用户id, | |
| 19 | + * @param context | |
| 20 | + * @param defaultUid 默认值,当设置DEFAULT_UID以后以DEFAULT_UID为主 | |
| 21 | + * @return | |
| 22 | + */ | |
| 23 | + public static String getUid(Context context, String defaultUid) { | |
| 24 | + /*CNLiveUserService userService = OpenServiceHelpUtil.getUserService(context); | |
| 25 | + if (null == userService && AppConfig.isDebug()) { | |
| 26 | + if (!TextUtils.isEmpty(DEFAULT_UID)) { | |
| 27 | + return DEFAULT_UID; | |
| 28 | + } else { | |
| 29 | + return defaultUid; | |
| 30 | + } | |
| 31 | + } | |
| 32 | + return userService.getUid(context);*/ | |
| 33 | + return "10510842"; | |
| 34 | + } | |
| 35 | + | |
| 36 | + /**获取昵称 | |
| 37 | + * @param context | |
| 38 | + * @param nickName | |
| 39 | + * @return | |
| 40 | + */ | |
| 41 | + public static String getNickName(Context context, String nickName) { | |
| 42 | + /*CNLiveUserService userService = OpenServiceHelpUtil.getUserService(context); | |
| 43 | + if (null == userService && AppConfig.isDebug()) { | |
| 44 | + if (!TextUtils.isEmpty(DEFAULT_NICK_NAME)) { | |
| 45 | + return DEFAULT_NICK_NAME; | |
| 46 | + } else { | |
| 47 | + return nickName; | |
| 48 | + } | |
| 49 | + } | |
| 50 | + return userService.getUserInfo(context).getNickName();*/ | |
| 51 | + return "yuansiwen"; | |
| 52 | + | |
| 53 | + } | |
| 54 | + | |
| 55 | + /**获取用户头像 | |
| 56 | + * @param context | |
| 57 | + * @param faceUrl | |
| 58 | + * @return | |
| 59 | + */ | |
| 60 | + public static String getFaceUrl(Context context, String faceUrl) { | |
| 61 | + CNLiveUserService userService = OpenServiceHelpUtil.getUserService(context); | |
| 62 | + if (null == userService && AppConfig.isDebug()) { | |
| 63 | + if (!TextUtils.isEmpty(DEFAULT_FACE_URL)) { | |
| 64 | + return DEFAULT_FACE_URL; | |
| 65 | + } else { | |
| 66 | + return faceUrl; | |
| 67 | + } | |
| 68 | + } | |
| 69 | + return userService.getUserInfo(context).getFaceUrl(); | |
| 70 | + } | |
| 71 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/widget/Constant.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/widget/Constant.java | |
| 1 | +package com.cnlive.publish.widget; | |
| 2 | + | |
| 3 | +import com.cnlive.libs.base.application.AppConfig; | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | +public class Constant { | |
| 8 | + //达人号id | |
| 9 | + public static final String SYS_DAREN_ID = "sys_daren"; | |
| 10 | + //生活号id | |
| 11 | + public static final String SYS_LIFE_ID = "sys_life"; | |
| 12 | + //朋友圈id | |
| 13 | + public static final String SYS_MOMENT_ID = "sys_moment"; | |
| 14 | + //订阅号id | |
| 15 | + public static final String SYS_SUBSCRIBE_ID = "sys_subscribe"; | |
| 16 | + //朋友圈发布审核状态 | |
| 17 | + public static final String SYS_MEDIA = "sys_media"; | |
| 18 | + //系统通知号 | |
| 19 | + public static final String SYS_NOTICE_ID = "sys_notice"; | |
| 20 | + //系统新闻号 | |
| 21 | + public static final String SYS_NEWS_ID = "sys_news"; | |
| 22 | + //直播号 | |
| 23 | + public static final String SYS_LIVE_ID = "sys_live"; | |
| 24 | + //系统撤回消息的号 | |
| 25 | + public static final String SYS_REVOKE_ID = "sys_revoke"; | |
| 26 | + //专门接收不需要显示的系统通知 | |
| 27 | + public static final String SYS_SYSTEM = "sys_system"; | |
| 28 | + //各种大号开头判断 | |
| 29 | + public static final String SYS_ = "sys_"; | |
| 30 | + //达人id的开头 | |
| 31 | + public static final String DAREN_ID_PRE = "daren_"; | |
| 32 | + //聊天页面视频文件最大100M | |
| 33 | + public static final int VIDEO_MAX_SIZE = 100 * 1024 * 1024; | |
| 34 | + //聊天页面视频文件最大时长 | |
| 35 | + public static final int VIDEO_MAX_TIME = 10 * 60 * 1000; | |
| 36 | + //聊天页面图片文件最大100M | |
| 37 | + public static final int IMAGE_MAX_SIZE = 25 * 1024 * 1024; | |
| 38 | + //聊天页面文件最大100M | |
| 39 | + public static final int FILE_MAX_SIZE = 100 * 1024 * 1024; | |
| 40 | + //聊天页面视频录制最大时长ms | |
| 41 | + public static final int RECORD_MAX_TIME = 60 * 1000; | |
| 42 | + //在线答题拍摄时长ms | |
| 43 | + public static final int OnLineAnswer_MAX_TIME = 30 * 1000; | |
| 44 | + //聊天消息正常情况,两条消息间间隔xx分钟会展示消息时间 | |
| 45 | + public static final int CHAT_ITEM_INTERVAL_TIME = 5 * 60; | |
| 46 | + //群组名最大字数限制 | |
| 47 | + public static final int GROUP_NAME_MAX_LIMIT = 10; | |
| 48 | + //群组@昵称后的特殊字符的ascii | |
| 49 | + public static final int GROUP_AIT_BACK_CHAT = 8197; | |
| 50 | + //群组默认展示的群成员数,超过就得查看全部群成员 | |
| 51 | + public static final int GROUP_INFO_MAX_MEMBERS_COUNT = 10; | |
| 52 | + //群组自定义字段key,群组的类型:特殊群组,普通群组 | |
| 53 | + public static final String GROUP_CUSTOM_KEY_TYPE = "type"; | |
| 54 | + //好友自定义字段key,备注手机号 | |
| 55 | + public static final String FRIEND_CUSTOM_KEY_MOBILE = "Tag_SNS_Custom_mobile"; | |
| 56 | + //好友信息更新的key(im定义的),备注名 | |
| 57 | + public static final String FRIEND_UPDATE_REMARK = "Tag_SNS_IM_Remark"; | |
| 58 | + //好友信息更新的key(im定义的),昵称 | |
| 59 | + public static final String FRIEND_UPDATE_NICK = "Tag_Profile_IM_Nick"; | |
| 60 | + //好友信息更新的key(im定义的),头像 | |
| 61 | + public static final String FRIEND_UPDATE_FACE = "Tag_Profile_IM_Image"; | |
| 62 | + //好友自定义字段key,备注手机号,获取的时候就不能用FRIEND_CUSTOM_KEY_MOBILE,因为它IM4.x版本key值变成了mobile | |
| 63 | + public static final String FRIEND_CUSTOM_KEY_MOBILE_GET = "mobile"; | |
| 64 | + //群通知的历史信息gson | |
| 65 | + public static final String GROUP_CUSTOM_KEY_NOTICE = "groupNotice"; | |
| 66 | + //普通群组类型 | |
| 67 | + public static final String GROUP_CUSTOM_VALUE_TYPE_NORMAL = "normalGroup"; | |
| 68 | + //特殊群组类型 | |
| 69 | + public static final String GROUP_CUSTOM_VALUE_TYPE_SPECIAL = "specialGroup"; | |
| 70 | + //亲情群组类型 | |
| 71 | + public static final String GROUP_CUSTOM_VALUE_TYPE_SPECIAL_FAMILY = "specialGroupFamily"; | |
| 72 | + //sp特色群 | |
| 73 | + public static final String GROUP_CUSTOM_VALUE_TYPE_SPECIAL_SP = "specialGroupSp"; | |
| 74 | + //明星群的群组类型也是specialGroupSp,所以根据群组id进行判断以cnlive_subGroup_开头就认为是明星群 | |
| 75 | + public static final String GROUP_STAR_ID_PRE = "cnlive_subGroup_"; | |
| 76 | + //同时转发的最大上线数量 | |
| 77 | + public static final int FORWARD_MAX_LIMIT = 9; | |
| 78 | + //撤回消息的最大时间限制2分钟(ms) | |
| 79 | + public static final int REVOKE_MAX_LIMIT = 2 * 60 * 1000; | |
| 80 | + //撤回消息的重新编辑最大时间限制5分钟(ms) | |
| 81 | + public static final int REVOKE_EDIT_MAX_LIMIT = 5 * 60 * 1000; | |
| 82 | + //聊天页面消息长按 | |
| 83 | + public static final String CHAT_LONG_PRESS_COPY = "复制"; | |
| 84 | + public static final String CHAT_LONG_PRESS_FORWARD = "发送给朋友"; | |
| 85 | + public static final String CHAT_LONG_PRESS_REVOKE = "撤回"; | |
| 86 | + public static final String CHAT_LONG_PRESS_DELETE = "删除"; | |
| 87 | + //此标记是给陌生人发消息失败后重试成功后使用的 | |
| 88 | + public static final String chat_item_stranger_custom_tag_ = "0"; | |
| 89 | + //此标记是给不是好友的陌生人发送消息(除了达人),展示重试按钮用的 | |
| 90 | + public static final String chat_item_stranger_custom_tag = "-1"; | |
| 91 | + //此标记是给群@中有敏感词使用的 | |
| 92 | + public static final String chat_item_group_ait_sensitive_word_message_tag = "-3"; | |
| 93 | + //互动直播聊天id的开头格式 | |
| 94 | + public static final String av_chat_room_is_pre = "AVCR_"; | |
| 95 | + //share link from | |
| 96 | + public static final String share_link_single = "singleMessage"; | |
| 97 | + public static final String share_link_group = "groupMessage"; | |
| 98 | + //群通知的@所有人 | |
| 99 | + public static final String GROUP_NOTICE_AIT_ALL = "@所有人\n"; | |
| 100 | + //聊天列表的订单是否有优惠 | |
| 101 | + public static final String CHAT_ORDER_OFFER_ACTIVITY = "1"; | |
| 102 | + | |
| 103 | + public static final String CHAT_VOICE_TEXT = "转换为文字(仅普通话)"; | |
| 104 | + public static final String CHAT_VOICE_TEXT_MISS = "收起文字"; | |
| 105 | + //群组头像最大展示的个数 | |
| 106 | + public static final int GROUP_FACE_MAX_COUNT = 4; | |
| 107 | + //聊天页面的图片压缩阈值(K),小于此值不进行压缩 | |
| 108 | + public static final int CHAT_IMAGE_COMPRESS_LIMIT = 20 * 1024; | |
| 109 | + //聊天信息页面展示部分群成员,获取200人(目前只展示两行数据,多取点以防这两行数据有人退出) | |
| 110 | + public static final int CHAT_GROUP_CHAT_INFO_MEMBER_MAX_COUNT = 200; | |
| 111 | + //获取群成员接口,因为接口限制不能一次获取太多数据,所以通过分页加载的数据的逻辑,每页200人 | |
| 112 | + public static final int CHAT_GROUP_GET_MEMBER_PAGE_SIZE = 200; | |
| 113 | + //每个群的群成员缓存人数,因为群都是千人大群,不能全部缓存(否则APP读取本地还不如网络快) | |
| 114 | + public static final int CHAT_GROUP_PER_GROUP_CACHE_COUNT = AppConfig.isDebug() ? 10 : 200; | |
| 115 | + //好友列表、达人列表、群@、会话列表的搜索,从前面页面带数据到搜索页面,需要分页存/取,因为数据过多Gson会OOM | |
| 116 | + public static final int CHAT_SEARCH_DATA_PAGE_SIZE = 1000; | |
| 117 | + //领头雁群组id前缀 | |
| 118 | + public static final String CHAT_LTY_GROUP_ID_PRE = "cnlive_subGroup_1261_lty3"; | |
| 119 | + //亲情群的id前缀 | |
| 120 | + public static final String CHAT_FAMILY_GROUP_ID_PRE = "sgf_group"; | |
| 121 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/widget/HorizontalProgressBarWithNumber.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/widget/HorizontalProgressBarWithNumber.java | |
| 1 | +package com.cnlive.publish.widget; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.content.res.TypedArray; | |
| 5 | +import android.graphics.Canvas; | |
| 6 | +import android.graphics.Paint; | |
| 7 | +import android.util.AttributeSet; | |
| 8 | +import android.util.TypedValue; | |
| 9 | +import android.widget.ProgressBar; | |
| 10 | + | |
| 11 | +import com.cnlive.publish.R; | |
| 12 | + | |
| 13 | + | |
| 14 | +public class HorizontalProgressBarWithNumber extends ProgressBar { | |
| 15 | + | |
| 16 | + private static final int DEFAULT_TEXT_SIZE = 10; | |
| 17 | + private static final int DEFAULT_TEXT_COLOR = 0XFFFC00D1; | |
| 18 | + private static final int DEFAULT_COLOR_UNREACHED_COLOR = 0xFFd3d6da; | |
| 19 | + private static final int DEFAULT_HEIGHT_REACHED_PROGRESS_BAR = 2; | |
| 20 | + private static final int DEFAULT_HEIGHT_UNREACHED_PROGRESS_BAR = 2; | |
| 21 | + private static final int DEFAULT_SIZE_TEXT_OFFSET = 10; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * painter of all drawing things | |
| 25 | + */ | |
| 26 | + protected Paint mPaint = new Paint(); | |
| 27 | + /** | |
| 28 | + * color of progress number | |
| 29 | + */ | |
| 30 | + protected int mTextColor = DEFAULT_TEXT_COLOR; | |
| 31 | + /** | |
| 32 | + * size of text (sp) | |
| 33 | + */ | |
| 34 | + protected int mTextSize = sp2px(DEFAULT_TEXT_SIZE); | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * offset of draw progress | |
| 38 | + */ | |
| 39 | + protected int mTextOffset = dp2px(DEFAULT_SIZE_TEXT_OFFSET); | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * height of reached progress bar | |
| 43 | + */ | |
| 44 | + protected int mReachedProgressBarHeight = dp2px(DEFAULT_HEIGHT_REACHED_PROGRESS_BAR); | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * color of reached bar | |
| 48 | + */ | |
| 49 | + protected int mReachedBarColor = DEFAULT_TEXT_COLOR; | |
| 50 | + /** | |
| 51 | + * color of unreached bar | |
| 52 | + */ | |
| 53 | + protected int mUnReachedBarColor = DEFAULT_COLOR_UNREACHED_COLOR; | |
| 54 | + /** | |
| 55 | + * height of unreached progress bar | |
| 56 | + */ | |
| 57 | + protected int mUnReachedProgressBarHeight = dp2px(DEFAULT_HEIGHT_UNREACHED_PROGRESS_BAR); | |
| 58 | + /** | |
| 59 | + * view width except padding | |
| 60 | + */ | |
| 61 | + protected int mRealWidth; | |
| 62 | + | |
| 63 | + protected boolean mIfDrawText = true; | |
| 64 | + | |
| 65 | + protected static final int VISIBLE = 0; | |
| 66 | + | |
| 67 | + public HorizontalProgressBarWithNumber(Context context, AttributeSet attrs) { | |
| 68 | + this(context, attrs, 0); | |
| 69 | + } | |
| 70 | + | |
| 71 | + public HorizontalProgressBarWithNumber(Context context, AttributeSet attrs, | |
| 72 | + int defStyle) { | |
| 73 | + super(context, attrs, defStyle); | |
| 74 | + obtainStyledAttributes(attrs); | |
| 75 | + mPaint.setTextSize(mTextSize); | |
| 76 | + mPaint.setColor(mTextColor); | |
| 77 | + } | |
| 78 | + | |
| 79 | + @Override | |
| 80 | + protected synchronized void onMeasure(int widthMeasureSpec, | |
| 81 | + int heightMeasureSpec) { | |
| 82 | + | |
| 83 | + int width = MeasureSpec.getSize(widthMeasureSpec); | |
| 84 | + int height = measureHeight(heightMeasureSpec); | |
| 85 | + setMeasuredDimension(width, height); | |
| 86 | + | |
| 87 | + mRealWidth = getMeasuredWidth() - getPaddingRight() - getPaddingLeft(); | |
| 88 | + } | |
| 89 | + | |
| 90 | + private int measureHeight(int measureSpec) { | |
| 91 | + int result = 0; | |
| 92 | + int specMode = MeasureSpec.getMode(measureSpec); | |
| 93 | + int specSize = MeasureSpec.getSize(measureSpec); | |
| 94 | + if (specMode == MeasureSpec.EXACTLY) { | |
| 95 | + result = specSize; | |
| 96 | + } else { | |
| 97 | + float textHeight = (mPaint.descent() - mPaint.ascent()); | |
| 98 | + result = (int) (getPaddingTop() + getPaddingBottom() + Math.max( | |
| 99 | + Math.max(mReachedProgressBarHeight, | |
| 100 | + mUnReachedProgressBarHeight), Math.abs(textHeight))); | |
| 101 | + if (specMode == MeasureSpec.AT_MOST) { | |
| 102 | + result = Math.min(result, specSize); | |
| 103 | + } | |
| 104 | + } | |
| 105 | + return result; | |
| 106 | + } | |
| 107 | + | |
| 108 | + /** | |
| 109 | + * get the styled attributes | |
| 110 | + * | |
| 111 | + * @param attrs | |
| 112 | + */ | |
| 113 | + private void obtainStyledAttributes(AttributeSet attrs) { | |
| 114 | + // init values from custom attributes | |
| 115 | + final TypedArray attributes = getContext().obtainStyledAttributes( | |
| 116 | + attrs, R.styleable.HorizontalProgressBarWithNumber); | |
| 117 | + | |
| 118 | + mTextColor = attributes | |
| 119 | + .getColor( | |
| 120 | + R.styleable.HorizontalProgressBarWithNumber_progress_text_color, | |
| 121 | + DEFAULT_TEXT_COLOR); | |
| 122 | + mTextSize = (int) attributes.getDimension( | |
| 123 | + R.styleable.HorizontalProgressBarWithNumber_progress_text_size, | |
| 124 | + mTextSize); | |
| 125 | + | |
| 126 | + mReachedBarColor = attributes | |
| 127 | + .getColor( | |
| 128 | + R.styleable.HorizontalProgressBarWithNumber_progress_reached_color, | |
| 129 | + mTextColor); | |
| 130 | + mUnReachedBarColor = attributes | |
| 131 | + .getColor( | |
| 132 | + R.styleable.HorizontalProgressBarWithNumber_progress_unreached_color, | |
| 133 | + DEFAULT_COLOR_UNREACHED_COLOR); | |
| 134 | + mReachedProgressBarHeight = (int) attributes | |
| 135 | + .getDimension( | |
| 136 | + R.styleable.HorizontalProgressBarWithNumber_progress_reached_bar_height, | |
| 137 | + mReachedProgressBarHeight); | |
| 138 | + mUnReachedProgressBarHeight = (int) attributes | |
| 139 | + .getDimension( | |
| 140 | + R.styleable.HorizontalProgressBarWithNumber_progress_unreached_bar_height, | |
| 141 | + mUnReachedProgressBarHeight); | |
| 142 | + mTextOffset = (int) attributes | |
| 143 | + .getDimension( | |
| 144 | + R.styleable.HorizontalProgressBarWithNumber_progress_text_offset, | |
| 145 | + mTextOffset); | |
| 146 | + | |
| 147 | + int textVisible = attributes | |
| 148 | + .getInt(R.styleable.HorizontalProgressBarWithNumber_progress_text_visibility, | |
| 149 | + VISIBLE); | |
| 150 | + if (textVisible != VISIBLE) { | |
| 151 | + mIfDrawText = false; | |
| 152 | + } | |
| 153 | + attributes.recycle(); | |
| 154 | + } | |
| 155 | + | |
| 156 | + @Override | |
| 157 | + protected synchronized void onDraw(Canvas canvas) { | |
| 158 | + | |
| 159 | + canvas.save(); | |
| 160 | + canvas.translate(getPaddingLeft(), getHeight() / 2); | |
| 161 | + | |
| 162 | + boolean noNeedBg = false; | |
| 163 | + float radio = getProgress() * 1.0f / getMax(); | |
| 164 | + float progressPosX = (int) (mRealWidth * radio); | |
| 165 | + String text = getProgress() + "%"; | |
| 166 | + // mPaint.getTextBounds(text, 0, text.length(), mTextBound); | |
| 167 | + | |
| 168 | + float textWidth = mPaint.measureText(text); | |
| 169 | + float textHeight = (mPaint.descent() + mPaint.ascent()) / 2; | |
| 170 | + | |
| 171 | + if (progressPosX + textWidth > mRealWidth) { | |
| 172 | + progressPosX = mRealWidth - textWidth; | |
| 173 | + noNeedBg = true; | |
| 174 | + } | |
| 175 | + | |
| 176 | + // draw reached bar | |
| 177 | + float endX = progressPosX - mTextOffset / 2; | |
| 178 | + if (endX > 0) { | |
| 179 | + mPaint.setColor(mReachedBarColor); | |
| 180 | + mPaint.setStrokeWidth(mReachedProgressBarHeight); | |
| 181 | + canvas.drawLine(0, 0, endX, 0, mPaint); | |
| 182 | + } | |
| 183 | + // draw progress bar | |
| 184 | + // measure text bound | |
| 185 | + if (mIfDrawText) { | |
| 186 | + mPaint.setColor(mTextColor); | |
| 187 | + canvas.drawText(text, progressPosX, -textHeight, mPaint); | |
| 188 | + } | |
| 189 | + | |
| 190 | + // draw unreached bar | |
| 191 | + if (!noNeedBg) { | |
| 192 | + float start = progressPosX + mTextOffset / 2 + textWidth; | |
| 193 | + mPaint.setColor(mUnReachedBarColor); | |
| 194 | + mPaint.setStrokeWidth(mUnReachedProgressBarHeight); | |
| 195 | + canvas.drawLine(start, 0, mRealWidth, 0, mPaint); | |
| 196 | + } | |
| 197 | + | |
| 198 | + canvas.restore(); | |
| 199 | + | |
| 200 | + } | |
| 201 | + | |
| 202 | + /** | |
| 203 | + * dp 2 px | |
| 204 | + * | |
| 205 | + * @param dpVal | |
| 206 | + */ | |
| 207 | + protected int dp2px(int dpVal) { | |
| 208 | + return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, | |
| 209 | + dpVal, getResources().getDisplayMetrics()); | |
| 210 | + } | |
| 211 | + | |
| 212 | + /** | |
| 213 | + * sp 2 px | |
| 214 | + * | |
| 215 | + * @param spVal | |
| 216 | + * @return | |
| 217 | + */ | |
| 218 | + protected int sp2px(int spVal) { | |
| 219 | + return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, | |
| 220 | + spVal, getResources().getDisplayMetrics()); | |
| 221 | + | |
| 222 | + } | |
| 223 | + | |
| 224 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/widget/RecycleViewDivider.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/widget/RecycleViewDivider.java | |
| 1 | +package com.cnlive.publish.widget; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.content.res.TypedArray; | |
| 5 | +import android.graphics.Canvas; | |
| 6 | +import android.graphics.Paint; | |
| 7 | +import android.graphics.Rect; | |
| 8 | +import android.graphics.drawable.Drawable; | |
| 9 | +import android.view.View; | |
| 10 | + | |
| 11 | +import androidx.core.content.ContextCompat; | |
| 12 | +import androidx.recyclerview.widget.RecyclerView; | |
| 13 | + | |
| 14 | +public class RecycleViewDivider extends RecyclerView.ItemDecoration { | |
| 15 | + | |
| 16 | + private Paint mPaint; | |
| 17 | + private Drawable mDivider; | |
| 18 | + private int mDividerHeight = 2;//分割线高度,默认为1px | |
| 19 | + private static final int[] ATTRS = new int[]{android.R.attr.listDivider}; | |
| 20 | + | |
| 21 | + public RecycleViewDivider(Context context) { | |
| 22 | + | |
| 23 | + final TypedArray a = context.obtainStyledAttributes(ATTRS); | |
| 24 | + mDivider = a.getDrawable(0); | |
| 25 | + a.recycle(); | |
| 26 | + } | |
| 27 | + | |
| 28 | + public RecycleViewDivider(Context context, int drawableId) { | |
| 29 | + this(context); | |
| 30 | + mDivider = ContextCompat.getDrawable(context, drawableId); | |
| 31 | + mDividerHeight = mDivider.getIntrinsicHeight(); | |
| 32 | + } | |
| 33 | + | |
| 34 | + public RecycleViewDivider(Context context, int dividerHeight, int dividerColor) { | |
| 35 | + this(context); | |
| 36 | + mDividerHeight = dividerHeight; | |
| 37 | + mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | |
| 38 | + mPaint.setColor(dividerColor); | |
| 39 | + mPaint.setStyle(Paint.Style.FILL); | |
| 40 | + } | |
| 41 | + | |
| 42 | + @Override | |
| 43 | + public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { | |
| 44 | + super.getItemOffsets(outRect, view, parent, state); | |
| 45 | + outRect.set(mDividerHeight / 1, 0, mDividerHeight / 2, mDividerHeight); | |
| 46 | + } | |
| 47 | + | |
| 48 | + @Override | |
| 49 | + public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) { | |
| 50 | + super.onDraw(c, parent, state); | |
| 51 | + drawVertical(c, parent); | |
| 52 | + } | |
| 53 | + | |
| 54 | + private void drawVertical(Canvas canvas, RecyclerView parent) { | |
| 55 | + final int top = parent.getPaddingTop(); | |
| 56 | + final int bottom = parent.getMeasuredHeight() - parent.getPaddingBottom(); | |
| 57 | + final int childSize = parent.getChildCount(); | |
| 58 | + for (int i = 0; i < childSize; i++) { | |
| 59 | + final View child = parent.getChildAt(i); | |
| 60 | + RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) child.getLayoutParams(); | |
| 61 | + final int left = child.getRight() + layoutParams.rightMargin; | |
| 62 | + final int right = left + mDividerHeight; | |
| 63 | + if (mDivider != null) { | |
| 64 | + mDivider.setBounds(left, top, right, bottom); | |
| 65 | + mDivider.draw(canvas); | |
| 66 | + } | |
| 67 | + if (mPaint != null) { | |
| 68 | + canvas.drawRect(left, top, right, bottom, mPaint); | |
| 69 | + } | |
| 70 | + } | |
| 71 | + } | |
| 72 | +} | |
| 0 | 73 | \ No newline at end of file | ... | ... |
publish/src/main/java/com/cnlive/publish/widget/ResizeFrameLayout.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/widget/ResizeFrameLayout.java | |
| 1 | +package com.cnlive.publish.widget; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.util.AttributeSet; | |
| 5 | +import android.util.DisplayMetrics; | |
| 6 | +import android.widget.FrameLayout; | |
| 7 | + | |
| 8 | +public class ResizeFrameLayout extends FrameLayout { | |
| 9 | + private KeyboardListener mListener; | |
| 10 | + private int minKeyboardHeight; | |
| 11 | + | |
| 12 | + public interface KeyboardListener { | |
| 13 | + void onKeyboardShown(int height); | |
| 14 | + | |
| 15 | + void onKeyboardHidden(int height); | |
| 16 | + } | |
| 17 | + | |
| 18 | + public ResizeFrameLayout(Context context) { | |
| 19 | + super(context); | |
| 20 | + } | |
| 21 | + | |
| 22 | + public ResizeFrameLayout(Context context, AttributeSet attrs) { | |
| 23 | + super(context, attrs); | |
| 24 | + } | |
| 25 | + | |
| 26 | + public ResizeFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { | |
| 27 | + super(context, attrs, defStyleAttr); | |
| 28 | + } | |
| 29 | + | |
| 30 | + public void setKeyboardListener(KeyboardListener listener) { | |
| 31 | + mListener = listener; | |
| 32 | + } | |
| 33 | + | |
| 34 | + @Override | |
| 35 | + protected void onAttachedToWindow() { | |
| 36 | + super.onAttachedToWindow(); | |
| 37 | + // 认为键盘最小高度为屏幕的1/4 | |
| 38 | + DisplayMetrics dm = getResources().getDisplayMetrics(); | |
| 39 | + minKeyboardHeight = dm.heightPixels / 4; | |
| 40 | + } | |
| 41 | + | |
| 42 | + @Override | |
| 43 | + protected void onSizeChanged(int w, int h, int oldw, int oldh) { | |
| 44 | + super.onSizeChanged(w, h, oldw, oldh); | |
| 45 | + if (h == 0 || oldh == 0) { | |
| 46 | + return; | |
| 47 | + } | |
| 48 | + if (oldh - h > minKeyboardHeight) { | |
| 49 | + notifyKeyboardEvent(true, oldh - h); | |
| 50 | + } else if (h - oldh > minKeyboardHeight) { | |
| 51 | + notifyKeyboardEvent(false, h - oldh); | |
| 52 | + } | |
| 53 | + } | |
| 54 | + | |
| 55 | + private void notifyKeyboardEvent(boolean show, int keyboardHeight) { | |
| 56 | + if (mListener == null) { | |
| 57 | + return; | |
| 58 | + } | |
| 59 | + if (show) { | |
| 60 | + mListener.onKeyboardShown(keyboardHeight); | |
| 61 | + } else { | |
| 62 | + mListener.onKeyboardHidden(keyboardHeight); | |
| 63 | + } | |
| 64 | + } | |
| 65 | +} | ... | ... |
publish/src/main/java/com/cnlive/publish/widget/RoundProgressBarWidthNumber.java
0 → 100644
| 1 | +++ a/publish/src/main/java/com/cnlive/publish/widget/RoundProgressBarWidthNumber.java | |
| 1 | +package com.cnlive.publish.widget; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.content.res.TypedArray; | |
| 5 | +import android.graphics.Canvas; | |
| 6 | +import android.graphics.Paint.Cap; | |
| 7 | +import android.graphics.Paint.Style; | |
| 8 | +import android.graphics.RectF; | |
| 9 | +import android.util.AttributeSet; | |
| 10 | + | |
| 11 | +import com.cnlive.publish.R; | |
| 12 | + | |
| 13 | + | |
| 14 | +public class RoundProgressBarWidthNumber extends | |
| 15 | + HorizontalProgressBarWithNumber { | |
| 16 | + /** | |
| 17 | + * mRadius of view | |
| 18 | + */ | |
| 19 | + private int mRadius = dp2px(30); | |
| 20 | + private int mMaxPaintWidth; | |
| 21 | + | |
| 22 | + public RoundProgressBarWidthNumber(Context context) { | |
| 23 | + this(context, null); | |
| 24 | + } | |
| 25 | + | |
| 26 | + public RoundProgressBarWidthNumber(Context context, AttributeSet attrs) { | |
| 27 | + super(context, attrs); | |
| 28 | + | |
| 29 | + mReachedProgressBarHeight = (int) (mUnReachedProgressBarHeight * 2.0f); | |
| 30 | + TypedArray ta = context.obtainStyledAttributes(attrs, | |
| 31 | + R.styleable.RoundProgressBarWidthNumber); | |
| 32 | + mRadius = (int) ta.getDimension( | |
| 33 | + R.styleable.RoundProgressBarWidthNumber_progress_radius, mRadius); | |
| 34 | + ta.recycle(); | |
| 35 | + | |
| 36 | + mPaint.setStyle(Style.STROKE); | |
| 37 | + mPaint.setAntiAlias(true); | |
| 38 | + mPaint.setDither(true); | |
| 39 | + mPaint.setStrokeCap(Cap.ROUND); | |
| 40 | + | |
| 41 | + } | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 这里默认在布局中padding值要么不设置,要么全部设置 | |
| 45 | + */ | |
| 46 | + @Override | |
| 47 | + protected synchronized void onMeasure(int widthMeasureSpec, | |
| 48 | + int heightMeasureSpec) { | |
| 49 | + | |
| 50 | + mMaxPaintWidth = Math.max(mReachedProgressBarHeight, | |
| 51 | + mUnReachedProgressBarHeight); | |
| 52 | + int expect = mRadius * 2 + mMaxPaintWidth + getPaddingLeft() | |
| 53 | + + getPaddingRight(); | |
| 54 | + int width = resolveSize(expect, widthMeasureSpec); | |
| 55 | + int height = resolveSize(expect, heightMeasureSpec); | |
| 56 | + int realWidth = Math.min(width, height); | |
| 57 | + | |
| 58 | + mRadius = (realWidth - getPaddingLeft() - getPaddingRight() - mMaxPaintWidth) / 2; | |
| 59 | + | |
| 60 | + setMeasuredDimension(realWidth, realWidth); | |
| 61 | + | |
| 62 | + } | |
| 63 | + | |
| 64 | + @Override | |
| 65 | + protected synchronized void onDraw(Canvas canvas) { | |
| 66 | + | |
| 67 | + String text = +getProgress() + "%"; | |
| 68 | + float textWidth = mPaint.measureText(text); | |
| 69 | + float textHeight = (mPaint.descent() + mPaint.ascent()) / 2; | |
| 70 | + | |
| 71 | + canvas.save(); | |
| 72 | + canvas.translate(getPaddingLeft() + mMaxPaintWidth / 2, getPaddingTop() | |
| 73 | + + mMaxPaintWidth / 2); | |
| 74 | + mPaint.setStyle(Style.STROKE); | |
| 75 | + // draw unreaded bar | |
| 76 | + | |
| 77 | + mPaint.setColor(mUnReachedBarColor); | |
| 78 | + mPaint.setStrokeWidth(mUnReachedProgressBarHeight); | |
| 79 | + canvas.drawCircle(mRadius, mRadius, mRadius, mPaint); | |
| 80 | + // draw reached bar | |
| 81 | + mPaint.setColor(mReachedBarColor); | |
| 82 | + mPaint.setStrokeWidth(mReachedProgressBarHeight); | |
| 83 | + float sweepAngle = getProgress() * 1.0f / getMax() * 360; | |
| 84 | + canvas.drawArc(new RectF(0, 0, mRadius * 2, mRadius * 2), 0, | |
| 85 | + sweepAngle, false, mPaint); | |
| 86 | + // draw text | |
| 87 | + mPaint.setStyle(Style.FILL); | |
| 88 | + canvas.drawText(text, mRadius - textWidth / 2, mRadius - textHeight, | |
| 89 | + mPaint); | |
| 90 | + | |
| 91 | + canvas.restore(); | |
| 92 | + | |
| 93 | + } | |
| 94 | + | |
| 95 | +} | ... | ... |
publish/src/main/res/drawable-hdpi/choose.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/choose_line.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/circle_photo.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/comment_emoji.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/comment_emoji_hover.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/fb_bof.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/fb_shanchu.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/fb_tjsc.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/fb_tjsp.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/fb_weixuan.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/fb_weizhi.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/fb_wenzi.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/fb_xiangji.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/fb_xuanzhong.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/fb_zctj.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/locationrefresh.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/mjz_bq.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/mjz_go.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/mjz_q.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/mjz_sq.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/mjz_zk.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/monkey_tag.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/monkeyaddress.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-hdpi/puq_xiaolian.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/choose.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/choose_line.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/circle_photo.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/comment_emoji.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/comment_emoji_hover.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/fb_bof.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/fb_shanchu.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/fb_tjsc.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/fb_tjsp.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/fb_weixuan.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/fb_weizhi.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/fb_wenzi.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/fb_xiangji.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/fb_xuanzhong.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/fb_zctj.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/locationrefresh.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/mjz_bq.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/mjz_go.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/mjz_q.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/mjz_sq.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/mjz_zk.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/monkey_tag.png
0 → 100644
711 Bytes
publish/src/main/res/drawable-xhdpi/monkeyaddress.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/puq_xiaolian.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xhdpi/white.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/choose.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/choose_line.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/circle_photo.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/comment_emoji_hover.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/fb_bof.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/fb_shanchu.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/fb_tjsc.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/fb_tjsp.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/fb_weixuan.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/fb_weizhi.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/fb_wenzi.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/fb_xiangji.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/fb_xuanzhong.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/fb_zctj.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/locationrefresh.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/mjz_bq.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/mjz_go.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/mjz_q.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/mjz_sq.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/mjz_zk.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/monkey_tag.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/monkeyaddress.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable-xxhdpi/puq_xiaolian.webp
0 → 100644
No preview for this file type
publish/src/main/res/drawable/bg_image_loading.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/drawable/bg_image_loading.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:shape="rectangle"> | |
| 4 | + | |
| 5 | + <corners android:radius="5dp" /> | |
| 6 | + <stroke | |
| 7 | + android:width="@dimen/list_divider_height" | |
| 8 | + android:color="@color/color_c3c3c3" /> | |
| 9 | + | |
| 10 | + <solid android:color="#f2f2f2" /> | |
| 11 | + | |
| 12 | + <corners | |
| 13 | + android:bottomLeftRadius="4dp" | |
| 14 | + android:bottomRightRadius="4dp" | |
| 15 | + android:topLeftRadius="4dp" | |
| 16 | + android:topRightRadius="4dp" /> <!-- 设置四个角的半径 --> | |
| 17 | + | |
| 18 | +</shape> | |
| 0 | 19 | \ No newline at end of file | ... | ... |
publish/src/main/res/drawable/bg_location_check.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/drawable/bg_location_check.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + | |
| 4 | + <item android:drawable="@drawable/fb_xuanzhong" android:state_checked="true" android:state_enabled="false" /> | |
| 5 | + <item android:drawable="@drawable/fb_xuanzhong" android:state_checked="true" android:state_enabled="true" /> | |
| 6 | + <item android:drawable="@drawable/fb_weixuan" android:state_checked="false" /> | |
| 7 | + | |
| 8 | +</selector> | |
| 0 | 9 | \ No newline at end of file | ... | ... |
publish/src/main/res/drawable/bg_location_check_monkey.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/drawable/bg_location_check_monkey.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + | |
| 4 | + <item android:drawable="@drawable/choose" android:state_checked="true" android:state_enabled="false" /> | |
| 5 | + <item android:drawable="@drawable/choose" android:state_checked="true" android:state_enabled="true" /> | |
| 6 | + <item android:drawable="@drawable/choose_line" android:state_checked="false" /> | |
| 7 | + | |
| 8 | +</selector> | |
| 0 | 9 | \ No newline at end of file | ... | ... |
publish/src/main/res/drawable/edit_cursor.xml
0 → 100644
publish/src/main/res/drawable/expression_face_selector.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/drawable/expression_face_selector.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + <item android:state_pressed="true" android:drawable="@drawable/comment_emoji" /> | |
| 4 | + <item android:state_pressed="false" android:drawable="@drawable/comment_emoji" /> | |
| 5 | +</selector> | ... | ... |
publish/src/main/res/drawable/expression_keyboard_selector.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/drawable/expression_keyboard_selector.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + <item android:state_pressed="true" android:drawable="@drawable/comment_emoji_hover" /> | |
| 4 | + <item android:state_pressed="false" android:drawable="@drawable/comment_emoji_hover" /> | |
| 5 | +</selector> | ... | ... |
publish/src/main/res/drawable/item_search2_history.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/drawable/item_search2_history.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:shape="rectangle"> | |
| 4 | + <stroke | |
| 5 | + android:width="1dp" | |
| 6 | + android:color="@color/color_12d919" /> | |
| 7 | + <size android:height="1dp" /> | |
| 8 | + <corners android:radius="25dp" /> | |
| 9 | +</shape> | |
| 0 | 10 | \ No newline at end of file | ... | ... |
publish/src/main/res/drawable/item_search3_history.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/drawable/item_search3_history.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android" > | |
| 3 | + <corners android:radius="25dip"/> | |
| 4 | + <solid android:color="#F9F9F9"/> | |
| 5 | +</shape> | |
| 0 | 6 | \ No newline at end of file | ... | ... |
publish/src/main/res/drawable/item_search_history.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/drawable/item_search_history.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:shape="rectangle"> | |
| 4 | + <stroke | |
| 5 | + android:width="1dp" | |
| 6 | + android:color="@color/color_d4d5da" /> | |
| 7 | + <solid android:color="#F9F9F9"/> | |
| 8 | + <size android:height="1dp" /> | |
| 9 | + <corners android:radius="25dp" /> | |
| 10 | +</shape> | |
| 0 | 11 | \ No newline at end of file | ... | ... |
publish/src/main/res/drawable/progressbg.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/drawable/progressbg.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + | |
| 4 | + <corners android:radius="20dp" | |
| 5 | + /> | |
| 6 | + <solid android:color="@color/black" | |
| 7 | + /> | |
| 8 | +</shape> | |
| 0 | 9 | \ No newline at end of file | ... | ... |
publish/src/main/res/drawable/shape_circle.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/drawable/shape_circle.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:shape="rectangle"> | |
| 4 | + <gradient | |
| 5 | + android:centerColor="#00000000" | |
| 6 | + android:endColor="#00000000" | |
| 7 | + android:startColor="#00000000" | |
| 8 | + android:type="linear" /> | |
| 9 | + <size | |
| 10 | + android:width="9dp" | |
| 11 | + android:height="5dp" /> | |
| 12 | + | |
| 13 | +</shape> | ... | ... |
publish/src/main/res/layout/fragment_release_info_edit.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/layout/fragment_release_info_edit.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | |
| 4 | + xmlns:tools="http://schemas.android.com/tools"> | |
| 5 | + | |
| 6 | + <data> | |
| 7 | + | |
| 8 | + <variable | |
| 9 | + name="data" | |
| 10 | + type="com.cnlive.publish.moudle.ReleaseMediaPage" /> | |
| 11 | + | |
| 12 | + <variable | |
| 13 | + name="onClick" | |
| 14 | + type="android.view.View.OnClickListener" /> | |
| 15 | + | |
| 16 | + <variable | |
| 17 | + name="onTouch" | |
| 18 | + type="android.view.View.OnTouchListener" /> | |
| 19 | + | |
| 20 | + <variable | |
| 21 | + name="onCheck" | |
| 22 | + type="android.widget.RadioGroup.OnCheckedChangeListener" /> | |
| 23 | + </data> | |
| 24 | + | |
| 25 | + <RelativeLayout | |
| 26 | + android:id="@+id/layout" | |
| 27 | + android:layout_width="match_parent" | |
| 28 | + android:layout_height="match_parent" | |
| 29 | + android:background="@color/white"> | |
| 30 | + | |
| 31 | + <include | |
| 32 | + android:id="@+id/includeToolbar" | |
| 33 | + layout="@layout/layout_back_toolbar" /> | |
| 34 | + | |
| 35 | + <TextView | |
| 36 | + android:id="@+id/bartitle" | |
| 37 | + android:layout_width="wrap_content" | |
| 38 | + android:layout_height="wrap_content" | |
| 39 | + android:layout_centerHorizontal="true" | |
| 40 | + android:layout_marginTop="15dp" | |
| 41 | + android:text="@={data.title}" | |
| 42 | + android:textColor="@color/black" | |
| 43 | + android:textSize="18sp" /> | |
| 44 | + | |
| 45 | + | |
| 46 | + <com.cnlive.strike.ui.widget.NetImageView | |
| 47 | + android:id="@+id/monkey" | |
| 48 | + android:layout_width="match_parent" | |
| 49 | + android:layout_height="match_parent" | |
| 50 | + android:layout_marginTop="?attr/qmui_topbar_height" | |
| 51 | + tools:background="@drawable/white" | |
| 52 | + /> | |
| 53 | + | |
| 54 | + <com.cnlive.publish.frame.view.MyScrollView | |
| 55 | + android:id="@+id/monkeyview" | |
| 56 | + android:layout_width="match_parent" | |
| 57 | + android:layout_height="match_parent" | |
| 58 | + android:layout_marginTop="?attr/qmui_topbar_height" | |
| 59 | + android:background="@color/transparent"> | |
| 60 | + | |
| 61 | + <RelativeLayout | |
| 62 | + android:layout_width="match_parent" | |
| 63 | + android:layout_height="wrap_content" | |
| 64 | + android:orientation="vertical"> | |
| 65 | + | |
| 66 | + <View | |
| 67 | + android:id="@+id/firstline" | |
| 68 | + android:layout_width="match_parent" | |
| 69 | + android:layout_height="0.5dp" | |
| 70 | + android:background="@color/color_eeeeee" /> | |
| 71 | + | |
| 72 | + <RelativeLayout | |
| 73 | + android:id="@+id/circle" | |
| 74 | + android:layout_width="match_parent" | |
| 75 | + android:layout_height="60dp" | |
| 76 | + android:orientation="horizontal" | |
| 77 | + android:visibility="gone" | |
| 78 | + > | |
| 79 | + | |
| 80 | + <ImageView | |
| 81 | + android:id="@+id/mjzq" | |
| 82 | + android:layout_width="wrap_content" | |
| 83 | + android:layout_height="wrap_content" | |
| 84 | + android:layout_marginStart="12dp" | |
| 85 | + android:layout_marginTop="@dimen/dp_20" | |
| 86 | + android:src="@drawable/mjz_q" /> | |
| 87 | + | |
| 88 | + <TextView | |
| 89 | + android:layout_width="wrap_content" | |
| 90 | + android:layout_height="wrap_content" | |
| 91 | + android:layout_alignStart="@+id/mjzq" | |
| 92 | + android:layout_marginStart="@dimen/dp_30" | |
| 93 | + android:layout_marginTop="@dimen/dp_20" | |
| 94 | + android:text="发布到圈子" /> | |
| 95 | + | |
| 96 | + | |
| 97 | + <Button | |
| 98 | + android:id="@+id/gobutton" | |
| 99 | + android:layout_width="wrap_content" | |
| 100 | + android:layout_height="wrap_content" | |
| 101 | + android:layout_alignParentEnd="true" | |
| 102 | + android:layout_centerVertical="true" | |
| 103 | + android:layout_marginEnd="20dp" | |
| 104 | + android:background="@color/white" | |
| 105 | + android:drawableEnd="@drawable/mjz_go" | |
| 106 | + android:onClick="@{onClick}" | |
| 107 | + android:text="@={data.wit}" | |
| 108 | + android:textColor="#333333" /> | |
| 109 | + | |
| 110 | + </RelativeLayout> | |
| 111 | + | |
| 112 | + <View | |
| 113 | + android:id="@+id/secondline" | |
| 114 | + android:layout_width="match_parent" | |
| 115 | + android:layout_height="0.5dp" | |
| 116 | + android:layout_below="@+id/circle" | |
| 117 | + android:background="@color/color_eeeeee" | |
| 118 | + android:visibility="gone" | |
| 119 | + /> | |
| 120 | + | |
| 121 | + | |
| 122 | + <!-- <com.cnlive.libs.emoj.widget.SimpleEditText | |
| 123 | + android:id="@+id/message" | |
| 124 | + android:layout_width="match_parent" | |
| 125 | + android:layout_height="110dp" | |
| 126 | + android:layout_below="@+id/secondline" | |
| 127 | + android:layout_marginLeft="12dp" | |
| 128 | + android:layout_marginRight="12dp" | |
| 129 | + android:layout_marginTop="8dp" | |
| 130 | + android:background="@color/white" | |
| 131 | + android:gravity="top" | |
| 132 | + android:focusableInTouchMode="true" | |
| 133 | + android:hint="@string/circletmesg" | |
| 134 | + android:imeOptions="flagNoFullscreen|flagNoExtractUi|actionNone" | |
| 135 | + android:maxLength="10000" | |
| 136 | + android:maxLines="6" | |
| 137 | + android:padding="8dp" | |
| 138 | + android:text="@={data.message}" | |
| 139 | + android:textColor="@color/text_input_color" | |
| 140 | + android:textColorHint="@color/color_edit_hint" | |
| 141 | + android:textCursorDrawable="@drawable/edit_cursor" | |
| 142 | + android:textSize="15sp" | |
| 143 | + app:onTouchListener="@{onTouch}" />--> | |
| 144 | + | |
| 145 | + <com.cnlive.libs.emoj.widget.ExpressionEditText | |
| 146 | + android:id="@+id/message" | |
| 147 | + android:layout_width="match_parent" | |
| 148 | + android:layout_height="110dp" | |
| 149 | + android:layout_below="@+id/firstline" | |
| 150 | + android:layout_marginLeft="12dp" | |
| 151 | + android:layout_marginTop="8dp" | |
| 152 | + android:layout_marginRight="12dp" | |
| 153 | + android:background="@color/transparent" | |
| 154 | + android:focusableInTouchMode="true" | |
| 155 | + android:gravity="top" | |
| 156 | + android:hint="@string/circletmesg" | |
| 157 | + android:imeOptions="flagNoFullscreen|flagNoExtractUi|actionNone" | |
| 158 | + android:maxLength="10000" | |
| 159 | + android:maxLines="6" | |
| 160 | + android:padding="8dp" | |
| 161 | + android:text="@={data.message}" | |
| 162 | + android:textColor="@color/text_input_color" | |
| 163 | + android:textColorHint="@color/color_edit_hint" | |
| 164 | + android:textCursorDrawable="@drawable/edit_cursor" | |
| 165 | + android:textSize="15sp" | |
| 166 | + app:onTouchListener="@{onTouch}" /> | |
| 167 | + | |
| 168 | + <TextView | |
| 169 | + android:id="@+id/messageCount" | |
| 170 | + android:layout_width="wrap_content" | |
| 171 | + android:layout_height="wrap_content" | |
| 172 | + android:layout_below="@+id/message" | |
| 173 | + android:layout_alignEnd="@+id/message" | |
| 174 | + android:layout_margin="8dp" | |
| 175 | + android:textColor="@color/color_989898" | |
| 176 | + android:textSize="12sp" | |
| 177 | + tools:text="(0/10000字以内)" /> | |
| 178 | + | |
| 179 | + <RelativeLayout | |
| 180 | + android:id="@+id/contentLayout" | |
| 181 | + android:layout_width="wrap_content" | |
| 182 | + android:layout_height="wrap_content" | |
| 183 | + android:background="@color/transparent" | |
| 184 | + android:layout_below="@+id/messageCount"> | |
| 185 | + | |
| 186 | + <RelativeLayout | |
| 187 | + android:id="@+id/sharelink" | |
| 188 | + android:layout_width="match_parent" | |
| 189 | + android:layout_height="60dp" | |
| 190 | + android:layout_marginLeft="15dp" | |
| 191 | + android:layout_marginTop="10dp" | |
| 192 | + android:layout_marginRight="15dp" | |
| 193 | + android:background="#F3F3F6" | |
| 194 | + android:visibility="@{data.shareVisibility}"> | |
| 195 | + | |
| 196 | + <com.cnlive.strike.ui.widget.NetImageView | |
| 197 | + android:id="@+id/sharepic" | |
| 198 | + android:layout_width="40dp" | |
| 199 | + android:layout_height="40dp" | |
| 200 | + android:layout_marginStart="10dp" | |
| 201 | + android:layout_marginTop="10dp" | |
| 202 | + android:layout_marginBottom="10dp" | |
| 203 | + app:setImageUrl="@{data.sharepic}" | |
| 204 | + /> | |
| 205 | + | |
| 206 | + <TextView | |
| 207 | + android:id="@+id/sharetitle" | |
| 208 | + android:layout_width="match_parent" | |
| 209 | + android:layout_height="wrap_content" | |
| 210 | + android:layout_centerVertical="true" | |
| 211 | + android:layout_marginStart="5dp" | |
| 212 | + android:layout_toEndOf="@+id/sharepic" | |
| 213 | + android:ellipsize="end" | |
| 214 | + android:maxLines="2" | |
| 215 | + android:text="@{data.sharetit}" | |
| 216 | + android:textSize="15sp" | |
| 217 | + tools:text="分享标题" /> | |
| 218 | + | |
| 219 | + </RelativeLayout> | |
| 220 | + | |
| 221 | + | |
| 222 | + <androidx.recyclerview.widget.RecyclerView | |
| 223 | + android:id="@+id/recyclerView" | |
| 224 | + android:layout_width="match_parent" | |
| 225 | + android:layout_height="wrap_content" | |
| 226 | + android:layout_below="@+id/sharelink" | |
| 227 | + android:layout_marginLeft="12dp" | |
| 228 | + android:layout_marginTop="6dp" | |
| 229 | + android:layout_marginRight="12dp" | |
| 230 | + android:minHeight="120dp" | |
| 231 | + android:visibility="@{data.recyclerVisibility}" | |
| 232 | + app:adapter="@{data.adapter}" /> | |
| 233 | + | |
| 234 | + <com.cnlive.strike.ui.widget.NetImageView | |
| 235 | + android:id="@+id/iswit" | |
| 236 | + android:layout_width="116dp" | |
| 237 | + android:layout_height="116dp" | |
| 238 | + android:layout_marginLeft="12dp" | |
| 239 | + android:layout_marginTop="6dp" | |
| 240 | + android:layout_marginRight="12dp" | |
| 241 | + android:visibility="@{data.isWitVisibility}" | |
| 242 | + app:setImageUrlWit="@{data.witimg}" /> | |
| 243 | + </RelativeLayout> | |
| 244 | + | |
| 245 | + | |
| 246 | + <RelativeLayout | |
| 247 | + android:id="@+id/bottomLayout" | |
| 248 | + android:layout_width="match_parent" | |
| 249 | + android:layout_height="45dp" | |
| 250 | + android:layout_below="@+id/contentLayout" | |
| 251 | + android:layout_marginTop="25dp" | |
| 252 | + android:layout_marginBottom="0dp" | |
| 253 | + android:orientation="horizontal" | |
| 254 | + android:visibility="@{data.locationVisibility}" | |
| 255 | + android:weightSum="2"> | |
| 256 | + | |
| 257 | + <CheckBox | |
| 258 | + android:id="@+id/closeAddress" | |
| 259 | + android:layout_width="20dp" | |
| 260 | + android:layout_height="20dp" | |
| 261 | + android:layout_alignParentEnd="true" | |
| 262 | + android:layout_centerVertical="true" | |
| 263 | + android:layout_marginEnd="20dp" | |
| 264 | + android:background="@drawable/bg_location_check" | |
| 265 | + android:button="@null" | |
| 266 | + android:padding="15dp" | |
| 267 | + android:checked="true" /> | |
| 268 | + | |
| 269 | + <TextView | |
| 270 | + android:id="@+id/address" | |
| 271 | + android:layout_width="wrap_content" | |
| 272 | + android:layout_height="wrap_content" | |
| 273 | + android:layout_centerVertical="true" | |
| 274 | + android:layout_marginStart="20dp" | |
| 275 | + android:drawableStart="@drawable/fb_weizhi" | |
| 276 | + android:drawablePadding="11dp" | |
| 277 | + android:textSize="12sp" | |
| 278 | + tools:text="当前位置" /> | |
| 279 | + | |
| 280 | + <TextView | |
| 281 | + android:id="@+id/locatagain" | |
| 282 | + android:layout_width="wrap_content" | |
| 283 | + android:layout_height="wrap_content" | |
| 284 | + android:text="重新获取" | |
| 285 | + android:textColor="#ff999999" | |
| 286 | + android:textSize="12sp" | |
| 287 | + android:layout_centerVertical="true" | |
| 288 | + android:layout_toStartOf="@+id/locationrefresh" | |
| 289 | + android:layout_marginEnd="6dp" | |
| 290 | + android:onClick="@{onClick}" | |
| 291 | + android:visibility="gone" | |
| 292 | + /> | |
| 293 | + <ImageView | |
| 294 | + android:id="@+id/locationrefresh" | |
| 295 | + android:layout_width="14dp" | |
| 296 | + android:layout_height="14dp" | |
| 297 | + android:src="@drawable/locationrefresh" | |
| 298 | + android:onClick="@{onClick}" | |
| 299 | + android:layout_alignParentEnd="true" | |
| 300 | + android:layout_centerVertical="true" | |
| 301 | + android:layout_marginEnd="20dp" | |
| 302 | + android:visibility="gone" | |
| 303 | + /> | |
| 304 | + <View | |
| 305 | + android:id="@+id/adline" | |
| 306 | + android:layout_width="match_parent" | |
| 307 | + android:layout_height="0.5dp" | |
| 308 | + android:background="@color/color_eeeeee" /> | |
| 309 | + | |
| 310 | + <View | |
| 311 | + android:id="@+id/adline1" | |
| 312 | + android:layout_width="match_parent" | |
| 313 | + android:layout_height="0.5dp" | |
| 314 | + android:layout_alignParentBottom="true" | |
| 315 | + android:background="@color/color_eeeeee" /> | |
| 316 | + </RelativeLayout> | |
| 317 | + | |
| 318 | + <RelativeLayout | |
| 319 | + android:id="@+id/tagLayout" | |
| 320 | + android:layout_width="match_parent" | |
| 321 | + android:layout_height="45dp" | |
| 322 | + android:layout_below="@+id/bottomLayout" | |
| 323 | + android:layout_marginBottom="15dp" | |
| 324 | + android:orientation="horizontal" | |
| 325 | + android:visibility="@{data.tagVisibility}" | |
| 326 | + android:weightSum="2"> | |
| 327 | + | |
| 328 | + <!--<TextView | |
| 329 | + android:id="@+id/chosetag" | |
| 330 | + android:layout_width="wrap_content" | |
| 331 | + android:layout_height="wrap_content" | |
| 332 | + android:layout_alignParentRight="true" | |
| 333 | + android:layout_centerVertical="true" | |
| 334 | + android:layout_marginRight="20dp" | |
| 335 | + android:text="@{data.tagtext}" | |
| 336 | + android:visibility="invisible" />--> | |
| 337 | + | |
| 338 | + <ImageView | |
| 339 | + android:id="@+id/zk" | |
| 340 | + android:layout_width="wrap_content" | |
| 341 | + android:layout_height="wrap_content" | |
| 342 | + android:layout_alignParentEnd="true" | |
| 343 | + android:layout_centerVertical="true" | |
| 344 | + android:layout_marginEnd="20dp" | |
| 345 | + android:onClick="@{onClick}" | |
| 346 | + android:paddingStart="60dp" | |
| 347 | + android:paddingTop="10dp" | |
| 348 | + android:paddingBottom="10dp" | |
| 349 | + android:paddingEnd="10dp" | |
| 350 | + android:src="@drawable/mjz_zk" | |
| 351 | + android:visibility="@{data.zkVisibility}" /> | |
| 352 | + | |
| 353 | + <ImageView | |
| 354 | + android:id="@+id/sq" | |
| 355 | + android:layout_width="wrap_content" | |
| 356 | + android:layout_height="wrap_content" | |
| 357 | + android:layout_alignParentEnd="true" | |
| 358 | + android:layout_centerVertical="true" | |
| 359 | + android:layout_marginEnd="20dp" | |
| 360 | + android:onClick="@{onClick}" | |
| 361 | + android:paddingStart="60dp" | |
| 362 | + android:paddingTop="10dp" | |
| 363 | + android:paddingBottom="10dp" | |
| 364 | + android:paddingEnd="10dp" | |
| 365 | + android:src="@drawable/mjz_sq" | |
| 366 | + android:visibility="@{data.sqVisibility}" /> | |
| 367 | + | |
| 368 | + | |
| 369 | + <TextView | |
| 370 | + android:id="@+id/tag" | |
| 371 | + android:layout_width="wrap_content" | |
| 372 | + android:layout_height="wrap_content" | |
| 373 | + android:layout_centerVertical="true" | |
| 374 | + android:layout_marginStart="20dp" | |
| 375 | + android:drawableStart="@drawable/mjz_bq" | |
| 376 | + android:drawablePadding="11dp" | |
| 377 | + android:text="标签" | |
| 378 | + android:textSize="15sp" /> | |
| 379 | + | |
| 380 | + <View | |
| 381 | + android:id="@+id/adline3" | |
| 382 | + android:layout_width="match_parent" | |
| 383 | + android:layout_height="0.5dp" | |
| 384 | + android:background="@color/color_eeeeee" /> | |
| 385 | + | |
| 386 | + <View | |
| 387 | + android:id="@+id/adline2" | |
| 388 | + android:layout_width="match_parent" | |
| 389 | + android:layout_height="0.5dp" | |
| 390 | + android:layout_alignParentBottom="true" | |
| 391 | + android:background="@color/color_eeeeee" /> | |
| 392 | + </RelativeLayout> | |
| 393 | + | |
| 394 | + <com.qmuiteam.qmui.widget.QMUIFloatLayout | |
| 395 | + android:id="@+id/gp" | |
| 396 | + android:layout_width="match_parent" | |
| 397 | + android:layout_height="wrap_content" | |
| 398 | + android:layout_below="@+id/tagLayout" | |
| 399 | + android:layout_margin="20dp" | |
| 400 | + android:visibility="@{data.radioGroupVisibility}" | |
| 401 | + app:qmui_childHorizontalSpacing="20dp" | |
| 402 | + app:qmui_childVerticalSpacing="10dp" | |
| 403 | + app:qmui_maxNumber="100" /> | |
| 404 | + </RelativeLayout> | |
| 405 | + </com.cnlive.publish.frame.view.MyScrollView> | |
| 406 | + | |
| 407 | + <LinearLayout | |
| 408 | + android:layout_width="match_parent" | |
| 409 | + android:layout_height="wrap_content" | |
| 410 | + android:orientation="vertical"> | |
| 411 | + | |
| 412 | + <View | |
| 413 | + android:id="@+id/topView" | |
| 414 | + android:layout_width="match_parent" | |
| 415 | + android:layout_height="match_parent" /> | |
| 416 | + | |
| 417 | + <RelativeLayout android:id="@+id/emoticonsButtonLayout" | |
| 418 | + android:layout_width="match_parent" | |
| 419 | + android:layout_height="49dp" | |
| 420 | + android:background="@color/transparent"> | |
| 421 | + | |
| 422 | + <View | |
| 423 | + android:layout_width="match_parent" | |
| 424 | + android:layout_height="49dp" | |
| 425 | + android:layout_alignParentTop="true" | |
| 426 | + android:background="@color/color_f2f2f2" /> | |
| 427 | + | |
| 428 | + <ImageView | |
| 429 | + android:id="@+id/emoticons_button" | |
| 430 | + android:layout_width="28dp" | |
| 431 | + android:layout_height="28dp" | |
| 432 | + android:layout_centerVertical="true" | |
| 433 | + android:layout_marginStart="11dp" | |
| 434 | + android:onClick="@{onClick}" | |
| 435 | + android:src="@drawable/puq_xiaolian" /> | |
| 436 | + | |
| 437 | + </RelativeLayout> | |
| 438 | + | |
| 439 | + <FrameLayout | |
| 440 | + android:id="@+id/emojicons" | |
| 441 | + android:layout_width="match_parent" | |
| 442 | + android:layout_height="match_parent" | |
| 443 | + android:visibility="gone" /> | |
| 444 | + </LinearLayout> | |
| 445 | + | |
| 446 | + <ImageView | |
| 447 | + android:id="@+id/cover" | |
| 448 | + android:layout_width="match_parent" | |
| 449 | + android:layout_height="match_parent" | |
| 450 | + android:background="@color/transparent" | |
| 451 | + android:visibility="gone" | |
| 452 | + /> | |
| 453 | + | |
| 454 | + <RelativeLayout | |
| 455 | + android:id="@+id/profa" | |
| 456 | + android:layout_width="140dp" | |
| 457 | + android:layout_height="110dp" | |
| 458 | + android:layout_centerInParent="true" | |
| 459 | + android:background="@drawable/progressbg" | |
| 460 | + android:alpha="0.7" | |
| 461 | + android:visibility="gone"> | |
| 462 | + | |
| 463 | + <TextView | |
| 464 | + android:id="@+id/wenan" | |
| 465 | + android:layout_width="wrap_content" | |
| 466 | + android:layout_height="wrap_content" | |
| 467 | + android:layout_below="@+id/progress" | |
| 468 | + android:layout_centerHorizontal="true" | |
| 469 | + android:layout_marginTop="3dp" | |
| 470 | + android:text="上传中..." | |
| 471 | + android:textColor="#ffffffff" | |
| 472 | + android:visibility="gone" /> | |
| 473 | + | |
| 474 | + <TextView | |
| 475 | + android:id="@+id/zip" | |
| 476 | + android:layout_width="wrap_content" | |
| 477 | + android:layout_height="wrap_content" | |
| 478 | + android:layout_centerInParent="true" | |
| 479 | + android:layout_marginTop="3dp" | |
| 480 | + android:text="压缩中..." | |
| 481 | + android:textColor="#ffffffff" /> | |
| 482 | + | |
| 483 | + <com.cnlive.publish.widget.RoundProgressBarWidthNumber | |
| 484 | + android:id="@+id/progress" | |
| 485 | + android:layout_width="wrap_content" | |
| 486 | + android:layout_height="wrap_content" | |
| 487 | + android:layout_centerHorizontal="true" | |
| 488 | + android:layout_marginTop="15dp" | |
| 489 | + android:progress="0" | |
| 490 | + android:visibility="gone" | |
| 491 | + app:progress_text_color="#ffffffff" | |
| 492 | + app:progress_text_size="15sp" | |
| 493 | + app:progress_unreached_color="#ffffffff" | |
| 494 | + app:progress_radius="30dp" /> | |
| 495 | + | |
| 496 | + | |
| 497 | + </RelativeLayout> | |
| 498 | + | |
| 499 | + <com.cnlive.publish.widget.ResizeFrameLayout | |
| 500 | + android:id="@+id/calculationView" | |
| 501 | + android:layout_width="match_parent" | |
| 502 | + android:layout_height="match_parent" /> | |
| 503 | + </RelativeLayout> | |
| 504 | + | |
| 505 | +</layout> | |
| 0 | 506 | \ No newline at end of file | ... | ... |
publish/src/main/res/layout/layout_back_toolbar.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/layout/layout_back_toolbar.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<com.qmuiteam.qmui.widget.QMUITopBar xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:id="@+id/topbar" | |
| 4 | + android:layout_width="match_parent" | |
| 5 | + android:layout_height="?attr/qmui_topbar_height" /> | |
| 6 | + | ... | ... |
publish/src/main/res/layout/list_item_release_media.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/layout/list_item_release_media.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | |
| 4 | + xmlns:tools="http://schemas.android.com/tools"> | |
| 5 | + | |
| 6 | + <data> | |
| 7 | + | |
| 8 | + <variable | |
| 9 | + name="data" | |
| 10 | + type="com.cnlive.publish.moudle.ReleaseMediaItem" /> | |
| 11 | + </data> | |
| 12 | + | |
| 13 | + <RelativeLayout | |
| 14 | + android:id="@+id/workBenchView" | |
| 15 | + android:layout_width="match_parent" | |
| 16 | + android:layout_height="100dp" | |
| 17 | + android:onClick="@{data.listener}"> | |
| 18 | + | |
| 19 | + <com.cnlive.strike.ui.widget.NetImageView | |
| 20 | + android:id="@+id/item_icon" | |
| 21 | + android:layout_width="match_parent" | |
| 22 | + android:layout_height="match_parent" | |
| 23 | + android:layout_centerInParent="true" | |
| 24 | + android:visibility="@{data.iconVisibility}" | |
| 25 | + app:net_image_radius="3dp" | |
| 26 | + app:setRoundedIcon="@{data.imagePath}" /> | |
| 27 | + | |
| 28 | + <ImageView | |
| 29 | + android:id="@+id/bofang" | |
| 30 | + android:layout_width="wrap_content" | |
| 31 | + android:layout_height="wrap_content" | |
| 32 | + android:background="@color/transparent" | |
| 33 | + android:layout_centerInParent="true" | |
| 34 | + android:src="@drawable/fb_bof" | |
| 35 | + android:visibility="@{data.bofangvisiable}" | |
| 36 | + /> | |
| 37 | + | |
| 38 | + <ImageView | |
| 39 | + android:id="@+id/item_delete" | |
| 40 | + android:layout_width="23dp" | |
| 41 | + android:layout_height="23dp" | |
| 42 | + android:layout_alignParentRight="true" | |
| 43 | + android:layout_margin="2dp" | |
| 44 | + android:src="@drawable/fb_shanchu" | |
| 45 | + android:visibility="@{data.iconVisibility}" | |
| 46 | + android:onClick="@{data.listener}"/> | |
| 47 | + | |
| 48 | + <RelativeLayout | |
| 49 | + android:id="@+id/tagLayout" | |
| 50 | + android:layout_width="wrap_content" | |
| 51 | + android:layout_height="wrap_content" | |
| 52 | + android:layout_centerInParent="true" | |
| 53 | + android:visibility="@{data.tagVisibility}"> | |
| 54 | + | |
| 55 | + <ImageView | |
| 56 | + android:id="@+id/addIcon" | |
| 57 | + android:layout_width="match_parent" | |
| 58 | + android:layout_height="match_parent" | |
| 59 | + app:setImageResource="@{data.iconRes}" | |
| 60 | + android:scaleType="fitCenter" | |
| 61 | + android:visibility="@{data.nullvisiable}" | |
| 62 | + /> | |
| 63 | + <!--app:setImageUrl="@{data.shareItem.icon}"--> | |
| 64 | + <ImageView | |
| 65 | + android:id="@+id/addIcon2" | |
| 66 | + android:layout_width="match_parent" | |
| 67 | + android:layout_height="match_parent" | |
| 68 | + android:src="@drawable/fb_zctj" | |
| 69 | + android:scaleType="fitCenter" | |
| 70 | + android:visibility="@{data.addvisiable}" | |
| 71 | + /> | |
| 72 | + | |
| 73 | + <TextView | |
| 74 | + android:id="@+id/tag" | |
| 75 | + android:layout_width="wrap_content" | |
| 76 | + android:layout_height="wrap_content" | |
| 77 | + android:layout_alignTop="@+id/addIcon" | |
| 78 | + android:layout_centerHorizontal="true" | |
| 79 | + android:layout_marginTop="66dp" | |
| 80 | + android:text="@{data.addTag}" | |
| 81 | + android:textColor="@color/color_989898" | |
| 82 | + android:textSize="12sp" | |
| 83 | + tools:text="" /> | |
| 84 | + | |
| 85 | + </RelativeLayout> | |
| 86 | + | |
| 87 | + </RelativeLayout> | |
| 88 | +</layout> | |
| 0 | 89 | \ No newline at end of file | ... | ... |
publish/src/main/res/values/attr_progress_bar.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/values/attr_progress_bar.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<resources> | |
| 3 | + | |
| 4 | + <declare-styleable name="HorizontalProgressBarWithNumber"> | |
| 5 | + <attr name="progress_unreached_color" format="color" /> | |
| 6 | + <attr name="progress_reached_color" format="color" /> | |
| 7 | + <attr name="progress_reached_bar_height" format="dimension" /> | |
| 8 | + <attr name="progress_unreached_bar_height" format="dimension" /> | |
| 9 | + <attr name="progress_text_size" format="dimension" /> | |
| 10 | + <attr name="progress_text_color" format="color" /> | |
| 11 | + <attr name="progress_text_offset" format="dimension" /> | |
| 12 | + <attr name="progress_text_visibility" format="enum"> | |
| 13 | + <enum name="visible" value="0" /> | |
| 14 | + <enum name="invisible" value="1" /> | |
| 15 | + </attr> | |
| 16 | + </declare-styleable> | |
| 17 | + | |
| 18 | + <declare-styleable name="RoundProgressBarWidthNumber"> | |
| 19 | + <attr name="progress_radius" format="dimension" /> | |
| 20 | + </declare-styleable> | |
| 21 | + | |
| 22 | +</resources> | |
| 0 | 23 | \ No newline at end of file | ... | ... |
publish/src/main/res/values/colors.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/values/colors.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<resources> | |
| 3 | + <!-- common --> | |
| 4 | + <color name="app_color_blue">#00A8E1</color> | |
| 5 | + <color name="app_color_blue_disabled">#8000A8E1</color> | |
| 6 | + <color name="app_color_blue_pressed">#c000A8E1</color> | |
| 7 | + | |
| 8 | + <color name="app_color_blue_2">#31BDF3</color> | |
| 9 | + <color name="app_color_blue_2_disabled">#7F31BDF3</color> | |
| 10 | + <color name="app_color_blue_2_pressed">#7F31BDF3</color> | |
| 11 | + | |
| 12 | + <color name="app_color_theme_1">#EF5362</color> <!-- Grapefruit --> | |
| 13 | + <color name="app_color_theme_2">#FE6D4B</color> <!-- Bittersweet --> | |
| 14 | + <color name="app_color_theme_3">#FFCF47</color> <!-- Sunflower --> | |
| 15 | + <color name="app_color_theme_4">#9FD661</color> <!-- Grass --> | |
| 16 | + <color name="app_color_theme_5">#3FD0AD</color> <!-- Mint --> | |
| 17 | + <color name="app_color_theme_6">#2BBDF3</color> <!-- Aqua --> | |
| 18 | + <color name="app_color_theme_7">#5A9AEF</color> <!-- Blue Jeans --> | |
| 19 | + <color name="app_color_theme_8">#AC8FEF</color> <!-- Lavender --> | |
| 20 | + <color name="app_color_theme_9">#EE85C1</color> <!-- Pink Rose --> | |
| 21 | + | |
| 22 | + <color name="app_color_description">@color/qmui_config_color_gray_5</color> | |
| 23 | + | |
| 24 | + <color name="bar_divider">#D4D6D8</color> | |
| 25 | + <color name="tab_panel_bg">#ffffff</color> | |
| 26 | + <color name="tab_panel_divider">@color/bar_divider</color> | |
| 27 | + | |
| 28 | + <!-- Components 组件 --> | |
| 29 | + <color name="radiusImageView_border_color">@color/app_color_theme_2</color> | |
| 30 | + <color name="radiusImageView_selected_border_color">@color/app_color_theme_1</color> | |
| 31 | + <color name="radiusImageView_selected_mask_color">#7FEF5362</color> | |
| 32 | + | |
| 33 | + <!-- Helper 系列界面 --> | |
| 34 | + | |
| 35 | + <!-- ColorHelper 颜色工具 --> | |
| 36 | + <color name="colorHelper_square_alpha_background">@color/app_color_theme_4</color> | |
| 37 | + <color name="colorHelper_square_from_ratio_background">@color/app_color_blue</color> | |
| 38 | + <color name="colorHelper_square_to_ratio_background">@color/app_color_theme_3</color> | |
| 39 | + | |
| 40 | + <!--新版主界面绿色背景色--> | |
| 41 | + <color name="main_bg_color">#16CC89</color> | |
| 42 | + <!-- 测试 --> | |
| 43 | + | |
| 44 | + | |
| 45 | + <color name="colorPrimary">#3F51B5</color> | |
| 46 | + <color name="colorPrimaryDark">#303F9F</color> | |
| 47 | + <color name="colorAccent">#FF4081</color> | |
| 48 | + | |
| 49 | + <color name="color_1e1e23">#1e1e23</color> | |
| 50 | + <color name="white">#ffffff</color> | |
| 51 | + <color name="monkey">#DA4336</color> | |
| 52 | + <color name="topview">#F5C269</color> | |
| 53 | + <color name="monkeytitle">#573801</color> | |
| 54 | + <color name="monkeyline">#ffeead3d</color> | |
| 55 | + <color name="monkeytag">#F2A116</color> | |
| 56 | + <color name="backgroundgray">#eeeeee</color> | |
| 57 | + <color name="titleWhite">#f5f5f5</color> | |
| 58 | + <color name="titleBlue">#0096FF</color> | |
| 59 | + <color name="titleBlue2">#0195FF</color> | |
| 60 | + <color name="textBlue">#324d82</color> | |
| 61 | + <color name="textBlueLight">#23a4ff</color> | |
| 62 | + <color name="bggreen">#52c6ff</color> | |
| 63 | + <color name="bgYellow">#ffb952</color> | |
| 64 | + <color name="greenlight">#79ca05</color> | |
| 65 | + <color name="greenlight2">#a6e34e</color> | |
| 66 | + <color name="appTextBlue">#28a6ff</color> | |
| 67 | + <color name="appTextGray">#888888</color> | |
| 68 | + <color name="blackalpha">#cc000000</color> | |
| 69 | + <color name="whiteShallow">#fdfdfd</color> | |
| 70 | + <color name="whiteGary">#f2f2f2</color> | |
| 71 | + <color name="whiteTxtBg">#f9f9f9</color> | |
| 72 | + <color name="redText">#f46d6a</color> | |
| 73 | + <color name="redBorder">#ff3433</color> | |
| 74 | + <color name="redSelect">#E84A4A</color> | |
| 75 | + <color name="blueName">#576b95</color> | |
| 76 | + <color name="blueText">#597bba</color> | |
| 77 | + <color name="black">#ff000000</color> | |
| 78 | + <color name="blacktext">#1c1c1c</color> | |
| 79 | + <color name="oldGray">#505050</color> | |
| 80 | + <color name="old2Gray">#3f3f3f</color> | |
| 81 | + <color name="titleBlack">#3e3e3e</color> | |
| 82 | + <color name="textBlack">#202020</color> | |
| 83 | + <color name="contentBlack">#444444</color> | |
| 84 | + <color name="examBgBlue">#CDE5FF</color> | |
| 85 | + <color name="textRed">#ff4e3c</color> | |
| 86 | + <color name="commentBlack">#5d5d5d</color> | |
| 87 | + <color name="grayAction">#e1e1e1</color> | |
| 88 | + <color name="grayText">#aaaaaa</color> | |
| 89 | + <color name="newgrayText">#52c7f3</color> | |
| 90 | + <color name="grayA">#aaaaaa</color> | |
| 91 | + <color name="grayText2">#8f8f8f</color> | |
| 92 | + <color name="grayText3">#757575</color> | |
| 93 | + <color name="grayLine">#b4b4b4</color> | |
| 94 | + <color name="grayLine2">#dedede</color> | |
| 95 | + <color name="lightBlue1">#00a2ff</color> | |
| 96 | + <color name="lightBlue2">#008ee0</color> | |
| 97 | + <color name="lightBlue3">#036eac</color> | |
| 98 | + <color name="brownBlack">#3E4B54</color> | |
| 99 | + <color name="other">#fff00f</color> | |
| 100 | + <color name="blue">#0000FF</color> | |
| 101 | + <color name="bannerbg">#DFDED4</color> | |
| 102 | + <color name="lightBlueDark">#00436a</color> | |
| 103 | + <color name="garyClickBg">#f3f3f3</color> | |
| 104 | + <color name="grayBlack">#6b6b6b</color> | |
| 105 | + <color name="grayBlack2">#a9a9a9</color> | |
| 106 | + <color name="grayBlack3">#bebebe</color> | |
| 107 | + <color name="garyTrigon">#dadada</color> | |
| 108 | + <color name="garyLight">#d4d4d4</color> | |
| 109 | + <color name="garyLight2">#e3e3e3</color> | |
| 110 | + <color name="garyLight3">#e9e9e9</color> | |
| 111 | + <color name="garyLight4">#e6e6e6</color> | |
| 112 | + <color name="garyLight5">#f8f8f8</color> | |
| 113 | + <color name="transparent">#00000000</color> | |
| 114 | + <color name="mask">#90000000</color> | |
| 115 | + <color name="maskLight">#70000000</color> | |
| 116 | + <color name="deepBlue">#0082db</color> | |
| 117 | + <color name="deepBlue2">#006ab3</color> | |
| 118 | + <color name="drakBlue">#41598a</color> | |
| 119 | + <color name="wheelBlue">#3598da</color> | |
| 120 | + <color name="wheelBlue_press">#1c4a68</color> | |
| 121 | + | |
| 122 | + <color name="border_danxiang">#ff6b57</color> | |
| 123 | + <color name="border_duoxuan">#57d2ff</color> | |
| 124 | + <color name="border_budingxiang">#ffb657</color> | |
| 125 | + <color name="border_panduan">#1e83ff</color> | |
| 126 | + <color name="border_tiankong">#ed49d8</color> | |
| 127 | + <color name="border_zhuguang">#57ffc6</color> | |
| 128 | + <color name="examcardblue">#55baff</color> | |
| 129 | + <color name="mooc_index_gray">#717171</color> | |
| 130 | + <color name="mooc_index_alphe">#bb000000</color> | |
| 131 | + <color name="mooc_index_alphe2">#77000000</color> | |
| 132 | + <color name="mooc_index_dirgray">#d9d9d9</color> | |
| 133 | + <color name="mooc_index_appheblack">#cc000000</color> | |
| 134 | + <color name="yellowBotton">#ff8400</color> | |
| 135 | + <color name="yellowBotton2">#ff6600</color> | |
| 136 | + | |
| 137 | + <color name="gray">#808080</color> | |
| 138 | + <color name="red">#ff0000</color> | |
| 139 | + <color name="redNewMsg">#f43531</color> | |
| 140 | + | |
| 141 | + <color name="lightGray">#BFBFBF</color> | |
| 142 | + <color name="unfocused">#cccccccc</color> | |
| 143 | + <color name="pressed">#fff22fff</color> | |
| 144 | + <color name="selected">#fff33fff</color> | |
| 145 | + <color name="focused">#ffff44ff</color> | |
| 146 | + | |
| 147 | + | |
| 148 | + <color name="none_color">#00000000</color> | |
| 149 | + | |
| 150 | + <color name="yancy_green500">#259b24</color> | |
| 151 | + <color name="yancy_green600">#0a8f08</color> | |
| 152 | + <color name="yancy_green700">#0a7e07</color> | |
| 153 | + <color name="yancy_green800">#056f00</color> | |
| 154 | + <color name="yancy_background">#181819</color> | |
| 155 | + <color name="dark_gray">#FF343535</color> | |
| 156 | + <color name="text_gray">#FF999999</color> | |
| 157 | + <color name="photo_mask">#88000000</color> | |
| 158 | + <color name="separation">#FFDCDCDC</color> | |
| 159 | + <color name="text_black">#FF333333</color> | |
| 160 | + | |
| 161 | + <color name="background_tab_pressed">#6633B5E5</color> | |
| 162 | + <color name="gray_line_color">#dcdcdc</color> | |
| 163 | + <color name="new_background">#eeeeee</color> | |
| 164 | + <color name="config_black_color">#323333</color> | |
| 165 | + <color name="config_gray_color">#969797</color> | |
| 166 | + | |
| 167 | + <!--数字,包括评论,转发,点赞栏的颜色-白天 --> | |
| 168 | + <color name="detail_count_bg">#FFFFFF</color> | |
| 169 | + <color name="detail_normal_text">#828282</color> | |
| 170 | + <color name="detail_highlight_text">#000000</color> | |
| 171 | + <color name="detail_config_order">#151515</color> | |
| 172 | + | |
| 173 | + <color name="comment_text_select">#000000</color> | |
| 174 | + <color name="comment_text_normal">#828282</color> | |
| 175 | + | |
| 176 | + <color name="main_tab_spinner_line_color">#D5D5D5</color> | |
| 177 | + <color name="text_input_color">#323333</color> | |
| 178 | + <color name="text_hint_color">#969797</color> | |
| 179 | + <color name="text_comment_hint_color">#C7CAD2</color> | |
| 180 | + | |
| 181 | + <color name="color_282828">#282828</color> | |
| 182 | + <color name="color_989898">#989898</color> | |
| 183 | + <color name="color_ffa300">#1AAD19</color> | |
| 184 | + <color name="color_f2f2f2">#f2f2f2</color> | |
| 185 | + <color name="color_f3f3f3">#f3f3f3</color> | |
| 186 | + <color name="color_656565">#656565</color> | |
| 187 | + <color name="color_999999">#999999</color> | |
| 188 | + <color name="color_26d521">#26d521</color> | |
| 189 | + <color name="color_99f2f2f2">#99f2f2f2</color> | |
| 190 | + <color name="color_898989">#898989</color> | |
| 191 | + | |
| 192 | + <color name="color_ff3355">#ff3355</color> | |
| 193 | + <color name="color_c3c3c3">#c3c3c3</color> | |
| 194 | + <color name="color_fff">#ffffff</color> | |
| 195 | + <color name="color_000">#000000</color> | |
| 196 | + | |
| 197 | + <color name="color_bg_dialog">#f5f7f7f7</color> | |
| 198 | + <color name="color_dialog_btn">#282828</color> | |
| 199 | + <color name="none_color_half">#b3000000</color> | |
| 200 | + | |
| 201 | + <color name="color_bg">#f2f2f2</color> | |
| 202 | + <color name="color_edit_hint">#c3c3c3</color> | |
| 203 | + <color name="color_b3000000">#b3000000</color> | |
| 204 | + <color name="color_b8bbc0">#b8bbc0</color> | |
| 205 | + <color name="color_f6f6f7">#f6f6f7</color> | |
| 206 | + <color name="color_686868">#686868</color> | |
| 207 | + <color name="color_232326">#232326</color> | |
| 208 | + <color name="color_666666">#666666</color> | |
| 209 | + <color name="color_1aad19">#1aad19</color> | |
| 210 | + <color name="color_939ba4">#939ba4</color> | |
| 211 | + <color name="color_b3ffffff">#b3ffffff</color> | |
| 212 | + <color name="color_5C8CC1">#5c8cc1</color> | |
| 213 | + <color name="color_63d18b">#63d18b</color> | |
| 214 | + <color name="color_333">#333333</color> | |
| 215 | + <color name="color_66cccc">#66cccc</color> | |
| 216 | + <color name="color_555555">#555555</color> | |
| 217 | + <color name="color_f5f6f7">#f5f6f7</color> | |
| 218 | + <color name="color_adadad">#adadad</color> | |
| 219 | + <color name="color_99ffffff">#99ffffff</color> | |
| 220 | + <color name="color_7cbd83">#7cbd83</color> | |
| 221 | + <color name="color_f3f4f5">#f3f4f5</color> | |
| 222 | + <color name="color_e7e7e7">#e7e7e7</color> | |
| 223 | + <color name="color_f4f4f4">#f4f4f4</color> | |
| 224 | + <color name="color_4a515">#4a515c</color> | |
| 225 | + | |
| 226 | + <color name="color_f6f6f6">#f6f6f6</color> | |
| 227 | + <color name="color_f9f9f9">#f9f9f9</color> | |
| 228 | + <color name="color_31d231">#31d231</color> | |
| 229 | + <color name="color_e6e6e6">#e6e6e6</color> | |
| 230 | + <color name="color_585858">#585858</color> | |
| 231 | + <color name="color_82da7f">#82da7f</color> | |
| 232 | + <color name="color_f7f7f7">#f7f7f7</color> | |
| 233 | + <color name="color_23d41e">#23d41e</color> | |
| 234 | + <color name="color_f9fbfc">#f9fbfc</color> | |
| 235 | + <color name="color_f3f6f8">#f3f6f8</color> | |
| 236 | + <color name="color_4a4a4a">#4a4a4a</color> | |
| 237 | + | |
| 238 | + <color name="color_24bc22">#24bc22</color> | |
| 239 | + <color name="color_363637">#363637</color> | |
| 240 | + <color name="color_d4d5da">#d4d5da</color> | |
| 241 | + | |
| 242 | + <color name="color_12d919">#12d919</color> | |
| 243 | + <color name="color_3b3b3b">#3b3b3b</color> | |
| 244 | + <color name="color_0abe06">#0abe06</color> | |
| 245 | + | |
| 246 | + <color name="color_99e999">#99e999</color> | |
| 247 | + <color name="color_a3a3a3">#3a3a3a</color> | |
| 248 | + <color name="color_afafaf">#afafaf</color> | |
| 249 | + <color name="color_343434">#343434</color> | |
| 250 | + <color name="color_00bababb">#bababb</color> | |
| 251 | + <color name="color_0b0b0b">#0b0b0b</color> | |
| 252 | + <color name="color_868686">#868686</color> | |
| 253 | + <color name="color_222222">#222222</color> | |
| 254 | + <color name="color_c8c7cc">#c8c7cc</color> | |
| 255 | + <color name="color_ebebeb">#ebebeb</color> | |
| 256 | + <color name="color_e5e5e5">#e5e5e5</color> | |
| 257 | + <color name="color_777">#777777</color> | |
| 258 | + <color name="color_0bbe06">#0bbe06</color> | |
| 259 | + <color name="color_dfdfdf">#dfdfdf</color> | |
| 260 | + <color name="color_f5f5f9">#f5f5f9</color> | |
| 261 | + <color name="color_00c200">#00c200</color> | |
| 262 | + <color name="color_353535">#353535</color> | |
| 263 | + <color name="color_d8d8d8">#d8d8d8</color> | |
| 264 | + <color name="color_3a3a3a">#3a3a3a</color> | |
| 265 | + <color name="color_a5a5a5">#a5a5a5</color> | |
| 266 | + <color name="color_888888">#888888</color> | |
| 267 | + <color name="color_00c900">#00c900</color> | |
| 268 | + <color name="color_eeeeee">#eeeeee</color> | |
| 269 | + <color name="color_8a8a8a">#8a8a8a</color> | |
| 270 | + <color name="color_b3b3b3">#b3b3b3</color> | |
| 271 | + <color name="color_e8e8e8">#e8e8e8</color> | |
| 272 | + <color name="color_00d636">#00d636</color> | |
| 273 | + | |
| 274 | + <color name="color_232323">#232323</color> | |
| 275 | + <color name="color_7b7b7b">#7b7b7b</color> | |
| 276 | + <color name="color_c1bebd">#c1bebd</color> | |
| 277 | + <color name="color_33ffffff">#33ffffff</color> | |
| 278 | + <color name="ff4e51">#ff4e51</color> | |
| 279 | + <color name="color_ff5800">#ff5800</color> | |
| 280 | + <color name="color_cbd3d7">#cbd3d7</color> | |
| 281 | + <color name="color_e3e3e3">#e3e3e3</color> | |
| 282 | + <color name="color_b3b2b2">#b3b2b2</color> | |
| 283 | + <color name="color_23d31e">#23d31e</color> | |
| 284 | + <color name="color_4d000000">#4d000000</color> | |
| 285 | + <color name="color_b9bdc5">#b9bdc5</color> | |
| 286 | + <color name="color_remark_dialog_ok">#007AFF</color> | |
| 287 | + <color name="color_remark">#ff2b91e2</color> | |
| 288 | + <color name="color_Divider">#c1bebd</color> | |
| 289 | + <color name="color_4c000000">#4c000000</color> | |
| 290 | + <color name="color_driver">#f2f3f4</color> | |
| 291 | + <color name="color_969696">#969696</color> | |
| 292 | + <color name="color_ddd">#dddddd</color> | |
| 293 | + <color name="color_bg_config">#F6F6F6</color> | |
| 294 | + <color name="color_13CC0C">#13CC0C</color> | |
| 295 | + <color name="color_1E2128">#1E2128</color> | |
| 296 | + <color name="transparent_background">#50000000</color> | |
| 297 | + <color name="listcolor">#25C888</color> | |
| 298 | + <color name="logot_green">#ff0bbe06</color> | |
| 299 | + <!--生活圈和视频动态 文字颜色--> | |
| 300 | + <color name="life_circle_and_video">#666666</color> | |
| 301 | + <!--矩形imageView的边框颜色--> | |
| 302 | + <color name="qmui_border_color">#F4F4F4</color> | |
| 303 | + <!--隐私页面完成按钮颜色--> | |
| 304 | + <color name="btn_green">#23D41E</color> | |
| 305 | + <color name="btn_gray">#4C000000</color> | |
| 306 | + <color name="btn_cant_click">#9EF4A7</color> | |
| 307 | + <color name="line">#EEEEEE</color> | |
| 308 | + | |
| 309 | + <color name="im_connect_error_bg">#FFEFF0</color> | |
| 310 | + <color name="im_connect_ing_bg">#00ffffff</color> | |
| 311 | + <color name="color_999">#ff999999</color> | |
| 312 | + <color name="mian_header_view_bg_color">#0D000000</color> | |
| 313 | + | |
| 314 | + <color name="color_ad">#eeaaaaaa</color> | |
| 315 | + <color name="color_home_selected">#FF3E45</color> | |
| 316 | + <color name="color_home_select">#999999</color> | |
| 317 | + | |
| 318 | + <color name="color_skin_dragon_boat_festival_selected">#3F9C43</color> | |
| 319 | + <color name="color_skin_dragon_boat_festival_select">#B2D5BB</color> | |
| 320 | + | |
| 321 | + <color name="color_cecece">#CECECE</color> | |
| 322 | + <color name="color_21BC23">#21BC23</color> | |
| 323 | + <color name="shareOut">#767676</color> | |
| 324 | + <color name="color_054C08">#054C08</color> | |
| 325 | + <color name="address_color">#fffe4646</color> | |
| 326 | + <color name="tagchose">#30928F</color> | |
| 327 | + <color name="tagnotchose">#999999</color> | |
| 328 | +</resources> | ... | ... |
publish/src/main/res/values/dimens.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/values/dimens.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<resources> | |
| 3 | + <!-- HomeFragment --> | |
| 4 | + <dimen name="home_tab_height">53dp</dimen> | |
| 5 | + <dimen name="common_content_spacing">@dimen/qmui_content_spacing_horizontal</dimen> | |
| 6 | + <!-- ListView --> | |
| 7 | + <dimen name="list_divider_height">1px</dimen> | |
| 8 | + <dimen name="list_divider_height_negative">-1px</dimen> | |
| 9 | + | |
| 10 | + <!-- Default screen margins, per the Android Design guidelines. --> | |
| 11 | + <dimen name="activity_horizontal_margin">16dp</dimen> | |
| 12 | + <dimen name="activity_vertical_margin">16dp</dimen> | |
| 13 | + | |
| 14 | + <dimen name="indicator_right_padding">10dp</dimen> | |
| 15 | + <dimen name="indicator_corner_radius">12dp</dimen> | |
| 16 | + <dimen name="indicator_internal_padding">4dp</dimen> | |
| 17 | + <dimen name="header_footer_left_right_padding">24dp</dimen> | |
| 18 | + <dimen name="header_footer_top_bottom_padding">12dp</dimen> | |
| 19 | + <dimen name="image_thumbnail_size">50dp</dimen> | |
| 20 | + <dimen name="image_thumbnail_spacing">1dp</dimen> | |
| 21 | + <dimen name="dotLeftMargin">10dp</dimen> | |
| 22 | + <dimen name="dotRightMargin">10dp</dimen> | |
| 23 | + <dimen name="ui_10_dip">10dip</dimen> | |
| 24 | + | |
| 25 | + <dimen name="image_size">120dp</dimen> | |
| 26 | + <dimen name="space_size">2dp</dimen> | |
| 27 | + <dimen name="folder_cover_size">72dp</dimen> | |
| 28 | + | |
| 29 | + | |
| 30 | + <!-- dp类 --> | |
| 31 | + <dimen name="title_height_worlduc_dp">45dp</dimen> | |
| 32 | + <dimen name="layout_bothdistance_worlduc_dp">12dp</dimen> | |
| 33 | + <dimen name="layout_bothdistance15_worlduc_dp">15dp</dimen> | |
| 34 | + <dimen name="layout_bothdistance10_worlduc_dp">10dp</dimen> | |
| 35 | + | |
| 36 | + <dimen name="layout_verticaldistance_worlduc_dp">10dp</dimen> | |
| 37 | + <dimen name="layout_verticaldistance12_worlduc_dp">12dp</dimen> | |
| 38 | + <dimen name="layout_verticaldistance15_worlduc_dp">15dp</dimen> | |
| 39 | + <!-- dp类 --> | |
| 40 | + | |
| 41 | + <!-- 文字类 --> | |
| 42 | + <dimen name="title_worlduc_sp">20sp</dimen> | |
| 43 | + <dimen name="title_both_worlduc_sp">16sp</dimen> | |
| 44 | + | |
| 45 | + <dimen name="content_smalltitle_worlduc_sp">16sp</dimen> | |
| 46 | + <dimen name="content_title_worlduc_sp">18sp</dimen> | |
| 47 | + <dimen name="content_worlduc_sp">16sp</dimen> | |
| 48 | + | |
| 49 | + <dimen name="name_worlduc_sp">16sp</dimen> | |
| 50 | + <dimen name="name_comment_worlduc_sp">15sp</dimen> | |
| 51 | + | |
| 52 | + <dimen name="flaglarge_worlduc_sp">18sp</dimen> | |
| 53 | + <dimen name="flag_worlduc_sp">17sp</dimen> | |
| 54 | + <dimen name="button_worlduc_sp">16sp</dimen> | |
| 55 | + <dimen name="select_worlduc_sp">15sp</dimen> | |
| 56 | + | |
| 57 | + <dimen name="textlarge_worlduc_sp">15sp</dimen> | |
| 58 | + <dimen name="text_worlduc_sp">14sp</dimen> | |
| 59 | + <dimen name="textnormal_worlduc_sp">13sp</dimen> | |
| 60 | + <dimen name="textsmall_worlduc_sp">12sp</dimen> | |
| 61 | + | |
| 62 | + <dimen name="hint_worlduc_sp">12sp</dimen> | |
| 63 | + <dimen name="hint2_worlduc_sp">11sp</dimen> | |
| 64 | + <dimen name="hint3_worlduc_sp">10sp</dimen> | |
| 65 | + | |
| 66 | + <dimen name="divider_height">6dip</dimen> | |
| 67 | + <dimen name="next_image_width">13dp</dimen> | |
| 68 | + <dimen name="next_image_height">21dp</dimen> | |
| 69 | + <dimen name="next_image_margin_right">9dp</dimen> | |
| 70 | + | |
| 71 | + <dimen name="config_image_height">28dip</dimen> | |
| 72 | + <dimen name="config_image_width">29dip</dimen> | |
| 73 | + <dimen name="config_item_height">54dip</dimen> | |
| 74 | + | |
| 75 | + <dimen name="qmui_group_list_section_header_footer_padding_vertical">4dp</dimen> | |
| 76 | + <dimen name="qmui_group_list_section_header_footer_vertical">8dp</dimen> | |
| 77 | + | |
| 78 | + <dimen name="input_height">278dip</dimen> | |
| 79 | + <dimen name="input_default_height">48dip</dimen> | |
| 80 | + <dimen name="input_comment_height">186dip</dimen> | |
| 81 | + <dimen name="order_list_divider_height_10">10dp</dimen> | |
| 82 | + <dimen name="input_height_landscape">218dip</dimen> | |
| 83 | + | |
| 84 | + <dimen name="dp_1">1dp</dimen>] | |
| 85 | + <dimen name="dp_3">3dp</dimen> | |
| 86 | + <dimen name="dp_5">5dp</dimen> | |
| 87 | + <dimen name="dp_9">9dp</dimen> | |
| 88 | + <dimen name="dp_8">8dp</dimen> | |
| 89 | + <dimen name="dp_10">10dp</dimen> | |
| 90 | + <dimen name="dp_15">15dp</dimen> | |
| 91 | + <dimen name="dp_20">20dp</dimen> | |
| 92 | + <dimen name="dp_23">23dp</dimen> | |
| 93 | + <dimen name="dp_25">25dp</dimen> | |
| 94 | + <dimen name="dp_27">27dp</dimen> | |
| 95 | + <dimen name="dp_30">30dp</dimen> | |
| 96 | + <dimen name="dp_35">35dp</dimen> | |
| 97 | + <dimen name="dp_40">40dp</dimen> | |
| 98 | + <dimen name="dp_43">43dp</dimen> | |
| 99 | + <dimen name="dp_45">45dp</dimen> | |
| 100 | + <dimen name="dp_50">50dp</dimen> | |
| 101 | + <dimen name="dp_55">55dp</dimen> | |
| 102 | + <dimen name="dp_60">60dp</dimen> | |
| 103 | + <dimen name="dp_200">200dp</dimen> | |
| 104 | + <dimen name="bannerhei">150dp</dimen> | |
| 105 | + <dimen name="releasewi">155dp</dimen> | |
| 106 | + <dimen name="releasehei">137dp</dimen> | |
| 107 | + | |
| 108 | + | |
| 109 | + <dimen name="group_head_height_big">50dp</dimen> | |
| 110 | + <dimen name="group_head_margin">10dp</dimen> | |
| 111 | + <dimen name="chat_head_height">40dp</dimen> | |
| 112 | + <dimen name="chat_item_send_status_btn_height">22dp</dimen> | |
| 113 | + <dimen name="goods_item_height">90dp</dimen> | |
| 114 | + <dimen name="member_role_size">14dp</dimen> | |
| 115 | +</resources> | |
| 0 | 116 | \ No newline at end of file | ... | ... |
publish/src/main/res/values/ids.xml
0 → 100644
publish/src/main/res/values/strings.xml
0 → 100644
| 1 | +++ a/publish/src/main/res/values/strings.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<resources> | |
| 3 | + | |
| 4 | + <string name="circletmesg">编辑想说的内容...</string> | |
| 5 | + <string name="permission_location">应用程序需要获取位置权限,否则无法获取位置信息</string> | |
| 6 | + <string name="user_trtc_talking">正在音视频通话中,无法使用此功能</string> | |
| 7 | + | |
| 8 | +</resources> | |
| 0 | 9 | \ No newline at end of file | ... | ... |
publish/src/test/java/com/cnlive/publish/ExampleUnitTest.java
0 → 100644
| 1 | +++ a/publish/src/test/java/com/cnlive/publish/ExampleUnitTest.java | |
| 1 | +package com.cnlive.publish; | |
| 2 | + | |
| 3 | +import org.junit.Test; | |
| 4 | + | |
| 5 | +import static org.junit.Assert.*; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Example local unit test, which will execute on the development machine (host). | |
| 9 | + * | |
| 10 | + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | |
| 11 | + */ | |
| 12 | +public class ExampleUnitTest { | |
| 13 | + @Test | |
| 14 | + public void addition_isCorrect() { | |
| 15 | + assertEquals(4, 2 + 2); | |
| 16 | + } | |
| 17 | +} | |
| 0 | 18 | \ No newline at end of file | ... | ... |
settings.gradle
0 → 100644
| 1 | +++ a/settings.gradle | |
| 1 | +include ':publish' | |
| 2 | +include ':app' | |
| 3 | +rootProject.name = "PublishingWorks" | |
| 4 | +//---------- Maven 配置 ---------- | |
| 5 | +def initMavenConfig() { | |
| 6 | + Properties properties = new Properties() | |
| 7 | + | |
| 8 | + File propertyFile = new File(rootDir.getAbsolutePath() + "/local.properties") | |
| 9 | + properties.load(propertyFile.newDataInputStream()) | |
| 10 | + | |
| 11 | + gradle.ext.mavenUrl = properties.getProperty('maven.url') | |
| 12 | + gradle.ext.mavenDevUrl = properties.getProperty('maven.devurl') | |
| 13 | + gradle.ext.mavenUserName = properties.getProperty('maven.username') | |
| 14 | + gradle.ext.mavenPwd = properties.getProperty('maven.password') | |
| 15 | +} | |
| 16 | + | |
| 17 | +initMavenConfig() | |
| 18 | +//---------- Maven 配置 ---------- | |
| 0 | 19 | \ No newline at end of file | ... | ... |