VionTv 推荐,我的,搜索

This commit is contained in:
guozhen 2025-04-15 19:56:47 +08:00
parent 376abae4e5
commit 956eba20ef
90 changed files with 3360 additions and 436 deletions

View File

@ -14,6 +14,7 @@ android {
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
// signingConfigs {
@ -39,6 +40,8 @@ android {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

View File

@ -1,37 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:name=".VTApplication"
android:theme="@style/Theme.VionTV"
tools:targetApi="31">
<application
android:name=".VTApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.VionTV">
<activity
android:name=".ui.activity.VTMainActivity"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ui.activity.play.VTVideoPlayerActivity"/>
</application>
<activity
android:name=".ui.activity.VTMainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ui.activity.play.VTVideoPlayerActivity" />
<activity android:name=".ui.activity.search.VTSearchActivity" />
<activity android:name=".ui.activity.WebViewActivity" />
</application>
</manifest>

View File

@ -19,6 +19,8 @@ public class VTApplication extends Application {
public static VTApplication AppContext;
public static boolean isCurrentPage = true;
public static VTApplication getAppContext() {
return AppContext;
}

View File

@ -1,23 +1,20 @@
package com.viontv.app.api;
import com.viontv.app.model.HomeBottomListBean;
import com.viontv.app.model.VTVideoListBean;
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.VTUserInfoBean;
import com.viontv.app.model.VTVideoDetailsBean;
import java.util.List;
import java.util.Map;
import com.viontv.app.model.VTVideoExploreListBean;
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;
@ -28,10 +25,14 @@ public interface VTApiService {
* 正式测试服
*/
boolean isProduce = false;
String URL = isProduce ? "https://admin-viontv.guyantv.com" : "https://test1-api.guyantv.com";
String URL = isProduce ? "https://api-zyreotv.zyreotv.com/7834f11d/" : "https://test1-api.guyantv.com";
public static final String rankTop10Type = "most_trending";
public static final String ZyreoTV_Private = "https://www.zyreotv.com/private";
public static final String ZyreoTV_USERAgreement = "https://www.zyreotv.com/user_policy";
public static final String rankTop10Type="most_trending";
/**
* 注册
*
@ -64,7 +65,7 @@ public interface VTApiService {
*/
@FormUrlEncoded
@POST("/newShortPlay")
Observable<VTResult<HomeBottomListBean>> newShortPlay(@Field("current_page") int currentpage,@Field("page_size") int pagesize);
Observable<VTResult<VTVideoListBean>> newShortPlay(@Field("current_page") int currentpage, @Field("page_size") int pagesize);
/**
@ -74,7 +75,7 @@ public interface VTApiService {
*/
@FormUrlEncoded
@POST("/homeRanking")
Observable<VTResult<HomeBottomListBean>> homeTop10(@Field("type") String type);
Observable<VTResult<VTVideoListBean>> homeTop10(@Field("type") String type);
/**
@ -93,7 +94,7 @@ public interface VTApiService {
*/
@FormUrlEncoded
@POST("/revenge")
Observable<VTResult<TabItemBean>> getTabItemBanner(@Field("category_id") String category_id);
Observable<VTResult<TabItemBean>> getTabItemBanner(@Field("category_id") int category_id);
/**
@ -102,8 +103,87 @@ public interface VTApiService {
* @return
*/
@GET("/videoList")
Observable<VTResult<HomeBottomListBean>> getVideoList(@Query("category_id") String category_id,@Query("current_page") int current,@Query("page_size") int pageSize,@Query("search") String search);
Observable<VTResult<VTVideoListBean>> getVideoList(@Query("category_id") int category_id, @Query("current_page") int current, @Query("page_size") int pageSize, @Query("search") String search);
/**
* 播放上报历史
*
* @return
*/
@FormUrlEncoded
@POST("/createHistory")
Observable<VTResult> createVideoHistory(@Field("short_play_id") int shorplayId, @Field("video_id") int videoId);
/**
* Search Hot List
*
* @return
*/
@GET("/search/hots")
Observable<VTResult<VTVideoListBean>> getSearchHotList();
/**
* Search Content List
*
* @return
*/
@GET("/search")
Observable<VTResult<VTVideoListBean>> getSearchContentList(@Query("search") String search);
/**
* 搜索点击上报
*
* @return
*/
@FormUrlEncoded
@POST("/search/click")
Observable<VTResult> searchClick(@Field("short_play_id") int shorplayId);
/**
* 首页推荐列表
*
* @return
*/
@GET("/getRecommands")
Observable<VTResult<VTVideoExploreListBean>> getExploreList(@Query("current_page") int current, @Query("page_size") int pageSize);
/**
* 收藏
*
* @return
*/
@FormUrlEncoded
@POST("/collect")
Observable<VTResult> collect(@Field("short_play_id") int shorplayId, @Field("video_id") int videoId);
/**
* 取消收藏
*
* @return
*/
@FormUrlEncoded
@POST("/cancelCollect")
Observable<VTResult> cancelCollect(@Field("short_play_id") int shorplayId);
/**
* 获取用户信息
*
* @return
*/
@GET("/customer/info")
Observable<VTResult<VTUserInfoBean>> getUserInfo();
/**
* 获取观看历史列表
*
* @return
*/
@GET("/myHistorys")
Observable<VTResult<VTVideoListBean>> getVideoHistoryList(@Query("current_page") int currentpage, @Query("page_size") int pageSize);
}

View File

@ -38,6 +38,9 @@ public class ItemBean {
private List<String> category;
private List<SearchCateGoryItemBean> categoryList; //搜索结果
@ -168,4 +171,13 @@ public class ItemBean {
public void setCategory(List<String> category) {
this.category = category;
}
public List<SearchCateGoryItemBean> getCategoryList() {
return categoryList;
}
public void setCategoryList(List<SearchCateGoryItemBean> categoryList) {
this.categoryList = categoryList;
}
}

View File

@ -0,0 +1,23 @@
package com.viontv.app.model;
public class SearchCateGoryItemBean {
private String name;
private int id;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}

View File

@ -0,0 +1,76 @@
package com.viontv.app.model;
public class VTUserInfoBean {
// "id": "S72866 (t)",
// "customer_id": "S72866 (t)",
// "is_guide_vip": true,
// "is_tourist": true,
// "family_name": "訪客",
// "giving_name": "",
// "vip_end_time": 0,
// "third_access_id": "",
// "is_vip": false,
// "coin_left_total": 0,
// "vip_type": "",
// "email": "",
// "third_access_platform": "",
// "ip_address": "116.128.252.77",
// "country_code": "CN",
// "user_level": "normal",
// "send_coin_left_total": 0,
// "avator": "",
// "sign_in_status": 0,
// "registered_days": 1,
// "ln": "ed590219f82c44d5a40d19cdff3cb6de49ccb0b3bf61ccd8214764105d736dbe",
// "country": "9fc4508238942e7cf40354d962db0c18c5ceec7320e0a3b9f69a0a7836efa50c"
public String family_name;
public boolean is_vip;
public String avator;
public String id;
public String customer_id;
public String getFamily_name() {
return family_name;
}
public void setFamily_name(String family_name) {
this.family_name = family_name;
}
public boolean isIs_vip() {
return is_vip;
}
public void setIs_vip(boolean is_vip) {
this.is_vip = is_vip;
}
public String getAvator() {
return avator;
}
public void setAvator(String avator) {
this.avator = avator;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCustomer_id() {
return customer_id;
}
public void setCustomer_id(String customer_id) {
this.customer_id = customer_id;
}
}

View File

@ -15,7 +15,8 @@ public class VTVideoDetailsBean {
public ShortPlayInfo shortPlayInfo;
public VideoInfo video_info;
public VideoInfoBean video_info;
@ -151,6 +152,10 @@ public class VTVideoDetailsBean {
int short_id;
int watch_total;
int short_play_id;
public int getAll_coins() {
return all_coins;
}
@ -247,6 +252,14 @@ public class VTVideoDetailsBean {
this.watch_total = watch_total;
}
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;
}
protected ShortPlayInfo(Parcel in) {
all_coins = in.readInt();
buy_type = in.readInt();
@ -260,6 +273,7 @@ public class VTVideoDetailsBean {
process = in.readInt();
short_id = in.readInt();
watch_total = in.readInt();
short_play_id = in.readInt();
}
public static final Creator<ShortPlayInfo> CREATOR = new Creator<ShortPlayInfo>() {
@ -293,133 +307,8 @@ public class VTVideoDetailsBean {
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<VideoInfo> CREATOR = new Creator<VideoInfo>() {
@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);
}
}
}

View File

@ -0,0 +1,179 @@
package com.viontv.app.model;
import java.util.List;
public class VTVideoExploreBean {
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 boolean is_collect;
public VideoInfoBean video_info;
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 boolean isIs_collect() {
return is_collect;
}
public void setIs_collect(boolean is_collect) {
this.is_collect = is_collect;
}
public VideoInfoBean getVideo_info() {
return video_info;
}
public void setVideo_info(VideoInfoBean video_info) {
this.video_info = video_info;
}
}

View File

@ -0,0 +1,18 @@
package com.viontv.app.model;
import java.util.List;
public class VTVideoExploreListBean {
public List<VTVideoExploreBean> list;
public List<VTVideoExploreBean> getList() {
return list;
}
public void setList(List<VTVideoExploreBean> list) {
this.list = list;
}
}

View File

@ -2,7 +2,7 @@ package com.viontv.app.model;
import java.util.List;
public class HomeBottomListBean {
public class VTVideoListBean {
private List<ItemBean> short_play_list;
private List<ItemBean> list;

View File

@ -0,0 +1,135 @@
package com.viontv.app.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
public class VideoInfoBean 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;
protected VideoInfoBean(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<VideoInfoBean> CREATOR = new Creator<VideoInfoBean>() {
@Override
public VideoInfoBean createFromParcel(Parcel in) {
return new VideoInfoBean(in);
}
@Override
public VideoInfoBean[] newArray(int size) {
return new VideoInfoBean[size];
}
};
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;
}
@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);
}
}

View File

@ -1,10 +1,8 @@
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;
@ -14,7 +12,7 @@ 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 com.viontv.app.ui.adapter.VTFragmentAdapter;
import java.util.ArrayList;
import java.util.List;
@ -31,7 +29,7 @@ public class VTMainActivity extends VTCommonActivity<ActivityMainVtBinding> impl
ActivityMainVtBinding binding;
private FragmentAdapter fragmentAdapter;
private VTFragmentAdapter fragmentAdapter;
@ -55,7 +53,7 @@ public class VTMainActivity extends VTCommonActivity<ActivityMainVtBinding> impl
fragments.add(VTExploreFragment);
fragments.add(VTMyListFragment);
fragments.add(VTMeFragment);
fragmentAdapter = new FragmentAdapter(this);
fragmentAdapter = new VTFragmentAdapter(this);
fragmentAdapter.setFragmentList(fragments);
binding.container.setUserInputEnabled(false);
binding.container.setAdapter(fragmentAdapter);

View File

@ -0,0 +1,69 @@
package com.viontv.app.ui.activity;
import android.annotation.SuppressLint;
import android.os.Build;
import android.webkit.CookieManager;
import android.webkit.WebSettings;
import com.viontv.app.databinding.ActivityMainVtBinding;
import com.viontv.app.databinding.ActivityWebviewBinding;
import com.viontv.app.ui.activity.basic.VTCommonActivity;
import com.viontv.app.utils.VTAppConstants;
public class WebViewActivity extends VTCommonActivity<ActivityWebviewBinding> {
public ActivityWebviewBinding binding;
private String webUrl;
private String webTitle;
@Override
public void init() {
getWindow().setNavigationBarColor(getResources().getColor(android.R.color.black));
binding = ActivityWebviewBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
webUrl = getIntent().getStringExtra(VTAppConstants.Constants_Page_WebUrl);
webTitle = getIntent().getStringExtra(VTAppConstants.Constants_Page_WebTitle);
}
@Override
public void initView() {
binding.ivWebviewBack.setOnClickListener(v -> finish());
binding.tvWebviewTitle.setText(webTitle);
binding.webview.getSettings();
WebSettings settings = binding.webview.getSettings();
settings.setDomStorageEnabled(true);
CookieManager.getInstance().setAcceptThirdPartyCookies(binding.webview, true);
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
// settings.setAppCacheEnabled(true);
settings.setCacheMode(WebSettings.LOAD_DEFAULT);
// settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
settings.setJavaScriptEnabled(true);
settings.setLoadWithOverviewMode(true);
// settings.setAppCachePath(APP_CACHE_DIRNAME);
// 设置允许访问文件数据
settings.setAllowFileAccess(true);
settings.setAllowContentAccess(true);
settings.setDatabaseEnabled(true);
settings.setSavePassword(false);
settings.setSaveFormData(false);
settings.setUseWideViewPort(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
// 设置在WebView内部是否允许通过file url加载的 Js代码读取其他的本地文件
// Android 4.1前默认允许4.1后默认禁止
settings.setAllowFileAccessFromFileURLs(true);
// 设置WebView内部是否允许通过 file url 加载的 Javascript 可以访问其他的源(包括httphttps等源)
// Android 4.1前默认允许4.1后默认禁止
settings.setAllowUniversalAccessFromFileURLs(true);
binding.webview.loadUrl(webUrl);
}
@Override
public void logic() {
}
}

View File

@ -24,7 +24,7 @@ public abstract class VTCommonActivity<T> extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 调用 HibitStatusBarTools 类的 pageDarkMode 方法设置页面为深色模式
VTStatusBarUtils.pageDarkMode(this, true);
VTStatusBarUtils.pageDarkMode(this, false);
// 设置窗口标志防止屏幕内容被截屏或录制
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_SECURE,

View File

@ -1,5 +1,6 @@
package com.viontv.app.ui.activity.explore;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@ -7,17 +8,53 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.fragment.app.Fragment;
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.VTApplication;
import com.viontv.app.api.VTResult;
import com.viontv.app.databinding.FragmentExploreVtBinding;
import com.viontv.app.databinding.FragmentMainVtBinding;
import com.viontv.app.model.VTVideoDetailsBean;
import com.viontv.app.model.VTVideoExploreBean;
import com.viontv.app.model.VTVideoExploreListBean;
import com.viontv.app.ui.activity.basic.VTBaseEventBus;
import com.viontv.app.ui.activity.home.MainViewModel;
import com.viontv.app.ui.activity.play.VTVideoPlayerActivity;
import com.viontv.app.ui.activity.play.VTVideoViewModel;
import com.viontv.app.ui.adapter.VTGooglePlayerAdapter;
import com.viontv.app.ui.adapter.VTGooglePlayerExploreAdapter;
import com.viontv.app.ui.view.VTHomeGoogleExoPlayerView;
import com.viontv.app.utils.IntentUtils;
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;
public class VTExploreFragment extends Fragment {
public class VTExploreFragment extends Fragment implements VTGooglePlayerExploreAdapter.PlayerDetailCollection {
private MainViewModel mViewModel;
private FragmentMainVtBinding binding;
private FragmentExploreVtBinding viewBinding;
private VTVideoExploreBean bean = null;
private VTGooglePlayerExploreAdapter vtGooglePlayerAdapter = null;
private int currentPosition = 0;
private boolean first = true;
private int pageHome = 1;
public static VTExploreFragment newInstance() {
return new VTExploreFragment();
@ -27,6 +64,7 @@ public class VTExploreFragment extends Fragment {
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mViewModel = new ViewModelProvider(this).get(MainViewModel.class);
// TODO: Use the ViewModel
}
@ -34,8 +72,204 @@ public class VTExploreFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
binding = FragmentMainVtBinding.inflate(inflater);
return binding.getRoot();
EventBus.getDefault().register(this);
viewBinding = FragmentExploreVtBinding.inflate(inflater);
return viewBinding.getRoot();
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
viewBinding.avi.smoothToShow();
mViewModel.getExploreVideoList(pageHome, 10);
viewBinding.viewPagerExploreEpisode.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@SuppressLint("NotifyDataSetChanged")
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
currentPosition = position;
int previousPosition = vtGooglePlayerAdapter != null ? vtGooglePlayerAdapter.getCurrentEpisodePlayingPosition() : -1;
if (previousPosition != position) {
vtGooglePlayerAdapter.getRecyclerView().post(() -> vtGooglePlayerAdapter.notifyDataSetChanged());
}
vtGooglePlayerAdapter.setCurrentEpisodePlayingPosition(position);
}
@Override
public void onPageScrollStateChanged(int state) {
super.onPageScrollStateChanged(state);
if (state == ViewPager2.SCROLL_STATE_IDLE) {
if (viewBinding.viewPagerExploreEpisode.getCurrentItem() == viewBinding.viewPagerExploreEpisode.getAdapter().getItemCount() - 1) {
if (!first) {
pageHome++;
mViewModel.getExploreVideoList(pageHome, 10);
} else {
first = false;
}
}
}
}
});
logic();
}
public void logic() {
mViewModel.getExploreVideoLiveData().observe(getViewLifecycleOwner(), data -> {
if (data != null) {
if (pageHome == 1) {
if (data.data.getList().isEmpty()) {
viewBinding.layoutEmpty.setVisibility(View.VISIBLE);
} else {
vtGooglePlayerAdapter = new VTGooglePlayerExploreAdapter();
viewBinding.viewPagerExploreEpisode.setAdapter(vtGooglePlayerAdapter);
vtGooglePlayerAdapter.setPlayerDetailCollection(this::collection);
vtGooglePlayerAdapter.submitList(data.data.getList());
viewBinding.layoutEmpty.setVisibility(View.GONE);
}
} else {
if (!data.data.getList().isEmpty()) {
vtGooglePlayerAdapter.addAll(data.data.getList());
} else {
ToastUtils.revealToast(TranslatesUtils.translates() != null ? TranslatesUtils.translates().getNo_more_data() : "no more data.", 0);
}
}
} else {
viewBinding.layoutEmpty.setVisibility(View.VISIBLE);
ToastUtils.revealToast(TranslatesUtils.translates() != null ? TranslatesUtils.translates().getNetwork_error() : getString(R.string.vt_network_error_please_check_the_network), 0);
}
viewBinding.avi.smoothToHide();
// viewBinding.refreshHome.finishRefresh();
});
mViewModel.getCollectionLiveData().observe(getViewLifecycleOwner(), data -> {
if (data != null && data.isSuccessful()) {
AppCompatImageView imageView = getHomePlayerView().findViewById(R.id.iv_collection_controller);
AppCompatTextView textView = getHomePlayerView().findViewById(R.id.tv_collection_num_controller);
imageView.setImageResource(R.mipmap.iv_vt_collect_h);
bean.setCollect_total(bean.getCollect_total() + 1);
vtGooglePlayerAdapter.getItems().get(currentPosition).setCollect_total(bean.getCollect_total());
vtGooglePlayerAdapter.getItems().get(currentPosition).setIs_collect(true);
textView.setText(TimeUtils.formatNumber(bean.getCollect_total()));
ToastUtils.revealToast(TranslatesUtils.translates() != null ? TranslatesUtils.translates().getSuccess() : "Success", 0);
}
});
mViewModel.getCollectioncancelLiveData().observe(getViewLifecycleOwner(), data -> {
if (data != null && data.isSuccessful()) {
AppCompatImageView imageView = getHomePlayerView().findViewById(R.id.iv_collection_controller);
AppCompatTextView textView = getHomePlayerView().findViewById(R.id.tv_collection_num_controller);
imageView.setImageResource(R.mipmap.iv_vt_collect_n);
bean.setCollect_total(bean.getCollect_total() - 1);
vtGooglePlayerAdapter.getItems().get(currentPosition).setCollect_total(bean.getCollect_total());
vtGooglePlayerAdapter.getItems().get(currentPosition).setIs_collect(false);
textView.setText(TimeUtils.formatNumber(bean.getCollect_total()));
ToastUtils.revealToast(TranslatesUtils.translates() != null ? TranslatesUtils.translates().getSuccess() : "Success", 0);
}
});
}
@Override
public void collection(VTVideoExploreBean videoExploreBean) {
SingleClickUtils.singleClick(() -> {
bean = videoExploreBean;
if (bean.isIs_collect()) {
mViewModel.cancelcollection(bean.getVideo_info().getShort_play_id());
} else {
mViewModel.collection(bean.getVideo_info().getShort_play_id(), bean.getVideo_info().getShort_play_video_id());
}
});
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(String event) {
if (VTAppConstants.Constants_Google_PLAYER_STATUS_FINISH.equals(event)) {
if (viewBinding.viewPagerExploreEpisode.getCurrentItem() == viewBinding.viewPagerExploreEpisode.getAdapter().getItemCount() - 1) {
viewBinding.viewPagerExploreEpisode.setCurrentItem(0);
} else {
vtGooglePlayerAdapter.setCurrentEpisodePlayingPosition(vtGooglePlayerAdapter.getCurrentEpisodePlayingPosition() + 1);
viewBinding.viewPagerExploreEpisode.setCurrentItem(vtGooglePlayerAdapter.getCurrentEpisodePlayingPosition());
}
}
if (VTAppConstants.Constants_PlayerView_DetialsEvent.equals(event)) {
int item = viewBinding.viewPagerExploreEpisode.getCurrentItem();
IntentUtils.startPlayerDetails(getActivity(), vtGooglePlayerAdapter.getItem(item).getShort_play_id(), 0);
}
if (VTAppConstants.Constants_PlayerView_SearchEvent.equals(event)) {
IntentUtils.startSearch(getActivity());
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(VTBaseEventBus<VTVideoDetailsBean.ShortPlayInfo> event) {
if (VTAppConstants.Constants_Episodes_Series_DataExample.equals(event.getCode())) {
if( event.getData().getShort_play_id() == vtGooglePlayerAdapter.getItems().get(currentPosition).getShort_play_id()){
AppCompatImageView imageView = getHomePlayerView().findViewById(R.id.iv_collection_controller);
AppCompatTextView textView = getHomePlayerView().findViewById(R.id.tv_collection_num_controller);
imageView.setImageResource(event.getData().isIs_collect() ? R.mipmap.iv_vt_collect_h : R.mipmap.iv_vt_collect_n);
vtGooglePlayerAdapter.getItems().get(currentPosition).setCollect_total(event.getData().getCollect_total());
vtGooglePlayerAdapter.getItems().get(currentPosition).setIs_collect(event.getData().isIs_collect());
textView.setText(TimeUtils.formatNumber(event.getData().getCollect_total()));
}
}
}
// @Subscribe(threadMode = ThreadMode.MAIN)
// public void onEventFa(BaseEventBus<HibitMyCollectionsBean.Data> event) {
// if (HibitAppConstants.Constants_Episodes_Series_DataFavorites.equals(event.getCode())) {
// if (event.getData().getName().equals(hibitHomePlayerAdapter.getItems().get(currentPosition).getName())) {
// AppCompatImageView imageView = getHomePlayerView().findViewById(R.id.iv_collection_controller);
// AppCompatTextView textView = getHomePlayerView().findViewById(R.id.tv_collection_num_controller);
// imageView.setImageResource(R.drawable.iv_hibit_like_n);
// int collectTotal = hibitHomePlayerAdapter.getItems().get(currentPosition).getCollect_total() - 1;
// hibitHomePlayerAdapter.getItems().get(currentPosition).setIs_collect(false);
// textView.setText(String.valueOf(collectTotal));
// }
// }
// }
private VTHomeGoogleExoPlayerView getHomePlayerView() {
RecyclerView recyclerView = (RecyclerView) viewBinding.viewPagerExploreEpisode.getChildAt(0);
return (VTHomeGoogleExoPlayerView) recyclerView.getLayoutManager().findViewByPosition(currentPosition);
}
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
if (!hidden) {
if (getHomePlayerView() != null) getHomePlayerView().start();
VTApplication.isCurrentPage = true;
} else {
VTApplication.isCurrentPage = false;
if (getHomePlayerView() != null) getHomePlayerView().suspend();
}
}
@Override
public void onResume() {
super.onResume();
VTApplication.isCurrentPage = true;
}
@Override
public void onPause() {
super.onPause();
VTApplication.isCurrentPage = false;
if (getHomePlayerView() != null) getHomePlayerView().suspend();
}
@Override
public void onDestroy() {
if (getHomePlayerView() != null) getHomePlayerView().release();
super.onDestroy();
EventBus.getDefault().unregister(this);
}
}

View File

@ -1,7 +1,93 @@
package com.viontv.app.ui.activity.home;
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.VTVideoDetailsBean;
import com.viontv.app.model.VTVideoExploreListBean;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
public class MainViewModel extends ViewModel {
// TODO: Implement the ViewModel
private final MutableLiveData<VTResult<VTVideoExploreListBean>> exploreVideoList = new MutableLiveData<>();
private final MutableLiveData<VTResult> collectioncancelLiveData = new MutableLiveData<>();
private final MutableLiveData<VTResult> collectionLiveData = new MutableLiveData<>();
public MutableLiveData<VTResult<VTVideoExploreListBean>> getExploreVideoLiveData() {
return exploreVideoList;
}
public MutableLiveData<VTResult> getCollectionLiveData() {
return collectionLiveData;
}
public MutableLiveData<VTResult> getCollectioncancelLiveData() {
return collectioncancelLiveData;
}
public void getExploreVideoList(int currentpage, int pagesize) {
VTApi.getInstance().getExploreList(currentpage, pagesize)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new VTBaseObserver<VTResult<VTVideoExploreListBean>>() {
@Override
public void onSuccess(VTResult<VTVideoExploreListBean> feedbackResp) {
exploreVideoList.setValue(feedbackResp);
}
@Override
public void onError(int code, String msg) {
Log.i("tag===", msg + "");
exploreVideoList.setValue(null);
}
});
}
public void collection(int shortplayId, int videoId) {
VTApi.getInstance().collect(shortplayId, videoId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new VTBaseObserver<VTResult>() {
@Override
public void onSuccess(VTResult feedbackResp) {
collectionLiveData.setValue(feedbackResp);
}
@Override
public void onError(int code, String msg) {
Log.i("tag===", msg + "");
collectionLiveData.setValue(null);
}
});
}
public void cancelcollection(int shortplayId) {
VTApi.getInstance().cancelCollect(shortplayId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new VTBaseObserver<VTResult>() {
@Override
public void onSuccess(VTResult feedbackResp) {
collectioncancelLiveData.setValue(feedbackResp);
}
@Override
public void onError(int code, String msg) {
Log.i("tag===", msg + "");
collectioncancelLiveData.setValue(null);
}
});
}
}

View File

@ -10,6 +10,7 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import android.os.CountDownTimer;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -22,6 +23,8 @@ 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 com.viontv.app.model.ItemBean;
import com.viontv.app.utils.IntentUtils;
import java.util.ArrayList;
import java.util.List;
@ -62,10 +65,14 @@ public class VTHomeFragment extends Fragment {
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getTopTitles();
myCountDownTimer = new MyCountDownTimer(365 * 24 * 60 * 60, 5000);
}
int item = 0;
private List<ItemBean> itemSearchList;
private void getTopTitles() {
binding.layoutSearch.setOnClickListener(v -> IntentUtils.startSearch(getActivity()));
VTApi.getInstance().homeTop()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@ -73,9 +80,19 @@ public class VTHomeFragment extends Fragment {
@Override
public void onSuccess(VTResult<HomeTopBean> feedbackResp) {
List<CateGoryItemBean> itemBeans = feedbackResp.data.getCategory();
tabShow(itemBeans);
binding.tvHomeSearch.setHint(feedbackResp.data.getHotData().get(0).getName());
if (feedbackResp.data != null) {
List<CateGoryItemBean> itemBeans = feedbackResp.data.getCategory();
tabShow(itemBeans);
itemSearchList = feedbackResp.data.getHotData();
item = 0;
binding.tvHomeSearch.setHint(itemSearchList.get(item).getName());
if (itemSearchList.size() > 1) {
myCountDownTimer.start();
}
}
}
@Override
@ -92,7 +109,7 @@ public class VTHomeFragment extends Fragment {
listFragment = new ArrayList<>();
listFragment.add(VTHotFragment.newInstance());
listFragment.add(VTTopFragment.newInstance());
for (CateGoryItemBean itemBean:itemBeans){
for (CateGoryItemBean itemBean : itemBeans) {
titles.add(itemBean.getCategory_name());
listFragment.add(VTTabItemFragment.newInstance(itemBean.getCategory_id()));
}
@ -128,4 +145,42 @@ public class VTHomeFragment extends Fragment {
}
MyCountDownTimer myCountDownTimer;
private class MyCountDownTimer extends CountDownTimer {
public MyCountDownTimer(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}
//计时过程
@Override
public void onTick(long l) {
//防止计时过程中重复点击
if (itemSearchList.size() - 1 > item) {
item++;
} else {
item = 0;
}
binding.tvHomeSearch.setHint(itemSearchList.get(item).getName());
}
@Override
public void onFinish() {
}
}
@Override
public void onDestroy() {
super.onDestroy();
if (myCountDownTimer != null) {
myCountDownTimer.cancel();
myCountDownTimer = null;
}
}
}

View File

@ -1,6 +1,5 @@
package com.viontv.app.ui.activity.home;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
@ -21,17 +20,16 @@ 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.VTVideoListBean;
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.ui.adapter.VTBannerHomeAdapter;
import com.viontv.app.ui.adapter.VTHotBottomListAdapter;
import com.viontv.app.ui.adapter.VTNineSquareAdapter;
import com.viontv.app.utils.IntentUtils;
import com.youth.banner.listener.OnBannerListener;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.android.schedulers.AndroidSchedulers;
@ -45,7 +43,7 @@ public class VTHotFragment extends Fragment {
private int currentPage = 1;
HotBottomListAdapter adapter;
VTHotBottomListAdapter adapter;
LinearLayoutManager layoutManager;
public static VTHotFragment newInstance() {
@ -70,24 +68,39 @@ public class VTHotFragment extends Fragment {
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
initRefreshLayout();
initShow();
}
private void initRefreshLayout() {
binding.smartrefreshlayoutHot.setEnableRefresh(true);
binding.smartrefreshlayoutHot.setEnableLoadMore(true);
binding.smartrefreshlayoutHot.setOnRefreshListener(refreshlayout -> {
currentPage = 1;
getBottomData();
});
binding.smartrefreshlayoutHot.setOnLoadMoreListener(refreshLayout -> {
currentPage++;
getBottomData();
});
}
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);
}
});
// 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() {
@ -116,40 +129,40 @@ public class VTHotFragment extends Fragment {
public void initHomeBottom() {
layoutManager = new LinearLayoutManager(getActivity());
binding.recyclerviewGenres.setLayoutManager(layoutManager);
adapter = new HotBottomListAdapter(getActivity(), ItemHomeExploreVtBinding.class);
adapter = new VTHotBottomListAdapter(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) {
// 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();
// }
}
}
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
}
});
//// 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();
}
@ -158,10 +171,12 @@ public class VTHotFragment extends Fragment {
VTApi.getInstance().newShortPlay(currentPage, 10)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new VTBaseObserver<VTResult<HomeBottomListBean>>() {
.subscribe(new VTBaseObserver<VTResult<VTVideoListBean>>() {
@Override
public void onSuccess(VTResult<HomeBottomListBean> feedbackResp) {
public void onSuccess(VTResult<VTVideoListBean> feedbackResp) {
binding.smartrefreshlayoutHot.finishRefresh();
binding.smartrefreshlayoutHot.finishLoadMore();
if (currentPage == 1) {
adapter.addDataList(feedbackResp.data.getShort_play_list(), true);
} else {
@ -173,7 +188,8 @@ public class VTHotFragment extends Fragment {
@Override
public void onError(int code, String msg) {
binding.smartrefreshlayoutHot.finishRefresh();
binding.smartrefreshlayoutHot.finishLoadMore();
}
});
}
@ -181,7 +197,7 @@ public class VTHotFragment extends Fragment {
public void initBanner(List<ItemBean> itemBeans) {
binding.banner.setAdapter(new BannerHomeAdapter(itemBeans)).
binding.banner.setAdapter(new VTBannerHomeAdapter(itemBeans)).
setCurrentItem(0, true)
.addBannerLifecycleObserver(this)
.setOnBannerListener((data, position) -> IntentUtils.startPlayerDetails(getActivity(), itemBeans.get(position).getShort_play_id(), 0))
@ -199,7 +215,7 @@ public class VTHotFragment extends Fragment {
binding.trendingTv.setText(homeNineSquareBean.getTitle());
binding.recyclerviewTrending.setLayoutManager(new GridLayoutManager(getActivity(), 3));
NineSquareAdapter adapter = new NineSquareAdapter(getActivity(), ItemHotSquareVtBinding.class);
VTNineSquareAdapter adapter = new VTNineSquareAdapter(getActivity(), ItemHotSquareVtBinding.class);
adapter.setItemClickListener((data, holder) -> {
IntentUtils.startPlayerDetails(getActivity(), data.getShort_play_id(), 0);
});

View File

@ -18,20 +18,12 @@ 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.VTVideoListBean;
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.ui.adapter.VTBannerHomeAdapter;
import com.viontv.app.ui.adapter.VTTabItemListAdapter;
import com.viontv.app.utils.IntentUtils;
import java.util.List;
@ -47,7 +39,7 @@ public class VTTabItemFragment extends Fragment {
private int currentPage = 1;
TabItemListAdapter adapter;
VTTabItemListAdapter adapter;
LinearLayoutManager layoutManager;
private int categoryId;
@ -101,7 +93,7 @@ public class VTTabItemFragment extends Fragment {
}
public void initBannerData() {
VTApi.getInstance().getTabItemBanner(String.valueOf(categoryId))
VTApi.getInstance().getTabItemBanner(categoryId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new VTBaseObserver<VTResult<TabItemBean>>() {
@ -126,7 +118,7 @@ public class VTTabItemFragment extends Fragment {
public void initGridList() {
layoutManager = new GridLayoutManager(getActivity(), 2);
binding.recyclerviewGrid.setLayoutManager(layoutManager);
adapter = new TabItemListAdapter(getActivity(), ItemHomeTablistVtBinding.class);
adapter = new VTTabItemListAdapter(getActivity(), ItemHomeTablistVtBinding.class);
adapter.setItemClickListener((data, holder) -> {
IntentUtils.startPlayerDetails(getActivity(), data.getShort_play_id(), 0);
});
@ -165,13 +157,13 @@ public class VTTabItemFragment extends Fragment {
}
public void getBottomData() {
VTApi.getInstance().getVideoList(String.valueOf(categoryId), currentPage, 10, "")
VTApi.getInstance().getVideoList(categoryId, currentPage, 10, "")
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new VTBaseObserver<VTResult<HomeBottomListBean>>() {
.subscribe(new VTBaseObserver<VTResult<VTVideoListBean>>() {
@Override
public void onSuccess(VTResult<HomeBottomListBean> feedbackResp) {
public void onSuccess(VTResult<VTVideoListBean> feedbackResp) {
if (currentPage == 1) {
adapter.addDataList(feedbackResp.data.getList(), true);
} else {
@ -191,7 +183,7 @@ public class VTTabItemFragment extends Fragment {
public void initBanner(List<ItemBean> itemBeans) {
binding.banner.setAdapter(new BannerHomeAdapter(itemBeans)).
binding.banner.setAdapter(new VTBannerHomeAdapter(itemBeans)).
setCurrentItem(0, true)
.addBannerLifecycleObserver(this)
.setOnBannerListener((data, position) -> IntentUtils.startPlayerDetails(getActivity(), itemBeans.get(position).getShort_play_id(), 0))

View File

@ -18,9 +18,9 @@ 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.model.VTVideoListBean;
import com.viontv.app.ui.adapter.Top10ListAdapter;
import com.viontv.app.ui.adapter.VTTop10ListAdapter;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
@ -32,7 +32,7 @@ public class VTTopFragment extends Fragment {
private FragmentTopVtBinding binding;
Top10ListAdapter adapter;
VTTop10ListAdapter adapter;
LinearLayoutManager layoutManager;
public static VTTopFragment newInstance() {
@ -65,7 +65,7 @@ public class VTTopFragment extends Fragment {
binding.rvFragmentHometop.setLayoutManager(layoutManager);
layoutManager = new LinearLayoutManager(getActivity());
binding.rvFragmentHometop.setLayoutManager(layoutManager);
adapter = new Top10ListAdapter(getActivity(), ItemHomeExploreVtBinding.class);
adapter = new VTTop10ListAdapter(getActivity(), ItemHomeExploreVtBinding.class);
binding.rvFragmentHometop.setAdapter(adapter);
getTop10Data();
}
@ -74,10 +74,10 @@ public class VTTopFragment extends Fragment {
VTApi.getInstance().homeTop10(VTApiService.rankTop10Type)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new VTBaseObserver<VTResult<HomeBottomListBean>>() {
.subscribe(new VTBaseObserver<VTResult<VTVideoListBean>>() {
@Override
public void onSuccess(VTResult<HomeBottomListBean> feedbackResp) {
public void onSuccess(VTResult<VTVideoListBean> feedbackResp) {
adapter.addDataList(feedbackResp.data.getList(), true);
}

View File

@ -1,5 +1,6 @@
package com.viontv.app.ui.activity.me;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@ -9,15 +10,42 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.bumptech.glide.Glide;
import com.viontv.app.R;
import com.viontv.app.api.VTApiService;
import com.viontv.app.databinding.FragmentMainVtBinding;
import com.viontv.app.databinding.FragmentMeBinding;
import com.viontv.app.databinding.ItemHomeExploreVtBinding;
import com.viontv.app.databinding.ItemVideoHistoryBinding;
import com.viontv.app.model.ItemBean;
import com.viontv.app.ui.activity.WebViewActivity;
import com.viontv.app.ui.activity.home.MainViewModel;
import com.viontv.app.ui.adapter.VTCommonAdapter;
import com.viontv.app.ui.adapter.VTGooglePlayerExploreAdapter;
import com.viontv.app.ui.adapter.VTTop10ListAdapter;
import com.viontv.app.ui.adapter.VTUserVideoHistoryAdapter;
import com.viontv.app.utils.IntentUtils;
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.Objects;
public class VTMeFragment extends Fragment {
private MainViewModel mViewModel;
private FragmentMainVtBinding binding;
private VTUserViewModel mViewModel;
private FragmentMeBinding binding;
private int currentPage = 1;
private VTUserVideoHistoryAdapter adapter;
public static VTMeFragment newInstance() {
return new VTMeFragment();
@ -26,7 +54,7 @@ public class VTMeFragment extends Fragment {
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mViewModel = new ViewModelProvider(this).get(MainViewModel.class);
mViewModel = new ViewModelProvider(this).get(VTUserViewModel.class);
// TODO: Use the ViewModel
}
@ -34,8 +62,67 @@ public class VTMeFragment extends Fragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
binding = FragmentMainVtBinding.inflate(inflater);
binding = FragmentMeBinding.inflate(inflater);
EventBus.getDefault().register(this);
return binding.getRoot();
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mViewModel.getUserInfo();
mViewModel.getHistory(currentPage, 10);
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
binding.recyclerviewHistory.setLayoutManager(layoutManager);
adapter = new VTUserVideoHistoryAdapter(getActivity(), ItemVideoHistoryBinding.class);
adapter.setItemClickListener((data, holder) -> {
IntentUtils.startPlayerDetails(getActivity(), data.getShort_play_id(), 0);
});
binding.recyclerviewHistory.setAdapter(adapter);
binding.tvPrivatePolicy.setOnClickListener(v -> startWebActivity(VTApiService.ZyreoTV_Private, getResources().getString(R.string.tabme_private_policy)));
binding.tvUserAgreement.setOnClickListener(v -> startWebActivity(VTApiService.ZyreoTV_USERAgreement, getResources().getString(R.string.tabme_user_agreement)));
logic();
}
private void startWebActivity(String url, String title) {
startActivity(new Intent(getActivity(), WebViewActivity.class).putExtra(VTAppConstants.Constants_Page_WebUrl, url).putExtra(VTAppConstants.Constants_Page_WebTitle, title));
}
public void logic() {
mViewModel.getGetUserInfoLiveData().observe(getViewLifecycleOwner(), data -> {
if (data != null) {
binding.tvMeName.setText(data.data.getFamily_name());
binding.tvMeId.setText("ID:" + data.data.getId());
Glide.with(requireActivity()).load(data.data.getAvator()).error(R.mipmap.ic_default_head).into(binding.ivHead);
}
});
mViewModel.getUserVideoHistoryLiveData().observe(getViewLifecycleOwner(), vtVideoListBeanVTResult -> {
if (vtVideoListBeanVTResult != null && !vtVideoListBeanVTResult.data.getList().isEmpty()) {
if (currentPage == 1) {
adapter.addDataList(vtVideoListBeanVTResult.data.getList(), true);
} else {
adapter.addDataList(vtVideoListBeanVTResult.data.getList(), false);
}
}
});
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(String event) {
if (VTAppConstants.Constants_PlayerView_CreateHistoryEvent.equals(event)) {
currentPage = 1;
mViewModel.getHistory(1, 10);
}
}
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
}

View File

@ -0,0 +1,75 @@
package com.viontv.app.ui.activity.me;
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.VTUserInfoBean;
import com.viontv.app.model.VTVideoDetailsBean;
import com.viontv.app.model.VTVideoListBean;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/**
* 关于用户的接口
*/
public class VTUserViewModel extends ViewModel {
private final MutableLiveData<VTResult<VTUserInfoBean>> userInfoLiveData = new MutableLiveData<>();
private final MutableLiveData<VTResult<VTVideoListBean>> userVideoHistoryLiveData = new MutableLiveData<>();
public MutableLiveData<VTResult<VTUserInfoBean>> getGetUserInfoLiveData() {
return userInfoLiveData;
}
public MutableLiveData<VTResult<VTVideoListBean>> getUserVideoHistoryLiveData() {
return userVideoHistoryLiveData;
}
public void getUserInfo() {
VTApi.getInstance().getUserInfo()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new VTBaseObserver<VTResult<VTUserInfoBean>>() {
@Override
public void onSuccess(VTResult<VTUserInfoBean> feedbackResp) {
userInfoLiveData.setValue(feedbackResp);
}
@Override
public void onError(int code, String msg) {
Log.i("tag===", msg + "");
userInfoLiveData.setValue(null);
}
});
}
public void getHistory(int currentPage, int pageSize) {
VTApi.getInstance().getVideoHistoryList(currentPage, pageSize)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new VTBaseObserver<VTResult<VTVideoListBean>>() {
@Override
public void onSuccess(VTResult<VTVideoListBean> feedbackResp) {
userVideoHistoryLiveData.setValue(feedbackResp);
}
@Override
public void onError(int code, String msg) {
Log.i("tag===", msg + "");
userVideoHistoryLiveData.setValue(null);
}
});
}
}

View File

@ -55,17 +55,17 @@ public class VTEpisodesSelectDialogFragment extends DialogFragment {
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;
}
}
// 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();
});

View File

@ -15,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.widget.ViewPager2;
import com.viontv.app.R;
import com.viontv.app.VTApplication;
import com.viontv.app.api.VTResult;
import com.viontv.app.databinding.ActivityVideoDetailsVtBinding;
import com.viontv.app.model.VTVideoDetailsBean;
@ -50,6 +51,7 @@ public class VTVideoPlayerActivity extends VTCommonActivity<ActivityVideoDetails
public void init() {
vtViewModel = new ViewModelProvider(this).get(VTVideoViewModel.class);
EventBus.getDefault().register(this);
getWindow().setNavigationBarColor(getResources().getColor(android.R.color.black));
viewBinding = ActivityVideoDetailsVtBinding.inflate(getLayoutInflater());
setContentView(viewBinding.getRoot());
episodeDetailId = getIntent().getIntExtra(VTAppConstants.Constants_Page_DetailId, 0);
@ -60,7 +62,7 @@ public class VTVideoPlayerActivity extends VTCommonActivity<ActivityVideoDetails
public void initView() {
viewBinding.avi.smoothToShow();
vtViewModel.getVideoDetails(episodeDetailId, episodevideo_id);
viewBinding.viewPagerHibitEpisode.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
viewBinding.viewPagerVtEpisode.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@SuppressLint("NotifyDataSetChanged")
@Override
public void onPageSelected(int position) {
@ -164,15 +166,16 @@ public class VTVideoPlayerActivity extends VTCommonActivity<ActivityVideoDetails
// } 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()
// );
// }
// }
if (vtGooglePlayerAdapter.getItems().get(position) != null) {
vtViewModel.createHistory(
vtGooglePlayerAdapter.getItems().get(position).getShort_play_id(),
vtGooglePlayerAdapter.getItems().get(position).getId()
);
EventBus.getDefault().post(VTAppConstants.Constants_PlayerView_CreateHistoryEvent);
}
}
}
// }
});
}
@ -187,10 +190,10 @@ public class VTVideoPlayerActivity extends VTCommonActivity<ActivityVideoDetails
vtGooglePlayerAdapter.setShortVideoInfo(it.data.shortPlayInfo);
vtGooglePlayerAdapter.setPlayerDetailCollection(VTVideoPlayerActivity.this);
shortVideoInfo = it.data.shortPlayInfo;
viewBinding.viewPagerHibitEpisode.setAdapter(vtGooglePlayerAdapter);
viewBinding.viewPagerVtEpisode.setAdapter(vtGooglePlayerAdapter);
vtGooglePlayerAdapter.submitList(it.data.episodeList);
if (it.data.video_info.getEpisode() > 1) {
viewBinding.viewPagerHibitEpisode.setCurrentItem(it.data.video_info.getEpisode() - 1, false);
viewBinding.viewPagerVtEpisode.setCurrentItem(it.data.video_info.getEpisode() - 1, false);
}
}
} else {
@ -260,63 +263,64 @@ public class VTVideoPlayerActivity extends VTCommonActivity<ActivityVideoDetails
// 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);
// }
// }
// });
vtViewModel.getCollectionLiveData().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.getCollectioncancelLiveData().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()));
}
EventBus.getDefault().post(new VTBaseEventBus<>(VTAppConstants.Constants_Episodes_Series_DataExample, shortVideoInfo));
} 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);
RecyclerView recyclerView = (RecyclerView) viewBinding.viewPagerVtEpisode.getChildAt(0);
VTGoogleExoPlayerView googleExoPlayerView = (VTGoogleExoPlayerView) recyclerView.getLayoutManager().findViewByPosition(currentPosition);
return googleExoPlayerView;
}
@ -328,7 +332,6 @@ public class VTVideoPlayerActivity extends VTCommonActivity<ActivityVideoDetails
if (shortVideoInfo == null) {
return;
}
VTEpisodesSelectDialogFragment hibitEpisodesSeriesDialogFragment = new VTEpisodesSelectDialogFragment();
Bundle bundle = new Bundle();
bundle.putInt(VTAppConstants.Constants_Page_Episodes_Series_Data_currentPosition, currentPosition);
@ -344,7 +347,7 @@ public class VTVideoPlayerActivity extends VTCommonActivity<ActivityVideoDetails
}
if (VTAppConstants.Constants_Google_PLAYER_STATUS_FINISH_DETAIL == event) {
if (vtGooglePlayerAdapter != null && vtGooglePlayerAdapter.getCurrentEpisodePlayingPosition()>=0 ) {
if (vtGooglePlayerAdapter != null && vtGooglePlayerAdapter.getCurrentEpisodePlayingPosition() >= 0) {
int nextPosition = vtGooglePlayerAdapter.getCurrentEpisodePlayingPosition() + 1;
vtGooglePlayerAdapter.getItems();
if (nextPosition < vtGooglePlayerAdapter.getItems().size()) {
@ -354,7 +357,7 @@ public class VTVideoPlayerActivity extends VTCommonActivity<ActivityVideoDetails
if (pageGoogleExoPlayerView() != null) {
pageGoogleExoPlayerView().stop();
}
viewBinding.viewPagerHibitEpisode.setCurrentItem(nextPosition);
viewBinding.viewPagerVtEpisode.setCurrentItem(nextPosition);
}
}
@ -368,13 +371,21 @@ public class VTVideoPlayerActivity extends VTCommonActivity<ActivityVideoDetails
}
@Override
public void onPause() {
super.onPause();
VTApplication.isCurrentPage = false;
if (pageGoogleExoPlayerView() != null) pageGoogleExoPlayerView().suspendPlayer();
}
@Override
protected void onDestroy() {
VTAppConstants.isCanPlay = false;
if(pageGoogleExoPlayerView()!=null) pageGoogleExoPlayerView().stop();
if(pageGoogleExoPlayerView()!=null) pageGoogleExoPlayerView().release();
if (pageGoogleExoPlayerView() != null) pageGoogleExoPlayerView().stop();
if (pageGoogleExoPlayerView() != null) pageGoogleExoPlayerView().release();
super.onDestroy();
EventBus.getDefault().unregister(this);
}
@ -388,7 +399,9 @@ public class VTVideoPlayerActivity extends VTCommonActivity<ActivityVideoDetails
public void run() {
if (shortVideoInfo != null) {
if (shortVideoInfo.isIs_collect()) {
vtViewModel.cancelcollection(shortVideoInfo.getShort_id());
} else {
vtViewModel.collection(shortVideoInfo.getShort_play_id(), episode.getId());
}
}
}
@ -402,7 +415,7 @@ public class VTVideoPlayerActivity extends VTCommonActivity<ActivityVideoDetails
if (pageGoogleExoPlayerView() != null) {
pageGoogleExoPlayerView().stop();
}
viewBinding.viewPagerHibitEpisode.setCurrentItem(bean.getEpisode() - 1);
viewBinding.viewPagerVtEpisode.setCurrentItem(bean.getEpisode() - 1);
}
}

View File

@ -23,6 +23,17 @@ public class VTVideoViewModel extends ViewModel {
return getVideoDetailsLiveData;
}
private final MutableLiveData<VTResult> collectioncancelLiveData = new MutableLiveData<>();
private final MutableLiveData<VTResult> collectionLiveData = new MutableLiveData<>();
public MutableLiveData<VTResult> getCollectionLiveData() {
return collectionLiveData;
}
public MutableLiveData<VTResult> getCollectioncancelLiveData() {
return collectioncancelLiveData;
}
public void getVideoDetails(int short_play_id, int video_id) {
VTApi.getInstance().getVideoDetails(short_play_id, video_id)
.subscribeOn(Schedulers.io())
@ -41,5 +52,58 @@ public class VTVideoViewModel extends ViewModel {
});
}
public void createHistory(int short_play_id,int video_id){
VTApi.getInstance().createVideoHistory(short_play_id, video_id)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new VTBaseObserver<>() {
@Override
public void onSuccess(VTResult feedbackResp) {
}
@Override
public void onError(int code, String msg) {
}
});
}
public void collection(int shortplayId, int videoId) {
VTApi.getInstance().collect(shortplayId, videoId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new VTBaseObserver<VTResult>() {
@Override
public void onSuccess(VTResult feedbackResp) {
collectionLiveData.setValue(feedbackResp);
}
@Override
public void onError(int code, String msg) {
Log.i("tag===", msg + "");
collectionLiveData.setValue(null);
}
});
}
public void cancelcollection(int shortplayId) {
VTApi.getInstance().cancelCollect(shortplayId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new VTBaseObserver<VTResult>() {
@Override
public void onSuccess(VTResult feedbackResp) {
collectioncancelLiveData.setValue(feedbackResp);
}
@Override
public void onError(int code, String msg) {
Log.i("tag===", msg + "");
collectioncancelLiveData.setValue(null);
}
});
}
}

View File

@ -0,0 +1,178 @@
package com.viontv.app.ui.activity.search;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.inputmethod.EditorInfo;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.google.gson.reflect.TypeToken;
import com.viontv.app.databinding.ActivitySearchVtBinding;
import com.viontv.app.databinding.ItemSearchDataVtBinding;
import com.viontv.app.databinding.ItemSearchHotVtBinding;
import com.viontv.app.ui.activity.basic.VTCommonActivity;
import com.viontv.app.ui.adapter.VTSearchDataAdapter;
import com.viontv.app.ui.adapter.VTSearchHistoryAdapter;
import com.viontv.app.ui.adapter.VTSearchHotListAdapter;
import com.viontv.app.utils.IntentUtils;
import com.viontv.app.utils.SharePreferenceUtils;
import com.viontv.app.utils.VTAppConstants;
import com.viontv.app.utils.VTGsonUtils;
import java.util.ArrayList;
public class VTSearchActivity extends VTCommonActivity<ActivitySearchVtBinding> {
ActivitySearchVtBinding binding;
VTSearchViewModel vtSearchViewModel;
VTSearchHotListAdapter adapter;
VTSearchHistoryAdapter historyAdapter;
VTSearchDataAdapter searchDataAdapter;
@Override
public void init() {
vtSearchViewModel = new ViewModelProvider(this).get(VTSearchViewModel.class);
getWindow().setNavigationBarColor(getResources().getColor(android.R.color.black));
binding = ActivitySearchVtBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
}
@Override
public void initView() {
binding.rvVtSearchHot.setLayoutManager(new LinearLayoutManager(this));
adapter = new VTSearchHotListAdapter(this, ItemSearchHotVtBinding.class);
adapter.setItemClickListener((data, holder) -> {
IntentUtils.startPlayerDetails(this, data.getShort_play_id(), 0);
});
binding.rvVtSearchHot.setAdapter(adapter);
vtSearchViewModel.getHotList();
binding.ivBackSearch.setOnClickListener(v -> finish());
StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager(4, StaggeredGridLayoutManager.VERTICAL);
binding.rvVtSearchHistory.setLayoutManager(staggeredGridLayoutManager);
historyAdapter = new VTSearchHistoryAdapter();
binding.rvVtSearchHistory.setAdapter(historyAdapter);
historyAdapter.setOnItemClickListener((baseQuickAdapter, view, i) -> {
String name = historyAdapter.getItem(i);
binding.editHomeSearch.setText(name);
vtSearchViewModel.getSearchList(historyAdapter.getItem(i));
});
getHistoryData();
binding.ivSearchHistoryDelete.setOnClickListener(v -> {
binding.editHomeSearch.setText("");
SharePreferenceUtils.saveString(VTAppConstants.SEARCH_HISTORY, VTGsonUtils.beanToJSONString(new ArrayList<String>()));
getHistoryData();
});
binding.rvVtSearchData.setLayoutManager(new LinearLayoutManager(this));
searchDataAdapter = new VTSearchDataAdapter(this, ItemSearchDataVtBinding.class);
searchDataAdapter.setItemClickListener((data, holder) -> {
vtSearchViewModel.setSearchClick(data.getShort_play_id());
IntentUtils.startPlayerDetails(VTSearchActivity.this, data.getShort_play_id(), 0);
});
binding.rvVtSearchData.setAdapter(searchDataAdapter);
binding.editHomeSearch.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if (TextUtils.isEmpty(s.toString())) {
getHistoryData();
searchDataAdapter.addDataList(null, true);
binding.layoutSearchHot.setVisibility(VISIBLE);
binding.layoutSearchHistory.setVisibility(VISIBLE);
binding.layoutSearchData.setVisibility(GONE);
hideKeyBord(binding.editHomeSearch, VTSearchActivity.this);
}
}
});
binding.editHomeSearch.setOnEditorActionListener((v, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
vtSearchViewModel.getSearchList(binding.editHomeSearch.getText().toString());
hideKeyBord(binding.editHomeSearch, this);
saveSearchHistory(binding.editHomeSearch.getText().toString());
}
return false;
});
}
@Override
public void logic() {
vtSearchViewModel.getSearchHostList().observe(this, homeBottomListBeanVTResult -> {
if (homeBottomListBeanVTResult != null && homeBottomListBeanVTResult.data != null) {
adapter.addDataList(homeBottomListBeanVTResult.data.getList(), true);
binding.rvVtSearchHot.setVisibility(VISIBLE);
binding.rvVtSearchData.setVisibility(GONE);
}
});
vtSearchViewModel.searchDataList().observe(this, homeBottomListBeanVTResult -> {
binding.layoutSearchData.setVisibility(VISIBLE);
if (homeBottomListBeanVTResult != null && !homeBottomListBeanVTResult.data.getList().isEmpty()) {
searchDataAdapter.addDataList(homeBottomListBeanVTResult.data.getList(), true);
binding.rvVtSearchData.setVisibility(VISIBLE);
binding.layoutSearchEmpty.setVisibility(GONE);
} else {
binding.rvVtSearchData.setVisibility(GONE);
binding.layoutSearchEmpty.setVisibility(VISIBLE);
}
binding.layoutSearchHot.setVisibility(GONE);
binding.layoutSearchHistory.setVisibility(GONE);
});
}
public void getHistoryData() {
String historyList = SharePreferenceUtils.getString(VTAppConstants.SEARCH_HISTORY, "");
ArrayList<String> arrayListHistory = VTGsonUtils.getListFromJSON(historyList, new TypeToken<ArrayList<String>>() {
}.getType());
if (arrayListHistory != null && !arrayListHistory.isEmpty()) {
binding.layoutSearchHistory.setVisibility(VISIBLE);
historyAdapter.submitList(arrayListHistory);
historyAdapter.notifyDataSetChanged();
} else {
binding.layoutSearchHistory.setVisibility(GONE);
}
}
public void saveSearchHistory(String content) {
String historyList = SharePreferenceUtils.getString(VTAppConstants.SEARCH_HISTORY, "");
ArrayList<String> arrayListHistory = VTGsonUtils.getListFromJSON(historyList, new TypeToken<ArrayList<String>>() {
}.getType());
if (arrayListHistory != null && !arrayListHistory.isEmpty()) {
for (String history : arrayListHistory) {
if (content.trim().equals(history)) {
break;
}
arrayListHistory.add(content);
}
} else {
arrayListHistory = new ArrayList<>();
arrayListHistory.add(content);
}
SharePreferenceUtils.saveString(VTAppConstants.SEARCH_HISTORY, VTGsonUtils.beanToJSONString(arrayListHistory));
}
}

View File

@ -0,0 +1,90 @@
package com.viontv.app.ui.activity.search;
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.VTVideoListBean;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
public class VTSearchViewModel extends ViewModel {
private final MutableLiveData<VTResult<VTVideoListBean>> searchHotListLiveData = new MutableLiveData<>();
private final MutableLiveData<VTResult<VTVideoListBean>> searchDataListLiveData = new MutableLiveData<>();
public MutableLiveData<VTResult<VTVideoListBean>> getSearchHostList() {
return searchHotListLiveData;
}
public MutableLiveData<VTResult<VTVideoListBean>> searchDataList() {
return searchDataListLiveData;
}
public void getHotList() {
VTApi.getInstance().getSearchHotList()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new VTBaseObserver<VTResult<VTVideoListBean>>() {
@Override
public void onSuccess(VTResult<VTVideoListBean> feedbackResp) {
searchHotListLiveData.setValue(feedbackResp);
}
@Override
public void onError(int code, String msg) {
Log.i("tag===", msg + "");
searchHotListLiveData.setValue(null);
}
});
}
public void getSearchList(String content) {
VTApi.getInstance().getSearchContentList(content)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new VTBaseObserver<VTResult<VTVideoListBean>>() {
@Override
public void onSuccess(VTResult<VTVideoListBean> feedbackResp) {
searchDataListLiveData.setValue(feedbackResp);
}
@Override
public void onError(int code, String msg) {
Log.i("tag===", msg + "");
searchDataListLiveData.setValue(null);
}
});
}
public void setSearchClick(int shorplayId) {
VTApi.getInstance().searchClick(shorplayId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new VTBaseObserver<VTResult>() {
@Override
public void onSuccess(VTResult feedbackResp) {
}
@Override
public void onError(int code, String msg) {
Log.i("tag===", msg + "");
}
});
}
}

View File

@ -1,28 +1,23 @@
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<ItemBean, BannerHomeAdapter.BannerHomeViewHolder> {
public class VTBannerHomeAdapter extends BannerAdapter<ItemBean, VTBannerHomeAdapter.BannerHomeViewHolder> {
public BannerHomeAdapter(List<ItemBean> mData) {
public VTBannerHomeAdapter(List<ItemBean> mData) {
super(mData);
}
@ -40,7 +35,11 @@ public class BannerHomeAdapter extends BannerAdapter<ItemBean, BannerHomeAdapter
@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);
String imageUrl = data.getHorizontally_img();
if(!imageUrl.endsWith(".jpg")){
imageUrl = data.getImage_url();
}
Glide.with(holder.itemView.getContext()).load(imageUrl).apply(RequestOptions.bitmapTransform(new RoundedCorners(30))).into(holder.imageView);
}

View File

@ -20,8 +20,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class CommonAdapter<T, R extends ViewBinding>
extends RecyclerView.Adapter<CommonAdapter.ItemViewHolder<R>> {
public class VTCommonAdapter<T, R extends ViewBinding>
extends RecyclerView.Adapter<VTCommonAdapter.ItemViewHolder<R>> {
private static final String TAG = "QChatCommonAdapter";
private static final String NAME_METHOD_INFLATE = "inflate";
protected final List<T> dataSource = new ArrayList<>();
@ -29,7 +29,7 @@ public class CommonAdapter<T, R extends ViewBinding>
protected OnClickListener<T, R> clickListener;
protected Method inflateMethod;
public CommonAdapter(Context context, Class<R> viewBinding) {
public VTCommonAdapter(Context context, Class<R> viewBinding) {
this.context = context;
try {
inflateMethod =

View File

@ -31,7 +31,7 @@ public class VTEpisodesSeriesAdapter extends BaseQuickAdapter<VTVideoDetailsBean
episodeBg.setBackground(holder.itemView.getContext().getDrawable(R.drawable.bg_vt_episodes));
}
holder.setVisible(R.id.iv_lock_show, item != null && item.isIs_lock());
// holder.setVisible(R.id.iv_lock_show, item != null && item.isIs_lock());
}
@Override

View File

@ -14,20 +14,20 @@ 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();
public class VTFragmentAdapter extends FragmentStateAdapter {
private static final String TAG = VTFragmentAdapter.class.getSimpleName();
private List<Fragment> fragmentList;
public FragmentAdapter(@NonNull FragmentActivity fragmentActivity) {
public VTFragmentAdapter(@NonNull FragmentActivity fragmentActivity) {
super(fragmentActivity);
}
public FragmentAdapter(@NonNull Fragment fragment) {
public VTFragmentAdapter(@NonNull Fragment fragment) {
super(fragment);
}
public FragmentAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle) {
public VTFragmentAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle) {
super(fragmentManager, lifecycle);
}

View File

@ -0,0 +1,78 @@
// 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.model.VTVideoDetailsBean;
import com.viontv.app.model.VTVideoExploreBean;
import com.viontv.app.model.VTVideoExploreListBean;
import com.viontv.app.ui.view.VTGoogleExoPlayerView;
import com.viontv.app.ui.view.VTHomeGoogleExoPlayerView;
public class VTGooglePlayerExploreAdapter
extends BaseQuickAdapter<VTVideoExploreBean, QuickViewHolder> {
public interface PlayerDetailCollection {
void collection(VTVideoExploreBean videoExploreBean);
}
public PlayerDetailCollection playerDetailCollection;
public void setPlayerDetailCollection(PlayerDetailCollection playerDetailCollection) {
this.playerDetailCollection = playerDetailCollection;
}
public int currentEpisodePlayingPosition = 0;
public int getCurrentEpisodePlayingPosition() {
return currentEpisodePlayingPosition;
}
public void setCurrentEpisodePlayingPosition(int currentEpisodePlayingPosition) {
this.currentEpisodePlayingPosition = currentEpisodePlayingPosition;
}
@NonNull
@Override
protected QuickViewHolder onCreateViewHolder(@NonNull Context context, @NonNull ViewGroup viewGroup, int i) {
return new QuickViewHolder(R.layout.item_google_home_player_vt,viewGroup);
}
@Override
protected void onBindViewHolder(@NonNull QuickViewHolder holder, int position, @Nullable VTVideoExploreBean bean) {
VTHomeGoogleExoPlayerView exampleDetailPlayerView = (VTHomeGoogleExoPlayerView) holder.getView(R.id.page_google_home_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(bean);
}
});
if (position == currentEpisodePlayingPosition) {
exampleDetailPlayerView.setMedia(bean);
} else {
exampleDetailPlayerView.stop();
}
}
}

View File

@ -11,16 +11,15 @@ 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<ItemBean, ItemHomeExploreVtBinding> {
public class VTHotBottomListAdapter
extends VTCommonAdapter<ItemBean, ItemHomeExploreVtBinding> {
private Context mcontext;
public HotBottomListAdapter(
public VTHotBottomListAdapter(
Context context, Class<ItemHomeExploreVtBinding> viewBinding) {
super(context, viewBinding);
this.mcontext = context;

View File

@ -5,22 +5,20 @@
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<ItemBean, ItemHotSquareVtBinding> {
public class VTNineSquareAdapter
extends VTCommonAdapter<ItemBean, ItemHotSquareVtBinding> {
private Context mcontext;
public NineSquareAdapter(
public VTNineSquareAdapter(
Context context, Class<ItemHotSquareVtBinding> viewBinding) {
super(context, viewBinding);
this.mcontext = context;

View File

@ -0,0 +1,78 @@
// 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.ItemSearchDataVtBinding;
import com.viontv.app.model.ItemBean;
public class VTSearchDataAdapter
extends VTCommonAdapter<ItemBean, ItemSearchDataVtBinding> {
private Context mcontext;
private String msearchText;
public String getMsearchText() {
return msearchText;
}
public void setMsearchText(String msearchText) {
this.msearchText = msearchText;
}
public VTSearchDataAdapter(
Context context, Class<ItemSearchDataVtBinding> viewBinding) {
super(context, viewBinding);
this.mcontext = context;
}
@Override
public void onBindViewHolder(
ItemSearchDataVtBinding 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.ivSearchDataItem);
binding.tvSearchDatatitleItem.setText(data.getName());
binding.tvSearchDatadescItem.setText(data.getDescription());
binding.tvSearchDatacategoryItem1.setVisibility(View.GONE);
binding.tvSearchDatacategoryItem1.setVisibility(View.GONE);
if (data.getCategoryList() != null && !data.getCategoryList().isEmpty()) {
binding.tvSearchDatacategoryItem1.setVisibility(View.VISIBLE);
binding.tvSearchDatacategoryItem1.setText(data.getCategoryList().get(0).getName());
if (data.getCategoryList().size() >= 2) {
binding.tvSearchDatacategoryItem2.setVisibility(View.VISIBLE);
binding.tvSearchDatacategoryItem2.setText(data.getCategoryList().get(1).getName());
}
}
}
}
}

View File

@ -0,0 +1,23 @@
package com.viontv.app.ui.adapter;
import com.chad.library.adapter4.BaseQuickAdapter;
import android.content.Context;
import android.view.ViewGroup;
import com.chad.library.adapter4.viewholder.QuickViewHolder;
import com.viontv.app.R;
public class VTSearchHistoryAdapter extends BaseQuickAdapter<String, QuickViewHolder> {
@Override
protected void onBindViewHolder(QuickViewHolder holder, int position, String item) {
holder.setText(R.id.tv_item_vt_search_history, item);
}
@Override
public QuickViewHolder onCreateViewHolder(Context context, ViewGroup parent, int viewType) {
return new QuickViewHolder(R.layout.item_search_history_vt, parent);
}
}

View File

@ -0,0 +1,75 @@
// 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.ItemSearchHotVtBinding;
import com.viontv.app.model.ItemBean;
import com.viontv.app.utils.TimeUtils;
public class VTSearchHotListAdapter
extends VTCommonAdapter<ItemBean, ItemSearchHotVtBinding> {
private Context mcontext;
public VTSearchHotListAdapter(
Context context, Class<ItemSearchHotVtBinding> viewBinding) {
super(context, viewBinding);
this.mcontext = context;
}
@Override
public void onBindViewHolder(
ItemSearchHotVtBinding 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.ivHotSearchItem);
binding.tvSearchHottitleItem.setText(data.getName());
binding.tvSearchHottotalItem.setText(TimeUtils.formatNumber(data.getWatch_total()));
binding.tvHotTopnumber.setVisibility(View.GONE);
if (bingingAdapterPosition < 10) {
binding.tvHotTopnumber.setVisibility(View.VISIBLE);
binding.tvHotTopnumber.setText(String.valueOf(bingingAdapterPosition + 1));
binding.tvHotTopnumber.setBackgroundResource(R.drawable.bg_search_hot_top4_gradient);
if(bingingAdapterPosition==0){
binding.tvHotTopnumber.setBackgroundResource(R.drawable.bg_search_hot_top1_gradient);
}
if(bingingAdapterPosition==1){
binding.tvHotTopnumber.setBackgroundResource(R.drawable.bg_search_hot_top2_gradient);
}
if(bingingAdapterPosition==2){
binding.tvHotTopnumber.setBackgroundResource(R.drawable.bg_search_hot_top3_gradient);
}
}
if (data.getCategory() != null && !data.getCategory().isEmpty()) {
binding.tvSearchHottagItem.setVisibility(View.VISIBLE);
binding.tvSearchHottagItem.setText(data.getCategory().get(0));
}
}
}
}

View File

@ -5,23 +5,20 @@
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<ItemBean, ItemHomeTablistVtBinding> {
public class VTTabItemListAdapter
extends VTCommonAdapter<ItemBean, ItemHomeTablistVtBinding> {
private Context mcontext;
public TabItemListAdapter(
public VTTabItemListAdapter(
Context context, Class<ItemHomeTablistVtBinding> viewBinding) {
super(context, viewBinding);
this.mcontext = context;
@ -35,8 +32,12 @@ public class TabItemListAdapter
int bingingAdapterPosition) {
if (data != null) {
String imageUrl = data.getHorizontally_img();
if (!imageUrl.endsWith(".jpg")) {
imageUrl = data.getImage_url();
}
Glide.with(mcontext)
.load(data.getHorizontally_img())
.load(imageUrl)
.apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.RESOURCE))
.into(binding.ivHometabItem);
binding.tvHometabTitleItem.setText(data.getName());

View File

@ -4,12 +4,9 @@
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;
@ -18,12 +15,12 @@ import com.viontv.app.model.ItemBean;
import com.viontv.app.utils.TimeUtils;
public class Top10ListAdapter
extends CommonAdapter<ItemBean, ItemHomeExploreVtBinding> {
public class VTTop10ListAdapter
extends VTCommonAdapter<ItemBean, ItemHomeExploreVtBinding> {
private Context mcontext;
public Top10ListAdapter(
public VTTop10ListAdapter(
Context context, Class<ItemHomeExploreVtBinding> viewBinding) {
super(context, viewBinding);
this.mcontext = context;

View File

@ -0,0 +1,54 @@
// 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.ItemVideoHistoryBinding;
import com.viontv.app.model.ItemBean;
import com.viontv.app.utils.TimeUtils;
public class VTUserVideoHistoryAdapter
extends VTCommonAdapter<ItemBean, ItemVideoHistoryBinding> {
private Context mcontext;
public VTUserVideoHistoryAdapter(
Context context, Class<ItemVideoHistoryBinding> viewBinding) {
super(context, viewBinding);
this.mcontext = context;
}
@Override
public void onBindViewHolder(
ItemVideoHistoryBinding 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.ivHistoryItem);
}
}
}

View File

@ -22,6 +22,7 @@ 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.TimeUtils;
import com.viontv.app.utils.ToastUtils;
import com.viontv.app.utils.TranslatesUtils;
import com.viontv.app.utils.VTAppConstants;
@ -224,8 +225,8 @@ public class VTGoogleExoPlayerView extends FrameLayout {
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()));
iv_collection_controller.setImageResource(shortVideoInfo.isIs_collect() ? R.mipmap.iv_vt_collect_h : R.mipmap.iv_vt_collect_n);
tv_collection_num_controller.setText(TimeUtils.formatNumber(shortVideoInfo.getCollect_total()));
rl_ep.setOnClickListener(v ->
EventBus.getDefault().post(VTAppConstants.Constants_PlayerView_MoreItemEvent)
);

View File

@ -0,0 +1,262 @@
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.LinearLayout;
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.cardview.widget.CardView;
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.VTApplication;
import com.viontv.app.databinding.LayoutVideoplayHomeVtBinding;
import com.viontv.app.databinding.LayoutVideoplayVtBinding;
import com.viontv.app.model.VTVideoDetailsBean;
import com.viontv.app.model.VTVideoExploreBean;
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 java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
public class VTHomeGoogleExoPlayerView 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 AppCompatTextView tv_des_player;
private AppCompatImageView ivPlayerSeries;
private AppCompatImageView ivSearch;
private AppCompatTextView tv_title_player;
private AppCompatTextView tv_collection_num_controller;
private AppCompatTextView tv_title_hibit_episode;
private ProgressLineView load_line;
private LinearLayout ll_ep;
private CardView cardPlayer;
private boolean isEpisodePlaying = false;
public VTHomeGoogleExoPlayerView(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_home_vt, this, true);
LayoutVideoplayHomeVtBinding bind = LayoutVideoplayHomeVtBinding.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_play_status);
iv_collection_controller = bind.playerView.findViewById(R.id.iv_collection_controller);
tv_collection_num_controller = bind.playerView.findViewById(R.id.tv_collection_num_controller);
tv_des_player = bind.playerView.findViewById(R.id.tv_des_player); //描述
//跳转选集
ivPlayerSeries = bind.playerView.findViewById(R.id.iv_homeplayer_video); //选集图片
tv_title_player = bind.playerView.findViewById(R.id.tv_name_episode);
load_line = bind.playerView.findViewById(R.id.load_line);
cardPlayer = bind.playerView.findViewById(R.id.cardview_homeplayer_video);
ll_ep = bind.playerView.findViewById(R.id.ll_ep);
ivSearch = bind.playerView.findViewById(R.id.iv_search_home_videoplay);
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 (VTApplication.isCurrentPage) {
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);
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);
suspend();
} 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;
}
});
}
public void start() {
player.play();
ivPagePlay.setImageResource(R.mipmap.iv_stop_vt);
isEpisodePlaying = true;
isDragging = false;
}
public void suspend() {
player.pause();
ivPagePlay.setImageResource(R.mipmap.iv_play_vt);
isEpisodePlaying = false;
isDragging = true;
}
public void seekTo(int progress) {
long duration = player.getDuration();
player.seekTo(duration * progress / 100);
}
public void setMedia(VTVideoExploreBean bean) {
VTAppConstants.isCanPlay = true;
tv_title_player.setText(bean.getName());
// if (TranslatesUtils.translates() != null) {
// tv_title_hibit_episode.setText(TranslatesUtils.replace(
// TranslatesUtils.translates().getEpisode_set(),
// String.valueOf(bean.getEpisode())
// ));
// tv_episode_name.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_name.setText("Complete set : ".concat(String.valueOf(shortVideoInfo.getEpisode_total())));
// }
tv_des_player.setText(bean.getDescription());
Glide.with(getContext()).load(bean.getImage_url()).into(ivCoverPlayerDetail);
Glide.with(getContext()).load(bean.getImage_url()).into(ivPlayerSeries);
ivCoverPlayerDetail.setVisibility(View.VISIBLE);
iv_collection_controller.setImageResource(bean.isIs_collect() ? R.mipmap.iv_vt_collect_h : R.mipmap.iv_vt_collect_n);
tv_collection_num_controller.setText(TimeUtils.formatNumber(bean.getCollect_total()));
ll_ep.setOnClickListener(v ->
EventBus.getDefault().post(VTAppConstants.Constants_PlayerView_DetialsEvent)
);
cardPlayer.setOnClickListener(v -> {
EventBus.getDefault().post(VTAppConstants.Constants_PlayerView_DetialsEvent);
});
ivSearch.setOnClickListener(v -> {
EventBus.getDefault().post(VTAppConstants.Constants_PlayerView_SearchEvent);
});
player.setMediaItem(MediaItem.fromUri(Uri.parse(bean.getVideo_info().getVideo_url())));
player.prepare();
}
public void stop() {
player.stop();
if (progressJob != null) {
progressJob.cancel(true);
progressJob = null;
}
}
public void release() {
player.release();
}
}

View File

@ -1,10 +1,12 @@
package com.viontv.app.utils;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import com.viontv.app.VTApplication;
import com.viontv.app.ui.activity.play.VTVideoPlayerActivity;
import com.viontv.app.ui.activity.search.VTSearchActivity;
public class IntentUtils {
@ -15,4 +17,9 @@ public class IntentUtils {
intent.putExtra(VTAppConstants.Constants_Page_video_id,video_id);
currentActivity.startActivity(intent);
}
public static void startSearch(Context context){
Intent intent = new Intent(context, VTSearchActivity.class);
context.startActivity(intent);
}
}

View File

@ -11,10 +11,19 @@ public class VTAppConstants {
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_WebUrl = "Constants_Page_WebUrl";
public static final String Constants_Page_WebTitle = "Constants_Page_WebTitle";
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_PlayerView_DetialsEvent =
"Constants_PlayerView_Details";
public static final String Constants_PlayerView_SearchEvent =
"Constants_PlayerView_SearchEvent";
public static final String Constants_PlayerView_CreateHistoryEvent =
"Constants_PlayerView_CreateHistoryEvent";
public static final String Constants_RecommendPlayerView_CLOSEExample =
"Constants_RecommendPlayerView_CLOSEExample";
public static final String Constants_Page_Episodes_Series_Data_currentPosition =
@ -22,32 +31,12 @@ public class VTAppConstants {
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";
public static final String SEARCH_HISTORY = "searchhistory";
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke
android:width="@dimen/dp_2"
android:color="@android:color/white" />
</shape>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/white">
<!-- 默认显⽰效果-->
<item>
<shape android:shape="rectangle">
<gradient
android:angle="180"
android:endColor="#F56490"
android:centerColor="#D568D2"
android:startColor="#BF6BFF"
android:type="linear"
android:useLevel="true" />
<corners
android:radius="@dimen/dp_11" />
</shape>
</item>
</ripple>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/white">
<!-- 默认显⽰效果-->
<item>
<shape android:shape="rectangle">
<gradient
android:angle="90"
android:endColor="#17f564b6"
android:startColor="#17ffffff"
android:type="linear"
android:useLevel="true" />
<corners
android:radius="@dimen/dp_12" />
</shape>
</item>
</ripple>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/white">
<!-- 默认显⽰效果-->
<item>
<shape android:shape="rectangle">
<gradient
android:angle="90"
android:startColor="#00f564b6"
android:centerColor="#91f564b6"
android:endColor="#fff56490"
android:type="linear"
android:useLevel="true" />
<corners android:topLeftRadius="@dimen/dp_6"
android:bottomRightRadius="@dimen/dp_6"/>
</shape>
</item>
</ripple>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/white">
<!-- 默认显⽰效果-->
<item>
<shape android:shape="rectangle">
<gradient
android:angle="90"
android:startColor="#00EB8A64"
android:centerColor="#91EB8A64"
android:endColor="#EB8A64"
android:type="linear"
android:useLevel="true" />
<corners android:topLeftRadius="@dimen/dp_6"
android:bottomRightRadius="@dimen/dp_6"/>
</shape>
</item>
</ripple>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/white">
<!-- 默认显⽰效果-->
<item>
<shape android:shape="rectangle">
<gradient
android:angle="90"
android:startColor="#00A77956"
android:centerColor="#91A77956"
android:endColor="#A77956"
android:type="linear"
android:useLevel="true" />
<corners android:topLeftRadius="@dimen/dp_6"
android:bottomRightRadius="@dimen/dp_6"/>
</shape>
</item>
</ripple>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/white">
<!-- 默认显⽰效果-->
<item>
<shape android:shape="rectangle">
<gradient
android:angle="90"
android:startColor="#00BF6BFF"
android:centerColor="#918A899F"
android:endColor="#8A899F"
android:type="linear"
android:useLevel="true" />
<corners android:topLeftRadius="@dimen/dp_6"
android:bottomRightRadius="@dimen/dp_6"/>
</shape>
</item>
</ripple>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/white">
<!-- 默认显⽰效果-->
<item>
<shape android:shape="rectangle">
<solid android:color="#45000000" />
<corners android:radius="@dimen/dp_5" />
</shape>
</item>
</ripple>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/white">
<!-- 默认显⽰效果-->
<item>
<shape android:shape="rectangle">
<solid android:color="#1affffff" />
<corners android:radius="@dimen/dp_12" />
</shape>
</item>
</ripple>

View File

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/iv_homefragment_bg">
<LinearLayout
android:id="@+id/layout_search"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"
android:layout_marginStart="@dimen/dp_14"
android:layout_marginTop="@dimen/dp_55"
android:layout_marginEnd="@dimen/dp_14"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_back_search"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:src="@mipmap/ic_play_vt_episode_left" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/edit_home_search"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/dp_13"
android:background="@drawable/shape_serarch_home"
android:drawablePadding="@dimen/dp_7"
android:gravity="center_vertical"
android:hint="@string/search_hint"
android:imeOptions="actionSearch"
android:inputType="text"
android:maxLines="1"
android:paddingStart="@dimen/dp_15"
android:textColor="@android:color/white"
android:textColorHint="#38ffffff"
android:textSize="@dimen/sp_12"
app:drawableStartCompat="@mipmap/iv_homefragment_search"
app:drawableTint="@android:color/white" />
</LinearLayout>
<RelativeLayout
android:id="@+id/layout_search_history"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_14"
android:layout_marginEnd="@dimen/dp_14"
app:layout_constraintStart_toStartOf="@+id/layout_search"
app:layout_constraintTop_toBottomOf="@+id/layout_search">
<TextView
android:id="@+id/tv_search_history_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginTop="@dimen/dp_10"
android:drawablePadding="@dimen/dp_5"
android:text="@string/search_history"
android:textColor="@android:color/white"
android:textSize="@dimen/sp_15"
app:drawableStartCompat="@mipmap/ic_search_history"
app:drawableTint="@android:color/white" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_search_history_delete"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:layout_alignTop="@+id/tv_search_history_txt"
android:layout_alignBottom="@+id/tv_search_history_txt"
android:layout_alignParentEnd="true"
android:src="@mipmap/ic_history_delete" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_vt_search_history"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_search_history_txt"
android:layout_marginTop="@dimen/dp_10" />
</RelativeLayout>
<LinearLayout
android:id="@+id/layout_search_data"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="@dimen/dp_14"
android:layout_marginEnd="@dimen/dp_14"
android:orientation="vertical"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/layout_search"
app:layout_constraintStart_toStartOf="@+id/layout_search"
app:layout_constraintTop_toBottomOf="@id/layout_search">
<TextView
android:id="@+id/tv_search_result_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:drawablePadding="@dimen/dp_5"
android:text="@string/search_result"
android:textColor="@android:color/white"
android:textSize="@dimen/sp_15" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_vt_search_data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_3"
android:visibility="visible" />
<LinearLayout
android:id="@+id/layout_search_empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_109"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/ic_search_empty" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:text="@string/search_nodata"
android:textColor="#4C4A6A"
android:textSize="@dimen/sp_14" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/layout_search_hot"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_15"
android:background="@drawable/bg_search_hot_gradient"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/layout_search"
app:layout_constraintStart_toStartOf="@+id/layout_search"
app:layout_constraintTop_toBottomOf="@id/layout_search_history"
app:layout_goneMarginTop="@dimen/dp_15">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_17"
android:drawablePadding="@dimen/dp_2"
android:text="@string/search_hotlist"
android:textColor="@color/color_ff4233"
android:textStyle="bold"
app:drawableStartCompat="@mipmap/ic_hot_search" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_vt_search_hot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_15" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -7,7 +7,7 @@
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewPager_hibit_episode"
android:id="@+id/viewPager_vt_episode"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" />

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_80"
android:background="@android:color/white"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_webview_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingStart="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_20"
android:paddingEnd="@dimen/dp_10"
android:src="@mipmap/iv_back_vt" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_webview_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layout_marginTop="@dimen/dp_20"
android:textColor="@color/color_333333"
android:textSize="@dimen/sp_16" />
</RelativeLayout>
<WebView
android:id="@+id/webview"
android:background="@color/color_f564b6"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.appcompat.widget.LinearLayoutCompat>

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#272A30">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewPager_explore_episode"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" />
<com.wang.avi.AVLoadingIndicatorView
android:id="@+id/avi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:indicatorName="BallSpinFadeLoaderIndicator"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/layout_empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:background="@mipmap/iv_homefragment_bg"
android:visibility="gone">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/home_explore_nodata"
android:textColor="@android:color/white"
android:textSize="@dimen/sp_24" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,22 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.scwang.smart.refresh.layout.SmartRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:id="@+id/smartrefreshlayout_hot"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.activity.home.VTHomeFragment">
android:layout_height="match_parent">
<!-- <com.scwang.smart.refresh.layout.SmartRefreshLayout-->
<!-- android:id="@+id/refreshLayout"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:visibility="visible"-->
<!-- app:srlAccentColor="@android:color/transparent">-->
<!-- <com.viontv.app.ui.view.VTBezierCircleHeader-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content" />-->
<com.scwang.smart.refresh.header.MaterialHeader
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
@ -90,8 +82,16 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_3" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<!-- </com.scwang.smart.refresh.layout.SmartRefreshLayout>-->
</androidx.constraintlayout.widget.ConstraintLayout>
<com.scwang.smart.refresh.footer.ClassicsFooter
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srlTextFinish="Load Success"
app:srlTextLoading="Loading…" />
</com.scwang.smart.refresh.layout.SmartRefreshLayout>

View File

@ -28,9 +28,9 @@
android:textColorHint="#38ffffff"
android:gravity="center_vertical"
android:drawablePadding="@dimen/dp_7"
android:drawableStart="@mipmap/iv_homefragment_search"
android:textColor="#38ffffff"
android:textSize="@dimen/sp_12" />
android:textSize="@dimen/sp_12"
app:drawableStartCompat="@mipmap/iv_homefragment_search" />
</FrameLayout>

View File

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/iv_homefragment_bg"
tools:context=".ui.activity.home.VTHomeFragment">
<FrameLayout
android:id="@+id/layout_head"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_93"
android:background="@drawable/bg_circle_headdefault_vt"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_head"
android:layout_width="@dimen/dp_78"
android:layout_height="@dimen/dp_78"
android:layout_gravity="center"
android:background="@mipmap/ic_default_head" />
</FrameLayout>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_me_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_16"
android:textColor="@android:color/white"
android:textSize="@dimen/sp_15"
app:layout_constraintStart_toEndOf="@+id/layout_head"
app:layout_constraintTop_toTopOf="@+id/layout_head" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_me_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:textColor="@color/color_d2d2d2"
android:textSize="@dimen/sp_12"
app:layout_constraintStart_toStartOf="@+id/tv_me_name"
app:layout_constraintTop_toBottomOf="@+id/tv_me_name" />
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/layout_playlist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_18"
android:layout_marginEnd="@dimen/dp_15"
android:background="@drawable/cornor_1affffff_12dp"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@+id/layout_head">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_me_playlist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:drawableStart="@mipmap/ic_playlist"
android:drawablePadding="@dimen/dp_9"
android:gravity="center_vertical"
android:text="@string/tabme_playlist"
android:textColor="#e6ffffff"
android:textSize="@dimen/sp_14"
app:layout_constraintStart_toEndOf="@+id/layout_head"
app:layout_constraintTop_toTopOf="@+id/layout_head" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview_history"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_15" />
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_18"
android:layout_marginEnd="@dimen/dp_15"
android:background="@drawable/cornor_1affffff_12dp"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@+id/layout_playlist">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_private_policy"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@mipmap/ic_me_private_policy"
android:drawablePadding="@dimen/dp_9"
android:gravity="center_vertical"
android:padding="@dimen/dp_10"
android:drawableEnd="@mipmap/ic_enter"
android:text="@string/tabme_private_policy"
android:textColor="#e6ffffff"
android:textSize="@dimen/sp_14" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_user_agreement"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@mipmap/ic_me_user_agreement"
android:drawablePadding="@dimen/dp_9"
android:gravity="center_vertical"
android:padding="@dimen/dp_10"
android:drawableEnd="@mipmap/ic_enter"
android:text="@string/tabme_user_agreement"
android:textColor="#e6ffffff"
android:textSize="@dimen/sp_14" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_about_us"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@mipmap/ic_me_about_us"
android:drawablePadding="@dimen/dp_9"
android:gravity="center_vertical"
android:padding="@dimen/dp_10"
android:drawableEnd="@mipmap/ic_enter"
android:text="@string/tabme_about_us"
android:textColor="#e6ffffff"
android:textSize="@dimen/sp_14" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<com.viontv.app.ui.view.VTHomeGoogleExoPlayerView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/page_google_home_player"
android:layout_width="match_parent"
android:layout_height="match_parent">
</com.viontv.app.ui.view.VTHomeGoogleExoPlayerView >

View File

@ -25,6 +25,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:minHeight="@dimen/dp_100"
app:layout_constraintDimensionRatio="82:110"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@ -33,6 +33,7 @@
android:layout_alignParentRight="true"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:visibility="gone"
android:src="@mipmap/iv_lock" />
</RelativeLayout>

View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_12">
<androidx.cardview.widget.CardView
android:id="@+id/cardview_search_data"
android:layout_width="@dimen/dp_82"
android:layout_height="wrap_content"
app:cardCornerRadius="@dimen/dp_6"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_search_data_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/dp_100"
android:scaleType="fitXY"
app:layout_constraintDimensionRatio="82:110"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_search_datatitle_item"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_5"
android:ellipsize="end"
android:maxLines="1"
android:textColor="#e6ffffff"
android:textSize="@dimen/sp_14"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/cardview_search_data"
app:layout_constraintTop_toTopOf="@+id/cardview_search_data" />
<TextView
android:id="@+id/tv_search_datadesc_item"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_5"
android:ellipsize="end"
android:maxLines="2"
android:textColor="#9D9D9D"
android:textSize="@dimen/sp_12"
app:layout_constraintBottom_toBottomOf="@+id/cardview_search_data"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/tv_search_datatitle_item"
app:layout_constraintTop_toTopOf="@+id/cardview_search_data" />
<TextView
android:id="@+id/tv_search_datacategory_item1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_5"
android:background="@drawable/cornor_1affffff_4dp"
android:paddingStart="@dimen/dp_10"
android:paddingEnd="@dimen/dp_10"
android:textColor="#8A899F"
android:textSize="@dimen/sp_10"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/cardview_search_data"
app:layout_constraintStart_toStartOf="@+id/tv_search_datatitle_item" />
<TextView
android:id="@+id/tv_search_datacategory_item2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_7"
android:layout_marginBottom="@dimen/dp_5"
android:background="@drawable/cornor_1affffff_4dp"
android:paddingStart="@dimen/dp_10"
android:paddingEnd="@dimen/dp_10"
android:textColor="#8A899F"
android:textSize="@dimen/sp_10"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/cardview_search_data"
app:layout_constraintStart_toEndOf="@+id/tv_search_datacategory_item1" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_item_vt_search_history"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:textColor="#47ffffff"
android:textSize="@dimen/sp_12" />
</FrameLayout>

View File

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_11">
<androidx.cardview.widget.CardView
android:id="@+id/cardview_hot_search"
android:layout_width="@dimen/dp_82"
android:layout_height="wrap_content"
app:cardCornerRadius="@dimen/dp_6"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_hot_search_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:minHeight="@dimen/dp_100"
app:layout_constraintDimensionRatio="82:110"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_hot_topnumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="@dimen/dp_7"
android:paddingEnd="@dimen/dp_7"
android:textColor="@android:color/white"
android:textSize="@dimen/sp_13"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_search_hottitle_item"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_5"
android:ellipsize="end"
android:maxLines="1"
android:textColor="#e6ffffff"
android:textSize="@dimen/sp_14"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/cardview_hot_search"
app:layout_constraintTop_toTopOf="@+id/cardview_hot_search" />
<TextView
android:id="@+id/tv_search_hottag_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_5"
android:background="@drawable/cornor_1affffff_4dp"
android:paddingStart="@dimen/dp_10"
android:paddingEnd="@dimen/dp_10"
android:text="@string/home_trending"
android:textColor="#e6ffffff"
android:textSize="@dimen/sp_10"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/cardview_hot_search"
app:layout_constraintStart_toStartOf="@+id/tv_search_hottitle_item"
app:layout_constraintTop_toTopOf="@+id/cardview_hot_search" />
<LinearLayout
android:id="@+id/layout_search_hottotal_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="@+id/cardview_hot_search"
app:layout_constraintStart_toStartOf="@+id/tv_search_hottitle_item">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/iv_hot"
app:tint="#40ffffff" />
<TextView
android:id="@+id/tv_search_hottotal_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_3"
android:textColor="#40ffffff"
android:textSize="@dimen/sp_12" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/dp_72"
android:layout_height="@dimen/dp_98"
android:layout_marginStart="@dimen/dp_10"
app:cardCornerRadius="@dimen/dp_7">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_history_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY" />
</androidx.cardview.widget.CardView>

View File

@ -17,7 +17,7 @@
android:layout_height="24dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="55dp"
android:src="@mipmap/iv_play_vt_episode_left" />
android:src="@mipmap/ic_play_vt_episode_left" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_title_hibit_episode"
@ -111,7 +111,7 @@
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="16dp"
android:src="@mipmap/iv_arrowright_vt_episode" />
android:src="@mipmap/ic_arrowright_vt_episode" />
</RelativeLayout>
<!-- 收藏功能按钮 start -->
@ -123,7 +123,6 @@
android:layout_marginRight="16dp"
android:layout_marginBottom="26dp"
android:gravity="center"
android:visibility="gone"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatImageView

View File

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_cover_player_detail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_search_home_videoplay"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="@dimen/dp_66"
android:layout_marginEnd="@dimen/dp_15"
android:src="@mipmap/iv_homefragment_search"
app:tint="@android:color/white"
android:visibility="visible" />
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/ll_top"
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_above="@id/conslayout_details"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="7dp"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/seekBar_player_detail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:maxHeight="2dp"
android:paddingStart="0dp"
android:paddingEnd="0dp"
android:progressDrawable="@drawable/bg_seekbar_pd_player_vt"
android:splitTrack="false"
android:thumb="@drawable/bg_shape_seekbar_player_vt"
android:thumbOffset="8dp" />
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_play_status"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:contentDescription="@null"
android:padding="15dp"
android:src="@mipmap/iv_stop_vt" />
<com.viontv.app.ui.view.ProgressLineView
android:id="@+id/load_line"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_above="@id/conslayout_details"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
android:visibility="gone" />
<!-- 收藏功能按钮 start -->
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/conslayout_details"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/dp_15"
android:layout_marginBottom="26dp"
android:gravity="center"
android:orientation="vertical"
android:visibility="visible">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_collection_controller"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_marginBottom="5dp" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_collection_num_controller"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="26dp"
android:gravity="center"
android:textColor="@color/white"
android:textSize="12sp" />
</androidx.appcompat.widget.LinearLayoutCompat>
<!-- 收藏功能按钮 end-->
<!-- 跳播放详情-->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/conslayout_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/tv_des_player"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="@dimen/dp_15">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="1dp"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.7" />
<LinearLayout
android:id="@+id/ll_ep"
android:layout_width="@dimen/dp_0"
android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_10"
android:background="@drawable/bg_vt_episodes_home"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_name_episode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_59"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginEnd="@dimen/dp_10"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@android:color/white"
android:textSize="@dimen/sp_13" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_series"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_59"
android:layout_marginTop="@dimen/dp_5"
android:background="@drawable/bg_home_series_gradient"
android:drawableStart="@mipmap/ic_series_play"
android:drawablePadding="@dimen/dp_3"
android:paddingStart="@dimen/dp_9"
android:paddingTop="@dimen/dp_3"
android:paddingBottom="@dimen/dp_3"
android:paddingEnd="@dimen/dp_9"
android:text="@string/home_explore_series"
android:textColor="@android:color/white"
android:textSize="@dimen/sp_11" />
</LinearLayout>
<androidx.cardview.widget.CardView
android:id="@+id/cardview_homeplayer_video"
android:layout_width="@dimen/dp_49"
android:layout_height="wrap_content"
app:cardCornerRadius="@dimen/dp_5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_homeplayer_video"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintDimensionRatio="49:66" />
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_des_player"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginEnd="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_15"
android:maxLines="2"
android:textColor="#D2D2D2"
android:textSize="@dimen/sp_12" />
</RelativeLayout>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.media3.ui.PlayerView
android:id="@+id/player_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:controller_layout_id="@layout/layout_player_home_controller_vt"
app:resize_mode="zoom" />
</FrameLayout>

View File

Before

Width:  |  Height:  |  Size: 822 B

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 931 B

After

Width:  |  Height:  |  Size: 931 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -10,4 +10,5 @@
<color name="color_d2d2d2">#D2D2D2</color>
<color name="color_f564b6">#F564B6</color>
<color name="color_333333">#333333</color>
<color name="color_ff4233">#FF4233</color>
</resources>

View File

@ -1,5 +1,5 @@
<resources>
<string name="app_name">VionTV</string>
<string name="app_name">ZyreoTV</string>
<string name="tab_main_home">Home</string>
<string name="tab_main_explore">Explore</string>
@ -12,6 +12,18 @@
<string name="tab_home_hot">Hot Picks</string>
<string name="tab_home_top10">Top 10</string>
<string name="search_hint">Enter the content</string>
<string name="search_history">Search History</string>
<string name="search_result">Search Result</string>
<string name="search_nodata">No Search</string>
<string name="search_hotlist">Hot List</string>
<string name="home_explore_series">Series</string>
<string name="home_explore_nodata">No Data</string>
<string name="tabme_playlist">Play List</string>
<string name="tabme_private_policy">Privacy Policy</string>
<string name="tabme_user_agreement">User Agreement</string>
<string name="tabme_about_us">About Us</string>
<string name="vt_network_error_please_check_the_network">Network error please check the network</string>
</resources>

View File

@ -2,8 +2,9 @@
<!-- Base application theme. -->
<style name="Theme.VionTV" parent="Theme.MaterialComponents.Light.NoActionBar.Bridge">
<!-- Primary brand color. -->
<item name="colorPrimaryDark">@android:color/black</item>
<item name="android:windowLightStatusBar" tools:ignore="NewApi">true</item>
<item name="colorPrimaryDark">@android:color/white</item>
<item name="android:windowLightStatusBar">true</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@ -16,11 +16,11 @@ 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"
refresh-layout = "3.0.0-alpha"
refresh-header = "3.0.0-alpha"
refresh-footer = "3.0.0-alpha"
banner = "2.2.3"
recyclerview = "1.2.1"
recyclerview = "1.3.2"
glide = "4.13.1"
avloadingindicatorview="2.1.4"
media3 ="1.4.0"