commit 376abae4e592417f12bb7175d62606933017e37a Author: guozhen Date: Mon Apr 14 13:39:46 2025 +0800 VionTv init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/AndroidProjectSystem.xml b/.idea/AndroidProjectSystem.xml new file mode 100644 index 0000000..4a53bee --- /dev/null +++ b/.idea/AndroidProjectSystem.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b86273d --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..feb0519 --- /dev/null +++ b/.idea/deploymentTargetSelector.xml @@ -0,0 +1,26 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..639c779 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..cf90582 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..16660f1 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..c338556 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,91 @@ +plugins { + alias(libs.plugins.android.application) +} + +android { + namespace 'com.viontv.app' + compileSdk 35 + + defaultConfig { + applicationId "com.viontv.app" + minSdk 24 + targetSdk 35 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + +// signingConfigs { +// debug { +// storeFile file('viontv.jks') +// storePassword "android123456" +// keyAlias 'key0' +// keyPassword "android123456" +// v1SigningEnabled true +// v2SigningEnabled true +// } +// release { +// storeFile file('viontv.jks') +// storePassword "android123456" +// keyAlias 'key0' +// keyPassword "android123456" +// v1SigningEnabled true +// v2SigningEnabled true +// } +// } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + + viewBinding { + enabled true + } + + dataBinding { + enabled true + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } +} + +dependencies { + + implementation libs.appcompat + implementation libs.material + implementation libs.constraintlayout + implementation libs.lifecycle.livedata.ktx + implementation libs.lifecycle.viewmodel.ktx + testImplementation libs.junit + androidTestImplementation libs.ext.junit + androidTestImplementation libs.espresso.core + //implementation libs.lifecycle + implementation libs.retrofit + implementation libs.okhttplog + implementation libs.converter.scalars + implementation libs.converter.gson + implementation libs.adapter.rxjava2 + implementation libs.rxjava + implementation libs.rxandroid + implementation libs.refreshlayout + implementation libs.refreshheader + implementation libs.refreshfooter + implementation libs.banner + implementation libs.recyclerview + implementation libs.glide + implementation libs.avloadingView + implementation libs.media3exoplayer + implementation libs.media3exoplayerdash + implementation libs.media3ui + implementation libs.media3exoplayerhls + implementation libs.eventbut + implementation libs.baseRecyclerAdapter + + +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/com/qinjiu/viontv/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/qinjiu/viontv/ExampleInstrumentedTest.java new file mode 100644 index 0000000..eea67d8 --- /dev/null +++ b/app/src/androidTest/java/com/qinjiu/viontv/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.qinjiu.viontv; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.qinjiu.viontv", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..0609d79 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/com/viontv/app/VTApplication.java b/app/src/main/java/com/viontv/app/VTApplication.java new file mode 100644 index 0000000..2be85c0 --- /dev/null +++ b/app/src/main/java/com/viontv/app/VTApplication.java @@ -0,0 +1,61 @@ +package com.viontv.app; + +import android.app.Application; +import android.text.TextUtils; +import android.util.Log; + +import com.viontv.app.api.VTApi; +import com.viontv.app.api.VTApiService; +import com.viontv.app.api.VTBaseObserver; +import com.viontv.app.api.VTResult; +import com.viontv.app.model.RegisteredBean; +import com.viontv.app.utils.SharePreferenceUtils; + +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.schedulers.Schedulers; +import retrofit2.adapter.rxjava2.Result; + +public class VTApplication extends Application { + + public static VTApplication AppContext; + + public static VTApplication getAppContext() { + return AppContext; + } + + @Override + public void onCreate() { + super.onCreate(); + AppContext = this; + regist(); + } + + + /** + * 获取token + */ + public void regist() { + String authkey = SharePreferenceUtils.getString(SharePreferenceUtils.auth, ""); + if (TextUtils.isEmpty(authkey)) { + VTApi.getInstance().register() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new VTBaseObserver>() { + + @Override + public void onSuccess(VTResult feedbackResp) { + SharePreferenceUtils.saveString(SharePreferenceUtils.auth, feedbackResp.data.getToken()); + + } + + @Override + public void onError(int code, String msg) { + + } + }); + } + + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/api/VTApi.java b/app/src/main/java/com/viontv/app/api/VTApi.java new file mode 100644 index 0000000..f8a1c99 --- /dev/null +++ b/app/src/main/java/com/viontv/app/api/VTApi.java @@ -0,0 +1,72 @@ +package com.viontv.app.api; + +import android.text.TextUtils; +import android.util.Log; + + +import java.io.UnsupportedEncodingException; +import java.net.Proxy; +import java.net.URLDecoder; +import java.util.HashMap; +import java.util.concurrent.TimeUnit; +import okhttp3.OkHttpClient; +import okhttp3.logging.HttpLoggingInterceptor; + + +public class VTApi extends VTBaseApi { + + private static final long CONNECT_TIMEOUT = 10; + private static final long READ_TIMEOUT = 10; + private static final long WRITE_TIMEOUT = 10; + + /** + * 静态内部类单例 + */ + private static class ApiHolder { + private static VTApi api = new VTApi(); + private final static VTApiService apiService = api.initRetrofit(VTApiService.URL) + .create(VTApiService.class); + + } + + public static VTApiService getInstance() { + return ApiHolder.apiService; + } + + + /** + * 做自己需要的操作 + */ + @Override + protected OkHttpClient setClient() { + OkHttpClient.Builder builder; + builder = new OkHttpClient() + .newBuilder(); + //禁止使用代理抓取数据 + builder.proxy(Proxy.NO_PROXY); + //设置超时 + builder.connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS); + builder.readTimeout(READ_TIMEOUT, TimeUnit.SECONDS); + builder.writeTimeout(WRITE_TIMEOUT, TimeUnit.SECONDS); + //错误重连 + builder.retryOnConnectionFailure(true); + builder.addInterceptor(new VTHeaderInterceptor()); + +// if(Config.IS_DEBUG) { + HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(message -> { + try { + String text = URLDecoder.decode(message, "utf-8"); + Log.i("OKHttp111111-----", text); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + Log.i("OKHttp1111111-----", e.getMessage()); + } + }); + interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); + builder.addInterceptor(interceptor); +// } + return builder.build(); + + } + +} diff --git a/app/src/main/java/com/viontv/app/api/VTApiService.java b/app/src/main/java/com/viontv/app/api/VTApiService.java new file mode 100644 index 0000000..6aef191 --- /dev/null +++ b/app/src/main/java/com/viontv/app/api/VTApiService.java @@ -0,0 +1,109 @@ +package com.viontv.app.api; + + +import com.viontv.app.model.HomeBottomListBean; +import com.viontv.app.model.HomeTopBannerBean; +import com.viontv.app.model.HomeTopBean; +import com.viontv.app.model.RegisteredBean; +import com.viontv.app.model.TabItemBean; +import com.viontv.app.model.VTVideoDetailsBean; + +import java.util.List; +import java.util.Map; + +import io.reactivex.Observable; +import retrofit2.http.Body; +import retrofit2.http.Field; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.GET; +import retrofit2.http.POST; +import retrofit2.http.Path; +import retrofit2.http.Query; + + +public interface VTApiService { + + + /** + * 正式测试服 + */ + boolean isProduce = false; + String URL = isProduce ? "https://admin-viontv.guyantv.com" : "https://test1-api.guyantv.com"; + + + public static final String rankTop10Type="most_trending"; + /** + * 注册 + * + * @return + */ + @POST("/customer/register") + Observable> register(); + + /** + * 首页顶部 + * + * @return + */ + @POST("/homeTop") + Observable> homeTop(); + + /** + * 首页9宫格和banner + * + * @return + */ + @POST("/homeBannerAndNineSquare") + Observable> bannersquare(); + + + /** + * 首页底部列表 + * + * @return + */ + @FormUrlEncoded + @POST("/newShortPlay") + Observable> newShortPlay(@Field("current_page") int currentpage,@Field("page_size") int pagesize); + + + /** + * Top10 + * + * @return + */ + @FormUrlEncoded + @POST("/homeRanking") + Observable> homeTop10(@Field("type") String type); + + + /** + * 获取视频详情 + * + * @return + */ + @GET("/getVideoDetails") + Observable> getVideoDetails(@Query("short_play_id") int short_play_id, @Query("video_id") int video_id); + + + /** + * 首页TabItem Banner + * + * @return + */ + @FormUrlEncoded + @POST("/revenge") + Observable> getTabItemBanner(@Field("category_id") String category_id); + + + /** + * 首页TabItem List + * + * @return + */ + @GET("/videoList") + Observable> getVideoList(@Query("category_id") String category_id,@Query("current_page") int current,@Query("page_size") int pageSize,@Query("search") String search); + + + +} diff --git a/app/src/main/java/com/viontv/app/api/VTBaseApi.java b/app/src/main/java/com/viontv/app/api/VTBaseApi.java new file mode 100644 index 0000000..902f7ec --- /dev/null +++ b/app/src/main/java/com/viontv/app/api/VTBaseApi.java @@ -0,0 +1,37 @@ +package com.viontv.app.api; + +import okhttp3.OkHttpClient; +import retrofit2.Retrofit; +import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; +import retrofit2.converter.gson.GsonConverterFactory; +import retrofit2.converter.scalars.ScalarsConverterFactory; + + +public abstract class VTBaseApi { + + /** + * 初始化Retrofit + */ + public Retrofit initRetrofit(String baseUrl) { + Retrofit.Builder builder = new Retrofit.Builder(); + //支持返回Call + builder.addConverterFactory(ScalarsConverterFactory.create()); + //支持直接格式化json返回Bean对象 + builder.addConverterFactory(GsonConverterFactory.create()); + //支持RxJava + builder.addCallAdapterFactory(RxJava2CallAdapterFactory.create()); + builder.baseUrl(baseUrl); + OkHttpClient client = setClient(); + if (client != null) { + builder.client(client); + } + return builder.build(); + } + + /** + * 设置OkHttpClient,添加拦截器等 + * + * @return 可以返回为null + */ + protected abstract OkHttpClient setClient(); +} diff --git a/app/src/main/java/com/viontv/app/api/VTBaseObserver.java b/app/src/main/java/com/viontv/app/api/VTBaseObserver.java new file mode 100644 index 0000000..55e117e --- /dev/null +++ b/app/src/main/java/com/viontv/app/api/VTBaseObserver.java @@ -0,0 +1,110 @@ +package com.viontv.app.api; + +import com.google.gson.JsonParseException; + +import org.json.JSONException; + +import java.io.InterruptedIOException; +import java.net.ConnectException; +import java.net.UnknownHostException; +import java.text.ParseException; + +import io.reactivex.observers.DisposableObserver; +import retrofit2.HttpException; + +public abstract class VTBaseObserver extends DisposableObserver { + /** + * 解析数据失败 + */ + public static final int PARSE_ERROR = 1001; + /** + * 网络问题 + */ + public static final int BAD_NETWORK = 1002; + /** + * 连接错误 + */ + public static final int CONNECT_ERROR = 1003; + /** + * 连接超时 + */ + public static final int CONNECT_TIMEOUT = 1004; + + @Override + public void onNext(T o) { + try { + VTResult model = (VTResult) o; + if (model.code == 200) { + onSuccess(o); + } else { + onError(model.code,model.msg); + } + } catch (Exception e) { + e.printStackTrace(); + onError(407,e.toString()); + + } + + } + + @Override + public void onError(Throwable e) { + if (e instanceof HttpException) { + // HTTP错误 + onException(BAD_NETWORK); + } else if (e instanceof ConnectException + || e instanceof UnknownHostException) { + // 连接错误 + onException(CONNECT_ERROR); + } else if (e instanceof InterruptedIOException) { + // 连接超时 + onException(CONNECT_TIMEOUT); + } else if (e instanceof JsonParseException + || e instanceof JSONException + || e instanceof ParseException) { + // 解析错误 + + onException(PARSE_ERROR); + } else { + if (e != null) { + onError(409,e.toString()); + } else { + onError(407,"未知错误"); + } + } + + } + + private void onException(int unknownError) { + switch (unknownError) { + case CONNECT_ERROR: + onError(CONNECT_ERROR,"连接错误"); + break; + + case CONNECT_TIMEOUT: + onError(CONNECT_TIMEOUT,"连接超时"); + break; + + case BAD_NETWORK: + onError(BAD_NETWORK,"网络问题"); + break; + + case PARSE_ERROR: + onError(PARSE_ERROR,"宇宙也是有尽头的"); + break; + + default: + break; + } + } + + @Override + public void onComplete() { + + } + + public abstract void onSuccess(T o); + + public abstract void onError(int code,String msg); + +} diff --git a/app/src/main/java/com/viontv/app/api/VTBaseObserver1.java b/app/src/main/java/com/viontv/app/api/VTBaseObserver1.java new file mode 100644 index 0000000..d03c6ac --- /dev/null +++ b/app/src/main/java/com/viontv/app/api/VTBaseObserver1.java @@ -0,0 +1,99 @@ +package com.viontv.app.api; + +import com.google.gson.JsonParseException; + +import org.json.JSONException; + +import java.io.InterruptedIOException; +import java.net.ConnectException; +import java.net.UnknownHostException; +import java.text.ParseException; + +import io.reactivex.observers.DisposableObserver; +import retrofit2.HttpException; + +public abstract class VTBaseObserver1 extends DisposableObserver { + /** + * 解析数据失败 + */ + public static final int PARSE_ERROR = 1001; + /** + * 网络问题 + */ + public static final int BAD_NETWORK = 1002; + /** + * 连接错误 + */ + public static final int CONNECT_ERROR = 1003; + /** + * 连接超时 + */ + public static final int CONNECT_TIMEOUT = 1004; + + @Override + public void onNext(T o) { + VTResult1 model = (VTResult1) o; + if (model.code == 0) { + onSuccess(o); + } else { + onError(model.code, model.msg); + } + } + + @Override + public void onError(Throwable e) { + if (e instanceof HttpException) { + // HTTP错误 + onException(BAD_NETWORK); + } else if (e instanceof ConnectException + || e instanceof UnknownHostException) { + // 连接错误 + onException(CONNECT_ERROR); + } else if (e instanceof InterruptedIOException) { + // 连接超时 + onException(CONNECT_TIMEOUT); + } else if (e instanceof JsonParseException + || e instanceof JSONException + || e instanceof ParseException) { + // 解析错误 + + onException(PARSE_ERROR); + } else { + if (e != null) { + onError(409, e.toString()); + } else { + onError(407, "未知错误"); + } + } + + } + + private void onException(int unknownError) { + switch (unknownError) { + case CONNECT_ERROR: + onError(CONNECT_ERROR, "连接错误"); + break; + case CONNECT_TIMEOUT: + onError(CONNECT_TIMEOUT, "连接超时"); + break; + case BAD_NETWORK: + onError(BAD_NETWORK, "网络问题"); + break; + case PARSE_ERROR: + onError(PARSE_ERROR, "宇宙也是有尽头的"); + break; + default: + break; + } + } + + @Override + public void onComplete() { + + } + + public abstract void onSuccess(T o); + + public abstract void onError(int code, String msg); + +} diff --git a/app/src/main/java/com/viontv/app/api/VTBaseObserverPrize.java b/app/src/main/java/com/viontv/app/api/VTBaseObserverPrize.java new file mode 100644 index 0000000..50a54fd --- /dev/null +++ b/app/src/main/java/com/viontv/app/api/VTBaseObserverPrize.java @@ -0,0 +1,101 @@ +package com.viontv.app.api; + +import com.google.gson.JsonParseException; + +import org.json.JSONException; + +import java.io.InterruptedIOException; +import java.net.ConnectException; +import java.net.UnknownHostException; +import java.text.ParseException; + +import io.reactivex.observers.DisposableObserver; +import retrofit2.HttpException; + +public abstract class VTBaseObserverPrize extends DisposableObserver { + /** + * 解析数据失败 + */ + public static final int PARSE_ERROR = 1001; + /** + * 网络问题 + */ + public static final int BAD_NETWORK = 1002; + /** + * 连接错误 + */ + public static final int CONNECT_ERROR = 1003; + /** + * 连接超时 + */ + public static final int CONNECT_TIMEOUT = 1004; + + @Override + public void onNext(T o) { + VTResultPrize model = (VTResultPrize) o; + if (model.code == 0) { + onSuccess(o); + } else { + onError(model.code, model.msg); + } + + + } + + @Override + public void onError(Throwable e) { + if (e instanceof HttpException) { + // HTTP错误 + onException(BAD_NETWORK); + } else if (e instanceof ConnectException + || e instanceof UnknownHostException) { + // 连接错误 + onException(CONNECT_ERROR); + } else if (e instanceof InterruptedIOException) { + // 连接超时 + onException(CONNECT_TIMEOUT); + } else if (e instanceof JsonParseException + || e instanceof JSONException + || e instanceof ParseException) { + // 解析错误 + + onException(PARSE_ERROR); + } else { + if (e != null) { + onError(409, e.toString()); + } else { + onError(407, "未知错误"); + } + } + + } + + private void onException(int unknownError) { + switch (unknownError) { + case CONNECT_ERROR: + onError(CONNECT_ERROR, "连接错误"); + break; + case CONNECT_TIMEOUT: + onError(CONNECT_TIMEOUT, "连接超时"); + break; + case BAD_NETWORK: + onError(BAD_NETWORK, "网络问题"); + break; + case PARSE_ERROR: + onError(PARSE_ERROR, "宇宙也是有尽头的"); + break; + default: + break; + } + } + + @Override + public void onComplete() { + + } + + public abstract void onSuccess(T o); + + public abstract void onError(int code, String msg); + +} diff --git a/app/src/main/java/com/viontv/app/api/VTHeaderInterceptor.java b/app/src/main/java/com/viontv/app/api/VTHeaderInterceptor.java new file mode 100644 index 0000000..c3e5b31 --- /dev/null +++ b/app/src/main/java/com/viontv/app/api/VTHeaderInterceptor.java @@ -0,0 +1,35 @@ +package com.viontv.app.api; + + +import java.io.IOException; +import com.viontv.app.VTApplication; +import com.viontv.app.utils.GetAndroidUniqueMark; +import com.viontv.app.utils.SharePreferenceUtils; +import com.viontv.app.utils.TimeUtils; + +import okhttp3.Interceptor; +import okhttp3.Request; +import okhttp3.Response; + +public class VTHeaderInterceptor implements Interceptor { + public VTHeaderInterceptor() { + } + + @Override + public Response intercept(Chain chain) throws IOException { + + //封装headers + Request request = chain.request().newBuilder() + .addHeader("Content-Type", "application/json") + .addHeader("authorization", SharePreferenceUtils.getString(SharePreferenceUtils.auth,"")) + .addHeader("security","false") + .addHeader("lang-key","en") + .addHeader("device-id",GetAndroidUniqueMark.getUniqueId(VTApplication.getAppContext())) + .addHeader("system-type","android") + .addHeader("time_zone", TimeUtils.getCurrentTimeZone()) + + .build(); + + return chain.proceed(request); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/api/VTResult.java b/app/src/main/java/com/viontv/app/api/VTResult.java new file mode 100644 index 0000000..3a7bd95 --- /dev/null +++ b/app/src/main/java/com/viontv/app/api/VTResult.java @@ -0,0 +1,32 @@ +package com.viontv.app.api; + + +import com.viontv.app.utils.VTGsonUtils; + +import java.io.Serializable; +import java.util.List; + +/** + * created by wmm on 2020/9/8 + */ +public class VTResult implements Serializable { + + public String msg; + public int code; + public T data; + + + + public boolean isSuccessful() { + return code == 200; + } + + @Override + public String toString() { + return "Result{" + + "message='" + msg + '\'' + + ", code=" + code + + ", data=" + VTGsonUtils.beanToJSONString(data) + + '}'; + } +} diff --git a/app/src/main/java/com/viontv/app/api/VTResult1.java b/app/src/main/java/com/viontv/app/api/VTResult1.java new file mode 100644 index 0000000..65587d0 --- /dev/null +++ b/app/src/main/java/com/viontv/app/api/VTResult1.java @@ -0,0 +1,24 @@ +package com.viontv.app.api; + +import java.io.Serializable; + +/** + * created by wmm on 2020/9/8 + */ +public class VTResult1 implements Serializable { + + public String msg; + public int code; + + public boolean isSuccessful() { + return code == 0; + } + + @Override + public String toString() { + return "Result{" + + "message='" + msg + '\'' + + ", code=" + code + + '}'; + } +} diff --git a/app/src/main/java/com/viontv/app/api/VTResultPrize.java b/app/src/main/java/com/viontv/app/api/VTResultPrize.java new file mode 100644 index 0000000..9f094a4 --- /dev/null +++ b/app/src/main/java/com/viontv/app/api/VTResultPrize.java @@ -0,0 +1,34 @@ +package com.viontv.app.api; + + + +import com.viontv.app.utils.VTGsonUtils; + +import java.io.Serializable; +import java.util.List; + +/** + * created by wmm on 2020/9/8 + */ +public class VTResultPrize implements Serializable { + + public String msg; + public int code; + public T data; + public List debug; + + + public boolean isSuccessful() { + return code == 0; + } + + @Override + public String toString() { + return "Result{" + + "message='" + msg + '\'' + + ", code=" + code + + ", data=" + VTGsonUtils.beanToJSONString(data) + + ", debug=" + VTGsonUtils.beanToJSONString(debug) + + '}'; + } +} diff --git a/app/src/main/java/com/viontv/app/model/CateGoryItemBean.java b/app/src/main/java/com/viontv/app/model/CateGoryItemBean.java new file mode 100644 index 0000000..7b5a319 --- /dev/null +++ b/app/src/main/java/com/viontv/app/model/CateGoryItemBean.java @@ -0,0 +1,23 @@ +package com.viontv.app.model; + +public class CateGoryItemBean { + + private String category_name; + private int category_id; + + public String getCategory_name() { + return category_name; + } + + public void setCategory_name(String category_name) { + this.category_name = category_name; + } + + public int getCategory_id() { + return category_id; + } + + public void setCategory_id(int category_id) { + this.category_id = category_id; + } +} diff --git a/app/src/main/java/com/viontv/app/model/HomeBottomListBean.java b/app/src/main/java/com/viontv/app/model/HomeBottomListBean.java new file mode 100644 index 0000000..3998290 --- /dev/null +++ b/app/src/main/java/com/viontv/app/model/HomeBottomListBean.java @@ -0,0 +1,26 @@ +package com.viontv.app.model; + +import java.util.List; + +public class HomeBottomListBean { + + private List short_play_list; + private List list; + + + public List getShort_play_list() { + return short_play_list; + } + + public void setShort_play_list(List short_play_list) { + this.short_play_list = short_play_list; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } +} diff --git a/app/src/main/java/com/viontv/app/model/HomeNineSquareBean.java b/app/src/main/java/com/viontv/app/model/HomeNineSquareBean.java new file mode 100644 index 0000000..4f36dad --- /dev/null +++ b/app/src/main/java/com/viontv/app/model/HomeNineSquareBean.java @@ -0,0 +1,26 @@ +package com.viontv.app.model; + +import java.util.List; + +public class HomeNineSquareBean { + + private List list; + private String title; + + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } +} diff --git a/app/src/main/java/com/viontv/app/model/HomeTopBannerBean.java b/app/src/main/java/com/viontv/app/model/HomeTopBannerBean.java new file mode 100644 index 0000000..8a189d0 --- /dev/null +++ b/app/src/main/java/com/viontv/app/model/HomeTopBannerBean.java @@ -0,0 +1,26 @@ +package com.viontv.app.model; + +import java.util.List; + +public class HomeTopBannerBean { + + private List bannerData; + + private HomeNineSquareBean nineSquare; + + public List getBannerData() { + return bannerData; + } + + public void setBannerData(List bannerData) { + this.bannerData = bannerData; + } + + public HomeNineSquareBean getNineSquare() { + return nineSquare; + } + + public void setNineSquare(HomeNineSquareBean nineSquare) { + this.nineSquare = nineSquare; + } +} diff --git a/app/src/main/java/com/viontv/app/model/HomeTopBean.java b/app/src/main/java/com/viontv/app/model/HomeTopBean.java new file mode 100644 index 0000000..de965bd --- /dev/null +++ b/app/src/main/java/com/viontv/app/model/HomeTopBean.java @@ -0,0 +1,30 @@ +package com.viontv.app.model; + + +import java.util.List; + +/** + * 首页顶部 + */ +public class HomeTopBean { + + private List hotData; + private List category; + + + public List getHotData() { + return hotData; + } + + public void setHotData(List hotData) { + this.hotData = hotData; + } + + public List getCategory() { + return category; + } + + public void setCategory(List category) { + this.category = category; + } +} diff --git a/app/src/main/java/com/viontv/app/model/ItemBean.java b/app/src/main/java/com/viontv/app/model/ItemBean.java new file mode 100644 index 0000000..01b9b85 --- /dev/null +++ b/app/src/main/java/com/viontv/app/model/ItemBean.java @@ -0,0 +1,171 @@ +package com.viontv.app.model; + + +import java.util.List; + +public class ItemBean { + + + private int id; + + private int short_id; + + private int short_play_id; + + private String name; + + private String description; + + private int process; + + private String image_url; + + private String horizontally_img; + + private int buy_type; + + private String tag_type; + + private int all_coins; + + private int collect_total; + + private int watch_total; + + private int episode_total; + + private int search_click_total; + + private List category; + + + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getShort_id() { + return short_id; + } + + public void setShort_id(int short_id) { + this.short_id = short_id; + } + + public int getShort_play_id() { + return short_play_id; + } + + public void setShort_play_id(int short_play_id) { + this.short_play_id = short_play_id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public int getProcess() { + return process; + } + + public void setProcess(int process) { + this.process = process; + } + + public String getImage_url() { + return image_url; + } + + public void setImage_url(String image_url) { + this.image_url = image_url; + } + + public String getHorizontally_img() { + return horizontally_img; + } + + public void setHorizontally_img(String horizontally_img) { + this.horizontally_img = horizontally_img; + } + + public int getBuy_type() { + return buy_type; + } + + public void setBuy_type(int buy_type) { + this.buy_type = buy_type; + } + + public String getTag_type() { + return tag_type; + } + + public void setTag_type(String tag_type) { + this.tag_type = tag_type; + } + + public int getAll_coins() { + return all_coins; + } + + public void setAll_coins(int all_coins) { + this.all_coins = all_coins; + } + + public int getCollect_total() { + return collect_total; + } + + public void setCollect_total(int collect_total) { + this.collect_total = collect_total; + } + + public int getWatch_total() { + return watch_total; + } + + public void setWatch_total(int watch_total) { + this.watch_total = watch_total; + } + + public int getEpisode_total() { + return episode_total; + } + + public void setEpisode_total(int episode_total) { + this.episode_total = episode_total; + } + + public int getSearch_click_total() { + return search_click_total; + } + + public void setSearch_click_total(int search_click_total) { + this.search_click_total = search_click_total; + } + + public List getCategory() { + return category; + } + + public void setCategory(List category) { + this.category = category; + } +} diff --git a/app/src/main/java/com/viontv/app/model/RegisteredBean.java b/app/src/main/java/com/viontv/app/model/RegisteredBean.java new file mode 100644 index 0000000..1b001a3 --- /dev/null +++ b/app/src/main/java/com/viontv/app/model/RegisteredBean.java @@ -0,0 +1,23 @@ +package com.viontv.app.model; + +public class RegisteredBean { + + private String token; + private String customer_id; + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getCustomer_id() { + return customer_id; + } + + public void setCustomer_id(String customer_id) { + this.customer_id = customer_id; + } +} diff --git a/app/src/main/java/com/viontv/app/model/TabItemBean.java b/app/src/main/java/com/viontv/app/model/TabItemBean.java new file mode 100644 index 0000000..43a6dd1 --- /dev/null +++ b/app/src/main/java/com/viontv/app/model/TabItemBean.java @@ -0,0 +1,16 @@ +package com.viontv.app.model; + +import java.util.List; + +public class TabItemBean { + + public List banners; + + public List getBanners() { + return banners; + } + + public void setBanners(List banners) { + this.banners = banners; + } +} diff --git a/app/src/main/java/com/viontv/app/model/TranslatesResBean.java b/app/src/main/java/com/viontv/app/model/TranslatesResBean.java new file mode 100644 index 0000000..f70db3d --- /dev/null +++ b/app/src/main/java/com/viontv/app/model/TranslatesResBean.java @@ -0,0 +1,1343 @@ +package com.viontv.app.model; + +import java.util.List; + +public class TranslatesResBean { + private List languages; + private String last_update_time; + private Translates translates; + + public TranslatesResBean(List languages, String last_update_time, Translates translates) { + this.languages = languages; + this.last_update_time = last_update_time; + this.translates = translates; + } + + public List getLanguages() { + return languages; + } + + public String getLast_update_time() { + return last_update_time; + } + + public Translates getTranslates() { + return translates; + } + + public static class Language { + private String cn_name; + private String description; + private int id; + private int is_default; + private String lang_key; + private String show_name; + + public Language(String cn_name, String description, int id, int is_default, String lang_key, String show_name) { + this.cn_name = cn_name; + this.description = description; + this.id = id; + this.is_default = is_default; + this.lang_key = lang_key; + this.show_name = show_name; + } + + public String getCn_name() { + return cn_name; + } + + public String getDescription() { + return description; + } + + public int getId() { + return id; + } + + public int getIs_default() { + return is_default; + } + + public String getLang_key() { + return lang_key; + } + + public String getShow_name() { + return show_name; + } + } + + public static class Translates { + private String alert_setting_message_logout; + private String all; + private String title_discover; + private String title_videos; + private String title_recommend; + private String common_play; + private String title_profile; + private String member_service_ag; + private String please_click_here; + private String common_unlock; + private String member_service_agreement; + private String vip_not_credit_notice_1; + private String vip_not_credit_notice_2; + private String vip_not_credit_notice_3; + private String vip_refresh; + private String alter_cancel; + private String alter_confirm; + private String buy_episode_notice; + private String change_language; + private String click_to_watch; + private String coins; + private String collection; + private String seen_today; + private String watch_video_unlock; + private String commom_highlight_agreement; + private String commom_highlight_children; + private String commom_highlight_privacy; + private String commom_highlight_teenager; + private String commom_highlight_third; + private String commom_highlight_user; + private String commom_text_subscribe; + private String common_button_more; + private String complete_episode; + private String consumption_record; + private String continue_watch; + private String day; + private String donate_coins; + private String enter_keywords_search; + private String episode_set; + private String first_start_close; + private String first_start_tips_message; + private String first_start_title; + private String free_from_ads; + private String g_pay_cancel; + private String g_pay_error; + private String g_pay_success; + private String google_login_exception; + private String home; + private String join; + private String jump_unlock_error; + private String lang_option_notice; + private String language; + private String language_text_system; + private String language_text_system_tip; + private String log_out; + private String login; + private String profile_vip_buy; + private String login_first; + private String login_read_text; + private String login_title_apple; + private String login_title_facebook; + private String login_title_tiktok; + private String me; + private String mine_text_renew; + private String mine_text_tip; + private String mine_title_browsing_istory; + private String mine_title_consumption; + private String mine_title_consumption_coins; + private String mine_title_consumption_vip; + private String mine_title_customer; + private String mine_title_setting; + private String mine_title_tourist; + private String more; + private String browsing_history; + private String my_collection; + private String network_error; + private String ad_error; + private String success; + private String no_more_data; + private String no_spend; + private String no_vip; + private String not_collect_warning; + private String not_unlock_episodes; + private String ok; + private String player_text_episcode; + private String privacy_policy; + private String purchase_record; + private String purchase_vip; + private String quit; + private String read_before_purchase; + private String recharge_coins; + private String recharge_wait_notice; + private String recommand; + private String recommand_head; + private String recommand_series; + private String refresh_Header_refreshing_text; + private String refresh_auto_footer_idle_text; + private String refresh_auto_footer_refreshing_rext; + private String refresh_auto_footer_no_more_data_text; + private String refresh_header_date_today_text; + private String refresh_header_idle_text; + private String refresh_header_last_time_text; + private String refresh_header_none_last_date_text; + private String refresh_header_pulling_text; + private String refresh_success; + private String reharge_vip_wait_notice; + private String s_no_content; + private String search; + private String search_history; + private String search_input; + private String send_coins; + private String send_coins_expire_notice; + private String setting_title_out; + private String settings; + private String short_ranking; + private String sin_in_with_google; + private String stay_turned; + private String system; + private String tabbar_discover; + private String tabbar_mine; + private String tabbar_videos; + private String theater; + private String tips; + private String coins_insufficient_and_recharge; + private String top_up_now; + private String try_again; + private String unlocking_coins_notice; + private String user_agreement; + private String vip_expire_time; + private String vip_not_credit_notice; + private String vip_update; + private String vistor; + private String watch_all; + private String watch_now; + private String alert_setting_message_signout; + private String yes; + private String top_up; + private String ad_viewing_limit; + private String tiktok_app_tips; + private String kick_out_login; + private String no_network; + + + public String getAlert_setting_message_logout() { + return alert_setting_message_logout; + } + + public void setAlert_setting_message_logout(String alert_setting_message_logout) { + this.alert_setting_message_logout = alert_setting_message_logout; + } + + public String getAll() { + return all; + } + + public void setAll(String all) { + this.all = all; + } + + public String getTitle_discover() { + return title_discover; + } + + public void setTitle_discover(String title_discover) { + this.title_discover = title_discover; + } + + public String getTitle_videos() { + return title_videos; + } + + public void setTitle_videos(String title_videos) { + this.title_videos = title_videos; + } + + public String getTitle_recommend() { + return title_recommend; + } + + public void setTitle_recommend(String title_recommend) { + this.title_recommend = title_recommend; + } + + public String getCommon_play() { + return common_play; + } + + public void setCommon_play(String common_play) { + this.common_play = common_play; + } + + public String getTitle_profile() { + return title_profile; + } + + public void setTitle_profile(String title_profile) { + this.title_profile = title_profile; + } + + public String getMember_service_ag() { + return member_service_ag; + } + + public void setMember_service_ag(String member_service_ag) { + this.member_service_ag = member_service_ag; + } + + public String getPlease_click_here() { + return please_click_here; + } + + public void setPlease_click_here(String please_click_here) { + this.please_click_here = please_click_here; + } + + public String getCommon_unlock() { + return common_unlock; + } + + public void setCommon_unlock(String common_unlock) { + this.common_unlock = common_unlock; + } + + public String getMember_service_agreement() { + return member_service_agreement; + } + + public void setMember_service_agreement(String member_service_agreement) { + this.member_service_agreement = member_service_agreement; + } + + public String getVip_not_credit_notice_1() { + return vip_not_credit_notice_1; + } + + public void setVip_not_credit_notice_1(String vip_not_credit_notice_1) { + this.vip_not_credit_notice_1 = vip_not_credit_notice_1; + } + + public String getVip_not_credit_notice_2() { + return vip_not_credit_notice_2; + } + + public void setVip_not_credit_notice_2(String vip_not_credit_notice_2) { + this.vip_not_credit_notice_2 = vip_not_credit_notice_2; + } + + public String getVip_not_credit_notice_3() { + return vip_not_credit_notice_3; + } + + public void setVip_not_credit_notice_3(String vip_not_credit_notice_3) { + this.vip_not_credit_notice_3 = vip_not_credit_notice_3; + } + + public String getVip_refresh() { + return vip_refresh; + } + + public void setVip_refresh(String vip_refresh) { + this.vip_refresh = vip_refresh; + } + + public String getAlter_cancel() { + return alter_cancel; + } + + public void setAlter_cancel(String alter_cancel) { + this.alter_cancel = alter_cancel; + } + + public String getAlter_confirm() { + return alter_confirm; + } + + public void setAlter_confirm(String alter_confirm) { + this.alter_confirm = alter_confirm; + } + + public String getBuy_episode_notice() { + return buy_episode_notice; + } + + public void setBuy_episode_notice(String buy_episode_notice) { + this.buy_episode_notice = buy_episode_notice; + } + + public String getChange_language() { + return change_language; + } + + public void setChange_language(String change_language) { + this.change_language = change_language; + } + + public String getClick_to_watch() { + return click_to_watch; + } + + public void setClick_to_watch(String click_to_watch) { + this.click_to_watch = click_to_watch; + } + + public String getCoins() { + return coins; + } + + public void setCoins(String coins) { + this.coins = coins; + } + + public String getCollection() { + return collection; + } + + public void setCollection(String collection) { + this.collection = collection; + } + + public String getSeen_today() { + return seen_today; + } + + public void setSeen_today(String seen_today) { + this.seen_today = seen_today; + } + + public String getWatch_video_unlock() { + return watch_video_unlock; + } + + public void setWatch_video_unlock(String watch_video_unlock) { + this.watch_video_unlock = watch_video_unlock; + } + + public String getCommom_highlight_agreement() { + return commom_highlight_agreement; + } + + public void setCommom_highlight_agreement(String commom_highlight_agreement) { + this.commom_highlight_agreement = commom_highlight_agreement; + } + + public String getCommom_highlight_children() { + return commom_highlight_children; + } + + public void setCommom_highlight_children(String commom_highlight_children) { + this.commom_highlight_children = commom_highlight_children; + } + + public String getCommom_highlight_privacy() { + return commom_highlight_privacy; + } + + public void setCommom_highlight_privacy(String commom_highlight_privacy) { + this.commom_highlight_privacy = commom_highlight_privacy; + } + + public String getCommom_highlight_teenager() { + return commom_highlight_teenager; + } + + public void setCommom_highlight_teenager(String commom_highlight_teenager) { + this.commom_highlight_teenager = commom_highlight_teenager; + } + + public String getCommom_highlight_third() { + return commom_highlight_third; + } + + public void setCommom_highlight_third(String commom_highlight_third) { + this.commom_highlight_third = commom_highlight_third; + } + + public String getCommom_highlight_user() { + return commom_highlight_user; + } + + public void setCommom_highlight_user(String commom_highlight_user) { + this.commom_highlight_user = commom_highlight_user; + } + + public String getCommom_text_subscribe() { + return commom_text_subscribe; + } + + public void setCommom_text_subscribe(String commom_text_subscribe) { + this.commom_text_subscribe = commom_text_subscribe; + } + + public String getCommon_button_more() { + return common_button_more; + } + + public void setCommon_button_more(String common_button_more) { + this.common_button_more = common_button_more; + } + + public String getComplete_episode() { + return complete_episode; + } + + public void setComplete_episode(String complete_episode) { + this.complete_episode = complete_episode; + } + + public String getConsumption_record() { + return consumption_record; + } + + public void setConsumption_record(String consumption_record) { + this.consumption_record = consumption_record; + } + + public String getContinue_watch() { + return continue_watch; + } + + public void setContinue_watch(String continue_watch) { + this.continue_watch = continue_watch; + } + + public String getDay() { + return day; + } + + public void setDay(String day) { + this.day = day; + } + + public String getDonate_coins() { + return donate_coins; + } + + public void setDonate_coins(String donate_coins) { + this.donate_coins = donate_coins; + } + + public String getEnter_keywords_search() { + return enter_keywords_search; + } + + public void setEnter_keywords_search(String enter_keywords_search) { + this.enter_keywords_search = enter_keywords_search; + } + + public String getEpisode_set() { + return episode_set; + } + + public void setEpisode_set(String episode_set) { + this.episode_set = episode_set; + } + + public String getFirst_start_close() { + return first_start_close; + } + + public void setFirst_start_close(String first_start_close) { + this.first_start_close = first_start_close; + } + + public String getFirst_start_tips_message() { + return first_start_tips_message; + } + + public void setFirst_start_tips_message(String first_start_tips_message) { + this.first_start_tips_message = first_start_tips_message; + } + + public String getFirst_start_title() { + return first_start_title; + } + + public void setFirst_start_title(String first_start_title) { + this.first_start_title = first_start_title; + } + + public String getFree_from_ads() { + return free_from_ads; + } + + public void setFree_from_ads(String free_from_ads) { + this.free_from_ads = free_from_ads; + } + + public String getG_pay_cancel() { + return g_pay_cancel; + } + + public void setG_pay_cancel(String g_pay_cancel) { + this.g_pay_cancel = g_pay_cancel; + } + + public String getG_pay_error() { + return g_pay_error; + } + + public void setG_pay_error(String g_pay_error) { + this.g_pay_error = g_pay_error; + } + + public String getG_pay_success() { + return g_pay_success; + } + + public void setG_pay_success(String g_pay_success) { + this.g_pay_success = g_pay_success; + } + + public String getGoogle_login_exception() { + return google_login_exception; + } + + public void setGoogle_login_exception(String google_login_exception) { + this.google_login_exception = google_login_exception; + } + + public String getHome() { + return home; + } + + public void setHome(String home) { + this.home = home; + } + + public String getJoin() { + return join; + } + + public void setJoin(String join) { + this.join = join; + } + + public String getJump_unlock_error() { + return jump_unlock_error; + } + + public void setJump_unlock_error(String jump_unlock_error) { + this.jump_unlock_error = jump_unlock_error; + } + + public String getLang_option_notice() { + return lang_option_notice; + } + + public void setLang_option_notice(String lang_option_notice) { + this.lang_option_notice = lang_option_notice; + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getLanguage_text_system() { + return language_text_system; + } + + public void setLanguage_text_system(String language_text_system) { + this.language_text_system = language_text_system; + } + + public String getLanguage_text_system_tip() { + return language_text_system_tip; + } + + public void setLanguage_text_system_tip(String language_text_system_tip) { + this.language_text_system_tip = language_text_system_tip; + } + + public String getLog_out() { + return log_out; + } + + public void setLog_out(String log_out) { + this.log_out = log_out; + } + + public String getLogin() { + return login; + } + + public void setLogin(String login) { + this.login = login; + } + + public String getProfile_vip_buy() { + return profile_vip_buy; + } + + public void setProfile_vip_buy(String profile_vip_buy) { + this.profile_vip_buy = profile_vip_buy; + } + + public String getLogin_first() { + return login_first; + } + + public void setLogin_first(String login_first) { + this.login_first = login_first; + } + + public String getLogin_read_text() { + return login_read_text; + } + + public void setLogin_read_text(String login_read_text) { + this.login_read_text = login_read_text; + } + + public String getLogin_title_apple() { + return login_title_apple; + } + + public void setLogin_title_apple(String login_title_apple) { + this.login_title_apple = login_title_apple; + } + + public String getLogin_title_facebook() { + return login_title_facebook; + } + + public void setLogin_title_facebook(String login_title_facebook) { + this.login_title_facebook = login_title_facebook; + } + + public String getLogin_title_tiktok() { + return login_title_tiktok; + } + + public void setLogin_title_tiktok(String login_title_tiktok) { + this.login_title_tiktok = login_title_tiktok; + } + + public String getMe() { + return me; + } + + public void setMe(String me) { + this.me = me; + } + + public String getMine_text_renew() { + return mine_text_renew; + } + + public void setMine_text_renew(String mine_text_renew) { + this.mine_text_renew = mine_text_renew; + } + + public String getMine_text_tip() { + return mine_text_tip; + } + + public void setMine_text_tip(String mine_text_tip) { + this.mine_text_tip = mine_text_tip; + } + + public String getMine_title_browsing_istory() { + return mine_title_browsing_istory; + } + + public void setMine_title_browsing_istory(String mine_title_browsing_istory) { + this.mine_title_browsing_istory = mine_title_browsing_istory; + } + + public String getMine_title_consumption() { + return mine_title_consumption; + } + + public void setMine_title_consumption(String mine_title_consumption) { + this.mine_title_consumption = mine_title_consumption; + } + + public String getMine_title_consumption_coins() { + return mine_title_consumption_coins; + } + + public void setMine_title_consumption_coins(String mine_title_consumption_coins) { + this.mine_title_consumption_coins = mine_title_consumption_coins; + } + + public String getMine_title_consumption_vip() { + return mine_title_consumption_vip; + } + + public void setMine_title_consumption_vip(String mine_title_consumption_vip) { + this.mine_title_consumption_vip = mine_title_consumption_vip; + } + + public String getMine_title_customer() { + return mine_title_customer; + } + + public void setMine_title_customer(String mine_title_customer) { + this.mine_title_customer = mine_title_customer; + } + + public String getMine_title_setting() { + return mine_title_setting; + } + + public void setMine_title_setting(String mine_title_setting) { + this.mine_title_setting = mine_title_setting; + } + + public String getMine_title_tourist() { + return mine_title_tourist; + } + + public void setMine_title_tourist(String mine_title_tourist) { + this.mine_title_tourist = mine_title_tourist; + } + + public String getMore() { + return more; + } + + public void setMore(String more) { + this.more = more; + } + + public String getBrowsing_history() { + return browsing_history; + } + + public void setBrowsing_history(String browsing_history) { + this.browsing_history = browsing_history; + } + + public String getMy_collection() { + return my_collection; + } + + public void setMy_collection(String my_collection) { + this.my_collection = my_collection; + } + + public String getNetwork_error() { + return network_error; + } + + public void setNetwork_error(String network_error) { + this.network_error = network_error; + } + + public String getAd_error() { + return ad_error; + } + + public void setAd_error(String ad_error) { + this.ad_error = ad_error; + } + + public String getSuccess() { + return success; + } + + public void setSuccess(String success) { + this.success = success; + } + + public String getNo_more_data() { + return no_more_data; + } + + public void setNo_more_data(String no_more_data) { + this.no_more_data = no_more_data; + } + + public String getNo_spend() { + return no_spend; + } + + public void setNo_spend(String no_spend) { + this.no_spend = no_spend; + } + + public String getNo_vip() { + return no_vip; + } + + public void setNo_vip(String no_vip) { + this.no_vip = no_vip; + } + + public String getNot_collect_warning() { + return not_collect_warning; + } + + public void setNot_collect_warning(String not_collect_warning) { + this.not_collect_warning = not_collect_warning; + } + + public String getNot_unlock_episodes() { + return not_unlock_episodes; + } + + public void setNot_unlock_episodes(String not_unlock_episodes) { + this.not_unlock_episodes = not_unlock_episodes; + } + + public String getOk() { + return ok; + } + + public void setOk(String ok) { + this.ok = ok; + } + + public String getPlayer_text_episcode() { + return player_text_episcode; + } + + public void setPlayer_text_episcode(String player_text_episcode) { + this.player_text_episcode = player_text_episcode; + } + + public String getPrivacy_policy() { + return privacy_policy; + } + + public void setPrivacy_policy(String privacy_policy) { + this.privacy_policy = privacy_policy; + } + + public String getPurchase_record() { + return purchase_record; + } + + public void setPurchase_record(String purchase_record) { + this.purchase_record = purchase_record; + } + + public String getPurchase_vip() { + return purchase_vip; + } + + public void setPurchase_vip(String purchase_vip) { + this.purchase_vip = purchase_vip; + } + + public String getQuit() { + return quit; + } + + public void setQuit(String quit) { + this.quit = quit; + } + + public String getRead_before_purchase() { + return read_before_purchase; + } + + public void setRead_before_purchase(String read_before_purchase) { + this.read_before_purchase = read_before_purchase; + } + + public String getRecharge_coins() { + return recharge_coins; + } + + public void setRecharge_coins(String recharge_coins) { + this.recharge_coins = recharge_coins; + } + + public String getRecharge_wait_notice() { + return recharge_wait_notice; + } + + public void setRecharge_wait_notice(String recharge_wait_notice) { + this.recharge_wait_notice = recharge_wait_notice; + } + + public String getRecommand() { + return recommand; + } + + public void setRecommand(String recommand) { + this.recommand = recommand; + } + + public String getRecommand_head() { + return recommand_head; + } + + public void setRecommand_head(String recommand_head) { + this.recommand_head = recommand_head; + } + + public String getRecommand_series() { + return recommand_series; + } + + public void setRecommand_series(String recommand_series) { + this.recommand_series = recommand_series; + } + + public String getRefresh_Header_refreshing_text() { + return refresh_Header_refreshing_text; + } + + public void setRefresh_Header_refreshing_text(String refresh_Header_refreshing_text) { + this.refresh_Header_refreshing_text = refresh_Header_refreshing_text; + } + + public String getRefresh_auto_footer_idle_text() { + return refresh_auto_footer_idle_text; + } + + public void setRefresh_auto_footer_idle_text(String refresh_auto_footer_idle_text) { + this.refresh_auto_footer_idle_text = refresh_auto_footer_idle_text; + } + + public String getRefresh_auto_footer_refreshing_rext() { + return refresh_auto_footer_refreshing_rext; + } + + public void setRefresh_auto_footer_refreshing_rext(String refresh_auto_footer_refreshing_rext) { + this.refresh_auto_footer_refreshing_rext = refresh_auto_footer_refreshing_rext; + } + + public String getRefresh_auto_footer_no_more_data_text() { + return refresh_auto_footer_no_more_data_text; + } + + public void setRefresh_auto_footer_no_more_data_text(String refresh_auto_footer_no_more_data_text) { + this.refresh_auto_footer_no_more_data_text = refresh_auto_footer_no_more_data_text; + } + + public String getRefresh_header_date_today_text() { + return refresh_header_date_today_text; + } + + public void setRefresh_header_date_today_text(String refresh_header_date_today_text) { + this.refresh_header_date_today_text = refresh_header_date_today_text; + } + + public String getRefresh_header_idle_text() { + return refresh_header_idle_text; + } + + public void setRefresh_header_idle_text(String refresh_header_idle_text) { + this.refresh_header_idle_text = refresh_header_idle_text; + } + + public String getRefresh_header_last_time_text() { + return refresh_header_last_time_text; + } + + public void setRefresh_header_last_time_text(String refresh_header_last_time_text) { + this.refresh_header_last_time_text = refresh_header_last_time_text; + } + + public String getRefresh_header_none_last_date_text() { + return refresh_header_none_last_date_text; + } + + public void setRefresh_header_none_last_date_text(String refresh_header_none_last_date_text) { + this.refresh_header_none_last_date_text = refresh_header_none_last_date_text; + } + + public String getRefresh_header_pulling_text() { + return refresh_header_pulling_text; + } + + public void setRefresh_header_pulling_text(String refresh_header_pulling_text) { + this.refresh_header_pulling_text = refresh_header_pulling_text; + } + + public String getRefresh_success() { + return refresh_success; + } + + public void setRefresh_success(String refresh_success) { + this.refresh_success = refresh_success; + } + + public String getReharge_vip_wait_notice() { + return reharge_vip_wait_notice; + } + + public void setReharge_vip_wait_notice(String reharge_vip_wait_notice) { + this.reharge_vip_wait_notice = reharge_vip_wait_notice; + } + + public String getS_no_content() { + return s_no_content; + } + + public void setS_no_content(String s_no_content) { + this.s_no_content = s_no_content; + } + + public String getSearch() { + return search; + } + + public void setSearch(String search) { + this.search = search; + } + + public String getSearch_history() { + return search_history; + } + + public void setSearch_history(String search_history) { + this.search_history = search_history; + } + + public String getSearch_input() { + return search_input; + } + + public void setSearch_input(String search_input) { + this.search_input = search_input; + } + + public String getSend_coins() { + return send_coins; + } + + public void setSend_coins(String send_coins) { + this.send_coins = send_coins; + } + + public String getSend_coins_expire_notice() { + return send_coins_expire_notice; + } + + public void setSend_coins_expire_notice(String send_coins_expire_notice) { + this.send_coins_expire_notice = send_coins_expire_notice; + } + + public String getSetting_title_out() { + return setting_title_out; + } + + public void setSetting_title_out(String setting_title_out) { + this.setting_title_out = setting_title_out; + } + + public String getSettings() { + return settings; + } + + public void setSettings(String settings) { + this.settings = settings; + } + + public String getShort_ranking() { + return short_ranking; + } + + public void setShort_ranking(String short_ranking) { + this.short_ranking = short_ranking; + } + + public String getSin_in_with_google() { + return sin_in_with_google; + } + + public void setSin_in_with_google(String sin_in_with_google) { + this.sin_in_with_google = sin_in_with_google; + } + + public String getStay_turned() { + return stay_turned; + } + + public void setStay_turned(String stay_turned) { + this.stay_turned = stay_turned; + } + + public String getSystem() { + return system; + } + + public void setSystem(String system) { + this.system = system; + } + + public String getTabbar_discover() { + return tabbar_discover; + } + + public void setTabbar_discover(String tabbar_discover) { + this.tabbar_discover = tabbar_discover; + } + + public String getTabbar_mine() { + return tabbar_mine; + } + + public void setTabbar_mine(String tabbar_mine) { + this.tabbar_mine = tabbar_mine; + } + + public String getTabbar_videos() { + return tabbar_videos; + } + + public void setTabbar_videos(String tabbar_videos) { + this.tabbar_videos = tabbar_videos; + } + + public String getTheater() { + return theater; + } + + public void setTheater(String theater) { + this.theater = theater; + } + + public String getTips() { + return tips; + } + + public void setTips(String tips) { + this.tips = tips; + } + + public String getCoins_insufficient_and_recharge() { + return coins_insufficient_and_recharge; + } + + public void setCoins_insufficient_and_recharge(String coins_insufficient_and_recharge) { + this.coins_insufficient_and_recharge = coins_insufficient_and_recharge; + } + + public String getTop_up_now() { + return top_up_now; + } + + public void setTop_up_now(String top_up_now) { + this.top_up_now = top_up_now; + } + + public String getTry_again() { + return try_again; + } + + public void setTry_again(String try_again) { + this.try_again = try_again; + } + + public String getUnlocking_coins_notice() { + return unlocking_coins_notice; + } + + public void setUnlocking_coins_notice(String unlocking_coins_notice) { + this.unlocking_coins_notice = unlocking_coins_notice; + } + + public String getUser_agreement() { + return user_agreement; + } + + public void setUser_agreement(String user_agreement) { + this.user_agreement = user_agreement; + } + + public String getVip_expire_time() { + return vip_expire_time; + } + + public void setVip_expire_time(String vip_expire_time) { + this.vip_expire_time = vip_expire_time; + } + + public String getVip_not_credit_notice() { + return vip_not_credit_notice; + } + + public void setVip_not_credit_notice(String vip_not_credit_notice) { + this.vip_not_credit_notice = vip_not_credit_notice; + } + + public String getVip_update() { + return vip_update; + } + + public void setVip_update(String vip_update) { + this.vip_update = vip_update; + } + + public String getVistor() { + return vistor; + } + + public void setVistor(String vistor) { + this.vistor = vistor; + } + + public String getWatch_all() { + return watch_all; + } + + public void setWatch_all(String watch_all) { + this.watch_all = watch_all; + } + + public String getWatch_now() { + return watch_now; + } + + public void setWatch_now(String watch_now) { + this.watch_now = watch_now; + } + + public String getAlert_setting_message_signout() { + return alert_setting_message_signout; + } + + public void setAlert_setting_message_signout(String alert_setting_message_signout) { + this.alert_setting_message_signout = alert_setting_message_signout; + } + + public String getYes() { + return yes; + } + + public void setYes(String yes) { + this.yes = yes; + } + + public String getTop_up() { + return top_up; + } + + public void setTop_up(String top_up) { + this.top_up = top_up; + } + + public String getAd_viewing_limit() { + return ad_viewing_limit; + } + + public void setAd_viewing_limit(String ad_viewing_limit) { + this.ad_viewing_limit = ad_viewing_limit; + } + + public String getTiktok_app_tips() { + return tiktok_app_tips; + } + + public void setTiktok_app_tips(String tiktok_app_tips) { + this.tiktok_app_tips = tiktok_app_tips; + } + + public String getKick_out_login() { + return kick_out_login; + } + + public void setKick_out_login(String kick_out_login) { + this.kick_out_login = kick_out_login; + } + + public String getNo_network() { + return no_network; + } + + public void setNo_network(String no_network) { + this.no_network = no_network; + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/model/VTAccountInfoBean.java b/app/src/main/java/com/viontv/app/model/VTAccountInfoBean.java new file mode 100644 index 0000000..0c4eec4 --- /dev/null +++ b/app/src/main/java/com/viontv/app/model/VTAccountInfoBean.java @@ -0,0 +1,86 @@ +package com.viontv.app.model; + +public class VTAccountInfoBean { + + public String avator; + public int coin_left_total; + public String customer_id; + public String family_name; + public String giving_name; + public int vip_end_time; + public boolean is_tourist; + public boolean is_vip; + public int send_coin_left_total; + + public String getAvator() { + return avator; + } + + public void setAvator(String avator) { + this.avator = avator; + } + + public int getCoin_left_total() { + return coin_left_total; + } + + public void setCoin_left_total(int coin_left_total) { + this.coin_left_total = coin_left_total; + } + + public String getCustomer_id() { + return customer_id; + } + + public void setCustomer_id(String customer_id) { + this.customer_id = customer_id; + } + + public String getFamily_name() { + return family_name; + } + + public void setFamily_name(String family_name) { + this.family_name = family_name; + } + + public String getGiving_name() { + return giving_name; + } + + public void setGiving_name(String giving_name) { + this.giving_name = giving_name; + } + + public int getVip_end_time() { + return vip_end_time; + } + + public void setVip_end_time(int vip_end_time) { + this.vip_end_time = vip_end_time; + } + + public boolean isIs_tourist() { + return is_tourist; + } + + public void setIs_tourist(boolean is_tourist) { + this.is_tourist = is_tourist; + } + + public boolean isIs_vip() { + return is_vip; + } + + public void setIs_vip(boolean is_vip) { + this.is_vip = is_vip; + } + + public int getSend_coin_left_total() { + return send_coin_left_total; + } + + public void setSend_coin_left_total(int send_coin_left_total) { + this.send_coin_left_total = send_coin_left_total; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/model/VTBaseData.java b/app/src/main/java/com/viontv/app/model/VTBaseData.java new file mode 100644 index 0000000..0602190 --- /dev/null +++ b/app/src/main/java/com/viontv/app/model/VTBaseData.java @@ -0,0 +1,32 @@ +package com.viontv.app.model; + +public class VTBaseData { + + int code; + String msg; + T data; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } +} diff --git a/app/src/main/java/com/viontv/app/model/VTVideoDetailsBean.java b/app/src/main/java/com/viontv/app/model/VTVideoDetailsBean.java new file mode 100644 index 0000000..4be06c8 --- /dev/null +++ b/app/src/main/java/com/viontv/app/model/VTVideoDetailsBean.java @@ -0,0 +1,425 @@ +package com.viontv.app.model; + +import android.os.Parcel; +import android.os.Parcelable; + +import androidx.annotation.NonNull; + +import java.util.List; + +public class VTVideoDetailsBean { + + + public List episodeList; + public boolean is_collect; + + public ShortPlayInfo shortPlayInfo; + + public VideoInfo video_info; + + + + public static class Episode implements Parcelable { + + int coins; + int episode; + int id; + boolean is_lock; + int is_vip; + int short_play_id; + String video_url; + int vip_coins; + + public int getVip_coins() { + return vip_coins; + } + + public void setVip_coins(int vip_coins) { + this.vip_coins = vip_coins; + } + + public String getVideo_url() { + return video_url; + } + + public void setVideo_url(String video_url) { + this.video_url = video_url; + } + + public int getShort_play_id() { + return short_play_id; + } + + public void setShort_play_id(int short_play_id) { + this.short_play_id = short_play_id; + } + + public int getIs_vip() { + return is_vip; + } + + public void setIs_vip(int is_vip) { + this.is_vip = is_vip; + } + + public boolean isIs_lock() { + return is_lock; + } + + public void setIs_lock(boolean is_lock) { + this.is_lock = is_lock; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getEpisode() { + return episode; + } + + public void setEpisode(int episode) { + this.episode = episode; + } + + public int getCoins() { + return coins; + } + + public void setCoins(int coins) { + this.coins = coins; + } + + protected Episode(Parcel in) { + coins = in.readInt(); + episode = in.readInt(); + id = in.readInt(); + is_lock = in.readByte() != 0; + is_vip = in.readInt(); + short_play_id = in.readInt(); + video_url = in.readString(); + vip_coins = in.readInt(); + } + + public final Creator CREATOR = new Creator() { + @Override + public Episode createFromParcel(Parcel in) { + return new Episode(in); + } + + @Override + public Episode[] newArray(int size) { + return new Episode[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + + dest.writeInt(coins); + dest.writeInt(episode); + dest.writeInt(id); + dest.writeByte((byte) (is_lock ? 1 : 0)); + dest.writeInt(is_vip); + dest.writeInt(short_play_id); + dest.writeString(video_url); + dest.writeInt(vip_coins); + } + } + + public static class ShortPlayInfo implements Parcelable { + + int all_coins; + int buy_type; + int collect_total; + String description; + int episode_total; + int id; + String image_url; + boolean is_collect; + String name; + int process; + int short_id; + int watch_total; + + public int getAll_coins() { + return all_coins; + } + + public void setAll_coins(int all_coins) { + this.all_coins = all_coins; + } + + public int getBuy_type() { + return buy_type; + } + + public void setBuy_type(int buy_type) { + this.buy_type = buy_type; + } + + public int getCollect_total() { + return collect_total; + } + + public void setCollect_total(int collect_total) { + this.collect_total = collect_total; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public int getEpisode_total() { + return episode_total; + } + + public void setEpisode_total(int episode_total) { + this.episode_total = episode_total; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getImage_url() { + return image_url; + } + + public void setImage_url(String image_url) { + this.image_url = image_url; + } + + public boolean isIs_collect() { + return is_collect; + } + + public void setIs_collect(boolean is_collect) { + this.is_collect = is_collect; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getProcess() { + return process; + } + + public void setProcess(int process) { + this.process = process; + } + + public int getShort_id() { + return short_id; + } + + public void setShort_id(int short_id) { + this.short_id = short_id; + } + + public int getWatch_total() { + return watch_total; + } + + public void setWatch_total(int watch_total) { + this.watch_total = watch_total; + } + + protected ShortPlayInfo(Parcel in) { + all_coins = in.readInt(); + buy_type = in.readInt(); + collect_total = in.readInt(); + description = in.readString(); + episode_total = in.readInt(); + id = in.readInt(); + image_url = in.readString(); + is_collect = in.readByte() != 0; + name = in.readString(); + process = in.readInt(); + short_id = in.readInt(); + watch_total = in.readInt(); + } + + public static final Creator CREATOR = new Creator() { + @Override + public ShortPlayInfo createFromParcel(Parcel in) { + return new ShortPlayInfo(in); + } + + @Override + public ShortPlayInfo[] newArray(int size) { + return new ShortPlayInfo[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + dest.writeInt(all_coins); + dest.writeInt(buy_type); + dest.writeInt(collect_total); + dest.writeString(description); + dest.writeInt(episode_total); + dest.writeInt(id); + dest.writeString(image_url); + dest.writeByte((byte) (is_collect ? 1 : 0)); + dest.writeString(name); + dest.writeInt(process); + dest.writeInt(short_id); + dest.writeInt(watch_total); + } + } + + public static class VideoInfo implements Parcelable{ + + int coins; + int episode; + int id; + int is_vip; + int short_id; + int short_play_id; + int short_play_video_id; + String video_url; + int vip_coins; + + public int getCoins() { + return coins; + } + + public void setCoins(int coins) { + this.coins = coins; + } + + public int getEpisode() { + return episode; + } + + public void setEpisode(int episode) { + this.episode = episode; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getIs_vip() { + return is_vip; + } + + public void setIs_vip(int is_vip) { + this.is_vip = is_vip; + } + + public int getShort_id() { + return short_id; + } + + public void setShort_id(int short_id) { + this.short_id = short_id; + } + + public int getShort_play_id() { + return short_play_id; + } + + public void setShort_play_id(int short_play_id) { + this.short_play_id = short_play_id; + } + + public int getShort_play_video_id() { + return short_play_video_id; + } + + public void setShort_play_video_id(int short_play_video_id) { + this.short_play_video_id = short_play_video_id; + } + + public String getVideo_url() { + return video_url; + } + + public void setVideo_url(String video_url) { + this.video_url = video_url; + } + + public int getVip_coins() { + return vip_coins; + } + + public void setVip_coins(int vip_coins) { + this.vip_coins = vip_coins; + } + + protected VideoInfo(Parcel in) { + coins = in.readInt(); + episode = in.readInt(); + id = in.readInt(); + is_vip = in.readInt(); + short_id = in.readInt(); + short_play_id = in.readInt(); + short_play_video_id = in.readInt(); + video_url = in.readString(); + vip_coins = in.readInt(); + } + + public static final Creator CREATOR = new Creator() { + @Override + public VideoInfo createFromParcel(Parcel in) { + return new VideoInfo(in); + } + + @Override + public VideoInfo[] newArray(int size) { + return new VideoInfo[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + dest.writeInt(coins); + dest.writeInt(episode); + dest.writeInt(id); + dest.writeInt(is_vip); + dest.writeInt(short_id); + dest.writeInt(short_play_id); + dest.writeInt(short_play_video_id); + dest.writeString(video_url); + dest.writeInt(vip_coins); + } + } +} diff --git a/app/src/main/java/com/viontv/app/ui/activity/VTMainActivity.java b/app/src/main/java/com/viontv/app/ui/activity/VTMainActivity.java new file mode 100644 index 0000000..2187c7c --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/activity/VTMainActivity.java @@ -0,0 +1,138 @@ +package com.viontv.app.ui.activity; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.AppCompatTextView; +import androidx.fragment.app.Fragment; + +import android.os.Bundle; +import android.view.View; + +import com.viontv.app.R; +import com.viontv.app.databinding.ActivityMainVtBinding; +import com.viontv.app.ui.activity.basic.VTCommonActivity; +import com.viontv.app.ui.activity.explore.VTExploreFragment; +import com.viontv.app.ui.activity.home.VTHomeFragment; +import com.viontv.app.ui.activity.me.VTMeFragment; +import com.viontv.app.ui.activity.mylist.VTMyListFragment; +import com.viontv.app.ui.adapter.FragmentAdapter; + +import java.util.ArrayList; +import java.util.List; + +public class VTMainActivity extends VTCommonActivity implements View.OnClickListener { + + + private static final int START_INDEX = 0; + private View mCurrentTab; + private VTHomeFragment VTHomeFragment; + private VTExploreFragment VTExploreFragment; + private VTMyListFragment VTMyListFragment; + private VTMeFragment VTMeFragment; + + ActivityMainVtBinding binding; + + private FragmentAdapter fragmentAdapter; + + + + @Override + public void init() { + getWindow().setNavigationBarColor(getResources().getColor(android.R.color.black)); + binding = ActivityMainVtBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + } + + @Override + public void initView() { + List fragments = new ArrayList<>(); + + VTHomeFragment = VTHomeFragment.newInstance(); + VTExploreFragment = VTExploreFragment.newInstance(); + VTMyListFragment = VTMyListFragment.newInstance(); + VTMeFragment = VTMeFragment.newInstance(); + + fragments.add(VTHomeFragment); + fragments.add(VTExploreFragment); + fragments.add(VTMyListFragment); + fragments.add(VTMeFragment); + fragmentAdapter = new FragmentAdapter(this); + fragmentAdapter.setFragmentList(fragments); + binding.container.setUserInputEnabled(false); + binding.container.setAdapter(fragmentAdapter); + binding.container.setCurrentItem(START_INDEX, false); + binding.container.setOffscreenPageLimit(fragments.size()); + + binding.tvVtMainHome.setOnClickListener(this); + binding.tvVtMainExplore.setOnClickListener(this); + binding.tvVtMainMylist.setOnClickListener(this); + binding.tvVtMainMe.setOnClickListener(this); + + mCurrentTab = binding.tvVtMainHome; + resetTabCurrent(); + } + + @Override + public void logic() { + + } + + private void resetTabStyle() { + + binding.tvVtMainHome.setTextColor( + getResources().getColor(R.color.color_d2d2d2)); + binding.tvVtMainHome.setCompoundDrawablesWithIntrinsicBounds( + null, getResources().getDrawable(R.mipmap.iv_main_tab_home_default), null, null); + + binding.tvVtMainExplore.setTextColor(getResources().getColor(R.color.color_d2d2d2)); + binding.tvVtMainExplore.setCompoundDrawablesWithIntrinsicBounds( + null, getResources().getDrawable(R.mipmap.iv_main_tab_explore_default), null, null); + + binding.tvVtMainMylist.setTextColor(getResources().getColor(R.color.color_d2d2d2)); + binding.tvVtMainMylist.setCompoundDrawablesWithIntrinsicBounds( + null, getResources().getDrawable(R.mipmap.iv_main_tab_mylist_default), null, null); + + binding.tvVtMainMe.setTextColor(getResources().getColor(R.color.color_d2d2d2)); + binding.tvVtMainMe.setCompoundDrawablesWithIntrinsicBounds( + null, getResources().getDrawable(R.mipmap.iv_main_tab_me_default), null, null); + } + + private void resetTabCurrent() { + if (mCurrentTab == binding.tvVtMainHome) { + setClickItem(0, binding.tvVtMainHome, R.mipmap.iv_main_tab_home_click); + } + if (mCurrentTab == binding.tvVtMainExplore) { + setClickItem(1, binding.tvVtMainExplore, R.mipmap.iv_main_tab_explore_click); + + } + if (mCurrentTab == binding.tvVtMainMylist) { + setClickItem(2, binding.tvVtMainMylist, R.mipmap.iv_main_tab_mylist_click); + + } + if (mCurrentTab == binding.tvVtMainMe) { + setClickItem(3, binding.tvVtMainMe, R.mipmap.iv_main_tab_me_click); + + } + } + + + public void setClickItem(int index, AppCompatTextView textView, int resource) { + binding.container.setCurrentItem(index, false); + textView.setTextColor( + getResources().getColor(R.color.color_f564b6)); + textView.setCompoundDrawablesWithIntrinsicBounds( + null, getResources().getDrawable(resource), null, null); + } + + + @Override + public void onClick(View v) { + if (mCurrentTab != null && mCurrentTab == v) { + return; + } + resetTabStyle(); + mCurrentTab = v; + resetTabCurrent(); + + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/ui/activity/basic/VTBaseEventBus.java b/app/src/main/java/com/viontv/app/ui/activity/basic/VTBaseEventBus.java new file mode 100644 index 0000000..baa2cfb --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/activity/basic/VTBaseEventBus.java @@ -0,0 +1,43 @@ +package com.viontv.app.ui.activity.basic; + +public class VTBaseEventBus { + private final String code; + private final T data; + + public VTBaseEventBus(String code, T data) { + this.code = code; + this.data = data; + } + + public String getCode() { + return code; + } + + public T getData() { + return data; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + VTBaseEventBus that = (VTBaseEventBus) o; + if (code != null ? !code.equals(that.code) : that.code != null) return false; + return data != null ? data.equals(that.data) : that.data == null; + } + + @Override + public int hashCode() { + int result = code != null ? code.hashCode() : 0; + result = 31 * result + (data != null ? data.hashCode() : 0); + return result; + } + + @Override + public String toString() { + return "BaseEventBus{" + + "code='" + code + '\'' + + ", data=" + data + + '}'; + } +} diff --git a/app/src/main/java/com/viontv/app/ui/activity/basic/VTCommonActivity.java b/app/src/main/java/com/viontv/app/ui/activity/basic/VTCommonActivity.java new file mode 100644 index 0000000..fa4b0fe --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/activity/basic/VTCommonActivity.java @@ -0,0 +1,67 @@ +package com.viontv.app.ui.activity.basic; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Context; +import android.content.pm.ActivityInfo; +import android.os.Bundle; +import android.view.WindowManager; +import android.widget.EditText; +import android.view.inputmethod.InputMethodManager; + +import com.viontv.app.utils.VTStatusBarUtils; + +public abstract class VTCommonActivity extends AppCompatActivity { + // 定义一个泛型类型的成员变量 _viewBinding,初始值为 null + public T viewBinding; + + // 定义一个受保护的 getter 方法 viewBinding,用于获取 _viewBinding 的值 + public T getViewBinding() { + return viewBinding; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + // 调用 HibitStatusBarTools 类的 pageDarkMode 方法,设置页面为深色模式 + VTStatusBarUtils.pageDarkMode(this, true); + // 设置窗口标志,防止屏幕内容被截屏或录制 + getWindow().setFlags( + WindowManager.LayoutParams.FLAG_SECURE, + WindowManager.LayoutParams.FLAG_SECURE + ); + // 设置活动的屏幕方向为竖屏 + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); + // 调用抽象方法 init、initView 和 logic + init(); + initView(); + logic(); + } + + // 定义抽象方法 init,具体实现由子类完成 + public abstract void init(); + + // 定义抽象方法 initView,具体实现由子类完成 + public abstract void initView(); + + // 定义抽象方法 logic,具体实现由子类完成 + public abstract void logic(); + + // 定义方法 showKeyBord,用于显示软键盘 + public void showKeyBord(EditText mEditText, Context mContext) { + // 获取输入法管理器 + InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); + // 显示软键盘 + imm.showSoftInput(mEditText, InputMethodManager.SHOW_FORCED); + // 切换软键盘的显示状态 + imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); + } + + // 定义方法 hideKeyBord,用于隐藏软键盘 + public void hideKeyBord(EditText mEditText, Context mContext) { + // 获取输入法管理器 + InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); + // 隐藏软键盘 + imm.hideSoftInputFromWindow(mEditText.getWindowToken(), 0); + } +} diff --git a/app/src/main/java/com/viontv/app/ui/activity/basic/VTCommonFragment.java b/app/src/main/java/com/viontv/app/ui/activity/basic/VTCommonFragment.java new file mode 100644 index 0000000..57d2234 --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/activity/basic/VTCommonFragment.java @@ -0,0 +1,51 @@ +package com.viontv.app.ui.activity.basic; + +import android.content.Context; +import android.os.Bundle; +import android.view.View; +import android.view.inputmethod.InputMethodManager; +import android.widget.EditText; +import androidx.fragment.app.Fragment; + +// 定义一个抽象泛型类 HibitCommonFragment,继承自 Fragment +public abstract class VTCommonFragment extends Fragment { + // 定义一个泛型类型的成员变量 _viewBinding,初始值为 null + private T _viewBinding; + + // 定义一个受保护的 getter 方法 viewBinding,用于获取 _viewBinding 的值 + protected T getViewBinding() { + return _viewBinding; + } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + // 调用抽象方法 initView 和 logic + initView(); + logic(); + } + + // 定义抽象方法 initView,具体实现由子类完成 + public abstract void initView(); + + // 定义抽象方法 logic,具体实现由子类完成 + public abstract void logic(); + + // 定义方法 showKeyBord,用于显示软键盘 + public void showKeyBord(EditText mEditText, Context mContext) { + // 获取输入法管理器 + InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); + // 显示软键盘 + imm.showSoftInput(mEditText, InputMethodManager.SHOW_FORCED); + // 切换软键盘的显示状态 + imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); + } + + // 定义方法 hideKeyBord,用于隐藏软键盘 + public void hideKeyBord(EditText mEditText, Context mContext) { + // 获取输入法管理器 + InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); + // 隐藏软键盘 + imm.hideSoftInputFromWindow(mEditText.getWindowToken(), 0); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/ui/activity/explore/VTExploreFragment.java b/app/src/main/java/com/viontv/app/ui/activity/explore/VTExploreFragment.java new file mode 100644 index 0000000..9cf02b5 --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/activity/explore/VTExploreFragment.java @@ -0,0 +1,41 @@ +package com.viontv.app.ui.activity.explore; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.lifecycle.ViewModelProvider; + +import com.viontv.app.databinding.FragmentMainVtBinding; +import com.viontv.app.ui.activity.home.MainViewModel; + + +public class VTExploreFragment extends Fragment { + + private MainViewModel mViewModel; + private FragmentMainVtBinding binding; + + public static VTExploreFragment newInstance() { + return new VTExploreFragment(); + } + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(MainViewModel.class); + // TODO: Use the ViewModel + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + binding = FragmentMainVtBinding.inflate(inflater); + return binding.getRoot(); + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/ui/activity/home/MainViewModel.java b/app/src/main/java/com/viontv/app/ui/activity/home/MainViewModel.java new file mode 100644 index 0000000..74e9774 --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/activity/home/MainViewModel.java @@ -0,0 +1,7 @@ +package com.viontv.app.ui.activity.home; + +import androidx.lifecycle.ViewModel; + +public class MainViewModel extends ViewModel { + // TODO: Implement the ViewModel +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/ui/activity/home/VTHomeFragment.java b/app/src/main/java/com/viontv/app/ui/activity/home/VTHomeFragment.java new file mode 100644 index 0000000..586f206 --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/activity/home/VTHomeFragment.java @@ -0,0 +1,131 @@ +package com.viontv.app.ui.activity.home; + +import androidx.fragment.app.FragmentActivity; +import androidx.lifecycle.ViewModelProvider; + +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.viewpager2.adapter.FragmentStateAdapter; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.google.android.material.tabs.TabLayoutMediator; +import com.viontv.app.R; +import com.viontv.app.api.VTApi; +import com.viontv.app.api.VTBaseObserver; +import com.viontv.app.api.VTResult; +import com.viontv.app.databinding.FragmentMainVtBinding; +import com.viontv.app.model.CateGoryItemBean; +import com.viontv.app.model.HomeTopBean; + +import java.util.ArrayList; +import java.util.List; + +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.schedulers.Schedulers; + + +public class VTHomeFragment extends Fragment { + + private com.viontv.app.ui.activity.home.MainViewModel mViewModel; + private FragmentMainVtBinding binding; + + private ArrayList titles; + + private List listFragment; + + public static VTHomeFragment newInstance() { + return new VTHomeFragment(); + } + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(com.viontv.app.ui.activity.home.MainViewModel.class); + // TODO: Use the ViewModel + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + binding = FragmentMainVtBinding.inflate(inflater); + return binding.getRoot(); + } + + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + getTopTitles(); + + } + + private void getTopTitles() { + VTApi.getInstance().homeTop() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new VTBaseObserver>() { + + @Override + public void onSuccess(VTResult feedbackResp) { + List itemBeans = feedbackResp.data.getCategory(); + tabShow(itemBeans); + binding.tvHomeSearch.setHint(feedbackResp.data.getHotData().get(0).getName()); + } + + @Override + public void onError(int code, String msg) { + + } + }); + } + + private void tabShow(List itemBeans) { + titles = new ArrayList<>(itemBeans.size() + 2); + titles.add(getString(R.string.tab_home_hot)); + titles.add(getString(R.string.tab_home_top10)); + listFragment = new ArrayList<>(); + listFragment.add(VTHotFragment.newInstance()); + listFragment.add(VTTopFragment.newInstance()); + for (CateGoryItemBean itemBean:itemBeans){ + titles.add(itemBean.getCategory_name()); + listFragment.add(VTTabItemFragment.newInstance(itemBean.getCategory_id())); + } + CommunityAdapter adapter = new CommunityAdapter(getActivity(), titles, listFragment); + binding.viewpager.setAdapter(adapter); +//把TabLayout(选项卡布局)和ViewPager2绑定在一起。特别说明一下,下面这行代码是官方给的,特别好使。 + new TabLayoutMediator(binding.tablayout, binding.viewpager, (tab, position) -> tab.setText(titles.get(position))).attach(); + + } + + public class CommunityAdapter extends FragmentStateAdapter { + private ArrayList listTitle; + private List listFragment; + + + public CommunityAdapter(@NonNull FragmentActivity fragmentActivity, ArrayList listTitle, List listFragment) { + super(fragmentActivity); + this.listTitle = listTitle; + this.listFragment = listFragment; + } + + + @NonNull + @Override + public Fragment createFragment(int position) { + return listFragment.get(position); + } + + @Override + public int getItemCount() { + return listFragment.size(); + } + + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/ui/activity/home/VTHotFragment.java b/app/src/main/java/com/viontv/app/ui/activity/home/VTHotFragment.java new file mode 100644 index 0000000..a36aade --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/activity/home/VTHotFragment.java @@ -0,0 +1,223 @@ +package com.viontv.app.ui.activity.home; + +import android.content.Intent; +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.lifecycle.ViewModelProvider; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.viontv.app.api.VTApi; +import com.viontv.app.api.VTBaseObserver; +import com.viontv.app.api.VTResult; +import com.viontv.app.databinding.FragmentHotVtBinding; +import com.viontv.app.databinding.ItemHomeExploreVtBinding; +import com.viontv.app.databinding.ItemHotSquareVtBinding; +import com.viontv.app.model.HomeBottomListBean; +import com.viontv.app.model.HomeNineSquareBean; +import com.viontv.app.model.HomeTopBannerBean; +import com.viontv.app.model.ItemBean; +import com.viontv.app.ui.adapter.BannerHomeAdapter; +import com.viontv.app.ui.adapter.CommonAdapter; +import com.viontv.app.ui.adapter.HotBottomListAdapter; +import com.viontv.app.ui.adapter.NineSquareAdapter; +import com.viontv.app.utils.IntentUtils; +import com.youth.banner.listener.OnBannerListener; + +import java.util.List; + +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.schedulers.Schedulers; + + +public class VTHotFragment extends Fragment { + + private MainViewModel mViewModel; + private FragmentHotVtBinding binding; + + private int currentPage = 1; + + HotBottomListAdapter adapter; + LinearLayoutManager layoutManager; + + public static VTHotFragment newInstance() { + return new VTHotFragment(); + } + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(MainViewModel.class); + + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + binding = FragmentHotVtBinding.inflate(inflater); + return binding.getRoot(); + } + + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + initShow(); + } + + public void initShow() { + binding.banner.addBannerLifecycleObserver(this); + initBannerAndSquare(); + initHomeBottom(); + binding.recyclerviewGenres.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { + super.onScrollStateChanged(recyclerView, newState); + } + + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + super.onScrolled(recyclerView, dx, dy); + } + }); + } + + public void initBannerAndSquare() { + VTApi.getInstance().bannersquare() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new VTBaseObserver>() { + + @Override + public void onSuccess(VTResult feedbackResp) { + + initBanner(feedbackResp.data.getBannerData()); + initSquareTop(feedbackResp.data.getNineSquare()); + + } + + @Override + public void onError(int code, String msg) { + + } + }); + } + + private final int LOAD_MORE_DIFF = 9; + + public void initHomeBottom() { + layoutManager = new LinearLayoutManager(getActivity()); + binding.recyclerviewGenres.setLayoutManager(layoutManager); + adapter = new HotBottomListAdapter(getActivity(), ItemHomeExploreVtBinding.class); + adapter.setItemClickListener((data, holder) -> { + IntentUtils.startPlayerDetails(getActivity(), data.getShort_play_id(), 0); + }); + binding.recyclerviewGenres.setAdapter(adapter); + + binding.recyclerviewGenres.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { + super.onScrollStateChanged(recyclerView, newState); + if (newState == RecyclerView.SCROLL_STATE_IDLE) { + int position = layoutManager.findLastCompletelyVisibleItemPosition(); + int position2 = layoutManager.findLastVisibleItemPosition(); + Log.i("Home+++++++++++++++", "position==" + position); + Log.i("Home+++++++++++++++", "position2==" + position2); + if (position == adapter.getItemCount() - 1) { + Log.i("Home+++++++++++++++", "page++++"); + currentPage++; + getBottomData(); + } +// if (adapter.getItemCount() < position + LOAD_MORE_DIFF +// && adapter.getItemCount() > 0) { +// Log.i("Home+++++++++++++++", "page++++"); +// currentPage++; +// getBottomData(); +// } + } + } + + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + super.onScrolled(recyclerView, dx, dy); + } + }); + currentPage = 1; + getBottomData(); + } + + public void getBottomData() { + VTApi.getInstance().newShortPlay(currentPage, 10) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new VTBaseObserver>() { + + @Override + public void onSuccess(VTResult feedbackResp) { + if (currentPage == 1) { + adapter.addDataList(feedbackResp.data.getShort_play_list(), true); + } else { + adapter.addDataList(feedbackResp.data.getShort_play_list(), false); + } + + + } + + @Override + public void onError(int code, String msg) { + + } + }); + } + + + public void initBanner(List itemBeans) { + + binding.banner.setAdapter(new BannerHomeAdapter(itemBeans)). + setCurrentItem(0, true) + .addBannerLifecycleObserver(this) + .setOnBannerListener((data, position) -> IntentUtils.startPlayerDetails(getActivity(), itemBeans.get(position).getShort_play_id(), 0)) + .isAutoLoop(true); + + + binding.banner.start(); + + } + + /** + * 顶部九宫格 + */ + public void initSquareTop(HomeNineSquareBean homeNineSquareBean) { + + binding.trendingTv.setText(homeNineSquareBean.getTitle()); + binding.recyclerviewTrending.setLayoutManager(new GridLayoutManager(getActivity(), 3)); + NineSquareAdapter adapter = new NineSquareAdapter(getActivity(), ItemHotSquareVtBinding.class); + adapter.setItemClickListener((data, holder) -> { + IntentUtils.startPlayerDetails(getActivity(), data.getShort_play_id(), 0); + }); + adapter.addDataList(homeNineSquareBean.getList(), true); + binding.recyclerviewTrending.setAdapter(adapter); + + + } + + @Override + public void onStop() { + super.onStop(); + binding.banner.stop(); + } + + @Override + public void onDestroy() { + super.onDestroy(); + binding.banner.destroy(); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/ui/activity/home/VTTabItemFragment.java b/app/src/main/java/com/viontv/app/ui/activity/home/VTTabItemFragment.java new file mode 100644 index 0000000..1f27d58 --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/activity/home/VTTabItemFragment.java @@ -0,0 +1,214 @@ +package com.viontv.app.ui.activity.home; + +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.lifecycle.ViewModelProvider; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.viontv.app.api.VTApi; +import com.viontv.app.api.VTBaseObserver; +import com.viontv.app.api.VTResult; +import com.viontv.app.databinding.FragmentCategoryItemBinding; +import com.viontv.app.databinding.FragmentHotVtBinding; +import com.viontv.app.databinding.FragmentTopVtBinding; +import com.viontv.app.databinding.ItemHomeExploreVtBinding; +import com.viontv.app.databinding.ItemHomeTablistVtBinding; +import com.viontv.app.databinding.ItemHotSquareVtBinding; +import com.viontv.app.model.HomeBottomListBean; +import com.viontv.app.model.HomeNineSquareBean; +import com.viontv.app.model.HomeTopBannerBean; +import com.viontv.app.model.ItemBean; +import com.viontv.app.model.TabItemBean; +import com.viontv.app.ui.adapter.BannerHomeAdapter; +import com.viontv.app.ui.adapter.HotBottomListAdapter; +import com.viontv.app.ui.adapter.NineSquareAdapter; +import com.viontv.app.ui.adapter.TabItemListAdapter; +import com.viontv.app.utils.IntentUtils; + +import java.util.List; + +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.schedulers.Schedulers; + + +public class VTTabItemFragment extends Fragment { + + private MainViewModel mViewModel; + private FragmentCategoryItemBinding binding; + + private int currentPage = 1; + + TabItemListAdapter adapter; + LinearLayoutManager layoutManager; + + private int categoryId; + + + public static VTTabItemFragment newInstance(int categoryId) { + Bundle bundle = new Bundle(); + bundle.putInt("categoryId", categoryId); + VTTabItemFragment view = new VTTabItemFragment(); + view.setArguments(bundle); + return view; + } + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(MainViewModel.class); + + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + binding = FragmentCategoryItemBinding.inflate(inflater); + categoryId = getArguments().getInt("categoryId"); + return binding.getRoot(); + } + + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + initShow(); + } + + public void initShow() { + binding.banner.addBannerLifecycleObserver(this); + initBannerData(); + initGridList(); + binding.recyclerviewGrid.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { + super.onScrollStateChanged(recyclerView, newState); + } + + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + super.onScrolled(recyclerView, dx, dy); + } + }); + } + + public void initBannerData() { + VTApi.getInstance().getTabItemBanner(String.valueOf(categoryId)) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new VTBaseObserver>() { + + @Override + public void onSuccess(VTResult feedbackResp) { + + initBanner(feedbackResp.data.getBanners()); + + + } + + @Override + public void onError(int code, String msg) { + + } + }); + } + + private final int LOAD_MORE_DIFF = 9; + + public void initGridList() { + layoutManager = new GridLayoutManager(getActivity(), 2); + binding.recyclerviewGrid.setLayoutManager(layoutManager); + adapter = new TabItemListAdapter(getActivity(), ItemHomeTablistVtBinding.class); + adapter.setItemClickListener((data, holder) -> { + IntentUtils.startPlayerDetails(getActivity(), data.getShort_play_id(), 0); + }); + binding.recyclerviewGrid.setAdapter(adapter); + + binding.recyclerviewGrid.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { + super.onScrollStateChanged(recyclerView, newState); + if (newState == RecyclerView.SCROLL_STATE_IDLE) { + int position = layoutManager.findLastCompletelyVisibleItemPosition(); + int position2 = layoutManager.findLastVisibleItemPosition(); + Log.i("Home+++++++++++++++", "position==" + position); + Log.i("Home+++++++++++++++", "position2==" + position2); + if (position == adapter.getItemCount() - 1) { + Log.i("Home+++++++++++++++", "page++++"); + currentPage++; + getBottomData(); + } +// if (adapter.getItemCount() < position + LOAD_MORE_DIFF +// && adapter.getItemCount() > 0) { +// Log.i("Home+++++++++++++++", "page++++"); +// currentPage++; +// getBottomData(); +// } + } + } + + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + super.onScrolled(recyclerView, dx, dy); + } + }); + currentPage = 1; + getBottomData(); + } + + public void getBottomData() { + VTApi.getInstance().getVideoList(String.valueOf(categoryId), currentPage, 10, "") + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new VTBaseObserver>() { + + @Override + public void onSuccess(VTResult feedbackResp) { + if (currentPage == 1) { + adapter.addDataList(feedbackResp.data.getList(), true); + } else { + adapter.addDataList(feedbackResp.data.getList(), false); + } + + + } + + @Override + public void onError(int code, String msg) { + + } + }); + } + + + public void initBanner(List itemBeans) { + + binding.banner.setAdapter(new BannerHomeAdapter(itemBeans)). + setCurrentItem(0, true) + .addBannerLifecycleObserver(this) + .setOnBannerListener((data, position) -> IntentUtils.startPlayerDetails(getActivity(), itemBeans.get(position).getShort_play_id(), 0)) + .isAutoLoop(true); + binding.banner.start(); + + } + + @Override + public void onStop() { + super.onStop(); + binding.banner.stop(); + } + + @Override + public void onDestroy() { + super.onDestroy(); + binding.banner.destroy(); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/ui/activity/home/VTTopFragment.java b/app/src/main/java/com/viontv/app/ui/activity/home/VTTopFragment.java new file mode 100644 index 0000000..d3230a4 --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/activity/home/VTTopFragment.java @@ -0,0 +1,93 @@ +package com.viontv.app.ui.activity.home; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.lifecycle.ViewModelProvider; +import androidx.recyclerview.widget.LinearLayoutManager; + +import com.viontv.app.api.VTApi; +import com.viontv.app.api.VTApiService; +import com.viontv.app.api.VTBaseObserver; +import com.viontv.app.api.VTResult; + +import com.viontv.app.databinding.FragmentTopVtBinding; +import com.viontv.app.databinding.ItemHomeExploreVtBinding; +import com.viontv.app.model.HomeBottomListBean; + +import com.viontv.app.ui.adapter.Top10ListAdapter; + +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.schedulers.Schedulers; + + +public class VTTopFragment extends Fragment { + + private MainViewModel mViewModel; + private FragmentTopVtBinding binding; + + + Top10ListAdapter adapter; + LinearLayoutManager layoutManager; + + public static VTTopFragment newInstance() { + return new VTTopFragment(); + } + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(MainViewModel.class); + + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + binding = FragmentTopVtBinding.inflate(inflater); + return binding.getRoot(); + } + + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + initList(); + } + + public void initList() { + layoutManager = new LinearLayoutManager(getActivity()); + binding.rvFragmentHometop.setLayoutManager(layoutManager); + layoutManager = new LinearLayoutManager(getActivity()); + binding.rvFragmentHometop.setLayoutManager(layoutManager); + adapter = new Top10ListAdapter(getActivity(), ItemHomeExploreVtBinding.class); + binding.rvFragmentHometop.setAdapter(adapter); + getTop10Data(); + } + + public void getTop10Data() { + VTApi.getInstance().homeTop10(VTApiService.rankTop10Type) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new VTBaseObserver>() { + + @Override + public void onSuccess(VTResult feedbackResp) { + adapter.addDataList(feedbackResp.data.getList(), true); + + } + + @Override + public void onError(int code, String msg) { + + } + }); + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/ui/activity/me/VTMeFragment.java b/app/src/main/java/com/viontv/app/ui/activity/me/VTMeFragment.java new file mode 100644 index 0000000..345fcb9 --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/activity/me/VTMeFragment.java @@ -0,0 +1,41 @@ +package com.viontv.app.ui.activity.me; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.lifecycle.ViewModelProvider; + +import com.viontv.app.databinding.FragmentMainVtBinding; +import com.viontv.app.ui.activity.home.MainViewModel; + + +public class VTMeFragment extends Fragment { + + private MainViewModel mViewModel; + private FragmentMainVtBinding binding; + + public static VTMeFragment newInstance() { + return new VTMeFragment(); + } + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(MainViewModel.class); + // TODO: Use the ViewModel + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + binding = FragmentMainVtBinding.inflate(inflater); + return binding.getRoot(); + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/ui/activity/mylist/VTMyListFragment.java b/app/src/main/java/com/viontv/app/ui/activity/mylist/VTMyListFragment.java new file mode 100644 index 0000000..4157125 --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/activity/mylist/VTMyListFragment.java @@ -0,0 +1,41 @@ +package com.viontv.app.ui.activity.mylist; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.lifecycle.ViewModelProvider; + +import com.viontv.app.databinding.FragmentMainVtBinding; +import com.viontv.app.ui.activity.home.MainViewModel; + + +public class VTMyListFragment extends Fragment { + + private MainViewModel mViewModel; + private FragmentMainVtBinding binding; + + public static VTMyListFragment newInstance() { + return new VTMyListFragment(); + } + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mViewModel = new ViewModelProvider(this).get(MainViewModel.class); + // TODO: Use the ViewModel + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + binding = FragmentMainVtBinding.inflate(inflater); + return binding.getRoot(); + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/ui/activity/play/VTEpisodesSelectDialogFragment.java b/app/src/main/java/com/viontv/app/ui/activity/play/VTEpisodesSelectDialogFragment.java new file mode 100644 index 0000000..9dbd360 --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/activity/play/VTEpisodesSelectDialogFragment.java @@ -0,0 +1,91 @@ +package com.viontv.app.ui.activity.play; + +import android.app.Dialog; +import android.os.Bundle; +import android.view.Gravity; +import android.view.WindowManager; + +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.DialogFragment; +import androidx.recyclerview.widget.GridLayoutManager; + +import com.viontv.app.R; +import com.viontv.app.databinding.DialogPageEpisodesSelectVtBinding; +import com.viontv.app.model.VTVideoDetailsBean; +import com.viontv.app.ui.adapter.VTEpisodesSeriesAdapter; +import com.viontv.app.utils.ToastUtils; +import com.viontv.app.utils.TranslatesUtils; +import com.viontv.app.utils.VTAppConstants; + +import java.util.List; + +public class VTEpisodesSelectDialogFragment extends DialogFragment { + + private PageEpisodesSeriesCallBack pageEpisodesSeriesCallBack; + + public void setPageEpisodesSeriesCallBack(PageEpisodesSeriesCallBack pageEpisodesSeriesCallBack) { + this.pageEpisodesSeriesCallBack = pageEpisodesSeriesCallBack; + } + + public interface PageEpisodesSeriesCallBack { + void chooseEpisodesSeries(VTVideoDetailsBean.Episode bean); + } + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity()); + android.view.LayoutInflater inflater = requireActivity().getLayoutInflater(); + android.view.View view = inflater.inflate(R.layout.dialog_page_episodes_select_vt, null); + DialogPageEpisodesSelectVtBinding bind = DialogPageEpisodesSelectVtBinding.bind(view); + + VTVideoDetailsBean.ShortPlayInfo readData = getArguments().getParcelable(VTAppConstants.Constants_Page_Episodes_Series_Data_VT); + List list = getArguments().getParcelableArrayList(VTAppConstants.Constants_Page_Episodes_Series_Data_List); + Integer currentPosition = getArguments().getInt(VTAppConstants.Constants_Page_Episodes_Series_Data_currentPosition, 0); + + if (list != null && !list.isEmpty()) { + VTEpisodesSeriesAdapter hibitEpisodesSeriesAdapter = new VTEpisodesSeriesAdapter(); + GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 5); + bind.rvDataEpisodesSeries.setLayoutManager(layoutManager); + bind.rvDataEpisodesSeries.setAdapter(hibitEpisodesSeriesAdapter); + hibitEpisodesSeriesAdapter.submitList(list); + + if (currentPosition != null) { + hibitEpisodesSeriesAdapter.setCurrentPosition(currentPosition); + } + + hibitEpisodesSeriesAdapter.setOnItemClickListener((adapter, view1, position) -> { + VTVideoDetailsBean.Episode item = (VTVideoDetailsBean.Episode) adapter.getItem(position); + if (position > 0) { + VTVideoDetailsBean.Episode item1 = (VTVideoDetailsBean.Episode) adapter.getItem(position - 1); + if (item1.isIs_lock()) { + String errorMessage = TranslatesUtils.translates() != null ? + TranslatesUtils.translates().getJump_unlock_error() : + "The prequel to this series is not unlocked. Please unlock the prequel before unlocking this series"; + ToastUtils.revealToast(errorMessage, 0); + dismiss(); + return; + } + } + pageEpisodesSeriesCallBack.chooseEpisodesSeries(item); + dismiss(); + }); + } + + bind.ivCloseEpisodesSeries.setOnClickListener(view12 -> dismiss()); + bind.tvContentEpisodesSeries.setText(readData != null ? readData.getName() : ""); + + builder.setView(bind.getRoot()); + Dialog dialog = builder.create(); + dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent); + android.view.Window window = dialog.getWindow(); + if (window != null) { + window.getDecorView().setPadding(0, 0, 0, 0); + window.setGravity(Gravity.BOTTOM); + WindowManager.LayoutParams layoutParams = window.getAttributes(); + layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; + layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT; + window.setAttributes(layoutParams); + } + return dialog; + } +} diff --git a/app/src/main/java/com/viontv/app/ui/activity/play/VTVideoPlayerActivity.java b/app/src/main/java/com/viontv/app/ui/activity/play/VTVideoPlayerActivity.java new file mode 100644 index 0000000..d5ec0de --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/activity/play/VTVideoPlayerActivity.java @@ -0,0 +1,408 @@ +package com.viontv.app.ui.activity.play; + + +import android.annotation.SuppressLint; +import android.content.Intent; +import android.graphics.Color; +import android.os.Bundle; +import android.view.View; + +import androidx.appcompat.widget.AppCompatImageView; +import androidx.appcompat.widget.AppCompatTextView; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModelProvider; +import androidx.recyclerview.widget.RecyclerView; +import androidx.viewpager2.widget.ViewPager2; + +import com.viontv.app.R; +import com.viontv.app.api.VTResult; +import com.viontv.app.databinding.ActivityVideoDetailsVtBinding; +import com.viontv.app.model.VTVideoDetailsBean; +import com.viontv.app.ui.activity.basic.VTBaseEventBus; +import com.viontv.app.ui.activity.basic.VTCommonActivity; +import com.viontv.app.ui.adapter.VTGooglePlayerAdapter; +import com.viontv.app.ui.view.VTGoogleExoPlayerView; +import com.viontv.app.utils.SharePreferenceUtils; +import com.viontv.app.utils.SingleClickUtils; +import com.viontv.app.utils.TimeUtils; +import com.viontv.app.utils.ToastUtils; +import com.viontv.app.utils.TranslatesUtils; +import com.viontv.app.utils.VTAppConstants; + +import org.greenrobot.eventbus.EventBus; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; + +import java.util.ArrayList; + +public class VTVideoPlayerActivity extends VTCommonActivity implements + VTGooglePlayerAdapter.PlayerDetailCollection, VTEpisodesSelectDialogFragment.PageEpisodesSeriesCallBack { + + private VTVideoViewModel vtViewModel; + private int episodeDetailId = 0; + private int episodevideo_id = 0; + private VTVideoDetailsBean.ShortPlayInfo shortVideoInfo = null; + private VTGooglePlayerAdapter vtGooglePlayerAdapter = null; + private int currentPosition = 0; + + + @Override + public void init() { + vtViewModel = new ViewModelProvider(this).get(VTVideoViewModel.class); + EventBus.getDefault().register(this); + viewBinding = ActivityVideoDetailsVtBinding.inflate(getLayoutInflater()); + setContentView(viewBinding.getRoot()); + episodeDetailId = getIntent().getIntExtra(VTAppConstants.Constants_Page_DetailId, 0); + episodevideo_id = getIntent().getIntExtra(VTAppConstants.Constants_Page_video_id, 0); + } + + @Override + public void initView() { + viewBinding.avi.smoothToShow(); + vtViewModel.getVideoDetails(episodeDetailId, episodevideo_id); + viewBinding.viewPagerHibitEpisode.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { + @SuppressLint("NotifyDataSetChanged") + @Override + public void onPageSelected(int position) { + super.onPageSelected(position); + currentPosition = position; + int previousPosition = vtGooglePlayerAdapter != null ? vtGooglePlayerAdapter.getCurrentEpisodePlayingPosition() : 0; + if (previousPosition != position) { + if (vtGooglePlayerAdapter.getRecyclerView() != null) { + vtGooglePlayerAdapter.getRecyclerView().post(() -> vtGooglePlayerAdapter.notifyDataSetChanged()); + } + } + if (vtGooglePlayerAdapter != null) { + vtGooglePlayerAdapter.setCurrentEpisodePlayingPosition(position); + VTVideoDetailsBean.Episode item = vtGooglePlayerAdapter.getItems().get(position); + //条件判断是否弹窗 +// if (item != null && item.isIs_lock() && !SharePreferenceUtils.is_Vip()) { +// VTAppConstants.isLock = true; +// viewBinding.viewLock.root.setVisibility(View.VISIBLE); +// if (TranslatesUtils.translates() != null) { +// viewBinding.viewLock.exampleTvContent.setText( +// TranslatesUtils.translates().unlocking_coins_notice.replace("##", String.valueOf(item.coins)) +// ); +// viewBinding.viewLock.exampleTvYes.setText(TranslatesUtils.translates().common_unlock); +// } else { +// viewBinding.viewLock.exampleTvContent.setText("Unlocking costs " + item.coins + " coins"); +// } +// +// viewBinding.viewLock.exampleTvYes.setOnClickListener(v -> { +// if (HibitMMKVUtils.isTourist()) { +// startActivity(new Intent(HibitVideoEpisodeActivity.this, HibitLoginActivity.class)); +// return; +// } +// if (currentPosition > 0) { +// HibitVideoDetailsBean.EpisodeItem previousItem = vtGooglePlayerAdapter.getItems().get(currentPosition - 1); +// if (previousItem != null && previousItem.is_lock) { +// if (TranslatesUtils.translates() != null) { +// HibitToastTools.revealToast(TranslatesUtils.translates().jump_unlock_error); +// } else { +// HibitToastTools.revealToast("The prequel to this series is not unlocked. Please unlock the prequel before unlocking this series"); +// } +// return; +// } +// } +// int allCoin = HibitMMKVUtils.getAllCoin(); +// if (allCoin >= item.coins) { +// HibitGoldShortageDialog exampleGoldShortageDialog = new HibitGoldShortageDialog(HibitVideoEpisodeActivity.this); +// AppCompatTextView tvThinkAgain = exampleGoldShortageDialog.findViewById(R.id.example_tv_think_again); +// AppCompatTextView tvYes = exampleGoldShortageDialog.findViewById(R.id.example_tv_yes); +// AppCompatTextView tvGoldCoins = exampleGoldShortageDialog.findViewById(R.id.example_tv_gold_coins); +// AppCompatTextView tv_content = exampleGoldShortageDialog.findViewById(R.id.example_tv_content); +// AppCompatTextView tvTitle = exampleGoldShortageDialog.findViewById(R.id.example_tv_title); +// tvGoldCoins.setText(String.valueOf(item.coins)); +// tvThinkAgain.setOnClickListener(v1 -> exampleGoldShortageDialog.dismiss()); +// if (TranslatesUtils.translates() != null) { +// tvThinkAgain.setText(TranslatesUtils.translates().try_again); +// tvYes.setText(TranslatesUtils.translates().yes); +// tvTitle.setText(TranslatesUtils.translates().tips); +// tv_content.setText(TranslatesUtils.translates().not_unlock_episodes); +// } +// tvYes.setOnClickListener(v1 -> { +// hibitHomeViewModel.buy_video(item.short_play_id, item.id); +// exampleGoldShortageDialog.dismiss(); +// }); +// exampleGoldShortageDialog.show(); +// } else { +// HibitGoldShortageDialog exampleGoldShortageDialog = new HibitGoldShortageDialog(HibitVideoEpisodeActivity.this); +// AppCompatTextView tvThinkAgain = exampleGoldShortageDialog.findViewById(R.id.example_tv_think_again); +// AppCompatTextView tvYes = exampleGoldShortageDialog.findViewById(R.id.example_tv_yes); +// AppCompatTextView tv_content = exampleGoldShortageDialog.findViewById(R.id.example_tv_content); +// AppCompatTextView tvGoldCoins = exampleGoldShortageDialog.findViewById(R.id.example_tv_gold_coins); +// AppCompatTextView tvTitle = exampleGoldShortageDialog.findViewById(R.id.example_tv_title); +// tvGoldCoins.setText(String.valueOf(item.coins)); +// if (TranslatesUtils.translates() != null) { +// tvThinkAgain.setText(TranslatesUtils.translates().try_again); +// tvYes.setText(TranslatesUtils.translates().top_up_now); +// tvTitle.setText(TranslatesUtils.translates().tips); +// tv_content.setText(TranslatesUtils.translates().coins_insufficient_and_recharge); +// } else { +// tvYes.setText("Top Up Now"); +// tv_content.setText("Insufficient gold coins, please recharge to continue watching"); +// } +// tvGoldCoins.setTextColor(Color.parseColor("#FF0049")); +// tvThinkAgain.setOnClickListener(v1 -> exampleGoldShortageDialog.dismiss()); +// tvYes.setOnClickListener(v1 -> { +// Intent intent = new Intent(HibitVideoEpisodeActivity.this, HibitRechargeGoldActivity.class); +// intent.putExtra(VTAppConstants.Constants_Page_DetailId, item.short_play_id); +// intent.putExtra(VTAppConstants.Constants_Page_video_id, item.id); +// startActivity(intent); +// exampleGoldShortageDialog.dismiss(); +// }); +// exampleGoldShortageDialog.show(); +// } +// }); +// if (viewBinding.viewLock.root != null) { +// viewBinding.viewLock.root.post(() -> { +// if (pageGoogleExoPlayerView() != null) { +// pageGoogleExoPlayerView().suspend(); +// } +// }); +// } +// } else { + VTAppConstants.isLock = false; + // viewBinding.viewLock.root.setVisibility(View.INVISIBLE); +// if (vtGooglePlayerAdapter.getItems() != null && vtGooglePlayerAdapter.getItems().get(position) != null) { +// vtViewModel.createHistory( +// vtGooglePlayerAdapter.getItems().get(position).getShort_play_id(), +// vtGooglePlayerAdapter.getItems().get(position).getId() +// ); +// } +// } + } + } + }); + } + + @Override + public void logic() { + vtViewModel.getVideoDetailsData().observe(this, new Observer>() { + @Override + public void onChanged(VTResult it) { + if (it != null) { + if (it.data != null && it.data.episodeList != null && !it.data.episodeList.isEmpty()) { + vtGooglePlayerAdapter = new VTGooglePlayerAdapter(); + vtGooglePlayerAdapter.setShortVideoInfo(it.data.shortPlayInfo); + vtGooglePlayerAdapter.setPlayerDetailCollection(VTVideoPlayerActivity.this); + shortVideoInfo = it.data.shortPlayInfo; + viewBinding.viewPagerHibitEpisode.setAdapter(vtGooglePlayerAdapter); + vtGooglePlayerAdapter.submitList(it.data.episodeList); + if (it.data.video_info.getEpisode() > 1) { + viewBinding.viewPagerHibitEpisode.setCurrentItem(it.data.video_info.getEpisode() - 1, false); + } + } + } else { + if (TranslatesUtils.translates() != null) { + ToastUtils.revealToast(TranslatesUtils.translates().getNetwork_error(), 0); + } else { + ToastUtils.revealToast(getString(R.string.vt_network_error_please_check_the_network), 0); + } + } + viewBinding.avi.smoothToHide(); + } + }); +// vtViewModel.getBuyVideoData().observe(this, it -> { +// if (it != null) { +// switch (it.data != null ? it.data.status : "") { +// case "no_play": +// ToastUtils.revealToast("No skits found",0); +// finish(); +// break; +// case "not_enough": +// // startActivity(new Intent(VTVideoPlayerActivity.this, HibitRechargeGoldActivity.class)); +// break; +// case "success": +// if (TranslatesUtils.translates() != null) { +// ToastUtils.revealToast(TranslatesUtils.translates().getSuccess(),0); +// } +// vtViewModel.accountDetails(); +// VTAppConstants.isLock = false; +// // viewBinding.viewLock.root.setVisibility(View.INVISIBLE); +// if (vtGooglePlayerAdapter.getItems() != null && vtGooglePlayerAdapter.getItems().get(currentPosition) != null) { +// VTVideoDetailsBean.Episode get = vtGooglePlayerAdapter.getItems().get(currentPosition); +// get.setIs_lock(false); +// vtGooglePlayerAdapter.notifyItemChanged(currentPosition); +// vtViewModel.createHistory(get.getShort_play_id(), get.getId()); +// } +// break; +// } +// } else { +// if (TranslatesUtils.translates() != null) { +// ToastUtils.revealToast(TranslatesUtils.translates().getNetwork_error(),0); +// } else { +// ToastUtils.revealToast(getString(R.string.vt_network_error_please_check_the_network),0); +// } +// } +// }); +// +// vtViewModel.getGetVideoDetailsData().observe(this, it -> { +// if (it != null) { +// if (it.data != null && it.data.episodeList != null && !it.data.episodeList.isEmpty()) { +// vtGooglePlayerAdapter = new VTGooglePlayerAdapter(); +// vtGooglePlayerAdapter.setShortVideoInfo(it.data.shortPlayInfo); +// vtGooglePlayerAdapter.setPlayerDetailCollection(this); +// shortVideoInfo = it.data.shortPlayInfo; +// viewBinding.viewPagerHibitEpisode.setAdapter(vtGooglePlayerAdapter); +// vtGooglePlayerAdapter.submitList(it.data.episodeList); +// if (it.data.video_info.episode > 1) { +// viewBinding.viewPagerHibitEpisode.setCurrentItem(it.data.video_info.episode - 1, false); +// } +// } +// } else { +// if (TranslatesUtils.translates() != null) { +// ToastUtils.revealToast(TranslatesUtils.translates().getNetwork_error(),0); +// } else { +// ToastUtils.revealToast(getString(R.string.vt_network_error_please_check_the_network),0); +// } +// } +// viewBinding.avi.smoothToHide(); +// }); + +// vtViewModel.getCollectData().observe(this, it -> { +// if (it != null) { +// AppCompatImageView imageView = pageGoogleExoPlayerView() != null ? pageGoogleExoPlayerView().findViewById(R.id.iv_collection_controller) : null; +// AppCompatTextView textview = pageGoogleExoPlayerView() != null ? pageGoogleExoPlayerView().findViewById(R.id.tv_collection_num_controller) : null; +// if (shortVideoInfo != null) { +// shortVideoInfo.setIs_collect(true); +// shortVideoInfo.setCollect_total(shortVideoInfo.getCollect_total()+1); +// } +// if (imageView != null) { +// imageView.setImageResource(R.mipmap.iv_vt_collect_h); +// } +// if (textview != null && shortVideoInfo != null) { +// textview.setText(TimeUtils.formatNumber(shortVideoInfo.getCollect_total())); +// } +// if (vtGooglePlayerAdapter != null) { +// vtGooglePlayerAdapter.setShortVideoInfo(shortVideoInfo); +// } +// EventBus.getDefault().post(new VTBaseEventBus<>(VTAppConstants.Constants_Episodes_Series_DataExample, shortVideoInfo)); +// if (TranslatesUtils.translates() != null) { +// ToastUtils.revealToast(TranslatesUtils.translates().getSuccess(),0); +// } +// } else { +// if (TranslatesUtils.translates() != null) { +// ToastUtils.revealToast(TranslatesUtils.translates().getNetwork_error(),0); +// } else { +// ToastUtils.revealToast(getString(R.string.vt_network_error_please_check_the_network),0); +// } +// } +// }); +// +// vtViewModel.getCancelCollectData().observe(this, it -> { +// if (it != null) { +// AppCompatImageView imageView = pageGoogleExoPlayerView() != null ? pageGoogleExoPlayerView().findViewById(R.id.iv_collection_controller) : null; +// AppCompatTextView textview = pageGoogleExoPlayerView() != null ? pageGoogleExoPlayerView().findViewById(R.id.tv_collection_num_controller) : null; +// if (shortVideoInfo != null) { +// shortVideoInfo.setIs_collect(false); +// shortVideoInfo.setCollect_total(shortVideoInfo.getCollect_total()-1); +// } +// if (imageView != null) { +// imageView.setImageResource(R.mipmap.iv_vt_collect_n); +// } +// if (textview != null && shortVideoInfo != null) { +// textview.setText(TimeUtils.formatNumber(shortVideoInfo.getCollect_total())); +// } +// } else { +// if (TranslatesUtils.translates() != null) { +// ToastUtils.revealToast(TranslatesUtils.translates().getNetwork_error(),0); +// } else { +// ToastUtils.revealToast(getString(R.string.vt_network_error_please_check_the_network),0); +// } +// } +// }); + } + + // 假设 pageGoogleExoPlayerView 方法在父类或者其他地方有定义 + private VTGoogleExoPlayerView pageGoogleExoPlayerView() { + RecyclerView recyclerView = (RecyclerView) viewBinding.viewPagerHibitEpisode.getChildAt(0); + VTGoogleExoPlayerView googleExoPlayerView = (VTGoogleExoPlayerView) recyclerView.getLayoutManager().findViewByPosition(currentPosition); + return googleExoPlayerView; + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onEvent(String event) { + // 处理事件 + if (VTAppConstants.Constants_PlayerView_MoreItemEvent == event) { + if (shortVideoInfo == null) { + return; + } + + VTEpisodesSelectDialogFragment hibitEpisodesSeriesDialogFragment = new VTEpisodesSelectDialogFragment(); + Bundle bundle = new Bundle(); + bundle.putInt(VTAppConstants.Constants_Page_Episodes_Series_Data_currentPosition, currentPosition); + bundle.putParcelable(VTAppConstants.Constants_Page_Episodes_Series_Data_VT, shortVideoInfo); + + if (vtGooglePlayerAdapter != null && vtGooglePlayerAdapter.getItems() != null) { + bundle.putParcelableArrayList(VTAppConstants.Constants_Page_Episodes_Series_Data_List, new ArrayList<>(vtGooglePlayerAdapter.getItems())); + } + + hibitEpisodesSeriesDialogFragment.setPageEpisodesSeriesCallBack(this); + hibitEpisodesSeriesDialogFragment.setArguments(bundle); + hibitEpisodesSeriesDialogFragment.show(getSupportFragmentManager(), "HibitEpisodesSeriesDialog"); + + } + if (VTAppConstants.Constants_Google_PLAYER_STATUS_FINISH_DETAIL == event) { + if (vtGooglePlayerAdapter != null && vtGooglePlayerAdapter.getCurrentEpisodePlayingPosition()>=0 ) { + int nextPosition = vtGooglePlayerAdapter.getCurrentEpisodePlayingPosition() + 1; + vtGooglePlayerAdapter.getItems(); + if (nextPosition < vtGooglePlayerAdapter.getItems().size()) { + VTVideoDetailsBean.Episode episode = vtGooglePlayerAdapter.getItems().get(nextPosition); + VTAppConstants.isLock = episode.isIs_lock(); + } + if (pageGoogleExoPlayerView() != null) { + pageGoogleExoPlayerView().stop(); + } + viewBinding.viewPagerHibitEpisode.setCurrentItem(nextPosition); + } + } + +// if (VTAppConstants.CONSTANTS_user_refresh == event) { +// vtViewModel.accountDetails(); +// } + + if (VTAppConstants.Constants_RecommendPlayerView_CLOSEExample == event) { + finish(); + } + + } + + + + @Override + protected void onDestroy() { + VTAppConstants.isCanPlay = false; + if(pageGoogleExoPlayerView()!=null) pageGoogleExoPlayerView().stop(); + if(pageGoogleExoPlayerView()!=null) pageGoogleExoPlayerView().release(); + super.onDestroy(); + EventBus.getDefault().unregister(this); + } + + + //收藏按钮逻辑 + @Override + public void collection(VTVideoDetailsBean.Episode episode) { + SingleClickUtils.singleClick(new Runnable() { + @Override + public void run() { + if (shortVideoInfo != null) { + if (shortVideoInfo.isIs_collect()) { + + } + } + } + }); + + } + + @Override + public void chooseEpisodesSeries(VTVideoDetailsBean.Episode bean) { + VTAppConstants.isLock = bean.isIs_lock(); + if (pageGoogleExoPlayerView() != null) { + pageGoogleExoPlayerView().stop(); + } + viewBinding.viewPagerHibitEpisode.setCurrentItem(bean.getEpisode() - 1); + + } +} diff --git a/app/src/main/java/com/viontv/app/ui/activity/play/VTVideoViewModel.java b/app/src/main/java/com/viontv/app/ui/activity/play/VTVideoViewModel.java new file mode 100644 index 0000000..f1d9b0e --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/activity/play/VTVideoViewModel.java @@ -0,0 +1,45 @@ +package com.viontv.app.ui.activity.play; + +import android.util.Log; + +import androidx.lifecycle.MutableLiveData; +import androidx.lifecycle.ViewModel; + +import com.viontv.app.api.VTApi; +import com.viontv.app.api.VTBaseObserver; +import com.viontv.app.api.VTResult; +import com.viontv.app.model.VTBaseData; +import com.viontv.app.model.VTVideoDetailsBean; + +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.schedulers.Schedulers; + +public class VTVideoViewModel extends ViewModel { + + + private final MutableLiveData> getVideoDetailsLiveData = new MutableLiveData<>(); + + public MutableLiveData> getVideoDetailsData() { + return getVideoDetailsLiveData; + } + + public void getVideoDetails(int short_play_id, int video_id) { + VTApi.getInstance().getVideoDetails(short_play_id, video_id) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new VTBaseObserver>() { + @Override + public void onSuccess(VTResult feedbackResp) { + Log.i("tag===", feedbackResp.data.shortPlayInfo.getShort_id() + ""); + getVideoDetailsLiveData.setValue(feedbackResp); + } + + @Override + public void onError(int code, String msg) { + Log.i("tag===", msg + ""); + } + }); + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/ui/adapter/BannerHomeAdapter.java b/app/src/main/java/com/viontv/app/ui/adapter/BannerHomeAdapter.java new file mode 100644 index 0000000..b62fd4d --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/adapter/BannerHomeAdapter.java @@ -0,0 +1,56 @@ +package com.viontv.app.ui.adapter; + +import android.media.Image; +import android.view.LayoutInflater; +import android.view.ViewGroup; +import android.widget.ImageView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; +import androidx.viewbinding.ViewBinding; + +import com.bumptech.glide.Glide; +import com.bumptech.glide.RequestBuilder; +import com.bumptech.glide.load.resource.bitmap.RoundedCorners; +import com.bumptech.glide.request.RequestOptions; +import com.viontv.app.databinding.ItemBannerVtBinding; +import com.viontv.app.model.ItemBean; +import com.youth.banner.adapter.BannerAdapter; + +import java.util.List; + +public class BannerHomeAdapter extends BannerAdapter { + + + public BannerHomeAdapter(List mData) { + super(mData); + } + + + @Override + public BannerHomeViewHolder onCreateHolder(ViewGroup parent, int viewType) { + ImageView imageView = new ImageView(parent.getContext()); + //注意,必须设置为match_parent,这个是viewpager2强制要求的 + imageView.setLayoutParams(new ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT)); + imageView.setScaleType(ImageView.ScaleType.FIT_XY); + return new BannerHomeViewHolder(imageView); + } + + @Override + public void onBindView(BannerHomeViewHolder holder, ItemBean data, int position, int size) { + Glide.with(holder.itemView.getContext()).load(data.getHorizontally_img()).apply(RequestOptions.bitmapTransform(new RoundedCorners(30))).into(holder.imageView); + } + + + class BannerHomeViewHolder extends RecyclerView.ViewHolder { + + ImageView imageView; + + public BannerHomeViewHolder(@NonNull ImageView view) { + super(view); + this.imageView = view; + } + } +} diff --git a/app/src/main/java/com/viontv/app/ui/adapter/CommonAdapter.java b/app/src/main/java/com/viontv/app/ui/adapter/CommonAdapter.java new file mode 100644 index 0000000..5076cdc --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/adapter/CommonAdapter.java @@ -0,0 +1,117 @@ +// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// Use of this source code is governed by a MIT license that can be +// found in the LICENSE file. + +package com.viontv.app.ui.adapter; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.view.LayoutInflater; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; +import androidx.viewbinding.ViewBinding; + + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +public class CommonAdapter + extends RecyclerView.Adapter> { + private static final String TAG = "QChatCommonAdapter"; + private static final String NAME_METHOD_INFLATE = "inflate"; + protected final List dataSource = new ArrayList<>(); + protected final Context context; + protected OnClickListener clickListener; + protected Method inflateMethod; + + public CommonAdapter(Context context, Class viewBinding) { + this.context = context; + try { + inflateMethod = + viewBinding.getMethod( + NAME_METHOD_INFLATE, LayoutInflater.class, ViewGroup.class, boolean.class); + } catch (NoSuchMethodException e) { + throw new IllegalStateException("create adapter error", e); + } + } + + @SuppressLint("NotifyDataSetChanged") + public void addDataList(List data, boolean clearOld) { + if (clearOld) { + dataSource.clear(); + } + if (data == null) { + return; + } + dataSource.addAll(data); + notifyDataSetChanged(); + } + + public void setItemClickListener(OnClickListener listener) { + this.clickListener = listener; + } + + @NonNull + @Override + @SuppressWarnings("unchecked") + public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + R binding; + try { + binding = (R) inflateMethod.invoke(null, LayoutInflater.from(context), parent, false); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new IllegalStateException("create view holder error", e); + } + return new ItemViewHolder<>(Objects.requireNonNull(binding)); + } + + @Override + public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) { + T item = getItemData(position); + holder.itemView.setOnClickListener( + v -> { + if (clickListener != null) { + clickListener.onClick(item, holder); + } + }); + if (item == null) { + return; + } + onBindViewHolder(holder, position, item); + } + + public void onBindViewHolder(@NonNull ItemViewHolder holder, int position, T data) { + onBindViewHolder(holder.binding, position, data, holder.getBindingAdapterPosition()); + } + + public void onBindViewHolder(R binding, int position, T data, int bingingAdapterPosition) {} + + @Override + public int getItemCount() { + return dataSource.size(); + } + + public T getItemData(int position) { + if (position < 0 || position >= dataSource.size()) { + return null; + } + return dataSource.get(position); + } + + public static class ItemViewHolder extends RecyclerView.ViewHolder { + public final T binding; + + public ItemViewHolder(T binding) { + super(binding.getRoot()); + this.binding = binding; + } + } + + public interface OnClickListener { + void onClick(T data, ItemViewHolder holder); + } +} diff --git a/app/src/main/java/com/viontv/app/ui/adapter/FragmentAdapter.java b/app/src/main/java/com/viontv/app/ui/adapter/FragmentAdapter.java new file mode 100644 index 0000000..78be0a9 --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/adapter/FragmentAdapter.java @@ -0,0 +1,61 @@ +// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// Use of this source code is governed by a MIT license that can be +// found in the LICENSE file. + +package com.viontv.app.ui.adapter; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; +import androidx.fragment.app.FragmentManager; +import androidx.lifecycle.Lifecycle; +import androidx.viewpager2.adapter.FragmentStateAdapter; + +import java.util.List; + +/** Fragment Adapter used in MainActivity */ +public class FragmentAdapter extends FragmentStateAdapter { + private static final String TAG = FragmentAdapter.class.getSimpleName(); + + private List fragmentList; + + public FragmentAdapter(@NonNull FragmentActivity fragmentActivity) { + super(fragmentActivity); + } + + public FragmentAdapter(@NonNull Fragment fragment) { + super(fragment); + } + + public FragmentAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle) { + super(fragmentManager, lifecycle); + } + + public void setFragmentList(List fragmentList) { + this.fragmentList = fragmentList; + } + + @NonNull + @Override + public Fragment createFragment(int position) { +// if (fragmentList == null || fragmentList.size() <= position) { +// return new Fragment(); +// } + return fragmentList.get(position); + } + + @Override + public int getItemCount() { + return fragmentList == null ? 0 : fragmentList.size(); + } + + @Override + public long getItemId(int position) { + return super.getItemId(position); + } + + @Override + public int getItemViewType(int position) { + return super.getItemViewType(position); + } +} diff --git a/app/src/main/java/com/viontv/app/ui/adapter/HotBottomListAdapter.java b/app/src/main/java/com/viontv/app/ui/adapter/HotBottomListAdapter.java new file mode 100644 index 0000000..2b6a95b --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/adapter/HotBottomListAdapter.java @@ -0,0 +1,57 @@ +// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// Use of this source code is governed by a MIT license that can be +// found in the LICENSE file. + +package com.viontv.app.ui.adapter; + +import android.content.Context; +import android.view.View; + +import com.bumptech.glide.Glide; +import com.bumptech.glide.load.engine.DiskCacheStrategy; +import com.bumptech.glide.request.RequestOptions; +import com.viontv.app.databinding.ItemHomeExploreVtBinding; +import com.viontv.app.databinding.ItemHotSquareVtBinding; +import com.viontv.app.model.ItemBean; + + +public class HotBottomListAdapter + extends CommonAdapter { + + private Context mcontext; + + public HotBottomListAdapter( + Context context, Class viewBinding) { + super(context, viewBinding); + this.mcontext = context; + } + + @Override + public void onBindViewHolder( + ItemHomeExploreVtBinding binding, + int position, + ItemBean data, + int bingingAdapterPosition) { + + if (data != null) { + Glide.with(mcontext) + .load(data.getImage_url()) + .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.RESOURCE)) + .into(binding.ivHotExploreItem); + binding.tvHomeExploretitleItem.setText(data.getName()); + binding.tvHomeExplorecontentItem.setText(data.getDescription()); + binding.tvHomeExplorecateItem1.setVisibility(View.GONE); + binding.tvHomeExplorecateItem2.setVisibility(View.GONE); + if (data.getCategory() != null && !data.getCategory().isEmpty()) { + + binding.tvHomeExplorecateItem1.setVisibility(View.VISIBLE); + binding.tvHomeExplorecateItem1.setText(data.getCategory().get(0)); + if(data.getCategory().size()>=2){ + binding.tvHomeExplorecateItem2.setVisibility(View.VISIBLE); + binding.tvHomeExplorecateItem2.setText(data.getCategory().get(1)); + } + } + + } + } +} diff --git a/app/src/main/java/com/viontv/app/ui/adapter/NineSquareAdapter.java b/app/src/main/java/com/viontv/app/ui/adapter/NineSquareAdapter.java new file mode 100644 index 0000000..b3acd2e --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/adapter/NineSquareAdapter.java @@ -0,0 +1,44 @@ +// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// Use of this source code is governed by a MIT license that can be +// found in the LICENSE file. + +package com.viontv.app.ui.adapter; + +import android.content.Context; +import android.text.TextUtils; + +import com.bumptech.glide.Glide; +import com.bumptech.glide.load.engine.DiskCacheStrategy; +import com.bumptech.glide.request.RequestOptions; +import com.viontv.app.databinding.ItemHotSquareVtBinding; +import com.viontv.app.model.ItemBean; +import com.viontv.app.utils.IntentUtils; + + +public class NineSquareAdapter + extends CommonAdapter { + + private Context mcontext; + + public NineSquareAdapter( + Context context, Class viewBinding) { + super(context, viewBinding); + this.mcontext = context; + } + + @Override + public void onBindViewHolder( + ItemHotSquareVtBinding binding, + int position, + ItemBean data, + int bingingAdapterPosition) { + + if (data != null) { + Glide.with(mcontext) + .load(data.getImage_url()) + .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE)) + .into(binding.ivHotSquareItem); + binding.tvHotSquareDesc.setText(data.getName()); + } + } +} diff --git a/app/src/main/java/com/viontv/app/ui/adapter/TabItemListAdapter.java b/app/src/main/java/com/viontv/app/ui/adapter/TabItemListAdapter.java new file mode 100644 index 0000000..9a470e2 --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/adapter/TabItemListAdapter.java @@ -0,0 +1,47 @@ +// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// Use of this source code is governed by a MIT license that can be +// found in the LICENSE file. + +package com.viontv.app.ui.adapter; + +import android.content.Context; +import android.view.View; + +import com.bumptech.glide.Glide; +import com.bumptech.glide.load.engine.DiskCacheStrategy; +import com.bumptech.glide.request.RequestOptions; +import com.viontv.app.R; +import com.viontv.app.databinding.ItemHomeExploreVtBinding; +import com.viontv.app.databinding.ItemHomeTablistVtBinding; +import com.viontv.app.model.ItemBean; + + +public class TabItemListAdapter + extends CommonAdapter { + + private Context mcontext; + + public TabItemListAdapter( + Context context, Class viewBinding) { + super(context, viewBinding); + this.mcontext = context; + } + + @Override + public void onBindViewHolder( + ItemHomeTablistVtBinding binding, + int position, + ItemBean data, + int bingingAdapterPosition) { + + if (data != null) { + Glide.with(mcontext) + .load(data.getHorizontally_img()) + .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.RESOURCE)) + .into(binding.ivHometabItem); + binding.tvHometabTitleItem.setText(data.getName()); + binding.tvHometabContentItem.setText(data.getDescription()); + + } + } +} diff --git a/app/src/main/java/com/viontv/app/ui/adapter/Top10ListAdapter.java b/app/src/main/java/com/viontv/app/ui/adapter/Top10ListAdapter.java new file mode 100644 index 0000000..f2ba069 --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/adapter/Top10ListAdapter.java @@ -0,0 +1,74 @@ +// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// Use of this source code is governed by a MIT license that can be +// found in the LICENSE file. + +package com.viontv.app.ui.adapter; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.view.View; + +import androidx.constraintlayout.widget.ConstraintLayout; + +import com.bumptech.glide.Glide; +import com.bumptech.glide.load.engine.DiskCacheStrategy; +import com.bumptech.glide.request.RequestOptions; +import com.viontv.app.databinding.ItemHomeExploreVtBinding; +import com.viontv.app.model.ItemBean; +import com.viontv.app.utils.TimeUtils; + + +public class Top10ListAdapter + extends CommonAdapter { + + private Context mcontext; + + public Top10ListAdapter( + Context context, Class viewBinding) { + super(context, viewBinding); + this.mcontext = context; + } + + + @Override + public void onBindViewHolder( + ItemHomeExploreVtBinding binding, + int position, + ItemBean data, + int bingingAdapterPosition) { + + if (data != null) { +// ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) binding.ivHotExploreItem.getLayoutParams(); +// params.dimensionRatio ="71:100"; +// binding.ivHotExploreItem.setLayoutParams(params); +// binding.ivHotExploreItem.requestLayout(); +// + Glide.with(mcontext) + .load(data.getImage_url()) + .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.RESOURCE)) + .into(binding.ivHotExploreItem); + binding.layoutHomeHotcontent.setVisibility(View.VISIBLE); + binding.tvHomeExplorecontentItem.setVisibility(View.GONE); + binding.tvHomeExploretitleItem.setText(data.getName()); + binding.tvHomeHotcontentItem.setText(TimeUtils.formatNumber(data.getWatch_total())); + binding.tvHomeExplorecateItem1.setVisibility(View.GONE); + binding.tvHomeExplorecateItem2.setVisibility(View.GONE); + binding.tvHotTopnumber.setVisibility(View.GONE); + if (bingingAdapterPosition < 10) { + binding.tvHotTopnumber.setVisibility(View.VISIBLE); + binding.tvHotTopnumber.setText(String.valueOf(bingingAdapterPosition + 1)); + } + if (data.getCategory() != null && !data.getCategory().isEmpty()) { + binding.tvHomeExplorecateItem1.setVisibility(View.VISIBLE); + binding.tvHomeExplorecateItem1.setText(data.getCategory().get(0)); + if (data.getCategory().size() >= 2) { + binding.tvHomeExplorecateItem2.setVisibility(View.VISIBLE); + binding.tvHomeExplorecateItem2.setText(data.getCategory().get(1)); + } + } + + } + } + + +} diff --git a/app/src/main/java/com/viontv/app/ui/adapter/VTEpisodesSeriesAdapter.java b/app/src/main/java/com/viontv/app/ui/adapter/VTEpisodesSeriesAdapter.java new file mode 100644 index 0000000..2f2fd20 --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/adapter/VTEpisodesSeriesAdapter.java @@ -0,0 +1,45 @@ +package com.viontv.app.ui.adapter; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.graphics.Color; +import android.view.ViewGroup; +import android.widget.RelativeLayout; +import androidx.appcompat.widget.AppCompatTextView; +import com.chad.library.adapter4.BaseQuickAdapter; +import com.chad.library.adapter4.viewholder.QuickViewHolder; +import com.viontv.app.R; +import com.viontv.app.model.VTVideoDetailsBean; + +public class VTEpisodesSeriesAdapter extends BaseQuickAdapter { + + private int currentPosition = -1; + + @SuppressLint("UseCompatLoadingForDrawables") + @Override + protected void onBindViewHolder(QuickViewHolder holder, int position, VTVideoDetailsBean.Episode item) { + AppCompatTextView tvEpisodesSeries = holder.getView(R.id.tv_episodes_series); + RelativeLayout episodeBg = holder.getView(R.id.episode_bg); + + tvEpisodesSeries.setText(String.valueOf(item != null ? item.getEpisode() : "")); + + if (currentPosition == holder.getAdapterPosition()) { + tvEpisodesSeries.setTextColor(Color.parseColor("#FF0049")); + episodeBg.setBackground(holder.itemView.getContext().getDrawable(R.drawable.bg_vt_episodes_h)); + } else { + tvEpisodesSeries.setTextColor(Color.parseColor("#999999")); + episodeBg.setBackground(holder.itemView.getContext().getDrawable(R.drawable.bg_vt_episodes)); + } + + holder.setVisible(R.id.iv_lock_show, item != null && item.isIs_lock()); + } + + @Override + public QuickViewHolder onCreateViewHolder(Context context, ViewGroup parent, int viewType) { + return new QuickViewHolder(R.layout.item_page_episodes_series_vt, parent); + } + + public void setCurrentPosition(int position) { + this.currentPosition = position; + } +} diff --git a/app/src/main/java/com/viontv/app/ui/adapter/VTGooglePlayerAdapter.java b/app/src/main/java/com/viontv/app/ui/adapter/VTGooglePlayerAdapter.java new file mode 100644 index 0000000..57beea8 --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/adapter/VTGooglePlayerAdapter.java @@ -0,0 +1,83 @@ +// Copyright (c) 2022 NetEase, Inc. All rights reserved. +// Use of this source code is governed by a MIT license that can be +// found in the LICENSE file. + +package com.viontv.app.ui.adapter; + +import android.content.Context; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.widget.AppCompatImageView; +import androidx.media3.ui.PlayerView; + +import com.chad.library.adapter4.BaseQuickAdapter; +import com.chad.library.adapter4.viewholder.QuickViewHolder; +import com.viontv.app.R; +import com.viontv.app.databinding.ItemGoogleExoPlayerVtBinding; +import com.viontv.app.model.VTVideoDetailsBean; +import com.viontv.app.ui.view.VTGoogleExoPlayerView; + + +public class VTGooglePlayerAdapter + extends BaseQuickAdapter { + + + public interface PlayerDetailCollection { + void collection(VTVideoDetailsBean.Episode episode); + } + + public PlayerDetailCollection playerDetailCollection; + + + public void setPlayerDetailCollection(PlayerDetailCollection playerDetailCollection) { + this.playerDetailCollection = playerDetailCollection; + } + + public int currentEpisodePlayingPosition = 0; + public VTVideoDetailsBean.ShortPlayInfo shortVideoInfo; + + + public int getCurrentEpisodePlayingPosition() { + return currentEpisodePlayingPosition; + } + + public void setCurrentEpisodePlayingPosition(int currentEpisodePlayingPosition) { + this.currentEpisodePlayingPosition = currentEpisodePlayingPosition; + } + + public VTVideoDetailsBean.ShortPlayInfo getShortVideoInfo() { + return shortVideoInfo; + } + + public void setShortVideoInfo(VTVideoDetailsBean.ShortPlayInfo shortVideoInfo) { + this.shortVideoInfo = shortVideoInfo; + } + + @NonNull + @Override + protected QuickViewHolder onCreateViewHolder(@NonNull Context context, @NonNull ViewGroup viewGroup, int i) { + + return new QuickViewHolder(R.layout.item_google_exo_player_vt,viewGroup); + } + + @Override + protected void onBindViewHolder(@NonNull QuickViewHolder holder, int position, @Nullable VTVideoDetailsBean.Episode episode) { + VTGoogleExoPlayerView exampleDetailPlayerView = (VTGoogleExoPlayerView) holder.getView(R.id.page_google_exo_player); + PlayerView playerView = exampleDetailPlayerView.findViewById(R.id.player_view); + AppCompatImageView imageView = playerView.findViewById(R.id.iv_collection_controller); + imageView.setOnClickListener(v -> { + if (playerDetailCollection != null) { + playerDetailCollection.collection(episode); + } + }); + if (position == currentEpisodePlayingPosition) { + exampleDetailPlayerView.setMedia(episode, shortVideoInfo); + } else { + exampleDetailPlayerView.stop(); + } + } + + +} diff --git a/app/src/main/java/com/viontv/app/ui/view/ProgressLineView.java b/app/src/main/java/com/viontv/app/ui/view/ProgressLineView.java new file mode 100644 index 0000000..05d5845 --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/view/ProgressLineView.java @@ -0,0 +1,61 @@ +package com.viontv.app.ui.view; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.view.animation.AlphaAnimation; +import android.view.animation.Animation; +import android.view.animation.AnimationSet; +import android.view.animation.ScaleAnimation; +import android.widget.FrameLayout; + +import androidx.annotation.Nullable; + +import com.viontv.app.R; + + +public class ProgressLineView extends FrameLayout { + private View loadView; + + public ProgressLineView(Context context) { + super(context); + initView(context); + } + + public ProgressLineView(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + initView(context); + } + + public ProgressLineView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + initView(context); + } + + private void initView(Context mContext) { + View view = LayoutInflater.from(mContext).inflate(R.layout.layout_player_progress_line_vt, null); + loadView = view.findViewById(R.id.loadingView); + this.addView(view); + } + + public void startAnimation() { + ScaleAnimation scale = new ScaleAnimation( + 0.3f, 1f, 1f, 1f, + Animation.RELATIVE_TO_SELF, 0.5f, + Animation.RELATIVE_TO_SELF, 0.5f + ); + AlphaAnimation alpha = new AlphaAnimation(1f, 0.2f); + scale.setRepeatCount(-1); + alpha.setRepeatCount(-1); + AnimationSet set = new AnimationSet(true); + set.addAnimation(scale); + set.addAnimation(alpha); + set.setDuration(500); + loadView.startAnimation(set); + } + + public void endAnimation() { + loadView.clearAnimation(); + } +} diff --git a/app/src/main/java/com/viontv/app/ui/view/VTBezierCircleHeader.java b/app/src/main/java/com/viontv/app/ui/view/VTBezierCircleHeader.java new file mode 100644 index 0000000..91d0d9b --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/view/VTBezierCircleHeader.java @@ -0,0 +1,362 @@ +package com.viontv.app.ui.view; + + +import android.animation.ValueAnimator; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.RectF; +import android.util.AttributeSet; +import android.view.View; +import android.view.animation.AccelerateInterpolator; +import android.view.animation.DecelerateInterpolator; + +import androidx.annotation.ColorInt; +import androidx.annotation.NonNull; +import androidx.core.graphics.ColorUtils; + +import com.scwang.smart.refresh.layout.api.RefreshHeader; +import com.scwang.smart.refresh.layout.api.RefreshKernel; +import com.scwang.smart.refresh.layout.api.RefreshLayout; +import com.scwang.smart.refresh.layout.constant.SpinnerStyle; +import com.scwang.smart.refresh.layout.simple.SimpleComponent; +import com.scwang.smart.refresh.layout.util.SmartUtil; + +/** + * CircleRefresh + */ +public class VTBezierCircleHeader extends SimpleComponent implements RefreshHeader { + + // + protected Path mPath; + protected Paint mBackPaint; + protected Paint mFrontPaint; + protected Paint mOuterPaint; + protected int mHeight; + protected float mWaveHeight; + protected float mHeadHeight; + protected float mSpringRatio; + protected float mFinishRatio; + + protected float mBollY;//弹出球体的Y坐标 + protected float mBollRadius;//球体半径 + protected boolean mShowOuter; + protected boolean mShowBoll;//是否显示中心球体 + protected boolean mShowBollTail;//是否显示球体拖拽的尾巴 + + protected int mRefreshStop = 90; + protected int mRefreshStart = 90; + protected boolean mOuterIsStart = true; + + protected static final int TARGET_DEGREE = 270; + protected boolean mWavePulling = false; + protected RefreshKernel mKernel; + // + + // + public VTBezierCircleHeader(Context context) { + this(context, null); + } + + public VTBezierCircleHeader(Context context, AttributeSet attrs) { + super(context, attrs, 0); + + mSpinnerStyle = SpinnerStyle.FixedBehind; + final View thisView = this; + thisView.setMinimumHeight(SmartUtil.dp2px(100)); + mBackPaint = new Paint(); + mBackPaint.setColor(0xff11bbff); + mBackPaint.setAntiAlias(true); + mFrontPaint = new Paint(); + mFrontPaint.setColor(0xffffffff); + mFrontPaint.setAntiAlias(true); + mOuterPaint = new Paint(); + mOuterPaint.setAntiAlias(true); + mOuterPaint.setColor(0xffffffff); + mOuterPaint.setStyle(Paint.Style.STROKE); + mOuterPaint.setStrokeWidth(SmartUtil.dp2px(2f)); + mPath = new Path(); + } + // + + // + @Override + protected void dispatchDraw(Canvas canvas) { + final View thisView = this; + final int viewWidth = thisView.getWidth(); + final int viewHeight = mHeight;//thisView.getHeight(); + //noinspection EqualsBetweenInconvertibleTypes + final boolean footer = mKernel != null && (this.equals(mKernel.getRefreshLayout().getRefreshFooter())); + + if (footer) { + canvas.save(); + canvas.translate(0, thisView.getHeight()); + canvas.scale(1, -1); + } + + if (thisView.isInEditMode()) { + mShowBoll = true; + mShowOuter = true; + mHeadHeight = viewHeight; + mRefreshStop = 270; + mBollY = mHeadHeight / 2; + mBollRadius = mHeadHeight / 6; + } + + drawWave(canvas, viewWidth, viewHeight); + drawSpringUp(canvas, viewWidth); + drawBoll(canvas, viewWidth); + drawOuter(canvas, viewWidth); + drawFinish(canvas, viewWidth); + + if (footer) { + canvas.restore(); + } + + super.dispatchDraw(canvas); + } + + protected void drawWave(Canvas canvas, int viewWidth, int viewHeight) { + float baseHeight = Math.min(mHeadHeight, viewHeight); + if (mWaveHeight != 0) { + mPath.reset(); + mPath.lineTo(viewWidth, 0); + mPath.lineTo(viewWidth, baseHeight); + mPath.quadTo(viewWidth / 2f, baseHeight + mWaveHeight * 2, 0, baseHeight); + mPath.close(); + canvas.drawPath(mPath, mBackPaint); + } else { + canvas.drawRect(0, 0, viewWidth, baseHeight, mBackPaint); + } + } + + protected void drawSpringUp(Canvas canvas, int viewWidth) { + if (mSpringRatio > 0) { + float leftX = (viewWidth / 2f - 4 * mBollRadius + mSpringRatio * 3 * mBollRadius); + if (mSpringRatio < 0.9) { + mPath.reset(); + mPath.moveTo(leftX, mBollY); + mPath.quadTo(viewWidth / 2f, mBollY - mBollRadius * mSpringRatio * 2, + viewWidth - leftX, mBollY); + canvas.drawPath(mPath, mFrontPaint); + } else { + canvas.drawCircle(viewWidth / 2f, mBollY, mBollRadius, mFrontPaint); + } + } + } + + protected void drawBoll(Canvas canvas, int viewWidth) { + if (mShowBoll) { + canvas.drawCircle(viewWidth / 2f, mBollY, mBollRadius, mFrontPaint); + + drawBollTail(canvas, viewWidth, (mHeadHeight + mWaveHeight) / mHeadHeight); + } + } + + protected void drawBollTail(Canvas canvas, int viewWidth, float fraction) { + if (mShowBollTail) { + final float bottom = mHeadHeight + mWaveHeight; + final float startY = mBollY + mBollRadius * fraction / 2; + final float startX = viewWidth / 2f + (float) Math.sqrt(mBollRadius * mBollRadius * (1 - fraction * fraction / 4)); + final float bezier1x = (viewWidth / 2f + (mBollRadius * 3 / 4) * (1 - fraction)); + final float bezier2x = bezier1x + mBollRadius; + + mPath.reset(); + mPath.moveTo(startX, startY); + mPath.quadTo(bezier1x, bottom, bezier2x, bottom); + mPath.lineTo(viewWidth - bezier2x, bottom); + mPath.quadTo(viewWidth - bezier1x, bottom, viewWidth - startX, startY); + canvas.drawPath(mPath, mFrontPaint); + } + } + + protected void drawOuter(Canvas canvas, int viewWidth) { + if (mShowOuter) { + float outerR = mBollRadius + mOuterPaint.getStrokeWidth() * 2; + + mRefreshStart += mOuterIsStart ? 3 : 10; + mRefreshStop += mOuterIsStart ? 10 : 3; + mRefreshStart = mRefreshStart % 360; + mRefreshStop = mRefreshStop % 360; + + int swipe = mRefreshStop - mRefreshStart; + swipe = swipe < 0 ? swipe + 360 : swipe; + + canvas.drawArc(new RectF(viewWidth / 2f - outerR, mBollY - outerR, viewWidth / 2f + outerR, mBollY + outerR), + mRefreshStart, swipe, false, mOuterPaint); + if (swipe >= TARGET_DEGREE) { + mOuterIsStart = false; + } else if (swipe <= 10) { + mOuterIsStart = true; + } + final View thisView = this; + thisView.invalidate(); + } + + } + + protected void drawFinish(Canvas canvas, int viewWidth) { + if (mFinishRatio > 0) { + int beforeColor = mOuterPaint.getColor(); + if (mFinishRatio < 0.3) { + canvas.drawCircle(viewWidth / 2f, mBollY, mBollRadius, mFrontPaint); + int outerR = (int) (mBollRadius + mOuterPaint.getStrokeWidth() * 2 * (1+mFinishRatio / 0.3f)); + int afterColor = ColorUtils.setAlphaComponent(beforeColor, (int) (0xff * (1 - mFinishRatio / 0.3f))); + mOuterPaint.setColor(afterColor); + canvas.drawArc(new RectF(viewWidth / 2f - outerR, mBollY - outerR, viewWidth / 2f + outerR, mBollY + outerR), + 0, 360, false, mOuterPaint); + } + mOuterPaint.setColor(beforeColor); + + if (mFinishRatio >= 0.3 && mFinishRatio < 0.7) { + float fraction = (mFinishRatio - 0.3f) / 0.4f; + mBollY = (int) (mHeadHeight / 2 + (mHeadHeight - mHeadHeight / 2) * fraction); + canvas.drawCircle(viewWidth / 2f, mBollY, mBollRadius, mFrontPaint); + if (mBollY >= mHeadHeight - mBollRadius * 2) { + mShowBollTail = true; + drawBollTail(canvas, viewWidth, fraction); + } + mShowBollTail = false; + } + + if (mFinishRatio >= 0.7 && mFinishRatio <= 1) { + float fraction = (mFinishRatio - 0.7f) / 0.3f; + int leftX = (int) (viewWidth / 2f - mBollRadius - 2 * mBollRadius * fraction); + mPath.reset(); + mPath.moveTo(leftX, mHeadHeight); + mPath.quadTo(viewWidth / 2f, mHeadHeight - (mBollRadius * (1 - fraction)), + viewWidth - leftX, mHeadHeight); + canvas.drawPath(mPath, mFrontPaint); + } + } + } + // + + // + @Override + public void onInitialized(@NonNull RefreshKernel kernel, int height, int maxDragHeight) { + mKernel = kernel; + } + + @Override + public void onMoving(boolean isDragging, float percent, int offset, int height, int maxDragHeight) { + mHeight = offset; + if (isDragging || mWavePulling) { + mWavePulling = true; + mHeadHeight = height; + mWaveHeight = Math.max(offset - height, 0) * .8f; + } + this.invalidate(); + } + + @Override + public void onReleased(@NonNull RefreshLayout refreshLayout, int height, int maxDragHeight) { + mWavePulling = false; + mHeadHeight = height; + mBollRadius = height / 6f; + DecelerateInterpolator interpolator = new DecelerateInterpolator(); + final float reboundHeight = Math.min(mWaveHeight * 0.8f, mHeadHeight / 2); + ValueAnimator waveAnimator = ValueAnimator.ofFloat( + mWaveHeight, 0, + -(reboundHeight*1.0f),0, + -(reboundHeight*0.4f),0 + ); + waveAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + float speed = 0; + float springBollY; + float springRatio = 0; + int status = 0;//0 还没开始弹起 1 向上弹起 2 在弹起的最高点停住 + @Override + public void onAnimationUpdate(ValueAnimator animation) { + float curValue = (float) animation.getAnimatedValue(); + if (status == 0 && curValue <= 0) { + status = 1; + speed = Math.abs(curValue - mWaveHeight); + } + if (status == 1) { + springRatio = -curValue / reboundHeight; + if (springRatio >= mSpringRatio) { + mSpringRatio = springRatio; + mBollY = mHeadHeight + curValue; + speed = Math.abs(curValue - mWaveHeight); + } else { + status = 2; + mSpringRatio = 0; + mShowBoll = true; + mShowBollTail = true; + springBollY = mBollY; + } + } + if (status == 2) { + if (mBollY > mHeadHeight / 2) { + mBollY = Math.max(mHeadHeight / 2, mBollY - speed); + float bally = animation.getAnimatedFraction() * (mHeadHeight / 2 - springBollY) + springBollY; + if (mBollY > bally) { + mBollY = bally; + } + } + } + if (mShowBollTail && curValue < mWaveHeight) { + mShowOuter = true; + mShowBollTail = false; + mOuterIsStart = true; + mRefreshStart = 90; + mRefreshStop = 90; + } + if (!mWavePulling) { + mWaveHeight = curValue; + final View thisView = VTBezierCircleHeader.this; + thisView.invalidate(); + } + } + }); + waveAnimator.setInterpolator(interpolator); + waveAnimator.setDuration(1000); + waveAnimator.start(); + } + + @Override + public int onFinish(@NonNull RefreshLayout layout, boolean success) { + mShowBoll = false; + mShowOuter = false; + final int DURATION_FINISH = 800; //动画时长 + ValueAnimator animator = ValueAnimator.ofFloat(0, 1); + animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator animation) { + final View thisView = VTBezierCircleHeader.this; + mFinishRatio = (float) animation.getAnimatedValue(); + thisView.invalidate(); + } + }); + animator.setInterpolator(new AccelerateInterpolator()); + animator.setDuration(DURATION_FINISH); + animator.start(); + return DURATION_FINISH; + } + + /** + * @param colors 对应Xml中配置的 srlPrimaryColor srlAccentColor + * @deprecated 只由框架调用 + * 使用者使用 {@link RefreshLayout#setPrimaryColorsId(int...)} + */ + @Override + @Deprecated + public void setPrimaryColors(@ColorInt int ... colors) { + if (colors.length > 0) { + mBackPaint.setColor(colors[0]); + if (colors.length > 1) { + mFrontPaint.setColor(colors[1]); + mOuterPaint.setColor(colors[1]); + } + } + } + +// @NonNull +// @Override +// public SpinnerStyle getSpinnerStyle() { +// return SpinnerStyle.Scale; +// } + // +} diff --git a/app/src/main/java/com/viontv/app/ui/view/VTGoogleExoPlayerView.java b/app/src/main/java/com/viontv/app/ui/view/VTGoogleExoPlayerView.java new file mode 100644 index 0000000..16ce72a --- /dev/null +++ b/app/src/main/java/com/viontv/app/ui/view/VTGoogleExoPlayerView.java @@ -0,0 +1,247 @@ +package com.viontv.app.ui.view; + +import android.content.Context; +import android.net.Uri; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.FrameLayout; +import android.widget.RelativeLayout; +import android.widget.SeekBar; + +import androidx.appcompat.widget.AppCompatImageView; +import androidx.appcompat.widget.AppCompatSeekBar; +import androidx.appcompat.widget.AppCompatTextView; +import androidx.media3.common.C; +import androidx.media3.common.MediaItem; +import androidx.media3.common.PlaybackException; +import androidx.media3.common.Player; +import androidx.media3.exoplayer.ExoPlayer; + +import com.bumptech.glide.Glide; +import com.viontv.app.R; +import com.viontv.app.databinding.LayoutVideoplayVtBinding; +import com.viontv.app.model.VTVideoDetailsBean; +import com.viontv.app.utils.ToastUtils; +import com.viontv.app.utils.TranslatesUtils; +import com.viontv.app.utils.VTAppConstants; + +import org.greenrobot.eventbus.EventBus; + +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + +public class VTGoogleExoPlayerView extends FrameLayout { + private ExoPlayer player; + // private Job progressJob; //任务调度器 + private ScheduledFuture progressJob; + + private boolean isDragging = false; + private AppCompatSeekBar seekBar; + private AppCompatImageView ivCoverPlayerDetail; + private AppCompatImageView ivPagePlay; + private AppCompatImageView iv_collection_controller; + private AppCompatImageView iv_back_hibit_episode; + private AppCompatTextView tv_des_player; + private AppCompatTextView tv_episode_player; + private AppCompatTextView tv_title_player; + private AppCompatTextView tv_collection_num_controller; + private AppCompatTextView tv_title_hibit_episode; + private ProgressLineView load_line; + private RelativeLayout rl_ep; + private boolean isEpisodePlaying = false; + + public VTGoogleExoPlayerView(Context context, AttributeSet attrs) { + super(context, attrs); + player = new ExoPlayer.Builder(context).build(); + LayoutInflater inflater = LayoutInflater.from(context); + View inflate = inflater.inflate(R.layout.layout_videoplay_vt, this, true); + LayoutVideoplayVtBinding bind = LayoutVideoplayVtBinding.bind(inflate); + bind.playerView.setPlayer(player); + seekBar = bind.playerView.findViewById(R.id.seekBar_player_detail); + ivCoverPlayerDetail = bind.playerView.findViewById(R.id.iv_cover_player_detail); + ivPagePlay = bind.playerView.findViewById(R.id.iv_hibit_play); + iv_collection_controller = bind.playerView.findViewById(R.id.iv_collection_controller); + iv_back_hibit_episode = bind.playerView.findViewById(R.id.iv_back_hibit_episode); + tv_des_player = bind.playerView.findViewById(R.id.tv_des_player); + tv_episode_player = bind.playerView.findViewById(R.id.tv_episode_player); + tv_title_player = bind.playerView.findViewById(R.id.tv_title_player); + load_line = bind.playerView.findViewById(R.id.load_line); + rl_ep = bind.playerView.findViewById(R.id.rl_ep); + + iv_back_hibit_episode.setOnClickListener(v -> + EventBus.getDefault().post(VTAppConstants.Constants_RecommendPlayerView_CLOSEExample) + ); + + tv_collection_num_controller = bind.playerView.findViewById(R.id.tv_collection_num_controller); + tv_title_hibit_episode = bind.playerView.findViewById(R.id.tv_title_hibit_episode); + + + player.addListener(new Player.Listener() { + @Override + public void onPlaybackStateChanged(int playbackState) { + Player.Listener.super.onPlaybackStateChanged(playbackState); + switch (playbackState) { + case Player.STATE_BUFFERING: + load_line.setVisibility(VISIBLE); + load_line.startAnimation(); + break; + case Player.STATE_READY: + bind.playerView.setEnabled(true); + if (VTAppConstants.isCanPlay && !VTAppConstants.isLock) { + start(); + setProgress(); + } + ivCoverPlayerDetail.setVisibility(View.INVISIBLE); + load_line.endAnimation(); + load_line.setVisibility(INVISIBLE); + break; + case Player.STATE_ENDED: + EventBus.getDefault().post(VTAppConstants.Constants_Google_PLAYER_STATUS_FINISH_DETAIL); + break; + case Player.STATE_IDLE: + bind.playerView.setEnabled(false); + break; + } + } + + @Override + public void onPlayerError(PlaybackException error) { + Player.Listener.super.onPlayerError(error); + ivCoverPlayerDetail.setVisibility(View.INVISIBLE); + load_line.setVisibility(INVISIBLE); + if (TranslatesUtils.translates() != null) { + ToastUtils.revealToast(TranslatesUtils.translates().getNetwork_error(), 0); + } else { + ToastUtils.revealToast(context.getString(R.string.vt_network_error_please_check_the_network), 0); + } + } + }); + + bind.playerView.setOnClickListener(v -> { + if (!VTAppConstants.isLock) { + if (isEpisodePlaying) { + ivPagePlay.setImageResource(R.mipmap.iv_play_vt); + suspendPlayer(); + } else { + ivPagePlay.setImageResource(R.mipmap.iv_stop_vt); + start(); + } + } + }); + } + + private void setProgress() { + if (progressJob != null) { + progressJob.cancel(true); + } + ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); + progressJob = executor.scheduleWithFixedDelay(() -> { + if (!isDragging) { + long duration = player.getDuration(); + long position = player.getCurrentPosition(); + int progress = (int) (position * 100 / (duration == C.TIME_UNSET ? 1 : duration)); + if (seekBar != null) { + seekBar.setMax(100); + seekBar.setProgress(progress + 1); + } + } + }, 0, 1, TimeUnit.SECONDS); +// if (progressJob != null) { +// progressJob.cancel(null); +// } +// progressJob = launchKt.launch(Dispatchers.getMain(), null, null, coroutineScope -> { +// while (isActive(coroutineScope)) { +// if (!isDragging.get()) { +// long duration = player.getDuration(); +// long position = player.getCurrentPosition(); +// int progress = (int) (position * 100 / (duration == C.TIME_UNSET ? 1 : duration)); +// seekBar.setMax(100); +// seekBar.setProgress(progress + 1); +// } +// delayKt.delay(1000); +// } +// return null; +// }); + + seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + if (fromUser) { + seekTo(progress); + } + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + isDragging = true; + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + isDragging = false; + } + }); + } + + private void start() { + player.play(); + ivPagePlay.setImageResource(R.mipmap.iv_stop_vt); + isEpisodePlaying = true; + isDragging = false; + } + + public void suspendPlayer() { + player.pause(); + ivPagePlay.setImageResource(R.mipmap.iv_play_vt); + isEpisodePlaying = false; + isDragging = true; + } + + private void seekTo(int progress) { + long duration = player.getDuration(); + player.seekTo(duration * progress / 100); + } + + public void setMedia(VTVideoDetailsBean.Episode bean, VTVideoDetailsBean.ShortPlayInfo shortVideoInfo) { + VTAppConstants.isCanPlay = true; + tv_title_player.setText(shortVideoInfo.getName()); + if (TranslatesUtils.translates() != null) { + tv_title_hibit_episode.setText(TranslatesUtils.replace( + TranslatesUtils.translates().getEpisode_set(), + String.valueOf(bean.getEpisode()) + )); + tv_episode_player.setText(TranslatesUtils.replace( + TranslatesUtils.translates().getComplete_episode(), + String.valueOf(shortVideoInfo.getEpisode_total()) + )); + } else { + tv_title_hibit_episode.setText("Episode ".concat(String.valueOf(bean.getEpisode()))); + tv_episode_player.setText("Complete set : ".concat(String.valueOf(shortVideoInfo.getEpisode_total()))); + } + tv_des_player.setText(shortVideoInfo.getDescription()); + Glide.with(getContext()).load(shortVideoInfo.getImage_url()).into(ivCoverPlayerDetail); + ivCoverPlayerDetail.setVisibility(View.VISIBLE); + // iv_collection_controller.setImageResource(shortVideoInfo.isIs_collect() ? R.drawable.iv_hibit_like_h : R.drawable.iv_hibit_like_n); + // tv_collection_num_controller.setText(Timestamp.formatNumber(shortVideoInfo.getCollect_total())); + rl_ep.setOnClickListener(v -> + EventBus.getDefault().post(VTAppConstants.Constants_PlayerView_MoreItemEvent) + ); + player.setMediaItem(MediaItem.fromUri(Uri.parse(bean.getVideo_url()))); + player.prepare(); + } + + public void stop() { + player.stop(); + if (progressJob != null) { + progressJob.cancel(true); + progressJob = null; + } + } + + public void release() { + player.release(); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/utils/GetAndroidUniqueMark.java b/app/src/main/java/com/viontv/app/utils/GetAndroidUniqueMark.java new file mode 100644 index 0000000..11806ca --- /dev/null +++ b/app/src/main/java/com/viontv/app/utils/GetAndroidUniqueMark.java @@ -0,0 +1,23 @@ +package com.viontv.app.utils; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.os.Build; +import android.provider.Settings; + + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +/** + * 设备ID + */ + +public class GetAndroidUniqueMark { + @SuppressLint("HardwareIds") + public static String getUniqueId(Context context) { + return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); + } + + +} diff --git a/app/src/main/java/com/viontv/app/utils/IntentUtils.java b/app/src/main/java/com/viontv/app/utils/IntentUtils.java new file mode 100644 index 0000000..d506959 --- /dev/null +++ b/app/src/main/java/com/viontv/app/utils/IntentUtils.java @@ -0,0 +1,18 @@ +package com.viontv.app.utils; + +import android.app.Activity; +import android.content.Intent; + +import com.viontv.app.VTApplication; +import com.viontv.app.ui.activity.play.VTVideoPlayerActivity; + +public class IntentUtils { + + + public static void startPlayerDetails(Activity currentActivity,int details_id, int video_id){ + Intent intent = new Intent(currentActivity.getApplicationContext(),VTVideoPlayerActivity.class); + intent.putExtra(VTAppConstants.Constants_Page_DetailId,details_id); + intent.putExtra(VTAppConstants.Constants_Page_video_id,video_id); + currentActivity.startActivity(intent); + } +} diff --git a/app/src/main/java/com/viontv/app/utils/SharePreferenceUtils.java b/app/src/main/java/com/viontv/app/utils/SharePreferenceUtils.java new file mode 100644 index 0000000..36f59b9 --- /dev/null +++ b/app/src/main/java/com/viontv/app/utils/SharePreferenceUtils.java @@ -0,0 +1,91 @@ +package com.viontv.app.utils; + +import static com.viontv.app.VTApplication.AppContext; + +import android.app.Activity; +import android.content.Context; +import android.content.SharedPreferences; + +import com.viontv.app.VTApplication; + +public class SharePreferenceUtils { + + + public static final String auth="auth"; + + public static void saveInt(String key, int value) { + SharedPreferences sp = AppContext.getSharedPreferences("InitApp", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = sp.edit(); + editor.putInt(key, value); + editor.apply(); + } + + public static void saveFloat(String key, float value) { + SharedPreferences sp = AppContext.getSharedPreferences("InitApp", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = sp.edit(); + editor.putFloat(key, value); + editor.apply(); + } + + public static void saveLong(String key, long value) { + SharedPreferences sp = AppContext.getSharedPreferences("InitApp", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = sp.edit(); + editor.putLong(key, value); + editor.apply(); + } + + public static void saveString(String key, String value) { + SharedPreferences sp = AppContext.getSharedPreferences("VionTV", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = sp.edit(); + editor.putString(key, value); + editor.apply(); + } + + public static void deleteKey(String key) { + SharedPreferences sp = AppContext.getSharedPreferences("VionTV", Activity.MODE_PRIVATE); + if (!sp.contains(key)) return; + SharedPreferences.Editor editor = sp.edit(); + editor.remove(key); + editor.apply(); + } + + public static void saveBoolean(String key, boolean value) { + SharedPreferences sp = AppContext.getSharedPreferences("VionTV", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = sp.edit(); + editor.putBoolean(key, value); + editor.apply(); + } + + public static int getInt(String key, int defValue) { + SharedPreferences sp = AppContext.getSharedPreferences("VionTV", Activity.MODE_PRIVATE); + return sp.getInt(key, defValue); + } + + public static float getFloat(String key, float defValue) { + SharedPreferences sp = AppContext.getSharedPreferences("VionTV", Activity.MODE_PRIVATE); + return sp.getFloat(key, defValue); + } + + public static long getLong(String key, long defValue) { + SharedPreferences sp = AppContext.getSharedPreferences("VionTV", Activity.MODE_PRIVATE); + return sp.getLong(key, defValue); + } + + public static boolean getBoolean(String key, boolean defValue) { + SharedPreferences sp = AppContext.getSharedPreferences("VionTV", Activity.MODE_PRIVATE); + return sp.getBoolean(key, defValue); + } + + public static String getString(String key, String defValue) { + Context context = AppContext; + if (context == null) { + return defValue; + } + SharedPreferences sp = context.getSharedPreferences("VionTV", Activity.MODE_PRIVATE); + return sp.getString(key, defValue); + } + + public static boolean is_Vip(){ + return true; + } +} diff --git a/app/src/main/java/com/viontv/app/utils/SingleClickUtils.java b/app/src/main/java/com/viontv/app/utils/SingleClickUtils.java new file mode 100644 index 0000000..f97f597 --- /dev/null +++ b/app/src/main/java/com/viontv/app/utils/SingleClickUtils.java @@ -0,0 +1,25 @@ +package com.viontv.app.utils; + +import java.util.Date; +import java.util.TimeZone; + +public class SingleClickUtils { + private static long lastClickTime = 0L; + + public static void singleClick(long during, Runnable callBack) { + long now = new Date().getTime(); + if (now - lastClickTime > during) { + callBack.run(); + } + lastClickTime = now; + } + + public static void singleClick(Runnable callBack) { + singleClick(500L, callBack); + } + + public static String getCurrentTimeZone() { + TimeZone tz = TimeZone.getDefault(); + return tz.getDisplayName(false, TimeZone.SHORT); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/utils/TimeUtils.java b/app/src/main/java/com/viontv/app/utils/TimeUtils.java new file mode 100644 index 0000000..d1a0744 --- /dev/null +++ b/app/src/main/java/com/viontv/app/utils/TimeUtils.java @@ -0,0 +1,66 @@ +package com.viontv.app.utils; + +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; + +public class TimeUtils { + + public static String getCurrentTimeZone() { + return createGmtOffsetString(true, true, TimeZone.getDefault().getRawOffset()); + } + + public static String createGmtOffsetString(boolean includeGmt, boolean includeMinuteSeparatori, int offsetMillis) { + int offsetMinutes = offsetMillis / 60000; + char sign = '+'; + if (offsetMinutes < 0) { + sign = '-'; + offsetMinutes = -offsetMinutes; + } + + StringBuilder builder = new StringBuilder(9); + if (includeGmt) { + builder.append("GMT"); + } + builder.append(sign); + appendNumber(builder, 2, offsetMinutes / 60); + return builder.toString(); + + } + + public static void appendNumber(StringBuilder builder, int count, int value) { + String string = Integer.toString(value); + int diff = count - string.length(); + for (int i = 0; i < diff; i++) { + builder.append('0'); + } + builder.append(string); + } + + + public static String transToString(Long time) { + Date date = new Date(time * 1000); + return new SimpleDateFormat("yyyy-MM-dd").format(date); + } + + + public static String formatNumber(int num) { + if (num >= 1000000) { + return formatDouble(num / 1000000, 1) + "m"; + } + if (num >= 1000) { + return formatDouble(num / 1000, 1) + "k"; + } + return String.valueOf(num); + } + + private static String formatDouble(double value, int digits) { + StringBuilder pattern = new StringBuilder("#."); + for (int i = 0; i < digits; i++) { + pattern.append("#"); + } + DecimalFormat df = new DecimalFormat(pattern.toString()); + return df.format(value); + } +} diff --git a/app/src/main/java/com/viontv/app/utils/ToastUtils.java b/app/src/main/java/com/viontv/app/utils/ToastUtils.java new file mode 100644 index 0000000..1e2896b --- /dev/null +++ b/app/src/main/java/com/viontv/app/utils/ToastUtils.java @@ -0,0 +1,32 @@ +package com.viontv.app.utils; + +import android.os.Handler; +import android.os.Looper; +import android.widget.Toast; +import com.viontv.app.VTApplication; + +public class ToastUtils { + private static Toast toast; + private static final Handler handler = new Handler(Looper.getMainLooper()); + + public static void revealToast(String message, int duration) { + if (duration == 0) { + duration = Toast.LENGTH_SHORT; + } + hideToast(); + int finalDuration = duration; + handler.post(() -> { + toast = Toast.makeText(VTApplication.getAppContext(), message, finalDuration); + if (toast != null) { + toast.show(); + } + }); + } + + private static void hideToast() { + if (toast != null) { + toast.cancel(); + toast = null; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/viontv/app/utils/TranslatesUtils.java b/app/src/main/java/com/viontv/app/utils/TranslatesUtils.java new file mode 100644 index 0000000..58d891b --- /dev/null +++ b/app/src/main/java/com/viontv/app/utils/TranslatesUtils.java @@ -0,0 +1,28 @@ +package com.viontv.app.utils; + +import com.viontv.app.model.TranslatesResBean; + +public class TranslatesUtils { + + + public static void saveTranslates(TranslatesResBean.Translates infoRes) { + + SharePreferenceUtils.saveString(VTAppConstants.CONSTANTS_Translates_STRING,VTGsonUtils.beanToJSONString(infoRes)); + } + + public static TranslatesResBean.Translates translates(){ + String vaule = SharePreferenceUtils.getString(VTAppConstants.CONSTANTS_Translates_STRING,""); + return VTGsonUtils.getObjFromJSON(vaule, TranslatesResBean.Translates.class); + } + + public static String replace(String value,String result){ + return value.replace("##",result); + } + + public static String replaces(String old,String new1,String new2){ + String replace = old.replace("#1#", new1); + return replace.replace("#2#",new2); + } + + +} diff --git a/app/src/main/java/com/viontv/app/utils/VTAppConstants.java b/app/src/main/java/com/viontv/app/utils/VTAppConstants.java new file mode 100644 index 0000000..50934cb --- /dev/null +++ b/app/src/main/java/com/viontv/app/utils/VTAppConstants.java @@ -0,0 +1,53 @@ +package com.viontv.app.utils; + + +public class VTAppConstants { + public static final int page_size = 10; + public static final String Constants_last_update_time = "Constants_last_update_time"; + public static final String Constants_language_refresh = "Constants_language_refresh"; + public static final String CONSTANTS_Translates_STRING = "CONSTANTS_Translates_STRING"; + public static final String Constants_BASE_URL = "https://api.hibitplay.com"; + // public static final String Constants_BASE_URL = "https://test-api.guyantv.com"; + public static final String Constants_HTTP_TOKEN = "Authorization"; + public static final String Constants_Page_DetailId = "constants_page_detail_id"; + public static final String Constants_Page_video_id = "Constants_Page_video_id"; + public static final String Constants_Page_Episodes_Series_Data_VT = "constants_page_episodes_series_data"; + public static final String Constants_Page_Episodes_Series_Data_List = "Constants_Page_Episodes_Series_Data_List"; + public static final String Constants_PlayerView_MoreItemEvent = + "Constants_PlayerView_MoreItem"; + public static final String Constants_RecommendPlayerView_CLOSEExample = + "Constants_RecommendPlayerView_CLOSEExample"; + public static final String Constants_Page_Episodes_Series_Data_currentPosition = + "Constants_Page_Episodes_Series_Data_currentPosition"; + public static final String Constants_Google_PLAYER_STATUS_FINISH = "constants_google_player_status_finish"; + public static final String Constants_Google_PLAYER_STATUS_FINISH_DETAIL = + "constants_google_player_status_finish_detail"; + public static final String CONSTANTS_refresh_auth = "CONSTANTS_refresh_auth"; + public static final String CONSTANTS_out_login = "CONSTANTS_out_login"; + public static final String CONSTANTS_user_refresh = "CONSTANTS_user_refresh"; + public static final String LogEvent_af_app_recharge = "af_app_recharge"; + public static final String CONSTANTS_AppsFlyer = "axv4xFtouhau4js4GxqBX9"; + public static final String Constants_Episodes_Series_DataExample = "Constants_Episodes_Series_DataExample"; + public static final String Constants_Episodes_Series_DataFavorites = "Constants_Episodes_Series_DataFavorites"; + public static final String CONSTANTS_GOOGLE_LOGIN = + "996139080527-njj3ehigooauk800e0o6hm785jofi2l5.apps.googleusercontent.com"; + public static final String CONSTANTS_device_id = "device-id"; + public static final String CONSTANTS_system_type = "system-type"; + public static final String CONSTANTS_model = "model"; + public static final String CONSTANTS_app_version = "app-version"; + public static final String CONSTANTS_app_name = "app-name"; + public static final String CONSTANTS_lang_key = "lang-key"; + public static final String CONSTANTS_time_zone = "time-zone"; + public static final String CONSTANTS_SEARCH_STRINGExample = "CONSTANTS_SEARCH_STRINGExample"; + public static final String CONSTANTS_User_STRING = "CONSTANTS_User_STRING"; + public static final int requestCodeByGoogleLogin = 666; + public static boolean isCanPlay = true; + public static boolean isLock = false; + public static final String Constants_member_ship_agreement = + "https://www.hibitplay.com/member_ship_agreement_android.html"; + public static final String Constants_user_agreement = "https://www.hibitplay.com/user_policy_android.html"; + public static final String Constants_privacy_policy = "https://www.hibitplay.com/private_android.html"; + public static final String Constants_Web_Url = "Constants_Web_Url"; + public static final String CLIENT_KEY = "awp5nm8lwpyebwgv"; + public static final String REDIRECT_URL = "hibitapp://oauthresponse"; +} diff --git a/app/src/main/java/com/viontv/app/utils/VTGsonUtils.java b/app/src/main/java/com/viontv/app/utils/VTGsonUtils.java new file mode 100644 index 0000000..8259804 --- /dev/null +++ b/app/src/main/java/com/viontv/app/utils/VTGsonUtils.java @@ -0,0 +1,87 @@ +package com.viontv.app.utils; + +import android.text.TextUtils; + +import com.google.gson.Gson; +import com.google.gson.JsonObject; +import com.google.gson.reflect.TypeToken; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; + + +public class VTGsonUtils { + + public static Gson gson = new Gson(); + + /** + * 返回List对象 + * @param str + * @param type new TypeToken>(){}.getType() + * @param + * @return + */ + public static T getListFromJSON(String str, Type type) { + if (!TextUtils.isEmpty(str)) { + return gson.fromJson(str, type); + } + return null; + } + + /** + * 返回List对象 + * @param str + * @param cls + * @param + * @return + */ + public static List getListFromJSON(String str, Class cls) + { + Type type = new TypeToken>() + {}.getType(); + ArrayList jsonObjects = gson.fromJson(str, type); + ArrayList arrayList = new ArrayList<>(); + for (JsonObject jsonObject : jsonObjects) + { + arrayList.add(gson.fromJson(jsonObject, cls)); + } + return arrayList; + } + + /** + * 返回对象 + * @param str + * @param cls + * @param + * @return + */ + public static T getObjFromJSON(String str, Class cls) { +// try { + if (!TextUtils.isEmpty(str)) { + return gson.fromJson(str, cls); + } + return null; +// }catch (Exception e) { +// return null; +// } + } + + /** + * 返回JsonString + * @return + */ + public static String beanToJSONString(Object bean) { + return new Gson().toJson(bean); + } + + + public static String JSONTokener(String in) { + // consume an optional byte order mark (BOM) if it exists + if (in != null && in.startsWith("\ufeff")) { + in = in.substring(1); + } + return in; + } + +} diff --git a/app/src/main/java/com/viontv/app/utils/VTStatusBarUtils.java b/app/src/main/java/com/viontv/app/utils/VTStatusBarUtils.java new file mode 100644 index 0000000..38c8b6a --- /dev/null +++ b/app/src/main/java/com/viontv/app/utils/VTStatusBarUtils.java @@ -0,0 +1,126 @@ +package com.viontv.app.utils; + +import android.annotation.TargetApi; +import android.app.Activity; +import android.content.Context; +import android.content.res.Resources; +import android.content.res.TypedArray; +import android.util.TypedValue; +import android.os.Build; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; + +public class VTStatusBarUtils { + private static int DEFAULT_COLOR = 0; + private static float DEFAULT_ALPHA = 0f; + private static final int MIN_API = 19; + + public static void pageImmersive(Window window, int color) { + pageImmersive(window, color, 1f); + } + + public static void pageImmersive(Window window, int color, float alpha) { + if (Build.VERSION.SDK_INT >= 21) { + window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + window.setStatusBarColor(pageMixtureColor(color, alpha)); + + int systemUiVisibility = window.getDecorView().getSystemUiVisibility(); + systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; + systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE; + window.getDecorView().setSystemUiVisibility(systemUiVisibility); + } else if (Build.VERSION.SDK_INT >= MIN_API) { + window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); + pageSetTranslucentView((ViewGroup) window.getDecorView(), color, alpha); + } else { + int systemUiVisibility = window.getDecorView().getSystemUiVisibility(); + systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; + systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE; + window.getDecorView().setSystemUiVisibility(systemUiVisibility); + } + } + + public static void pageDarkMode(Activity activity, boolean dark) { + pageDarkMode(activity.getWindow(), DEFAULT_COLOR, DEFAULT_ALPHA, dark); + } + + @TargetApi(Build.VERSION_CODES.M) + public static void pageDarkMode(Window window, int color, float alpha, boolean dark) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + pageDarkModeForM(window, dark); + pageImmersive(window, color, alpha); + } else if (Build.VERSION.SDK_INT >= MIN_API) { + window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); + pageSetTranslucentView((ViewGroup) window.getDecorView(), color, alpha); + } else { + pageImmersive(window, color, alpha); + } + } + + @TargetApi(Build.VERSION_CODES.M) + public static void pageDarkModeForM(Window window, boolean dark) { + int systemUiVisibility = window.getDecorView().getSystemUiVisibility(); + if (dark) { + systemUiVisibility |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; + } else { + systemUiVisibility &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; + } + window.getDecorView().setSystemUiVisibility(systemUiVisibility); + } + + public static void pageSetPaddingSmart(Context context, View view) { + if (Build.VERSION.SDK_INT >= MIN_API) { + ViewGroup.LayoutParams lp = view.getLayoutParams(); + if (lp != null && lp.height > 0) { + lp.height += pageGetStatusBarHeight(context); + } + view.setPadding( + view.getPaddingLeft(), + view.getPaddingTop() + pageGetStatusBarHeight(context), + view.getPaddingRight(), + view.getPaddingBottom() + ); + } + } + + private static void pageSetTranslucentView(ViewGroup container, int color, float alpha) { + if (Build.VERSION.SDK_INT >= MIN_API) { + int mixtureColor = pageMixtureColor(color, alpha); + View translucentView = container.findViewById(android.R.id.custom); + if (translucentView == null && mixtureColor != 0) { + translucentView = new View(container.getContext()); + translucentView.setId(android.R.id.custom); + ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + pageGetStatusBarHeight(container.getContext()) + ); + container.addView(translucentView, lp); + } + if (translucentView != null) { + translucentView.setBackgroundColor(mixtureColor); + } + } + } + + private static int pageMixtureColor(int color, float alpha) { + int a = (color & 0xff000000) == 0 ? 0xff : color >>> 24; + return (color & 0x00ffffff) | ((int) (a * alpha) << 24); + } + + private static int pageGetStatusBarHeight(Context context) { + int result = 24; + int resId = context.getResources().getIdentifier("status_bar_height", "dimen", "android"); + if (resId > 0) { + result = context.getResources().getDimensionPixelSize(resId); + } else { + result = (int) TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_DIP, + result, + Resources.getSystem().getDisplayMetrics() + ); + } + return result; + } +} diff --git a/app/src/main/res/drawable/bg_dialog_recharge_no_bottom_vt.xml b/app/src/main/res/drawable/bg_dialog_recharge_no_bottom_vt.xml new file mode 100644 index 0000000..83227e4 --- /dev/null +++ b/app/src/main/res/drawable/bg_dialog_recharge_no_bottom_vt.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_seekbar_pd_player_vt.xml b/app/src/main/res/drawable/bg_seekbar_pd_player_vt.xml new file mode 100644 index 0000000..93f2b13 --- /dev/null +++ b/app/src/main/res/drawable/bg_seekbar_pd_player_vt.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_shape_seekbar_player_vt.xml b/app/src/main/res/drawable/bg_shape_seekbar_player_vt.xml new file mode 100644 index 0000000..0b473f2 --- /dev/null +++ b/app/src/main/res/drawable/bg_shape_seekbar_player_vt.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_vt_episodes.xml b/app/src/main/res/drawable/bg_vt_episodes.xml new file mode 100644 index 0000000..3d4e0ee --- /dev/null +++ b/app/src/main/res/drawable/bg_vt_episodes.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_vt_episodes_h.xml b/app/src/main/res/drawable/bg_vt_episodes_h.xml new file mode 100644 index 0000000..d520770 --- /dev/null +++ b/app/src/main/res/drawable/bg_vt_episodes_h.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/cornor_1affffff_4dp.xml b/app/src/main/res/drawable/cornor_1affffff_4dp.xml new file mode 100644 index 0000000..4f6cb15 --- /dev/null +++ b/app/src/main/res/drawable/cornor_1affffff_4dp.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/cornor_gradient_6dp.xml b/app/src/main/res/drawable/cornor_gradient_6dp.xml new file mode 100644 index 0000000..4c58a59 --- /dev/null +++ b/app/src/main/res/drawable/cornor_gradient_6dp.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/main_tab_explore.xml b/app/src/main/res/drawable/main_tab_explore.xml new file mode 100644 index 0000000..42efa14 --- /dev/null +++ b/app/src/main/res/drawable/main_tab_explore.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/main_tab_home.xml b/app/src/main/res/drawable/main_tab_home.xml new file mode 100644 index 0000000..290d00b --- /dev/null +++ b/app/src/main/res/drawable/main_tab_home.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/main_tab_me.xml b/app/src/main/res/drawable/main_tab_me.xml new file mode 100644 index 0000000..50e4897 --- /dev/null +++ b/app/src/main/res/drawable/main_tab_me.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/main_tab_mylist.xml b/app/src/main/res/drawable/main_tab_mylist.xml new file mode 100644 index 0000000..be2901b --- /dev/null +++ b/app/src/main/res/drawable/main_tab_mylist.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/main_tab_rewards.xml b/app/src/main/res/drawable/main_tab_rewards.xml new file mode 100644 index 0000000..87ebf74 --- /dev/null +++ b/app/src/main/res/drawable/main_tab_rewards.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_serarch_home.xml b/app/src/main/res/drawable/shape_serarch_home.xml new file mode 100644 index 0000000..60f2b3f --- /dev/null +++ b/app/src/main/res/drawable/shape_serarch_home.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/tabindicator_item.xml b/app/src/main/res/drawable/tabindicator_item.xml new file mode 100644 index 0000000..1391046 --- /dev/null +++ b/app/src/main/res/drawable/tabindicator_item.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main_vt.xml b/app/src/main/res/layout/activity_main_vt.xml new file mode 100644 index 0000000..2898fe7 --- /dev/null +++ b/app/src/main/res/layout/activity_main_vt.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_playinfo.xml b/app/src/main/res/layout/activity_playinfo.xml new file mode 100644 index 0000000..b2c5bf7 --- /dev/null +++ b/app/src/main/res/layout/activity_playinfo.xml @@ -0,0 +1,23 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_video_details_vt.xml b/app/src/main/res/layout/activity_video_details_vt.xml new file mode 100644 index 0000000..043e389 --- /dev/null +++ b/app/src/main/res/layout/activity_video_details_vt.xml @@ -0,0 +1,25 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_page_episodes_select_vt.xml b/app/src/main/res/layout/dialog_page_episodes_select_vt.xml new file mode 100644 index 0000000..df8afc3 --- /dev/null +++ b/app/src/main/res/layout/dialog_page_episodes_select_vt.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_category_item.xml b/app/src/main/res/layout/fragment_category_item.xml new file mode 100644 index 0000000..6313b40 --- /dev/null +++ b/app/src/main/res/layout/fragment_category_item.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_hot_vt.xml b/app/src/main/res/layout/fragment_hot_vt.xml new file mode 100644 index 0000000..2049782 --- /dev/null +++ b/app/src/main/res/layout/fragment_hot_vt.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_main_vt.xml b/app/src/main/res/layout/fragment_main_vt.xml new file mode 100644 index 0000000..49c69b3 --- /dev/null +++ b/app/src/main/res/layout/fragment_main_vt.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_top_vt.xml b/app/src/main/res/layout/fragment_top_vt.xml new file mode 100644 index 0000000..26991e4 --- /dev/null +++ b/app/src/main/res/layout/fragment_top_vt.xml @@ -0,0 +1,18 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_banner_vt.xml b/app/src/main/res/layout/item_banner_vt.xml new file mode 100644 index 0000000..c6ce9e4 --- /dev/null +++ b/app/src/main/res/layout/item_banner_vt.xml @@ -0,0 +1,23 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_google_exo_player_vt.xml b/app/src/main/res/layout/item_google_exo_player_vt.xml new file mode 100644 index 0000000..5aeeee7 --- /dev/null +++ b/app/src/main/res/layout/item_google_exo_player_vt.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_home_explore_vt.xml b/app/src/main/res/layout/item_home_explore_vt.xml new file mode 100644 index 0000000..ce37ae0 --- /dev/null +++ b/app/src/main/res/layout/item_home_explore_vt.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/item_home_tablist_vt.xml b/app/src/main/res/layout/item_home_tablist_vt.xml new file mode 100644 index 0000000..7c96a7b --- /dev/null +++ b/app/src/main/res/layout/item_home_tablist_vt.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/item_hot_square_vt.xml b/app/src/main/res/layout/item_hot_square_vt.xml new file mode 100644 index 0000000..a9b484f --- /dev/null +++ b/app/src/main/res/layout/item_hot_square_vt.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_page_episodes_series_vt.xml b/app/src/main/res/layout/item_page_episodes_series_vt.xml new file mode 100644 index 0000000..f5b62d2 --- /dev/null +++ b/app/src/main/res/layout/item_page_episodes_series_vt.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_player_controller_vt.xml b/app/src/main/res/layout/layout_player_controller_vt.xml new file mode 100644 index 0000000..5271de9 --- /dev/null +++ b/app/src/main/res/layout/layout_player_controller_vt.xml @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_player_progress_line_vt.xml b/app/src/main/res/layout/layout_player_progress_line_vt.xml new file mode 100644 index 0000000..d8f5a10 --- /dev/null +++ b/app/src/main/res/layout/layout_player_progress_line_vt.xml @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_videoplay_vt.xml b/app/src/main/res/layout/layout_videoplay_vt.xml new file mode 100644 index 0000000..e1cbbb5 --- /dev/null +++ b/app/src/main/res/layout/layout_videoplay_vt.xml @@ -0,0 +1,13 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/iv_arrowright_vt_episode.webp b/app/src/main/res/mipmap-xxhdpi/iv_arrowright_vt_episode.webp new file mode 100644 index 0000000..04ad306 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/iv_arrowright_vt_episode.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/iv_back_vt.png b/app/src/main/res/mipmap-xxhdpi/iv_back_vt.png new file mode 100644 index 0000000..eb2a037 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/iv_back_vt.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/iv_close_episodes_select_vt.webp b/app/src/main/res/mipmap-xxhdpi/iv_close_episodes_select_vt.webp new file mode 100644 index 0000000..a0176fa Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/iv_close_episodes_select_vt.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/iv_lock.png b/app/src/main/res/mipmap-xxhdpi/iv_lock.png new file mode 100644 index 0000000..1dcf112 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/iv_lock.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/iv_play_vt.webp b/app/src/main/res/mipmap-xxhdpi/iv_play_vt.webp new file mode 100644 index 0000000..9a03968 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/iv_play_vt.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/iv_play_vt_episode_left.png b/app/src/main/res/mipmap-xxhdpi/iv_play_vt_episode_left.png new file mode 100644 index 0000000..013e60e Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/iv_play_vt_episode_left.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/iv_stop_vt.webp b/app/src/main/res/mipmap-xxhdpi/iv_stop_vt.webp new file mode 100644 index 0000000..229de68 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/iv_stop_vt.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/iv_vt_collect_h.png b/app/src/main/res/mipmap-xxhdpi/iv_vt_collect_h.png new file mode 100644 index 0000000..00b67cb Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/iv_vt_collect_h.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/iv_vt_collect_n.png b/app/src/main/res/mipmap-xxhdpi/iv_vt_collect_n.png new file mode 100644 index 0000000..f69a1df Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/iv_vt_collect_n.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/iv_banner_collect.png b/app/src/main/res/mipmap-xxxhdpi/iv_banner_collect.png new file mode 100644 index 0000000..0fb3b4d Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/iv_banner_collect.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/iv_homefragment_bg.png b/app/src/main/res/mipmap-xxxhdpi/iv_homefragment_bg.png new file mode 100644 index 0000000..45acd25 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/iv_homefragment_bg.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/iv_homefragment_search.png b/app/src/main/res/mipmap-xxxhdpi/iv_homefragment_search.png new file mode 100644 index 0000000..08d85d9 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/iv_homefragment_search.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/iv_hot.png b/app/src/main/res/mipmap-xxxhdpi/iv_hot.png new file mode 100644 index 0000000..302c578 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/iv_hot.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_explore_click.png b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_explore_click.png new file mode 100644 index 0000000..f0e2790 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_explore_click.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_explore_default.png b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_explore_default.png new file mode 100644 index 0000000..ec6e7aa Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_explore_default.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_home_click.png b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_home_click.png new file mode 100644 index 0000000..f92f957 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_home_click.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_home_default.png b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_home_default.png new file mode 100644 index 0000000..f35fcf5 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_home_default.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_me_click.png b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_me_click.png new file mode 100644 index 0000000..f4e8f5e Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_me_click.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_me_default.png b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_me_default.png new file mode 100644 index 0000000..99c1698 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_me_default.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_mylist_click.png b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_mylist_click.png new file mode 100644 index 0000000..1a5b76e Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_mylist_click.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_mylist_default.png b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_mylist_default.png new file mode 100644 index 0000000..e36b9ec Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_mylist_default.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_rewards.png b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_rewards.png new file mode 100644 index 0000000..add7d56 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_rewards.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_rewards_click.png b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_rewards_click.png new file mode 100644 index 0000000..b88f87a Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_rewards_click.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_rewards_default.png b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_rewards_default.png new file mode 100644 index 0000000..97dab07 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/iv_main_tab_rewards_default.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/iv_tab_indicator.png b/app/src/main/res/mipmap-xxxhdpi/iv_tab_indicator.png new file mode 100644 index 0000000..af8ccd9 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/iv_tab_indicator.png differ diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..a19d450 --- /dev/null +++ b/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..817af1c --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,13 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + #D2D2D2 + #F564B6 + #333333 + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..bb2bc00 --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,435 @@ + + + + + @dimen/dp_15 + + + + -60dp + -30dp + -20dp + -12dp + -10dp + -8dp + -5dp + -4dp + -2dp + -1dp + 0dp + 0.1dp + 0.5dp + 1dp + 1.5dp + 2dp + 2.5dp + 3dp + 3.5dp + 4dp + 4.5dp + 5dp + 6dp + 7dp + 7.5dp + 8dp + 9dp + 10dp + 11dp + 12dp + 13dp + 14dp + 15dp + 16dp + 17dp + 18dp + 19dp + 20dp + 21dp + 22dp + 23dp + 24dp + 25dp + 26dp + 27dp + 28dp + 29dp + 30dp + 31dp + 32dp + 33dp + 34dp + 35dp + 36dp + 37dp + 38dp + 39dp + 40dp + 41dp + 42dp + 43dp + 44dp + 45dp + 46dp + 47dp + 48dp + 49dp + 50dp + 51dp + 52dp + 53dp + 54dp + 55dp + 56dp + 57dp + 58dp + 59dp + 60dp + 61dp + 62dp + 63dp + 64dp + 65dp + 66dp + 67dp + 68dp + 69dp + 70dp + 71dp + 72dp + 73dp + 74dp + 75dp + 76dp + 77dp + 78dp + 79dp + 80dp + 81dp + 82dp + 83dp + 84dp + 85dp + 86dp + 87dp + 88dp + 89dp + 90dp + 91dp + 92dp + 93dp + 94dp + 95dp + 96dp + 97dp + 98dp + 99dp + 100dp + 101dp + 102dp + 103dp + 104dp + 104.5dp + 105dp + 106dp + 107dp + 108dp + 109dp + 110dp + 111dp + 112dp + 113dp + 114dp + 115dp + 116dp + 117dp + 118dp + 119dp + 120dp + 121dp + 122dp + 123dp + 124dp + 125dp + 126dp + 127dp + 128dp + 129dp + 130dp + 131dp + 132dp + 133dp + 134dp + 134.5dp + 135dp + 136dp + 137dp + 138dp + 139dp + 140dp + 141dp + 142dp + 143dp + 144dp + 145dp + 146dp + 147dp + 148dp + 149dp + 150dp + 151dp + 152dp + 153dp + 154dp + 155dp + 156dp + 157dp + 158dp + 159dp + 160dp + 161dp + 162dp + 163dp + 164dp + 165dp + 166dp + 167dp + 168dp + 169dp + 170dp + 171dp + 172dp + 173dp + 174dp + 175dp + 176dp + 177dp + 178dp + 179dp + 180dp + 181dp + 182dp + 183dp + 184dp + 185dp + 186dp + 187dp + 188dp + 189dp + 190dp + 191dp + 191.25dp + 192dp + 193dp + 194dp + 195dp + 196dp + 197dp + 198dp + 199dp + 200dp + 201dp + 202dp + 203dp + 204dp + 205dp + 206dp + 207dp + 208dp + 209dp + 210dp + 211dp + 212dp + 213dp + 214dp + 215dp + 216dp + 217dp + 218dp + 219dp + 220dp + 221dp + 222dp + 223dp + 224dp + 225dp + 226dp + 227dp + 228dp + 229dp + 230dp + 231dp + 232dp + 233dp + 234dp + 235dp + 236dp + 237dp + 238dp + 239dp + 240dp + 241dp + 242dp + 243dp + 244dp + 245dp + 246dp + 247dp + 248dp + 249dp + 250dp + 251dp + 252dp + 253dp + 254dp + 255dp + 256dp + 257dp + 258dp + 259dp + 260dp + 261dp + 262dp + 263dp + 264dp + 265dp + 266dp + 267dp + 268dp + 269dp + 270dp + 271dp + 272dp + 273dp + 274dp + 275dp + 276dp + 277dp + 278dp + 279dp + 280dp + 281dp + 282dp + 283dp + 284dp + 285dp + 286dp + 287dp + 288dp + 289dp + 290dp + 291dp + 292dp + 293dp + 294dp + 295dp + 296dp + 297dp + 298dp + 299dp + 300dp + 301dp + 302dp + 303dp + 304dp + 305dp + 306dp + 307dp + 308dp + 309dp + 310dp + 311dp + 312dp + 313dp + 314dp + 315dp + 316dp + 317dp + 318dp + 319dp + 320dp + 321dp + 322dp + 323dp + 324dp + 325dp + 326dp + 327dp + 328dp + 329dp + 330dp + 331dp + 332dp + 333dp + 334dp + 335dp + 336dp + 337dp + 338dp + 339dp + 340dp + 341dp + 342dp + 343dp + 344dp + 345dp + 346dp + 347dp + 348dp + 349dp + 350dp + 351dp + 352dp + 353dp + 354dp + 355dp + 356dp + 357dp + 358dp + 359dp + 360dp + 365dp + 370dp + 400dp + 410dp + 422dp + 440dp + + 472dp + 500dp + 600dp + 640dp + 720dp + + + 6sp + 7sp + 8sp + 9sp + 10sp + 11sp + 12sp + 13sp + 14sp + 15sp + 16sp + 17sp + 18sp + 19sp + 20sp + 21sp + 22sp + 23sp + 24sp + 25sp + 26sp + 28sp + 30sp + 32sp + 34sp + 36sp + 38sp + 40sp + 42sp + 48sp + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..9ea267d --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,17 @@ + + VionTV + + Home + Explore + Rewards + My list + Me + + Trending Now + Genres to Explore + + Hot Picks + Top 10 + + Network error please check the network + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..25edf1d --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,17 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..acb052b --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/backup_rules.xml b/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 0000000..4df9255 --- /dev/null +++ b/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 0000000..9ee9997 --- /dev/null +++ b/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/test/java/com/qinjiu/viontv/ExampleUnitTest.java b/app/src/test/java/com/qinjiu/viontv/ExampleUnitTest.java new file mode 100644 index 0000000..a380c66 --- /dev/null +++ b/app/src/test/java/com/qinjiu/viontv/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.qinjiu.viontv; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/app/viontv.jks b/app/viontv.jks new file mode 100644 index 0000000..3f5bf44 Binary files /dev/null and b/app/viontv.jks differ diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..565f8c2 --- /dev/null +++ b/build.gradle @@ -0,0 +1,4 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { +alias(libs.plugins.android.application) apply false +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..4387edc --- /dev/null +++ b/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. For more details, visit +# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..667d239 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,64 @@ +[versions] +agp = "8.9.1" +junit = "4.13.2" +junitVersion = "1.1.5" +espressoCore = "3.5.1" +appcompat = "1.6.1" +material = "1.10.0" +lifecycle = "1.1.1" +retrofit ="2.5.0" +converter-scalars= "2.3.0" +converter-gson= "2.4.0" +adapter-rxjava2= "2.4.0" +rxjava= "2.1.16" +rxandroid= "2.0.2" +okhttp-logging= "4.12.0" +constraintlayout = "2.1.4" +lifecycleLivedataKtx = "2.6.1" +lifecycleViewmodelKtx = "2.6.1" +refresh-layout = "2.1.0" +refresh-header = "2.1.0" +refresh-footer = "2.1.0" +banner = "2.2.3" +recyclerview = "1.2.1" +glide = "4.13.1" +avloadingindicatorview="2.1.4" +media3 ="1.4.0" +eventbus="3.3.1" +baseRecyclerViewAdapter="4.1.4" + +[libraries] +junit = { group = "junit", name = "junit", version.ref = "junit" } +ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } +espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } +appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } +material = { group = "com.google.android.material", name = "material", version.ref = "material" } +lifecycle = { group="android.arch.lifecycle:extensions",name="lifecycle",version.ref = "lifecycle"} +retrofit = { group="com.squareup.retrofit2",name="retrofit",version.ref = "retrofit"} +converter-scalars = { group="com.squareup.retrofit2",name="converter-scalars",version.ref = "converter-scalars"} +converter-gson = { group="com.squareup.retrofit2",name="converter-gson",version.ref = "converter-gson"} +adapter-rxjava2 = { group="com.squareup.retrofit2",name="adapter-rxjava2",version.ref = "adapter-rxjava2"} +rxjava = { group="io.reactivex.rxjava2",name="rxjava",version.ref = "rxjava"} +rxandroid = { group="io.reactivex.rxjava2",name="rxandroid",version.ref = "rxandroid"} +okhttplog = { group="com.squareup.okhttp3",name="logging-interceptor",version.ref = "okhttp-logging"} +constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" } +lifecycle-livedata-ktx = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version.ref = "lifecycleLivedataKtx" } +lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycleViewmodelKtx" } +refreshlayout = { group = "io.github.scwang90", name = "refresh-layout-kernel", version.ref = "refresh-layout" } +refreshheader = { group = "io.github.scwang90", name = "refresh-header-material", version.ref = "refresh-header" } +refreshfooter = { group = "io.github.scwang90", name = "refresh-footer-classics", version.ref = "refresh-footer" } +banner = { group = "io.github.youth5201314", name = "banner", version.ref = "banner" } +recyclerview = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "recyclerview" } +glide = { group = "com.github.bumptech.glide", name = "glide", version.ref = "glide" } +avloadingView = { group = "io.github.maitrungduc1410", name = "AVLoadingIndicatorView", version.ref = "avloadingindicatorview" } +media3exoplayer = { group = "androidx.media3", name = "media3-exoplayer", version.ref = "media3" } +media3exoplayerdash = { group = "androidx.media3", name = "media3-exoplayer-dash", version.ref = "media3" } +media3ui = { group = "androidx.media3", name = "media3-ui", version.ref = "media3" } +media3exoplayerhls = { group = "androidx.media3", name = "media3-exoplayer-hls", version.ref = "media3" } +eventbut={group = "org.greenrobot", name = "eventbus", version.ref = "eventbus" } +baseRecyclerAdapter={group = "io.github.cymchad", name = "BaseRecyclerViewAdapterHelper4", version.ref = "baseRecyclerViewAdapter" } + + +[plugins] +android-application = { id = "com.android.application", version.ref = "agp" } + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e708b1c Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..12de29e --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Thu Apr 10 10:43:37 CST 2025 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.11.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..4f906e0 --- /dev/null +++ b/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..36f7811 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,37 @@ +pluginManagement { + repositories { + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } + mavenCentral() + gradlePluginPortal() + maven { + setUrl("https://jitpack.io") + } + maven { + setUrl("https://maven.aliyun.com/nexus/content/repositories/jcenter") + } + maven { setUrl("https://s01.oss.sonatype.org/content/groups/public" ) } + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven { + setUrl("https://jitpack.io") + } + maven { + setUrl("https://maven.aliyun.com/nexus/content/repositories/jcenter") + } + maven { setUrl("https://s01.oss.sonatype.org/content/groups/public" ) } + } +} + +rootProject.name = "VionTV" +include ':app'