Commit c337c476 authored by mengcuiguang's avatar mengcuiguang

Merge branch 'dev_vedio_quwuxian_241122_wxsign' of...

Merge branch 'dev_vedio_quwuxian_241122_wxsign' of http://gitlab.mints-id.com/android/android_vedio into dev_vedio_quwuxian_241122_wxsign
parents 1a439fc5 13084fee
...@@ -4,4 +4,7 @@ seeds.txt ...@@ -4,4 +4,7 @@ seeds.txt
unused.txt unused.txt
priguardMapping.txt priguardMapping.txt
/facai /facai
/smartclean /oppo
\ No newline at end of file /vivo
/huawei
/xiaomi
\ No newline at end of file
...@@ -10,8 +10,8 @@ android { ...@@ -10,8 +10,8 @@ android {
applicationId "com.duben.infinitefunjia" applicationId "com.duben.infinitefunjia"
minSdkVersion rootProject.ext.androidMinSdkVersion minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 724 versionCode 725
versionName "7.2.4" versionName "7.2.5"
flavorDimensions "default" flavorDimensions "default"
// dex突破65535的限制 // dex突破65535的限制
......
...@@ -195,6 +195,11 @@ ...@@ -195,6 +195,11 @@
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.BookReadActivity"
android:exported="false"
android:screenOrientation="portrait" />
<service <service
android:name=".ui.service.UpdateService" android:name=".ui.service.UpdateService"
android:exported="true" /> android:exported="true" />
......
package com.duben.infinitefunjia.common
import android.graphics.Color
const val BOOK_CONTENT_COLOR = "BOOK_CONTENT_COLOR"
const val BOOK_CONTENT_SIZE = "BOOK_CONTENT_SIZE"
enum class BookConstant(var color: Int) {
BOOK_CONTENT_COLOR_1(Color.parseColor("#E0E4E7")),
BOOK_CONTENT_COLOR_2(Color.parseColor("#d4e0c6")),
BOOK_CONTENT_COLOR_3(Color.parseColor("#ccd8e4")),
BOOK_CONTENT_COLOR_4(Color.parseColor("#f9d4d4")),
BOOK_CONTENT_COLOR_5(Color.parseColor("#b1b1b1")),
BOOK_CONTENT_COLOR_6(Color.parseColor("#000000")),
BOOK_CONTENT_TEXT_COLOR_1(Color.BLACK),
BOOK_CONTENT_TEXT_COLOR_2(Color.WHITE),
}
\ No newline at end of file
...@@ -49,4 +49,6 @@ object Constant { ...@@ -49,4 +49,6 @@ object Constant {
const val GRO_MORE_ADTYPE2 = "2" const val GRO_MORE_ADTYPE2 = "2"
const val GRO_MORE_ADTYPE3 = "3" const val GRO_MORE_ADTYPE3 = "3"
const val GRO_MORE_ADTYPE4 = "4" const val GRO_MORE_ADTYPE4 = "4"
const val ROUTE_BOOK_ID = "BOOK_ID"
} }
\ No newline at end of file
package com.duben.infinitefunjia.manager
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import com.duben.infinitefunjia.common.Constant
import com.duben.infinitefunjia.mvp.model.BookBean
import com.duben.infinitefunjia.ui.activitys.BookReadActivity
//import com.duben.infinitefunjia.ui.activitys.LongBookReadActivity
/**
* @author Assen
* @date 2024/9/27
* @desc
*/
class BookReadManager {
companion object {
val instance: BookReadManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
BookReadManager()
}
}
fun goReadPage(activity: Activity, data: BookBean) {
val bundle = Bundle()
bundle.putString(Constant.ROUTE_BOOK_ID, data.id)
if (data.shortis == "0") {
val intent = Intent(activity, BookReadActivity::class.java)
intent.putExtras(bundle)
activity.startActivity(intent)
} else {
// val intent = Intent(activity, LongBookReadActivity::class.java)
// intent.putExtras(bundle)
// activity.startActivity(intent)
}
}
}
\ No newline at end of file
package com.duben.infinitefunjia.manager
import com.duben.infinitefunjia.utils.AppPreferencesManager
import com.duben.infinitefunjia.utils.TimeRender
import java.util.*
class ReadTimeCount {
companion object {
const val KEY_STORAGE_READ_TIME_COUNT = "READ_TIME_COUNT"
val instance by lazy(LazyThreadSafetyMode.NONE) {
ReadTimeCount()
}
}
private var startReadTime: Date? = null // 开始阅读时间
private var readTimeCountMap: String = ""
fun getReadTime(): Array<String> {
if (readTimeCountMap == "") {
readTimeCountMap =
AppPreferencesManager.get()
.getString(
KEY_STORAGE_READ_TIME_COUNT,
TimeRender.formatDate(Date()) + "*0"
)!!
}
val date = readTimeCountMap.split("*")[0]
if (date != TimeRender.formatDate(Date())) {
return TimeRender.ms2HMS_S(0)
}
val time = readTimeCountMap.split("*")[1].toInt()
return TimeRender.ms2HMS_S(time)
}
/**
* 存储阅读时间计时
*/
private fun setReadTimeCount(count: Int) {
if (readTimeCountMap == "") {
readTimeCountMap =
AppPreferencesManager.get()
.getString(
KEY_STORAGE_READ_TIME_COUNT,
TimeRender.formatDate(Date()) + "*0"
)!!
}
var time = readTimeCountMap.split("*")[1].toInt()
time += count
readTimeCountMap = TimeRender.formatDate(Date()) + "*" + time
AppPreferencesManager.get().put(KEY_STORAGE_READ_TIME_COUNT, readTimeCountMap)
}
/**
* 开始阅读计时
*/
fun startCountReadTime() {
startReadTime = Date()
}
/**
* 停止阅读计时
*/
fun endCountReadTime() {
if (startReadTime == null) return
val endReadTime = Date()
val count = (endReadTime.time - startReadTime!!.time).toInt()
startReadTime = null
setReadTimeCount(count)
}
}
\ No newline at end of file
package com.duben.infinitefunjia.mvp.model;
import java.io.Serializable;
import java.util.List;
public class BookBean implements Serializable {
private String id;
private String username;
private String userAvatar;
private String title;
private String author;
private String avatar;
private String summary;
private int isStick;
private int isOriginal;
private int isPublish;
private int quantity;
private int commentCount;
private int likeCount;
private int collectCount;
private boolean isCollect;
private String commentContent;
private String categoryName;
private String categoryId;
private String createTime;
private Object lastReadTime;
private Object formatCreateTime;
private String shortis;
private int commonNum;
private String viewPermissions;
private String carouselUrl;
private boolean checked;// 选中
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
private List<TagListDTO> tagList;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getUserAvatar() {
return userAvatar;
}
public void setUserAvatar(String userAvatar) {
this.userAvatar = userAvatar;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
public int getIsStick() {
return isStick;
}
public void setIsStick(int isStick) {
this.isStick = isStick;
}
public int getIsOriginal() {
return isOriginal;
}
public void setIsOriginal(int isOriginal) {
this.isOriginal = isOriginal;
}
public int getIsPublish() {
return isPublish;
}
public void setIsPublish(int isPublish) {
this.isPublish = isPublish;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public int getCommentCount() {
return commentCount;
}
public void setCommentCount(int commentCount) {
this.commentCount = commentCount;
}
public int getLikeCount() {
return likeCount;
}
public void setLikeCount(int likeCount) {
this.likeCount = likeCount;
}
public int getCollectCount() {
return collectCount;
}
public void setCollectCount(int collectCount) {
this.collectCount = collectCount;
}
public boolean getIsCollect() {
return isCollect;
}
public void setIsCollect(boolean isCollect) {
this.isCollect = isCollect;
}
public Object getCommentContent() {
return commentContent;
}
public void setCommentContent(String commentContent) {
this.commentContent = commentContent;
}
public Object getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public String getCategoryId() {
return categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public Object getLastReadTime() {
return lastReadTime;
}
public void setLastReadTime(Object lastReadTime) {
this.lastReadTime = lastReadTime;
}
public Object getFormatCreateTime() {
return formatCreateTime;
}
public void setFormatCreateTime(Object formatCreateTime) {
this.formatCreateTime = formatCreateTime;
}
public String getShortis() {
return shortis;
}
public void setShortis(String shortis) {
this.shortis = shortis;
}
public int getCommonNum() {
return commonNum;
}
public void setCommonNum(int commonNum) {
this.commonNum = commonNum;
}
public String getViewPermissions() {
return viewPermissions;
}
public void setViewPermissions(String viewPermissions) {
this.viewPermissions = viewPermissions;
}
public String getCarouselUrl() {
return carouselUrl;
}
public void setCarouselUrl(String carouselUrl) {
this.carouselUrl = carouselUrl;
}
public List<TagListDTO> getTagList() {
return tagList;
}
public void setTagList(List<TagListDTO> tagList) {
this.tagList = tagList;
}
public static class TagListDTO {
private String id;
private String name;
private int clickVolume;
private int sort;
private String createTime;
private String updateTime;
private int type;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getClickVolume() {
return clickVolume;
}
public void setClickVolume(int clickVolume) {
this.clickVolume = clickVolume;
}
public int getSort() {
return sort;
}
public void setSort(int sort) {
this.sort = sort;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
}
}
package com.duben.infinitefunjia.mvp.model;
import java.io.Serializable;
import java.util.List;
public class BookContentBean implements Serializable {
/**
* id : 80826
* userId : 59
* username : null
* title : 婉婉思忱
* avatar : https://mints-sh.oss-cn-shanghai.aliyuncs.com/vedioApp/coverImage/1724149846155.webp
* author : 兰笙
* summary : 我喜欢了江忱十二年,看着他从校服衬衫到西装革履,
* 他变了很多,唯一不变的,是他从未喜欢过我...他有他爱的人,所以他很厌恶我:“林婉,有时候我真的希望你去死。”他不知道,马上就能如他所愿了...
* content : null
* contentMd : null
* free :
* freeMd :
* charge :
* chargeMd :
* lockRate : 60
* isStick : 0
* isPublish : 1
* isOriginal : 1
* originalUrl : null
* readType : 0
* bookLegumes : 0
* quantity : 0
* likeCount : null
* commentCount : null
* createTime : 1724149846000
* updateTime : 1724403633000
* tagList : null
* category : null
* isLike : false
* isCollect : 0
* isUnlock : 0
* isFollowed : 0
* collectCount : 0
* activeReadType : false
* freeNum : 0
* articleChapterList : null
*/
private int id;
private String userId;
private String username;
private String title;
private String avatar;
private String author;
private String summary;
private String content;
private String contentMd;
private String free;
private String freeMd;
private String charge;
private String chargeMd;
private int lockRate;
private int isStick;
private int isPublish;
private int isOriginal;
private String originalUrl;
private int readType;
private int bookLegumes;
private int quantity;
private int likeCount;
private int commentCount;
private long createTime;
private long updateTime;
private Object tagList;
private Object category;
private boolean isLike;
private int isCollect;
private int isUnlock;
private int isFollowed;
private int collectCount;
private boolean activeReadType;
private int freeNum;
private List<ArticleChapterList> articleChapterList;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public Object getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getContentMd() {
return contentMd;
}
public void setContentMd(String contentMd) {
this.contentMd = contentMd;
}
public String getFree() {
return free;
}
public void setFree(String free) {
this.free = free;
}
public String getFreeMd() {
return freeMd;
}
public void setFreeMd(String freeMd) {
this.freeMd = freeMd;
}
public String getCharge() {
return charge;
}
public void setCharge(String charge) {
this.charge = charge;
}
public String getChargeMd() {
return chargeMd;
}
public void setChargeMd(String chargeMd) {
this.chargeMd = chargeMd;
}
public int getLockRate() {
return lockRate;
}
public void setLockRate(int lockRate) {
this.lockRate = lockRate;
}
public int getIsStick() {
return isStick;
}
public void setIsStick(int isStick) {
this.isStick = isStick;
}
public int getIsPublish() {
return isPublish;
}
public void setIsPublish(int isPublish) {
this.isPublish = isPublish;
}
public int getIsOriginal() {
return isOriginal;
}
public void setIsOriginal(int isOriginal) {
this.isOriginal = isOriginal;
}
public String getOriginalUrl() {
return originalUrl;
}
public void setOriginalUrl(String originalUrl) {
this.originalUrl = originalUrl;
}
public int getReadType() {
return readType;
}
public void setReadType(int readType) {
this.readType = readType;
}
public int getBookLegumes() {
return bookLegumes;
}
public void setBookLegumes(int bookLegumes) {
this.bookLegumes = bookLegumes;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public int getLikeCount() {
return likeCount;
}
public void setLikeCount(int likeCount) {
this.likeCount = likeCount;
}
public int getCommentCount() {
return commentCount;
}
public void setCommentCount(int commentCount) {
this.commentCount = commentCount;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(long updateTime) {
this.updateTime = updateTime;
}
public Object getTagList() {
return tagList;
}
public void setTagList(Object tagList) {
this.tagList = tagList;
}
public Object getCategory() {
return category;
}
public void setCategory(Object category) {
this.category = category;
}
public boolean isIsLike() {
return isLike;
}
public void setIsLike(boolean isLike) {
this.isLike = isLike;
}
public int getIsCollect() {
return isCollect;
}
public void setIsCollect(int isCollect) {
this.isCollect = isCollect;
}
public int getIsUnlock() {
return isUnlock;
}
public void setIsUnlock(int isUnlock) {
this.isUnlock = isUnlock;
}
public int getIsFollowed() {
return isFollowed;
}
public void setIsFollowed(int isFollowed) {
this.isFollowed = isFollowed;
}
public int getCollectCount() {
return collectCount;
}
public void setCollectCount(int collectCount) {
this.collectCount = collectCount;
}
public boolean isActiveReadType() {
return activeReadType;
}
public void setActiveReadType(boolean activeReadType) {
this.activeReadType = activeReadType;
}
public int getFreeNum() {
return freeNum;
}
public void setFreeNum(int freeNum) {
this.freeNum = freeNum;
}
public List<ArticleChapterList> getArticleChapterList() {
return articleChapterList;
}
public void setArticleChapterList(List<ArticleChapterList> articleChapterList) {
this.articleChapterList = articleChapterList;
}
public static class ArticleChapterList implements Serializable {
/**
* id : 407740
* bookId : 80670
* chapterNum : 1
* chapterName : 导语
* wordCount : null
* isVip : 0
* createTime : null
* updateTime : null
*/
private int id;
private int bookId;
private int chapterNum;
private String chapterName;
private Object wordCount;
private int isVip;
private Object createTime;
private Object updateTime;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getBookId() {
return bookId;
}
public void setBookId(int bookId) {
this.bookId = bookId;
}
public int getChapterNum() {
return chapterNum;
}
public void setChapterNum(int chapterNum) {
this.chapterNum = chapterNum;
}
public String getChapterName() {
return chapterName;
}
public void setChapterName(String chapterName) {
this.chapterName = chapterName;
}
public Object getWordCount() {
return wordCount;
}
public void setWordCount(Object wordCount) {
this.wordCount = wordCount;
}
public int getIsVip() {
return isVip;
}
public void setIsVip(int isVip) {
this.isVip = isVip;
}
public Object getCreateTime() {
return createTime;
}
public void setCreateTime(Object createTime) {
this.createTime = createTime;
}
public Object getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Object updateTime) {
this.updateTime = updateTime;
}
}
}
package com.duben.infinitefunjia.mvp.model;
import java.io.Serializable;
import java.util.List;
/**
* @author Assen
* @date 2024/9/20
* @desc
*/
public class BookList2Bean implements Serializable {
/**
* id : 80917
* username : null
* userAvatar : null
* title : 伴娘闺蜜企图毁我婚礼
* author : 小雨
* avatar : https://mints-sh.oss-cn-shanghai.aliyuncs.com/vedioApp/coverImage/1724381017651.jpeg
* summary : 因为我知道,从一开始她就不是真心要来给我当伴娘。
* isStick : 1
* isOriginal : 1
* isPublish : 1
* quantity : 0
* commentCount : null
* likeCount : null
* collectCount : 0
* isCollect : null
* commentContent : null
* categoryName : null
* categoryId : null
* createTime : 2024-08-22 19:49:52
* lastReadTime : null
* formatCreateTime : null
* tagList : [{"id":"305","name":"都市情感","clickVolume":0,"sort":0,"createTime":"2023-12-08 19:09:46","updateTime":"2023-12-08 19:09:45","type":1},{"id":"493","name":"爱情","clickVolume":0,"sort":0,"createTime":null,"updateTime":"2024-08-20 18:27:03","type":1},{"id":"496","name":"现实生活","clickVolume":0,"sort":0,"createTime":null,"updateTime":"2024-08-20 18:27:31","type":1},{"id":"497","name":"感情","clickVolume":0,"sort":0,"createTime":null,"updateTime":"2024-08-20 18:28:40","type":1}]
* shortis : 0
* commonNum : 0
* viewPermissions : 0
* carouselUrl : null
*/
private List<BookBean> list;
public List<BookBean> getRecords() {
return list;
}
public void setRecords(List<BookBean> records) {
this.list = records;
}
}
package com.duben.infinitefunjia.mvp.model;
import java.io.Serializable;
import java.util.List;
/**
* @author Assen
* @date 2024/9/20
* @desc
*/
public class BookListBean implements Serializable {
/**
* id : 80917
* username : null
* userAvatar : null
* title : 伴娘闺蜜企图毁我婚礼
* author : 小雨
* avatar : https://mints-sh.oss-cn-shanghai.aliyuncs.com/vedioApp/coverImage/1724381017651.jpeg
* summary : 因为我知道,从一开始她就不是真心要来给我当伴娘。
* isStick : 1
* isOriginal : 1
* isPublish : 1
* quantity : 0
* commentCount : null
* likeCount : null
* collectCount : 0
* isCollect : null
* commentContent : null
* categoryName : null
* categoryId : null
* createTime : 2024-08-22 19:49:52
* lastReadTime : null
* formatCreateTime : null
* tagList : [{"id":"305","name":"都市情感","clickVolume":0,"sort":0,"createTime":"2023-12-08 19:09:46","updateTime":"2023-12-08 19:09:45","type":1},{"id":"493","name":"爱情","clickVolume":0,"sort":0,"createTime":null,"updateTime":"2024-08-20 18:27:03","type":1},{"id":"496","name":"现实生活","clickVolume":0,"sort":0,"createTime":null,"updateTime":"2024-08-20 18:27:31","type":1},{"id":"497","name":"感情","clickVolume":0,"sort":0,"createTime":null,"updateTime":"2024-08-20 18:28:40","type":1}]
* shortis : 0
* commonNum : 0
* viewPermissions : 0
* carouselUrl : null
*/
private List<BookBean> records;
public List<BookBean> getRecords() {
return records;
}
public void setRecords(List<BookBean> records) {
this.records = records;
}
}
package com.duben.infinitefunjia.mvp.model
import java.io.Serializable
import java.util.ArrayList
data class BookTypeBean(
var id: String,
var name: String,
var sort: Int,
) : Serializable
...@@ -11,7 +11,11 @@ data class HotStyleTypesList( ...@@ -11,7 +11,11 @@ data class HotStyleTypesList(
val list: List<HotStyleTypesBean> val list: List<HotStyleTypesBean>
) : Parcelable ) : Parcelable
@SuppressLint("ParcelCreator")
@Parcelize
data class HotBookTypeList(
val records: List<BookTypeBean>
) : Parcelable
@SuppressLint("ParcelCreator") @SuppressLint("ParcelCreator")
@Parcelize @Parcelize
......
package com.duben.infinitefunjia.mvp.presenters
import com.duben.infinitefunjia.manager.AppHttpManager
import com.duben.infinitefunjia.mvp.model.BaseResponse
import com.duben.library.net.neterror.BaseSubscriber
import com.duben.library.net.neterror.Throwable
import com.duben.infinitefunjia.mvp.model.BookListBean
import com.duben.infinitefunjia.mvp.views.BookListView
class BookListPresenter : BasePresenter<BookListView>() {
fun getHomePageImageList(typeId: Int, page: Int, pageCount: Int) {
val vo = hashMapOf<String, Any>()
vo["categoryId"] = typeId
vo["pageNo"] = page
vo["pageSize"] = pageCount
AppHttpManager.getInstance(loanApplication)
.call(loanService.getArticleList(vo),
object : BaseSubscriber<BaseResponse<BookListBean>>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun onError(e: Throwable) {
if (isLinkView) return
view.showToast(e.message)
view.getHomePageImageListFail()
}
override fun onNext(baseResponse: BaseResponse<BookListBean>) {
if (isLinkView) return
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> {
view.getHomePageImageListSuc(baseResponse.data)
}
else -> {
view.showToast(message)
view.getHomePageImageListFail()
}
}
}
})
}
}
\ No newline at end of file
package com.duben.infinitefunjia.mvp.presenters
import com.google.gson.JsonObject
import com.duben.library.net.neterror.Throwable
import com.duben.infinitefunjia.manager.AppHttpManager
import com.duben.infinitefunjia.mvp.model.BaseResponse
import com.duben.infinitefunjia.mvp.model.BookContentBean
import com.duben.infinitefunjia.mvp.views.BookReadView
import com.duben.library.net.neterror.BaseSubscriber
import java.util.HashMap
class BookReadPresenter : BasePresenter<BookReadView>() {
fun getBookDetail(bookId: String) {
val vo = HashMap<String, Any>()
vo["id"] = bookId
AppHttpManager.getInstance(loanApplication)
.call(loanService.getBookDetail(vo),
object : BaseSubscriber<BaseResponse<BookContentBean>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<BookContentBean>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.getBookDetailSuc(baseResponse.data)
else -> {
view.getBookDetailFail()
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
view.getBookDetailFail()
}
})
}
fun addReadRecord(bookId: String) {
val vo = HashMap<String, Any>()
vo["articleId"] = bookId
AppHttpManager.getInstance(loanApplication)
.call(loanService.addReadRecord(vo),
object : BaseSubscriber<BaseResponse<JsonObject>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<JsonObject>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> {}
else -> {
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
}
})
}
fun collect(articleId: String) {
val vo = HashMap<String, Any>()
vo["articleId"] = articleId
AppHttpManager.getInstance(loanApplication)
.call(loanService.collect(vo),
object : BaseSubscriber<BaseResponse<JsonObject>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<JsonObject>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> {}
else -> {
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
}
})
}
fun cancelCollect(articleId: String) {
val vo = HashMap<String, Any>()
vo["articleId"] = articleId
AppHttpManager.getInstance(loanApplication)
.call(loanService.collectCancel(vo),
object : BaseSubscriber<BaseResponse<JsonObject>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<JsonObject>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> {}
else -> {
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
}
})
}
}
\ No newline at end of file
package com.duben.infinitefunjia.mvp.presenters
import com.duben.infinitefunjia.manager.AppHttpManager
import com.duben.infinitefunjia.mvp.model.*
import com.duben.infinitefunjia.mvp.views.CountView
import com.duben.library.net.neterror.BaseSubscriber
import com.duben.library.net.neterror.Throwable
class CountPresenter : BasePresenter<CountView>() {
fun getCategoryList() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.categoryList,
object : BaseSubscriber<BaseResponse<HotBookTypeList>>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun onError(e: Throwable) {
if (isLinkView) return
view.showToast(e.message)
}
override fun onNext(baseResponse: BaseResponse<HotBookTypeList>) {
if (isLinkView) return
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> {
view.getCategoryListSuc(baseResponse.data)
}
else -> {
view.showToast(message)
}
}
}
})
}
}
\ No newline at end of file
...@@ -6,6 +6,7 @@ import com.duben.library.net.neterror.Throwable ...@@ -6,6 +6,7 @@ import com.duben.library.net.neterror.Throwable
import com.duben.infinitefunjia.manager.AppHttpManager import com.duben.infinitefunjia.manager.AppHttpManager
import com.duben.infinitefunjia.mvp.model.BannerList import com.duben.infinitefunjia.mvp.model.BannerList
import com.duben.infinitefunjia.mvp.model.BaseResponse import com.duben.infinitefunjia.mvp.model.BaseResponse
import com.duben.infinitefunjia.mvp.model.BookList2Bean
import com.duben.infinitefunjia.mvp.views.WatchRecordView import com.duben.infinitefunjia.mvp.views.WatchRecordView
import java.util.HashMap import java.util.HashMap
...@@ -44,6 +45,41 @@ class WatchRecordPresenter : BasePresenter<WatchRecordView>() { ...@@ -44,6 +45,41 @@ class WatchRecordPresenter : BasePresenter<WatchRecordView>() {
} }
}) })
}
fun getBookHistory() {
val vo = hashMapOf<String, Any>()
vo["page"] = 1
vo["size"] = 100
AppHttpManager.getInstance(loanApplication)
.call(loanService.getBookHistory(vo), object : BaseSubscriber<BaseResponse<BookList2Bean>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<BookList2Bean>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.getBookHistorySuc(baseResponse.data)
else -> {
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
}
})
} }
......
package com.duben.infinitefunjia.mvp.views
import com.duben.infinitefunjia.mvp.model.BookListBean
interface BookListView : BaseView {
fun getHomePageImageListSuc(data: BookListBean)
fun getHomePageImageListFail()
}
package com.duben.infinitefunjia.mvp.views
import com.duben.infinitefunjia.mvp.model.BookContentBean
interface BookReadView : BaseView {
fun getBookDetailSuc(data: BookContentBean)
fun getBookDetailFail()
}
package com.duben.infinitefunjia.mvp.views
import com.duben.infinitefunjia.mvp.model.HotBookTypeList
interface CountView : BaseView {
fun getCategoryListSuc(data: HotBookTypeList)
}
package com.duben.infinitefunjia.mvp.views package com.duben.infinitefunjia.mvp.views
import com.duben.infinitefunjia.mvp.model.* import com.duben.infinitefunjia.mvp.model.BannerList
interface PicContentView : BaseView { interface PicContentView : BaseView {
fun getHomePageImageListSuc(data: BannerList) fun getHomePageImageListSuc(data: BannerList)
......
package com.duben.infinitefunjia.mvp.views package com.duben.infinitefunjia.mvp.views
import com.duben.infinitefunjia.mvp.model.BannerList import com.duben.infinitefunjia.mvp.model.BannerList
import com.duben.infinitefunjia.mvp.model.BookList2Bean
interface WatchRecordView : BaseView { interface WatchRecordView : BaseView {
fun getHistorySuc(historyBean: BannerList) fun getHistorySuc(historyBean: BannerList)
fun getHistoryFail() fun getHistoryFail()
fun getBookHistorySuc(historyBean: BookList2Bean)
fun collectSuc() fun collectSuc()
fun collectFail() fun collectFail()
......
...@@ -3,6 +3,10 @@ package com.duben.infinitefunjia.net; ...@@ -3,6 +3,10 @@ package com.duben.infinitefunjia.net;
import android.content.Context; import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import com.duben.infinitefunjia.mvp.model.BookContentBean;
import com.duben.infinitefunjia.mvp.model.BookList2Bean;
import com.duben.infinitefunjia.mvp.model.BookListBean;
import com.duben.infinitefunjia.mvp.model.HotBookTypeList;
import com.duben.infinitefunjia.mvp.model.RecommendBannerList; import com.duben.infinitefunjia.mvp.model.RecommendBannerList;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.duben.infinitefunjia.BuildConfig; import com.duben.infinitefunjia.BuildConfig;
...@@ -344,6 +348,54 @@ public interface LoanService { ...@@ -344,6 +348,54 @@ public interface LoanService {
Observable<BaseResponse<JsonObject>> showVedioConfs(); Observable<BaseResponse<JsonObject>> showVedioConfs();
/**
* 获取文章详情
*
* @return
*/
@POST("api/book/info")
Observable<BaseResponse<BookContentBean>> getBookDetail(@Body Map<String, Object> vo);
/**
* 添加阅读记录
*
* @return
*/
@POST("api/book/addReadRecord")
Observable<BaseResponse<JsonObject>> addReadRecord(@Body Map<String, Object> vo);
/**
* 取消收藏
*
* @return
*/
@POST("api/book/collectCancel")
Observable<BaseResponse<Object>> collectCancel(@Body Map<String, Object> vo);
/**
* 书库分类
*
* @return
*/
@POST("api/book/categoryList")
Observable<BaseResponse<HotBookTypeList>> getCategoryList();
/**
* 书库列表 和 搜索
*
* @return
*/
@POST("api/book/articleList")
Observable<BaseResponse<BookListBean>> getArticleList(@Body Map<String, Object> vo);
/**
* 阅读记录
*
* @return
*/
@POST("api/book/readRecordList")
Observable<BaseResponse<BookList2Bean>> getBookHistory(@Body Map<String, Object> vo);
/** /**
* 默认http工厂 * 默认http工厂
*/ */
......
package com.duben.infinitefunjia.ui.activitys
import android.graphics.Color
import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import com.duben.infinitefunjia.R
import com.duben.infinitefunjia.common.BOOK_CONTENT_COLOR
import com.duben.infinitefunjia.common.BOOK_CONTENT_SIZE
import com.duben.infinitefunjia.common.BookConstant
import com.duben.infinitefunjia.common.Constant
import com.duben.infinitefunjia.manager.ReadTimeCount
import com.duben.infinitefunjia.mvp.model.BookContentBean
import com.duben.infinitefunjia.mvp.presenters.BookReadPresenter
import com.duben.infinitefunjia.mvp.views.BookReadView
import com.duben.infinitefunjia.ui.activitys.base.BaseActivity
import com.duben.infinitefunjia.ui.widgets.BookSettingDialog
import com.duben.infinitefunjia.utils.AppPreferencesManager
import com.duben.library.utils.GlideUtils
import kotlinx.android.synthetic.main.activity_book_read.*
import kotlinx.android.synthetic.main.header_layout.*
class BookReadActivity : BaseActivity(), View.OnClickListener, BookReadView {
private var bookId = ""
private var isCollect = false
private val readPresenter by lazy { BookReadPresenter() }
private var bookSettingDialog: BookSettingDialog? = null
override fun getContentViewLayoutID() = R.layout.activity_book_read
override fun isApplyKitKatTranslucency() = false
override fun getBundleExtras(extras: Bundle?) {
super.getBundleExtras(extras)
extras?.let {
bookId = extras.getString(Constant.ROUTE_BOOK_ID).toString()
}
}
override fun initViewsAndEvents() {
iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
readPresenter.attachView(this)
initListener()
popBookSettingDialog()
}
override fun onResume() {
super.onResume()
readPresenter.getBookDetail(bookId)
readPresenter.addReadRecord(bookId)
ReadTimeCount.instance.startCountReadTime()
}
override fun onPause() {
super.onPause()
ReadTimeCount.instance.endCountReadTime()
}
override fun onClick(v: View?) {
when (v?.id) {
R.id.iv_left_icon -> finish()
R.id.tab_setting_collect -> {
setIsCollect(!isCollect)
}
R.id.tab_setting_book -> {
bookSettingDialog?.show()
}
R.id.tab_setting_share -> {
}
R.id.btn_submit -> {
val bundle = Bundle()
bundle.putBoolean(VipActivity.IS_RECOMMEND, true)
readyGo(VipActivity::class.java, bundle)
}
}
}
private fun popBookSettingDialog() {
bookSettingDialog = BookSettingDialog(this)
bookSettingDialog?.setOnBookSettingCallback(object :
BookSettingDialog.OnBookSettingCallback {
override fun onFontSize(size: Int) {
tv_content.textSize = size.toFloat()
AppPreferencesManager.get().put(BOOK_CONTENT_SIZE, size)
}
override fun onBgColor(color: Int) {
var textColor = Color.BLACK
if (color == BookConstant.BOOK_CONTENT_COLOR_6.color) {
textColor = Color.WHITE
}
tv_content.setTextColor(textColor)
view_book.setBackgroundColor(color)
AppPreferencesManager.get().put(BOOK_CONTENT_COLOR, color)
}
})
bookSettingDialog?.loadSetting()
}
private fun initListener() {
iv_left_icon.setOnClickListener(this)
tab_setting_collect.setOnClickListener(this)
tab_setting_share.setOnClickListener(this)
tab_setting_book.setOnClickListener(this)
btn_submit.setOnClickListener(this)
}
override fun getBookDetailSuc(data: BookContentBean) {
setBookThumb(data)
if (data.isUnlock == 0) {
view_vip.visibility = View.VISIBLE
tv_content.text = data.freeMd
} else {
view_vip.visibility = View.GONE
tv_content.text = data.freeMd + data.chargeMd
}
}
private fun setBookThumb(data: BookContentBean) {
tv_title.text = "阅读:${data.title}"
GlideUtils.loadImageViewNoAnim2(this, data.avatar, image_iv)
title_tv.text = data.title
info_tv.text = data.summary
label_tv.text = data.author
if (data.isCollect == 1) {
tab_iv_bookshelf.setImageResource(R.mipmap.ic_book_collect_s)
tab_tv_bookshelf.text = "已收藏"
tab_tv_bookshelf.setTextColor(ContextCompat.getColor(this, R.color.color_goldenrod))
} else {
tab_iv_bookshelf.setImageResource(R.mipmap.ic_book_collect)
tab_tv_bookshelf.text = "收藏"
tab_tv_bookshelf.setTextColor(ContextCompat.getColor(this, R.color.black))
}
}
private fun setIsCollect(collect: Boolean) {
isCollect = collect
if (isCollect) {
tab_iv_bookshelf.setImageResource(R.mipmap.ic_book_collect_s)
tab_tv_bookshelf.text = "已收藏"
tab_tv_bookshelf.setTextColor(ContextCompat.getColor(this, R.color.color_goldenrod))
readPresenter.collect(bookId)
} else {
tab_iv_bookshelf.setImageResource(R.mipmap.ic_book_collect)
tab_tv_bookshelf.text = "收藏"
tab_tv_bookshelf.setTextColor(ContextCompat.getColor(this, R.color.black))
readPresenter.cancelCollect(bookId)
}
}
override fun getBookDetailFail() {
}
override fun onDestroy() {
super.onDestroy()
readPresenter.detachView()
}
}
...@@ -17,10 +17,7 @@ import com.duben.infinitefunjia.R ...@@ -17,10 +17,7 @@ import com.duben.infinitefunjia.R
import com.duben.infinitefunjia.common.AppConfig import com.duben.infinitefunjia.common.AppConfig
import com.duben.infinitefunjia.common.Constant import com.duben.infinitefunjia.common.Constant
import com.duben.infinitefunjia.ui.activitys.base.BaseActivity import com.duben.infinitefunjia.ui.activitys.base.BaseActivity
import com.duben.infinitefunjia.ui.fragment.MainFragment import com.duben.infinitefunjia.ui.fragment.*
import com.duben.infinitefunjia.ui.fragment.MyFragment
import com.duben.infinitefunjia.ui.fragment.RecommendFragment
import com.duben.infinitefunjia.ui.fragment.VipEnjoyFragment
import com.duben.infinitefunjia.ui.widgets.DialogListener import com.duben.infinitefunjia.ui.widgets.DialogListener
import com.duben.infinitefunjia.ui.widgets.PhoneDialog import com.duben.infinitefunjia.ui.widgets.PhoneDialog
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
...@@ -36,7 +33,7 @@ class MainActivity : BaseActivity(), View.OnClickListener { ...@@ -36,7 +33,7 @@ class MainActivity : BaseActivity(), View.OnClickListener {
var tabIvLoan: TextView? = null var tabIvLoan: TextView? = null
var tabIvRecommend: TextView? = null var tabIvRecommend: TextView? = null
var tabIvEnjoy: ImageView? = null var tabIvEnjoy: TextView? = null
var tabIvMy: TextView? = null var tabIvMy: TextView? = null
private var mShowBlack = false private var mShowBlack = false
...@@ -45,7 +42,7 @@ class MainActivity : BaseActivity(), View.OnClickListener { ...@@ -45,7 +42,7 @@ class MainActivity : BaseActivity(), View.OnClickListener {
private var mainFragment: Fragment? = null private var mainFragment: Fragment? = null
private var recommendFragment: Fragment? = null private var recommendFragment: Fragment? = null
private var myFragment: Fragment? = null private var myFragment: Fragment? = null
private var vipEnjoyFragment: Fragment? = null private var countFragment: Fragment? = null
private var currentFragment: Fragment? = null private var currentFragment: Fragment? = null
private var phoneDialog: PhoneDialog? = null private var phoneDialog: PhoneDialog? = null
...@@ -67,12 +64,12 @@ class MainActivity : BaseActivity(), View.OnClickListener { ...@@ -67,12 +64,12 @@ class MainActivity : BaseActivity(), View.OnClickListener {
findViewById<View>(R.id.tab_rl_enjoy).setOnClickListener(this) findViewById<View>(R.id.tab_rl_enjoy).setOnClickListener(this)
findViewById<View>(R.id.tab_rl_my).setOnClickListener(this) findViewById<View>(R.id.tab_rl_my).setOnClickListener(this)
if (AppConfig.showVipVedio) { // if (AppConfig.showVipVedio) {
// 显示尊享页面 // 显示尊享页面
tab_rl_enjoy.visibility = View.VISIBLE tab_rl_enjoy.visibility = View.VISIBLE
} else { // } else {
tab_rl_enjoy.visibility = View.GONE // tab_rl_enjoy.visibility = View.GONE
} // }
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_ONE AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_ONE
if (mainFragment == null) { if (mainFragment == null) {
...@@ -164,10 +161,9 @@ class MainActivity : BaseActivity(), View.OnClickListener { ...@@ -164,10 +161,9 @@ class MainActivity : BaseActivity(), View.OnClickListener {
addOrShowFragment(supportFragmentManager.beginTransaction(), mainFragment!!) addOrShowFragment(supportFragmentManager.beginTransaction(), mainFragment!!)
tabIvLoan!!.isSelected = true tabIvLoan!!.isSelected = true
tabIvRecommend!!.isSelected = false tabIvRecommend!!.isSelected = false
// tabIvEnjoy!!.isSelected = false tabIvEnjoy!!.isSelected = false
tabIvMy!!.isSelected = false tabIvMy!!.isSelected = false
tabIvEnjoy!!.scaleX = 0.9f tabIvEnjoy!!.scaleX = 0.9f
tabIvEnjoy!!.scaleY = 0.9f tabIvEnjoy!!.scaleY = 0.9f
changeBottomTabColor(false) changeBottomTabColor(false)
...@@ -184,7 +180,7 @@ class MainActivity : BaseActivity(), View.OnClickListener { ...@@ -184,7 +180,7 @@ class MainActivity : BaseActivity(), View.OnClickListener {
addOrShowFragment(supportFragmentManager.beginTransaction(), recommendFragment!!) addOrShowFragment(supportFragmentManager.beginTransaction(), recommendFragment!!)
tabIvLoan!!.isSelected = false tabIvLoan!!.isSelected = false
tabIvRecommend!!.isSelected = true tabIvRecommend!!.isSelected = true
// tabIvEnjoy!!.isSelected = false tabIvEnjoy!!.isSelected = false
tabIvMy!!.isSelected = false tabIvMy!!.isSelected = false
tabIvEnjoy!!.scaleX = 0.9f tabIvEnjoy!!.scaleX = 0.9f
...@@ -197,17 +193,17 @@ class MainActivity : BaseActivity(), View.OnClickListener { ...@@ -197,17 +193,17 @@ class MainActivity : BaseActivity(), View.OnClickListener {
*/ */
fun clickTab3Layout() { fun clickTab3Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_THREE AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_THREE
if (vipEnjoyFragment == null) { if (countFragment == null) {
vipEnjoyFragment = VipEnjoyFragment.newInstance() countFragment = CountFragment()
} }
addOrShowFragment(supportFragmentManager.beginTransaction(), vipEnjoyFragment!!) addOrShowFragment(supportFragmentManager.beginTransaction(), countFragment!!)
tabIvLoan!!.isSelected = false tabIvLoan!!.isSelected = false
tabIvRecommend!!.isSelected = false tabIvRecommend!!.isSelected = false
// tabIvEnjoy!!.isSelected = true tabIvEnjoy!!.isSelected = true
tabIvMy!!.isSelected = false tabIvMy!!.isSelected = false
tabIvEnjoy!!.scaleX = 1.0f tabIvEnjoy!!.scaleX = 0.9f
tabIvEnjoy!!.scaleY = 1.0f tabIvEnjoy!!.scaleY = 0.9f
changeBottomTabColor(false) changeBottomTabColor(false)
} }
...@@ -222,7 +218,7 @@ class MainActivity : BaseActivity(), View.OnClickListener { ...@@ -222,7 +218,7 @@ class MainActivity : BaseActivity(), View.OnClickListener {
addOrShowFragment(supportFragmentManager.beginTransaction(), myFragment!!) addOrShowFragment(supportFragmentManager.beginTransaction(), myFragment!!)
tabIvLoan!!.isSelected = false tabIvLoan!!.isSelected = false
tabIvRecommend!!.isSelected = false tabIvRecommend!!.isSelected = false
// tabIvEnjoy!!.isSelected = false tabIvEnjoy!!.isSelected = false
tabIvMy!!.isSelected = true tabIvMy!!.isSelected = true
tabIvEnjoy!!.scaleX = 0.9f tabIvEnjoy!!.scaleX = 0.9f
......
...@@ -4,12 +4,16 @@ import android.view.LayoutInflater ...@@ -4,12 +4,16 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.duben.infinitefunjia.R import com.duben.infinitefunjia.R
import com.duben.infinitefunjia.manager.BookReadManager
import com.duben.infinitefunjia.manager.LocalVedioManager import com.duben.infinitefunjia.manager.LocalVedioManager
import com.duben.infinitefunjia.mvp.model.BannerList import com.duben.infinitefunjia.mvp.model.BannerList
import com.duben.infinitefunjia.mvp.model.BookBean
import com.duben.infinitefunjia.mvp.model.BookList2Bean
import com.duben.infinitefunjia.mvp.model.VedioBean import com.duben.infinitefunjia.mvp.model.VedioBean
import com.duben.infinitefunjia.mvp.presenters.WatchRecordPresenter import com.duben.infinitefunjia.mvp.presenters.WatchRecordPresenter
import com.duben.infinitefunjia.mvp.views.WatchRecordView import com.duben.infinitefunjia.mvp.views.WatchRecordView
import com.duben.infinitefunjia.ui.activitys.base.BaseActivity import com.duben.infinitefunjia.ui.activitys.base.BaseActivity
import com.duben.infinitefunjia.ui.adapter.BookRecordAdapter
import com.duben.infinitefunjia.ui.adapter.WatchRecordAdapter import com.duben.infinitefunjia.ui.adapter.WatchRecordAdapter
import com.duben.infinitefunjia.ui.widgets.StickHeaderDecoration import com.duben.infinitefunjia.ui.widgets.StickHeaderDecoration
import com.duben.infinitefunjia.utils.TimeHelp import com.duben.infinitefunjia.utils.TimeHelp
...@@ -25,8 +29,11 @@ class WatchRecordActivity : BaseActivity(), WatchRecordView { ...@@ -25,8 +29,11 @@ class WatchRecordActivity : BaseActivity(), WatchRecordView {
private val watchRecordPresenter by lazy { WatchRecordPresenter() } private val watchRecordPresenter by lazy { WatchRecordPresenter() }
private var mWatchRecordAdapter: WatchRecordAdapter? = null private var mVideoAdapter: WatchRecordAdapter? = null
private var datas = mutableListOf<VedioBean>() private var videoDatas = mutableListOf<VedioBean>()
private var mBookAdapter: BookRecordAdapter? = null
private var bookDatas = mutableListOf<BookBean>()
override fun getContentViewLayoutID() = R.layout.activity_watch_record override fun getContentViewLayoutID() = R.layout.activity_watch_record
...@@ -37,35 +44,87 @@ class WatchRecordActivity : BaseActivity(), WatchRecordView { ...@@ -37,35 +44,87 @@ class WatchRecordActivity : BaseActivity(), WatchRecordView {
iv_left_icon.visibility = View.VISIBLE iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back) iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
iv_left_icon.setOnClickListener { finish() } iv_left_icon.setOnClickListener { finish() }
tab_video.isSelected = true
tab_book.isSelected = false
tab_video.setOnClickListener {
tab_video.isSelected = true
tab_book.isSelected = false
rv_video.visibility = View.VISIBLE
rv_book.visibility = View.GONE
}
tab_book.setOnClickListener {
if (bookDatas.isEmpty()) {
watchRecordPresenter.getBookHistory()
}
rv_video.visibility = View.GONE
rv_book.visibility = View.VISIBLE
tab_video.isSelected = false
tab_book.isSelected = true
}
watchRecordPresenter.getHistory() watchRecordPresenter.getHistory()
mWatchRecordAdapter = WatchRecordAdapter() initVideoRv()
initBookRv()
}
private fun initVideoRv() {
mVideoAdapter = WatchRecordAdapter()
val emptyView = LayoutInflater.from(this).inflate(R.layout.item_empty_history, null) val emptyView = LayoutInflater.from(this).inflate(R.layout.item_empty_history, null)
mWatchRecordAdapter?.setEmptyView(emptyView) mVideoAdapter?.setEmptyView(emptyView)
mWatchRecordAdapter?.setNewInstance(datas) mVideoAdapter?.setNewInstance(videoDatas)
mWatchRecordAdapter?.setOnItemClickListener { adapter, view, position -> mVideoAdapter?.setOnItemClickListener { adapter, view, position ->
LocalVedioManager.startVedioDetailActivityForType( LocalVedioManager.startVedioDetailActivityForType(
this@WatchRecordActivity, this@WatchRecordActivity,
datas[position] videoDatas[position]
) )
} }
mWatchRecordAdapter?.setOnItemCollectClickListener(object : mVideoAdapter?.setOnItemCollectClickListener(object :
WatchRecordAdapter.OnItemCollectClickListener { WatchRecordAdapter.OnItemCollectClickListener {
override fun onItemCollectClick(position: Int) { override fun onItemCollectClick(position: Int) {
if (datas[position].collect == 0) { if (videoDatas[position].collect == 0) {
datas[position].collect = 1 videoDatas[position].collect = 1
watchRecordPresenter.collect("" + datas[position].vedioId) watchRecordPresenter.collect("" + videoDatas[position].vedioId)
} else { } else {
datas[position].collect = 0 videoDatas[position].collect = 0
watchRecordPresenter.cancelCollect("" + datas[position].vedioId) watchRecordPresenter.cancelCollect("" + videoDatas[position].vedioId)
} }
mWatchRecordAdapter?.notifyItemChanged(position) mVideoAdapter?.notifyItemChanged(position)
} }
}) })
rv_watch_record.layoutManager = LinearLayoutManager(this) rv_video.layoutManager = LinearLayoutManager(this)
rv_watch_record.addItemDecoration(StickHeaderDecoration(this)) rv_video.addItemDecoration(StickHeaderDecoration(this))
rv_watch_record.adapter = mWatchRecordAdapter rv_video.adapter = mVideoAdapter
}
private fun initBookRv() {
mBookAdapter = BookRecordAdapter()
val emptyView = LayoutInflater.from(this).inflate(R.layout.item_empty_history, null)
mBookAdapter?.setEmptyView(emptyView)
mBookAdapter?.setNewInstance(bookDatas)
mBookAdapter?.setOnItemClickListener { adapter, view, position ->
BookReadManager.instance.goReadPage(this, bookDatas[position])
}
// mBookAdapter?.setOnItemCollectClickListener(object :
// BookRecordAdapter.OnItemCollectClickListener {
// override fun onItemCollectClick(position: Int) {
// if (bookDatas[position].collect == 0) {
// bookDatas[position].collect = 1
// watchRecordPresenter.collect("" + bookDatas[position].vedioId)
// } else {
// bookDatas[position].collect = 0
// watchRecordPresenter.cancelCollect("" + bookDatas[position].vedioId)
// }
// mBookAdapter?.notifyItemChanged(position)
// }
// })
rv_book.layoutManager = LinearLayoutManager(this)
rv_book.addItemDecoration(StickHeaderDecoration(this))
rv_book.adapter = mBookAdapter
} }
override fun isApplyKitKatTranslucency() = true override fun isApplyKitKatTranslucency() = true
...@@ -76,20 +135,25 @@ class WatchRecordActivity : BaseActivity(), WatchRecordView { ...@@ -76,20 +135,25 @@ class WatchRecordActivity : BaseActivity(), WatchRecordView {
} }
override fun getHistorySuc(historyBean: BannerList) { override fun getHistorySuc(historyBean: BannerList) {
datas.clear() videoDatas.clear()
val data = historyBean.list val data = historyBean.list
for (datum in data) { for (datum in data) {
datum.topTabsReamrk = TimeHelp.format(datum.seeUpdateTime * 1000) datum.topTabsReamrk = TimeHelp.format(datum.seeUpdateTime * 1000)
datas.add(datum) videoDatas.add(datum)
} }
// mWatchRecordAdapter?.setNewInstance(datas) mVideoAdapter?.notifyDataSetChanged()
mWatchRecordAdapter?.notifyDataSetChanged()
} }
override fun getHistoryFail() { override fun getHistoryFail() {
} }
override fun getBookHistorySuc(historyBean: BookList2Bean) {
this.bookDatas = historyBean.records
mBookAdapter?.setNewInstance(historyBean.records)
mBookAdapter?.notifyDataSetChanged()
}
override fun collectSuc() { override fun collectSuc() {
} }
......
package com.duben.infinitefunjia.ui.adapter
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.airbnb.lottie.LottieAnimationView
import com.airbnb.lottie.LottieComposition
import com.airbnb.lottie.LottieCompositionFactory
import com.airbnb.lottie.LottieDrawable
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.duben.infinitefunjia.R
import com.duben.infinitefunjia.mvp.model.BookBean
class BookRecordAdapter :
BaseQuickAdapter<BookBean, BaseViewHolder>(R.layout.item_book_record) {
override fun convert(holder: BaseViewHolder, item: BookBean) {
holder.getView<TextView>(R.id.tv_watch_title).text = item.title
holder.getView<TextView>(R.id.tv_watch_text).text = item.summary
holder.getView<TextView>(R.id.tv_watch_user).text = "作者:" + item.author
// if (item.isCollect) {
// holder.getView<ImageView>(R.id.iv_collect).setImageResource(R.mipmap.home_collect_img_1)
// } else {
// holder.getView<ImageView>(R.id.iv_collect).setImageResource(R.mipmap.home_collect_img_0)
// }
// holder.getView<View>(R.id.ll_collect).setOnClickListener {
// if (!item.isCollect) {
// playCollectAnim(holder.getView(R.id.iv_collect))
// mOnItemCollectClickListener?.onItemCollectClick(item)
// } else {
// playCancelCollectAnim(holder.getView(R.id.iv_collect))
// mOnItemCollectClickListener?.onItemCollectClick(item)
// }
// }
}
private fun playCollectAnim(view: LottieAnimationView) {
// val lottieDrawable = LottieDrawable()
// LottieCompositionFactory.fromAsset(context, "home_collect.json")
// .addListener { result: LottieComposition? ->
// lottieDrawable.setImagesAssetsFolder("images/")
// lottieDrawable.composition = result
// lottieDrawable.loop(false)
// lottieDrawable.playAnimation()
// }
// view.setImageDrawable(lottieDrawable)
}
private fun playCancelCollectAnim(view: LottieAnimationView) {
// val lottieDrawable = LottieDrawable()
// LottieCompositionFactory.fromAsset(context, "home_cancel_collect.json")
// .addListener { result: LottieComposition? ->
// lottieDrawable.setImagesAssetsFolder("images/")
// lottieDrawable.composition = result
// lottieDrawable.loop(false)
// lottieDrawable.playAnimation()
// }
// view.setImageDrawable(lottieDrawable)
}
private var mOnItemCollectClickListener: OnItemCollectClickListener? = null
fun setOnItemCollectClickListener(onItemCollectClickListener: OnItemCollectClickListener) {
this.mOnItemCollectClickListener = onItemCollectClickListener
}
interface OnItemCollectClickListener {
fun onItemCollectClick(bean: BookBean)
}
}
\ No newline at end of file
package com.duben.infinitefunjia.ui.adapter
import android.text.SpannableString
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.duben.infinitefunjia.R
import com.duben.infinitefunjia.mvp.model.BookBean
import com.duben.infinitefunjia.ui.adapter.base.OnItemClickListener
import com.duben.infinitefunjia.utils.RoundBackgroundColorSpan
import com.duben.library.utils.GlideUtils
class CountAdapter :
BaseQuickAdapter<BookBean, BaseViewHolder>(R.layout.item_list_count) {
override fun convert(holder: BaseViewHolder, item: BookBean) {
holder.getView<TextView>(R.id.title_tv).text = item.title
holder.getView<TextView>(R.id.info_tv).text = item.summary
if (item.tagList != null && item.tagList.size > 0) {
val span = SpannableStringBuilder()
for (i in 0 until item.tagList.size) {
val labelText = SpannableString(" " + item.tagList[i].name + " ")
val start = 0
val end = item.tagList[i].name.length + 4
labelText.setSpan(
RoundBackgroundColorSpan(
ContextCompat.getColor(context, R.color.color_FEF3F3),
ContextCompat.getColor(context, R.color.color_F1413C)
), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
span.append(labelText)
}
holder.getView<TextView>(R.id.label_tv).text = span
}
GlideUtils.loadImageViewNoAnim2(context, item.avatar, holder.getView(R.id.image_iv))
holder.getView<LinearLayout>(R.id.ll_count_root).setOnClickListener {
mOnItemClickListener?.onItemClick(item)
}
}
private var mOnItemClickListener: OnCountItemClickListener? = null
fun setOnCountItemClickListener(listener: OnCountItemClickListener) {
mOnItemClickListener = listener
}
interface OnCountItemClickListener {
fun onItemClick(bean: BookBean)
}
}
\ No newline at end of file
package com.duben.infinitefunjia.ui.adapter
import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.duben.infinitefunjia.mvp.model.BookTypeBean
import com.duben.infinitefunjia.ui.fragment.BookListFragment
class HomeBookPageAdapter(
private val data: List<BookTypeBean>,
fragment: Fragment
) :
FragmentStateAdapter(fragment) {
private val fragments = mutableMapOf<Int, Fragment>()
override fun getItemId(position: Int): Long {
return data[position].id.toLong()
}
override fun getItemCount() = data.size
override fun createFragment(position: Int): Fragment {
val newFragment = BookListFragment.newInstance(data[position].id.toInt(),position)
fragments[position] = newFragment
return newFragment
}
override fun containsItem(itemId: Long): Boolean {
data.forEach {
if (it.id.toLong() == itemId) {
return true
}
}
return false
}
fun getFragments(): MutableMap<Int, Fragment> {
return fragments
}
}
\ No newline at end of file
package com.duben.infinitefunjia.ui.fragment
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.duben.infinitefunjia.R
import com.duben.infinitefunjia.ad.express.MainExpressManager
import com.duben.infinitefunjia.common.Constant
import com.duben.infinitefunjia.manager.BookReadManager
import com.duben.infinitefunjia.mvp.model.BookBean
import com.duben.infinitefunjia.mvp.model.BookListBean
import com.duben.infinitefunjia.mvp.presenters.BookListPresenter
import com.duben.infinitefunjia.mvp.views.BookListView
import com.duben.infinitefunjia.ui.adapter.CountAdapter
import com.duben.infinitefunjia.ui.fragment.base.LazyLoadBaseFragment
import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener
import com.scwang.smartrefresh.layout.listener.OnRefreshListener
import kotlinx.android.synthetic.main.fragment_movie.*
/**
* 书库-列表
*/
class BookListFragment : LazyLoadBaseFragment(), BookListView, OnRefreshListener,
OnLoadMoreListener {
private var mType = 0
private var mPosition = 0 // 首页-第一个tab-第一个recyclerview Item
private var hotBookData: MutableList<BookBean> = mutableListOf()
companion object {
private const val VIDEO_TYPE = "VIDEO_TYPE"
private const val VIDEO_POSITION = "VIDEO_POSITION"
fun newInstance(type: Int, position: Int): Fragment {
val args = Bundle()
args.putInt(VIDEO_TYPE, type)
args.putInt(VIDEO_POSITION, position)
val fragment = BookListFragment()
fragment.arguments = args
return fragment
}
}
private val bookListPresenter by lazy { BookListPresenter() }
private var hotPage = 1 // 分页
private var hotPageSize = Constant.PAGE_SIZE // 分页
private lateinit var hotStyleAdapter: CountAdapter
override fun getContentViewLayoutID() = R.layout.fragment_movie
override fun initViewsAndEvents() {
arguments?.let {
mType = it.getInt(VIDEO_TYPE, mType)
mPosition = it.getInt(VIDEO_POSITION, mPosition)
}
bookListPresenter.attachView(this)
initView()
initListener()
hotPage = 1
srlMainPage.resetNoMoreData()
bookListPresenter.getHomePageImageList(mType, hotPage, hotPageSize)
}
override fun onResume() {
super.onResume()
}
override fun onDestroy() {
super.onDestroy()
bookListPresenter.detachView()
}
override fun onLoadMore(refreshLayout: RefreshLayout) {
hotPage = ++hotPage
bookListPresenter.getHomePageImageList(mType, hotPage, hotPageSize)
}
override fun getHomePageImageListSuc(data: BookListBean) {
if (activity == null || requireActivity().isFinishing) {
srlMainPage?.finishRefresh(true)
return
}
if (::hotStyleAdapter.isInitialized) {
if (hotPage == 1) {
srlMainPage.finishRefresh(true)
hotStyleAdapter.setNewInstance(data.records)
} else {
if (data.records.size < hotPageSize) {
srlMainPage.finishLoadMoreWithNoMoreData()
} else {
srlMainPage.finishLoadMore()
}
hotStyleAdapter.addData(data.records)
}
}
}
override fun getHomePageImageListFail() {
hotPage = 1
srlMainPage?.finishRefresh(false)
}
private fun initView() {
rv_pic_list.layoutManager = LinearLayoutManager(context)
hotStyleAdapter = CountAdapter()
hotStyleAdapter.animationEnable = false
rv_pic_list.adapter = hotStyleAdapter
hotStyleAdapter.setOnCountItemClickListener(object :
CountAdapter.OnCountItemClickListener {
override fun onItemClick(bean: BookBean) {
BookReadManager.instance.goReadPage(requireActivity(), bean)
}
})
}
private fun initListener() {
srlMainPage.setOnRefreshListener(this)
srlMainPage.setOnLoadMoreListener(this)
// srlMainPage.autoRefresh()
}
override fun onDestroyView() {
super.onDestroyView()
MainExpressManager.instance.destroy()
}
override fun onRefresh(refreshLayout: RefreshLayout) {
hotPage = 1
srlMainPage.resetNoMoreData()
bookListPresenter.getHomePageImageList(mType, hotPage, hotPageSize)
}
}
\ No newline at end of file
package com.duben.infinitefunjia.ui.fragment
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
import com.duben.infinitefunjia.R
import com.duben.infinitefunjia.common.AppConfig
import com.duben.infinitefunjia.common.Constant
import com.duben.infinitefunjia.manager.UserManager
import com.duben.infinitefunjia.mvp.model.*
import com.duben.infinitefunjia.mvp.presenters.CountPresenter
import com.duben.infinitefunjia.mvp.views.CountView
import com.duben.infinitefunjia.ui.adapter.HomeBookPageAdapter
import com.duben.infinitefunjia.ui.fragment.base.LazyLoadBaseFragment
import com.duben.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.fragment_main_count.*
import java.lang.reflect.Field
import java.util.*
import kotlin.concurrent.schedule
/**
* 书库
*/
class CountFragment : LazyLoadBaseFragment(), CountView {
companion object {
var mSelectTabIndex = -1
}
private val countPresenter by lazy { CountPresenter() }
private val userManager by lazy { UserManager.getInstance() }
private val tabsData = mutableListOf<BookTypeBean>()
private var vpAdapter: HomeBookPageAdapter? = null
override fun getContentViewLayoutID() = R.layout.fragment_main_count
override fun initViewsAndEvents() {
countPresenter.attachView(this)
}
private fun loadData() {
Timer().schedule(200) {
requireActivity().runOnUiThread {
if (AntiShake.check(tablayout?.id)) return@runOnUiThread
if (!TextUtils.isEmpty(userManager?.userID)) {
countPresenter.getCategoryList()
}
}
}
}
override fun onFragmentFirstVisible() {
super.onFragmentFirstVisible()
initVp()
loadData()
}
override fun onDestroy() {
super.onDestroy()
countPresenter.detachView()
}
override fun onFragmentResume() {
super.onFragmentResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_THREE) {
vpAdapter?.getFragments()?.get(mSelectTabIndex)?.onResume()
}
}
override fun onPause() {
super.onPause()
vpAdapter?.getFragments()?.get(mSelectTabIndex)?.onPause()
}
override fun getCategoryListSuc(data: HotBookTypeList) {
tabsData.clear()
tabsData.addAll(data.records)
if (tabsData.isNotEmpty()) {
mSelectTabIndex = 0
vpAdapter?.notifyDataSetChanged()
}
}
private fun initVp() {
vpAdapter = HomeBookPageAdapter(tabsData, this)
vp2.adapter = vpAdapter
vp2.desensitization()
TabLayoutMediator(tablayout, vp2) { tab, position ->
// 初始化Tab
tab.id = position
if (tabsData.size > 0) {
tab.customView = getTabView(tabsData[position].name)
}
}.attach()
tablayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab?) {
updateTab(tab, true)
mSelectTabIndex = tab!!.id
}
override fun onTabUnselected(tab: TabLayout.Tab?) {
updateTab(tab, false)
}
override fun onTabReselected(tab: TabLayout.Tab?) {
}
})
vp2.offscreenPageLimit = 100
}
private fun updateTab(tab: TabLayout.Tab?, isSelected: Boolean) {
tab?.customView?.let {
val text = it.findViewById<TextView>(R.id.item_tv)
if (isSelected) {
text.setTextColor(ContextCompat.getColor(requireContext(), R.color.white))
text.background=ContextCompat.getDrawable(requireContext(), R.drawable.shape_book_text_enable)
} else {
text.background=ContextCompat.getDrawable(requireContext(), R.drawable.shape_book_text_none)
text.setTextColor(ContextCompat.getColor(requireContext(), R.color.color_6B6B6B))
}
}
}
private fun getTabView(text: String): View {
val view = LayoutInflater.from(requireContext()).inflate(R.layout.item_video_tab, null)
view.findViewById<TextView>(R.id.item_tv).text = text
return view
}
fun ViewPager2.desensitization() {
//动态设置ViewPager2 灵敏度
try {
val recyclerViewField: Field = ViewPager2::class.java.getDeclaredField("mRecyclerView")
recyclerViewField.isAccessible = true
val recyclerView = recyclerViewField.get(this) as RecyclerView
val touchSlopField: Field = RecyclerView::class.java.getDeclaredField("mTouchSlop")
touchSlopField.isAccessible = true
val touchSlop = touchSlopField.get(recyclerView) as Int
touchSlopField.set(recyclerView, touchSlop * 3) //6 is empirical value
} catch (ignore: java.lang.Exception) {
}
}
}
\ No newline at end of file
package com.duben.infinitefunjia.ui.widgets
import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.WindowManager
import android.widget.RadioButton
import android.widget.SeekBar
import com.duben.infinitefunjia.R
import com.duben.infinitefunjia.common.BOOK_CONTENT_COLOR
import com.duben.infinitefunjia.common.BOOK_CONTENT_SIZE
import com.duben.infinitefunjia.common.BookConstant
import com.duben.infinitefunjia.utils.AppPreferencesManager
import kotlinx.android.synthetic.main.dialog_book_setting.*
class BookSettingDialog(context: Context) : Dialog(context, R.style.dialog) {
private var mOnBookSettingCallback: OnBookSettingCallback? = null
init {
setContentView(R.layout.dialog_book_setting)
// 设置window属性
val lp = window!!.attributes
lp.gravity = Gravity.BOTTOM
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.windowAnimations = R.style.DialogAnimBottom
// lp.dimAmount = 0f // 去背景遮盖
lp.alpha = 1f//透明效果
window!!.attributes = lp
setCancelable(true)
setCanceledOnTouchOutside(true)
(seekbar as SeekBar).setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
tv_seek.text = "$progress"
mOnBookSettingCallback?.onFontSize(progress)
}
override fun onStartTrackingTouch(seekBar: SeekBar?) {}
override fun onStopTrackingTouch(seekBar: SeekBar?) {}
})
rg_color.setOnCheckedChangeListener { group, checkedId ->
for (i in 0 until group.childCount) {
val rb = group.getChildAt(i) as RadioButton
if (rb.id == checkedId) {
rb.scaleX = 1.2f
rb.scaleY = 1.2f
} else {
rb.scaleX = 1f
rb.scaleY = 1f
}
}
when (checkedId) {
R.id.rb_color1 -> {
mOnBookSettingCallback?.onBgColor(BookConstant.BOOK_CONTENT_COLOR_1.color)
}
R.id.rb_color2 -> {
mOnBookSettingCallback?.onBgColor(BookConstant.BOOK_CONTENT_COLOR_2.color)
}
R.id.rb_color3 -> {
mOnBookSettingCallback?.onBgColor(BookConstant.BOOK_CONTENT_COLOR_3.color)
}
R.id.rb_color4 -> {
mOnBookSettingCallback?.onBgColor(BookConstant.BOOK_CONTENT_COLOR_4.color)
}
R.id.rb_color5 -> {
mOnBookSettingCallback?.onBgColor(BookConstant.BOOK_CONTENT_COLOR_5.color)
}
R.id.rb_color6 -> {
mOnBookSettingCallback?.onBgColor(BookConstant.BOOK_CONTENT_COLOR_6.color)
}
else -> {}
}
}
}
fun loadSetting() {
val color = AppPreferencesManager.get()
.getInt(BOOK_CONTENT_COLOR, BookConstant.BOOK_CONTENT_COLOR_1.color)
val size = AppPreferencesManager.get()
.getInt(BOOK_CONTENT_SIZE, 17)
tv_seek.text = "$size"
seekbar.progress = size
mOnBookSettingCallback?.onBgColor(color)
mOnBookSettingCallback?.onFontSize(size)
when (color) {
BookConstant.BOOK_CONTENT_COLOR_1.color -> {
rb_color1.scaleX = 1.2f
rb_color1.scaleY = 1.2f
rb_color1.isChecked = true
}
BookConstant.BOOK_CONTENT_COLOR_2.color -> {
rb_color2.scaleX = 1.2f
rb_color2.scaleY = 1.2f
rb_color2.isChecked = true
}
BookConstant.BOOK_CONTENT_COLOR_3.color -> {
rb_color3.scaleX = 1.2f
rb_color3.scaleY = 1.2f
rb_color3.isChecked = true
}
BookConstant.BOOK_CONTENT_COLOR_4.color -> {
rb_color4.scaleX = 1.2f
rb_color4.scaleY = 1.2f
rb_color4.isChecked = true
}
BookConstant.BOOK_CONTENT_COLOR_5.color -> {
rb_color5.scaleX = 1.2f
rb_color5.scaleY = 1.2f
rb_color5.isChecked = true
}
BookConstant.BOOK_CONTENT_COLOR_6.color -> {
rb_color6.scaleX = 1.2f
rb_color6.scaleY = 1.2f
rb_color6.isChecked = true
}
}
}
fun setOnBookSettingCallback(onBookSettingCallback: OnBookSettingCallback) {
this.mOnBookSettingCallback = onBookSettingCallback
}
interface OnBookSettingCallback {
fun onFontSize(size: Int)
fun onBgColor(color: Int)
}
}
\ No newline at end of file
package com.duben.infinitefunjia.utils;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.text.style.ReplacementSpan;
public class RoundBackgroundColorSpan extends ReplacementSpan {
private int bgColor;
private int textColor;
public RoundBackgroundColorSpan(int bgColor, int textColor) {
super();
this.bgColor = bgColor;
this.textColor = textColor;
}
@Override
public int getSize(Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm) {
//设置宽度为文字宽度加16dp
return ((int) paint.measureText(text, start, end) + BubbleUtils.px2dp(16));
}
@Override
public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) {
int originalColor = paint.getColor();
paint.setColor(this.bgColor);
//画圆角矩形背景
canvas.drawRoundRect(new RectF(x,
top + BubbleUtils.px2dp(3),
x + ((int) paint.measureText(text, start, end) + BubbleUtils.px2dp(16)),
bottom - BubbleUtils.px2dp(1)),
BubbleUtils.px2dp(20),
BubbleUtils.px2dp(20),
paint);
paint.setColor(this.textColor);
//画文字,两边各增加8dp
canvas.drawText(text, start, end, x + BubbleUtils.px2dp(8), y, paint);
//将paint复原
paint.setColor(originalColor);
}
}
\ No newline at end of file
...@@ -308,4 +308,25 @@ object TimeRender { ...@@ -308,4 +308,25 @@ object TimeRender {
return time > outMin && adPreLoadTime > 0 return time > outMin && adPreLoadTime > 0
} }
fun ms2HMS_S(ms: Int): Array<String> {
var _ms = ms
_ms /= 1000
val hour = _ms / 3600
val mint = _ms % 3600 / 60
val sed = _ms % 60
var hourStr = hour.toString()
if (hour < 10) {
hourStr = "0$hourStr"
}
var mintStr = mint.toString()
if (mint < 10) {
mintStr = "0$mintStr"
}
var sedStr = sed.toString()
if (sed < 10) {
sedStr = "0$sedStr"
}
return arrayOf(hourStr, mintStr, sedStr)
}
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="20dp" />
<solid android:color="@color/color_FEF3F3" />
<stroke
android:width="1.5dp"
android:color="@color/color_goldenrod" />
</shape>
\ No newline at end of file
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="5dp" />
<solid android:color="#CCCCCC" />
<size android:height="5dp" />
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="5dp" />
<solid android:color="@color/color_F1413C" />
<size android:height="5dp" />
</shape>
</clip>
</item>
</layer-list>
\ No newline at end of file
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="10dp" />
<solid android:color="@color/color_F1413C" />
<size android:width="20dp" android:height="20dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_book_content_color1_s" android:state_checked="true" />
<item android:drawable="@drawable/shape_book_content_color1" android:state_checked="false" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_book_content_color2_s" android:state_checked="true" />
<item android:drawable="@drawable/shape_book_content_color2" android:state_checked="false" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_book_content_color3_s" android:state_checked="true" />
<item android:drawable="@drawable/shape_book_content_color3" android:state_checked="false" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_book_content_color4_s" android:state_checked="true" />
<item android:drawable="@drawable/shape_book_content_color4" android:state_checked="false" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_book_content_color5_s" android:state_checked="true" />
<item android:drawable="@drawable/shape_book_content_color5" android:state_checked="false" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_book_content_color6_s" android:state_checked="true" />
<item android:drawable="@drawable/shape_book_content_color6" android:state_checked="false" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="@color/my_color_gray2" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="6dip" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/book_content_color1" />
<stroke
android:width="1dp"
android:color="@color/graya" />
<corners android:radius="14dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/book_content_color1" />
<stroke
android:width="2dp"
android:color="@color/color_F1413C" />
<corners android:radius="14dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/book_content_color2" />
<stroke
android:width="1dp"
android:color="@color/graya" />
<corners android:radius="14dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/book_content_color2" />
<stroke
android:width="2dp"
android:color="@color/color_F1413C" />
<corners android:radius="14dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/book_content_color3" />
<stroke
android:width="1dp"
android:color="@color/graya" />
<corners android:radius="14dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/book_content_color3" />
<stroke
android:width="2dp"
android:color="@color/color_F1413C" />
<corners android:radius="14dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/book_content_color4" />
<stroke
android:width="1dp"
android:color="@color/graya" />
<corners android:radius="14dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/book_content_color4" />
<stroke
android:width="2dp"
android:color="@color/color_F1413C" />
<corners android:radius="14dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/book_content_color5" />
<stroke
android:width="1dp"
android:color="@color/graya" />
<corners android:radius="14dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/book_content_color5" />
<stroke
android:width="2dp"
android:color="@color/color_F1413C" />
<corners android:radius="14dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/book_content_color6" />
<stroke
android:width="1dp"
android:color="@color/graya" />
<corners android:radius="14dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/book_content_color6" />
<stroke
android:width="2dp"
android:color="@color/color_F1413C" />
<corners android:radius="14dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="#F1413C" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="15dip" />
<padding
android:top="2dip"
android:bottom="2dip"
android:left="5dip"
android:right="5dip" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="#00000000" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<!-- <corners android:radius="20dip" />-->
<padding
android:top="2dip"
android:bottom="2dip"
android:left="5dip"
android:right="5dip" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/view_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<include layout="@layout/header_layout" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true"
android:overScrollMode="never">
<LinearLayout
android:id="@+id/view_book"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="15dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_bg_gray2"
android:orientation="horizontal"
android:padding="@dimen/dp_10">
<ImageView
android:id="@+id/image_iv"
android:layout_width="80dp"
android:layout_height="100dp"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:orientation="vertical"
android:paddingStart="10dp">
<TextView
android:id="@+id/title_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lines="2"
android:textColor="@color/black"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="@+id/info_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:ellipsize="end"
android:lines="2"
android:textColor="@color/gray"
android:textSize="12sp" />
<TextView
android:id="@+id/label_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:drawableStart="@mipmap/ic_author"
android:drawablePadding="2dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/color_378eff"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/tv_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingMultiplier="2"
android:textColor="@color/black" />
<LinearLayout
android:id="@+id/view_vip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:text="后续内容更精彩,充值后继续阅读"
android:textColor="@color/color_goldenrod" />
<TextView
android:id="@+id/btn_submit"
android:layout_width="300dp"
android:layout_height="38dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="40dp"
android:background="@drawable/btn_bg_gold"
android:gravity="center"
android:text="开通会员,免费阅读本书"
android:textColor="@color/color_goldenrod"
android:textSize="18sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="1.目前充值会员暂不支持退款,一经购买不可退换\n\n2.未满18岁的未成年人需要在监护人主导,同意下进行相关付费操作\n\n3.充值一般在5分钟内到账,如未到账请提供支付截图在'我的'页面联系客服\n\n4.之前充值账户请登录后继续阅读"
android:textColor="@color/color_956244" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<LinearLayout
android:id="@+id/view_setting"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp"
android:paddingBottom="5dp">
<LinearLayout
android:visibility="gone"
android:id="@+id/tab_setting_collect"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/tab_iv_bookshelf"
android:layout_width="20dp"
android:layout_height="20dp"
android:contentDescription="@null"
android:paddingTop="2dp" />
<TextView
android:id="@+id/tab_tv_bookshelf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="收藏"
android:textColor="@color/black"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/tab_setting_book"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:contentDescription="@null"
android:src="@mipmap/ic_book_setting" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="设置"
android:textColor="@color/black"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/tab_setting_share"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:contentDescription="@null"
android:src="@mipmap/ic_book_share" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="分享"
android:textColor="@color/black"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
...@@ -70,27 +70,44 @@ ...@@ -70,27 +70,44 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1.0" android:layout_weight="1.0"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical">
android:paddingBottom="4dp"
android:visibility="visible">
<ImageView <TextView
android:id="@+id/tab_iv_enjoy" android:id="@+id/tab_iv_enjoy"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:scaleX="0.9" android:text="书库"
android:scaleY="0.9" android:textColor="@color/item_text_sel"
android:src="@mipmap/ic_enjoy_label2" /> android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<!-- <TextView--> <!-- <LinearLayout-->
<!-- android:id="@+id/tab_rl_enjoy"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_weight="1.0"-->
<!-- android:gravity="center"-->
<!-- android:orientation="vertical"-->
<!-- android:paddingBottom="4dp"-->
<!-- android:visibility="visible">-->
<!-- <ImageView-->
<!-- android:id="@+id/tab_iv_enjoy"--> <!-- android:id="@+id/tab_iv_enjoy"-->
<!-- android:layout_width="wrap_content"--> <!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"--> <!-- android:layout_height="wrap_content"-->
<!-- android:text="尊享"--> <!-- android:scaleX="0.9"-->
<!-- android:textColor="@color/item_text_sel3"--> <!-- android:scaleY="0.9"-->
<!-- android:textSize="20sp"--> <!-- android:src="@mipmap/ic_enjoy_label2" />-->
<!-- android:textStyle="bold" />--> <!-- <TextView-->
</LinearLayout> <!-- android:id="@+id/tab_iv_enjoy"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="尊享"-->
<!-- android:textColor="@color/item_text_sel3"-->
<!-- android:textSize="20sp"-->
<!-- android:textStyle="bold" />-->
<!-- </LinearLayout>-->
<LinearLayout <LinearLayout
android:id="@+id/tab_rl_my" android:id="@+id/tab_rl_my"
......
...@@ -8,28 +8,50 @@ ...@@ -8,28 +8,50 @@
<include layout="@layout/header_layout" /> <include layout="@layout/header_layout" />
<!-- <com.scwang.smartrefresh.layout.SmartRefreshLayout--> <LinearLayout
<!-- android:id="@+id/srlMainPage"--> android:id="@+id/ll_bottom_tab"
<!-- android:layout_width="match_parent"--> android:layout_width="match_parent"
<!-- android:layout_height="0dp"--> android:layout_height="46dp"
<!-- android:layout_weight="1"--> android:gravity="center_vertical"
<!-- app:srlAccentColor="@color/black">--> android:orientation="horizontal">
<!-- <com.scwang.smartrefresh.header.MaterialHeader--> <TextView
<!-- android:layout_width="match_parent"--> android:id="@+id/tab_video"
<!-- android:layout_height="wrap_content" />--> android:layout_width="0dp"
android:layout_height="wrap_content"
<androidx.recyclerview.widget.RecyclerView android:layout_weight="1"
android:id="@+id/rv_watch_record" android:gravity="center"
android:layout_width="match_parent" android:text="短剧"
android:layout_height="match_parent" /> android:textColor="@color/item_text_sel"
android:textSize="16sp"
<!-- <com.scwang.smartrefresh.layout.footer.ClassicsFooter--> android:textStyle="bold" />
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"--> <TextView
<!-- app:srlAccentColor="@color/black"--> android:id="@+id/tab_book"
<!-- app:srlPrimaryColor="@color/color_FDFDFD" />--> android:layout_width="0dp"
<!-- </com.scwang.smartrefresh.layout.SmartRefreshLayout>--> android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="小说"
android:textColor="@color/item_text_sel"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_video"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_book"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/my_color_gray"
android:visibility="invisible" />
</LinearLayout> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_tab_friends"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="字体大小"
android:textColor="@color/black"
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="42dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/seekbar"
style="@style/CustomSeekBar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/full_transparent"
android:max="24"
android:maxHeight="5dp"
android:min="14"
android:minHeight="5dp"
android:progress="18" />
<TextView
android:id="@+id/tv_seek"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="18"
android:textColor="@color/black"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="背景颜色"
android:textColor="@color/black"
android:textSize="14sp"
android:textStyle="bold" />
<RadioGroup
android:id="@+id/rg_color"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="15dp"
android:gravity="center"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rb_color1"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_marginEnd="10dp"
android:background="@drawable/selector_book_content_1"
android:button="@null"
android:checked="true" />
<RadioButton
android:id="@+id/rb_color2"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_marginEnd="10dp"
android:background="@drawable/selector_book_content_2"
android:button="@null"
android:checked="false" />
<RadioButton
android:id="@+id/rb_color3"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_marginEnd="10dp"
android:background="@drawable/selector_book_content_3"
android:button="@null"
android:checked="false" />
<RadioButton
android:id="@+id/rb_color4"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_marginEnd="10dp"
android:background="@drawable/selector_book_content_4"
android:button="@null"
android:checked="false" />
<RadioButton
android:id="@+id/rb_color5"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_marginEnd="10dp"
android:background="@drawable/selector_book_content_5"
android:button="@null"
android:checked="false" />
<RadioButton
android:id="@+id/rb_color6"
android:layout_width="42dp"
android:layout_height="42dp"
android:background="@drawable/selector_book_content_6"
android:button="@null"
android:checked="false" />
</RadioGroup>
</LinearLayout>
\ No newline at end of file
<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"
android:background="@mipmap/bg_my">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tablayout"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="30dp"
android:layout_marginRight="10dp"
android:paddingTop="-10dp"
app:tabBackground="@null"
app:tabIndicatorHeight="0dp"
app:tabMaxWidth="200dp"
app:tabMinWidth="20dp"
app:tabMode="scrollable"
app:tabPaddingEnd="6dp"
app:tabPaddingStart="6dp"
app:tabRippleColor="@null" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/vp2"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</FrameLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ll_watch_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/shape_bg_write"
android:orientation="horizontal"
android:padding="10dp">
<LinearLayout
android:layout_width="0dp"
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="@+id/tv_watch_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:lines="2"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold"
tools:text="我去平行时空" />
<TextView
android:id="@+id/tv_watch_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:textColor="@color/gray"
android:maxLines="5"
android:ellipsize="end"
android:textSize="16sp"
tools:text="123123123" />
<TextView
android:id="@+id/tv_watch_user"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textColor="@color/black"
android:textSize="14sp"
tools:text="123123123" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_collect"
android:visibility="gone"
android:layout_width="50dp"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/iv_collect"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="10dp"
android:src="@mipmap/home_collect_img_0" />
<TextView
android:id="@+id/tv_collect_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:gravity="center"
android:text="收藏"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll_count_root"
android:layout_width="match_parent"
android:layout_height="126dp"
android:layout_marginBottom="10dp"
android:paddingRight="4dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/image_iv"
android:layout_width="100dp"
android:layout_height="126dp"
android:scaleType="centerCrop"
android:src="@mipmap/ic_launcher_main" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="126dp"
android:layout_weight="1"
android:orientation="vertical"
android:paddingStart="10dp">
<TextView
android:id="@+id/title_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:lines="1"
android:textStyle="bold"
android:ellipsize="end"
android:text="我去平行时空"
android:textColor="@color/black"
android:textSize="18sp" />
<TextView
android:id="@+id/info_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:lines="2"
android:ellipsize="end"
android:minLines="2"
android:textColor="@color/gray"
android:textSize="16sp" />
<TextView
android:id="@+id/label_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:ellipsize="end"
android:maxLines="1"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
...@@ -34,4 +34,19 @@ ...@@ -34,4 +34,19 @@
<color name="color_815136">#815136</color> <color name="color_815136">#815136</color>
<color name="color_FFF0D4">#FFF0D4</color> <color name="color_FFF0D4">#FFF0D4</color>
<color name="my_color_gray2">#F9FAFB</color>
<color name="color_378eff">#378eff</color>
<color name="color_goldenrod">#daa520</color>
<color name="color_956244">#956244</color>
<color name="color_FEF3F3">#FEF3F3</color>
<color name="color_F1413C">#F1413C</color>
<color name="color_6B6B6B">#6B6B6B</color>
<color name="book_content_color1">#E0E4E7</color>
<color name="book_content_color2">#d4e0c6</color>
<color name="book_content_color3">#ccd8e4</color>
<color name="book_content_color4">#f9d4d4</color>
<color name="book_content_color5">#b1b1b1</color>
<color name="book_content_color6">#000000</color>
</resources> </resources>
\ No newline at end of file
...@@ -76,6 +76,9 @@ ...@@ -76,6 +76,9 @@
<style name="CustomCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox"> <style name="CustomCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox">
<item name="android:button">@drawable/checkbox_style</item> <item name="android:button">@drawable/checkbox_style</item>
</style> </style>
<style name="CustomSeekBar" parent="Widget.AppCompat.SeekBar">
<item name="android:progressDrawable">@drawable/custom_seekbar_progress</item>
<item name="android:thumb">@drawable/custom_seekbar_thumb</item>
</style>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment