Commit 63de0379 authored by jyx's avatar jyx

代码优化

parent f9715733
...@@ -208,8 +208,6 @@ dependencies { ...@@ -208,8 +208,6 @@ dependencies {
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-26' implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-26'
//banner //banner
implementation 'io.github.youth5201314:banner:2.2.2' implementation 'io.github.youth5201314:banner:2.2.2'
// zxing
// implementation 'com.king.zxing:zxing-lite:1.1.7-androidx'
// 动画库 // 动画库
implementation 'com.daimajia.easing:library:2.0@aar' implementation 'com.daimajia.easing:library:2.0@aar'
implementation 'com.daimajia.androidanimations:library:2.3@aar' implementation 'com.daimajia.androidanimations:library:2.3@aar'
...@@ -219,13 +217,10 @@ dependencies { ...@@ -219,13 +217,10 @@ dependencies {
implementation 'com.sunfusheng:MarqueeView:1.4.1' implementation 'com.sunfusheng:MarqueeView:1.4.1'
// 光效 // 光效
implementation 'io.supercharge:shimmerlayout:2.1.0' implementation 'io.supercharge:shimmerlayout:2.1.0'
// 选择器 implementation 'com.airbnb.android:lottie:3.4.0'
implementation 'com.contrarywind:Android-PickerView:4.1.9' // html格式
// 表格 implementation 'com.github.NightWhistler:HtmlSpanner:0.4'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation 'com.airbnb.android:lottie:6.0.0'
// gif
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.25'
// 工具类 // 工具类
// BASE64Decoder // BASE64Decoder
...@@ -233,6 +228,8 @@ dependencies { ...@@ -233,6 +228,8 @@ dependencies {
// 兼容奔溃问题-Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. // 兼容奔溃问题-Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
implementation 'androidx.work:work-runtime-ktx:2.7.1' implementation 'androidx.work:work-runtime-ktx:2.7.1'
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4'
// 三方接入 // 三方接入
// talkingdata接入 // talkingdata接入
// 友盟统计SDK // 友盟统计SDK
......
...@@ -6,13 +6,14 @@ ...@@ -6,13 +6,14 @@
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/> <uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" /> <uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" <uses-permission
android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" /> tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" /> <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.VIBRATE" />
...@@ -107,6 +108,15 @@ ...@@ -107,6 +108,15 @@
android:name=".ui.activitys.OrderRecordActivity" android:name=".ui.activitys.OrderRecordActivity"
android:exported="false" android:exported="false"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.BookSearchActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.BookReadActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity <activity
android:name=".ui.activitys.WxLoginActivity" android:name=".ui.activitys.WxLoginActivity"
android:configChanges="orientation|screenSize|keyboardHidden" android:configChanges="orientation|screenSize|keyboardHidden"
...@@ -143,6 +153,7 @@ ...@@ -143,6 +153,7 @@
<service <service
android:name=".manager.KeepMintsManager$GrayInnerService" android:name=".manager.KeepMintsManager$GrayInnerService"
android:process=":live" /> android:process=":live" />
<activity <activity
android:name=".ui.activitys.PixelActivity" android:name=".ui.activitys.PixelActivity"
android:excludeFromRecents="true" android:excludeFromRecents="true"
......
package com.mints.enjoyboxjia.common
import com.mints.enjoyboxjia.R
const val BOOK_BOOK_CONTENT_COLOR = "BOOK_CONTENT_COLOR"
enum class BookConstant(var color: Int) {
BOOK_CONTENT_COLOR_1(R.color.book_content_color1),
BOOK_CONTENT_COLOR_2(R.color.book_content_color2),
BOOK_CONTENT_COLOR_3(R.color.book_content_color3),
BOOK_CONTENT_COLOR_4(R.color.book_content_color4),
BOOK_CONTENT_COLOR_5(R.color.book_content_color5),
BOOK_CONTENT_COLOR_6(R.color.book_content_color6),
}
\ No newline at end of file
package com.mints.enjoyboxjia.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 String 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<BookBean.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 String getIsCollect() {
return isCollect;
}
public void setIsCollect(String 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<BookBean.TagListDTO> getTagList() {
return tagList;
}
public void setTagList(List<BookBean.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.mints.enjoyboxjia.mvp.model;
import java.io.Serializable;
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 Object username;
private String title;
private String avatar;
private String author;
private String summary;
private Object content;
private Object 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 Object 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(Object 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 Object getContent() {
return content;
}
public void setContent(Object content) {
this.content = content;
}
public Object getContentMd() {
return contentMd;
}
public void setContentMd(Object 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 Object getArticleChapterList() {
return articleChapterList;
}
public void setArticleChapterList(Object articleChapterList) {
this.articleChapterList = articleChapterList;
}
}
package com.mints.enjoyboxjia.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.mints.enjoyboxjia.mvp.model
import com.chad.library.adapter.base.entity.MultiItemEntity
const val MULTI_ITEM_1 = 1
const val MULTI_ITEM_2 = 2
data class BookMultiItemEntity(
override var itemType: Int,
var data: BookBean,
var type: String
) : MultiItemEntity, java.io.Serializable
\ No newline at end of file
package com.mints.enjoyboxjia.mvp.model
import java.util.ArrayList
data class CosumerAddressEntity(
var options1Items: MutableList<ProvinceCosumer>? = null,
var options2Items: MutableList<ArrayList<String>>? = null,
) : java.io.Serializable
package com.mints.enjoyboxjia.mvp.model;
import com.contrarywind.interfaces.IPickerViewData;
import java.util.List;
/**
*
* @author: 小嵩
* @date: 2017/3/16 15:36
*/
public class JsonBean implements IPickerViewData {
/**
* name : 省份
* city : [{"name":"北京市","area":["东城区","西城区","崇文区","宣武区","朝阳区"]}]
*/
private String name;
private List<CityBean> city;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<CityBean> getCityList() {
return city;
}
public void setCityList(List<CityBean> city) {
this.city = city;
}
// 实现 IPickerViewData 接口,
// 这个用来显示在PickerView上面的字符串,
// PickerView会通过IPickerViewData获取getPickerViewText方法显示出来。
@Override
public String getPickerViewText() {
return this.name;
}
public static class CityBean {
/**
* name : 城市
* area : ["东城区","西城区","崇文区","昌平区"]
*/
private String name;
private List<String> area;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<String> getArea() {
return area;
}
public void setArea(List<String> area) {
this.area = area;
}
}
}
package com.mints.enjoyboxjia.mvp.model
import java.io.Serializable
import java.util.ArrayList
data class MainMultiItemEntity(
var beans: List<String>?= null,
var options1Items: MutableList<JsonBean>? = null,
var options2Items: MutableList<ArrayList<String>>? = null,
var options3Items: MutableList<ArrayList<ArrayList<String>>>? = null,
var itemType: Int = 0,
) : Serializable
package com.mints.enjoyboxjia.mvp.model;
import com.contrarywind.interfaces.IPickerViewData;
/**
* Created by Sai on 15/11/22.
*/
public class ProvinceCosumer implements IPickerViewData {
private long id;
private String name;
private String description;
private String others;
public ProvinceCosumer(long id, String name, String description, String others){
this.id = id;
this.name = name;
this.description = description;
this.others = others;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getOthers() {
return others;
}
public void setOthers(String others) {
this.others = others;
}
//这个用来显示在PickerView上面的字符串,PickerView会通过getPickerViewText方法获取字符串显示出来。
@Override
public String getPickerViewText() {
return name;
}
}
package com.mints.enjoyboxjia.mvp.presenters package com.mints.enjoyboxjia.mvp.presenters
import com.mints.library.net.neterror.BaseSubscriber import com.google.gson.JsonObject
import com.mints.library.net.neterror.Throwable
import com.mints.enjoyboxjia.common.DeviceInfo import com.mints.enjoyboxjia.common.DeviceInfo
import com.mints.library.net.neterror.Throwable
import com.mints.enjoyboxjia.manager.AppHttpManager import com.mints.enjoyboxjia.manager.AppHttpManager
import com.mints.enjoyboxjia.manager.UserManager import com.mints.enjoyboxjia.manager.UserManager
import com.mints.enjoyboxjia.mvp.model.* import com.mints.enjoyboxjia.mvp.model.BaseResponse
import com.mints.enjoyboxjia.mvp.views.HomeView import com.mints.enjoyboxjia.mvp.model.BookListBean
import com.mints.enjoyboxjia.mvp.model.UserBean
import com.mints.enjoyboxjia.mvp.views.BookCityView
import com.mints.enjoyboxjia.utils.DeviceUuidFactory import com.mints.enjoyboxjia.utils.DeviceUuidFactory
import com.mints.library.net.neterror.BaseSubscriber
import java.util.HashMap
class HomePresenter : BasePresenter<HomeView>() { class BookCityPresenter : BasePresenter<BookCityView>() {
/** /**
* 游客登录 * 游客登录
...@@ -86,36 +90,121 @@ class HomePresenter : BasePresenter<HomeView>() { ...@@ -86,36 +90,121 @@ class HomePresenter : BasePresenter<HomeView>() {
}) })
} }
fun getMyInfo() { fun getBannerBook() {
val vo = java.util.HashMap<String, Any>() val vo = HashMap<String, Any>()
vo["os"] = "android" vo["flag"] = "carousel"
vo["quantity"] = "10"
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.getMyInfo(vo), .call(loanService.getRecommendV1(vo),
object : BaseSubscriber<BaseResponse<UserBean>>() { object : BaseSubscriber<BaseResponse<BookListBean>>() {
override fun onCompleted() { override fun onCompleted() {
if (isLinkView) if (isLinkView) return
return view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<BookListBean>) {
if (isLinkView) return
view.hideLoading() view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.getBannerBookSuc(baseResponse.data)
else -> {
view.getBannerBookFail()
view.showToast(message)
}
}
} }
override fun onError(e: Throwable) { override fun onError(e: Throwable?) {
if (isLinkView) return if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
view.getBannerBookFail()
}
})
}
fun getHotBook() {
val vo = HashMap<String, Any>()
vo["flag"] = "hot"
vo["quantity"] = "5"
AppHttpManager.getInstance(loanApplication)
.call(loanService.getRecommendV1(vo),
object : BaseSubscriber<BaseResponse<BookListBean>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading() view.hideLoading()
} }
override fun onNext(baseResponse: BaseResponse<UserBean>) { override fun onNext(baseResponse: BaseResponse<BookListBean>) {
if (isLinkView) return if (isLinkView) return
val code: Int = baseResponse.status view.hideLoading()
val message: String = baseResponse.message val code = baseResponse.status
val message = baseResponse.message
when (code) { when (code) {
200 -> { 200 -> view.getHotBookSuc(baseResponse.data)
UserManager.getInstance().saveUserInfo(baseResponse.data) else -> {
view.getHotBookFail()
view.showToast(message)
} }
} }
} }
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
view.getHotBookFail()
}
})
}
fun getNewBook() {
val vo = HashMap<String, Any>()
vo["flag"] = "newbook"
vo["quantity"] = "8"
AppHttpManager.getInstance(loanApplication)
.call(loanService.getRecommendV1(vo),
object : BaseSubscriber<BaseResponse<BookListBean>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<BookListBean>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.getNewBookSuc(baseResponse.data)
else -> {
view.getNewBookFail()
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
view.getNewBookFail()
}
}) })
} }
} }
\ No newline at end of file
package com.mints.enjoyboxjia.mvp.presenters
import com.google.gson.JsonObject
import com.mints.library.net.neterror.Throwable
import com.mints.enjoyboxjia.manager.AppHttpManager
import com.mints.enjoyboxjia.mvp.model.BaseResponse
import com.mints.enjoyboxjia.mvp.model.BookContentBean
import com.mints.enjoyboxjia.mvp.views.BookReadView
import com.mints.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.getBookDetail(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.mints.enjoyboxjia.mvp.presenters
import com.google.gson.JsonObject
import com.mints.library.net.neterror.Throwable
import com.mints.enjoyboxjia.manager.AppHttpManager
import com.mints.enjoyboxjia.mvp.model.BaseResponse
import com.mints.enjoyboxjia.mvp.views.BookSearchView
import com.mints.library.net.neterror.BaseSubscriber
import java.util.HashMap
class BookSearchPresenter : BasePresenter<BookSearchView>() {
fun getHotBook() {
val vo = HashMap<String, Any>()
vo["flag"] = "hot"
vo["quantity"] = "5"
AppHttpManager.getInstance(loanApplication)
.call(loanService.getRecommendV1(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 -> view.getHotBookSuc(baseResponse.data)
else -> {
view.getHotBookFail()
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
view.getHotBookFail()
}
})
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.mvp.presenters
import com.google.gson.JsonObject
import com.mints.library.net.neterror.Throwable
import com.mints.enjoyboxjia.manager.AppHttpManager
import com.mints.enjoyboxjia.mvp.model.BaseResponse
import com.mints.enjoyboxjia.mvp.model.BookListBean
import com.mints.enjoyboxjia.mvp.views.BookShelfView
import com.mints.library.net.neterror.BaseSubscriber
import java.util.HashMap
class BookShelfPresenter : BasePresenter<BookShelfView>() {
fun getCollectList() {
val vo = HashMap<String, Any>()
vo["sss"] = ""
AppHttpManager.getInstance(loanApplication)
.call(loanService.collectList(vo),
object : BaseSubscriber<BaseResponse<BookListBean>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<BookListBean>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.getCollectListSuc(baseResponse.data)
else -> {
view.getCollectListFail()
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
view.getCollectListFail()
}
})
}
fun cancelCollect(videoId: List<String>) {
val vo = HashMap<String, Any>()
vo["list"] = videoId
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 -> view.cancelCollectSuc()
else -> {
view.cancelCollectFail()
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
view.cancelCollectFail()
}
})
}
fun getArticleLike() {
val vo = HashMap<String, Any>()
vo["quantity"] = "8"
AppHttpManager.getInstance(loanApplication)
.call(loanService.getArticleLike(vo),
object : BaseSubscriber<BaseResponse<BookListBean>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<BookListBean>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.getArticleLikeSuc(baseResponse.data)
else -> {
view.getArticleLikeFail()
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
view.getArticleLikeFail()
}
})
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.mvp.views
import com.mints.enjoyboxjia.mvp.model.BookListBean
interface BookCityView : BaseView {
fun getHotBookSuc(data: BookListBean)
fun getHotBookFail()
fun getNewBookSuc(data: BookListBean)
fun getNewBookFail()
fun getBannerBookSuc(data: BookListBean)
fun getBannerBookFail()
}
package com.mints.enjoyboxjia.mvp.views
import com.mints.enjoyboxjia.mvp.model.BookContentBean
interface BookReadView : BaseView {
fun getBookDetailSuc(data: BookContentBean)
fun getBookDetailFail()
}
package com.mints.enjoyboxjia.mvp.views package com.mints.enjoyboxjia.mvp.views
interface HomeView : BaseView { interface BookSearchView : BaseView {
fun getHotBookSuc(data: Any)
fun getHotBookFail()
} }
package com.mints.enjoyboxjia.mvp.views
import com.mints.enjoyboxjia.mvp.model.BookListBean
interface BookShelfView : BaseView {
fun getCollectListSuc(data: BookListBean)
fun getCollectListFail()
fun getArticleLikeSuc(data: BookListBean)
fun getArticleLikeFail()
fun cancelCollectSuc()
fun cancelCollectFail()
}
...@@ -6,9 +6,16 @@ import com.google.gson.JsonObject; ...@@ -6,9 +6,16 @@ import com.google.gson.JsonObject;
import com.mints.enjoyboxjia.BuildConfig; import com.mints.enjoyboxjia.BuildConfig;
import com.mints.enjoyboxjia.mvp.model.BannerList; import com.mints.enjoyboxjia.mvp.model.BannerList;
import com.mints.enjoyboxjia.mvp.model.BaseResponse; import com.mints.enjoyboxjia.mvp.model.BaseResponse;
<<<<<<< Updated upstream
import com.mints.enjoyboxjia.mvp.model.BookTypeBean; import com.mints.enjoyboxjia.mvp.model.BookTypeBean;
import com.mints.enjoyboxjia.mvp.model.HotBookTypeList; import com.mints.enjoyboxjia.mvp.model.HotBookTypeList;
import com.mints.enjoyboxjia.mvp.model.HotStyleTypesList; import com.mints.enjoyboxjia.mvp.model.HotStyleTypesList;
=======
import com.mints.enjoyboxjia.mvp.model.BookBean;
import com.mints.enjoyboxjia.mvp.model.BookContentBean;
import com.mints.enjoyboxjia.mvp.model.BookListBean;
import com.mints.enjoyboxjia.mvp.model.HotStyleListBean;
>>>>>>> Stashed changes
import com.mints.enjoyboxjia.mvp.model.OrderRecordBean; import com.mints.enjoyboxjia.mvp.model.OrderRecordBean;
import com.mints.enjoyboxjia.mvp.model.UserBean; import com.mints.enjoyboxjia.mvp.model.UserBean;
import com.mints.enjoyboxjia.mvp.model.Version; import com.mints.enjoyboxjia.mvp.model.Version;
...@@ -145,26 +152,41 @@ public interface LoanService { ...@@ -145,26 +152,41 @@ public interface LoanService {
Observable<BaseResponse<BannerList>> orders(); Observable<BaseResponse<BannerList>> orders();
/** /**
<<<<<<< Updated upstream
* 历史记录 * 历史记录
* *
* @return * @return
*/ */
@POST("api/vedioV1/history") @POST("api/vedioV1/history")
Observable<BaseResponse<BannerList>> history(); Observable<BaseResponse<BannerList>> history();
=======
* 收藏列表
*
* @return
*/
@POST("api/book/collectList")
Observable<BaseResponse<BookListBean>> collectList(@Body Map<String, Object> vo);
>>>>>>> Stashed changes
/** /**
* 收藏 * 收藏
* *
* @return * @return
*/ */
<<<<<<< Updated upstream
@POST("api/vedioV1/collect") @POST("api/vedioV1/collect")
Observable<BaseResponse<Object>> collect(@Body Map<String, Object> vo); Observable<BaseResponse<Object>> collect(@Body Map<String, Object> vo);
=======
@POST("api/book/collect")
Observable<BaseResponse<JsonObject>> collect(@Body Map<String, Object> vo);
>>>>>>> Stashed changes
/** /**
* 取消收藏 * 取消收藏
* *
* @return * @return
*/ */
<<<<<<< Updated upstream
@POST("api/vedioV1/cancelCollect") @POST("api/vedioV1/cancelCollect")
Observable<BaseResponse<Object>> cancelCollect(@Body Map<String, Object> vo); Observable<BaseResponse<Object>> cancelCollect(@Body Map<String, Object> vo);
...@@ -185,6 +207,50 @@ public interface LoanService { ...@@ -185,6 +207,50 @@ public interface LoanService {
Observable<BaseResponse<HotBookTypeList>> getHomeV1Types(); Observable<BaseResponse<HotBookTypeList>> getHomeV1Types();
=======
@POST("api/book/collectCancel")
Observable<BaseResponse<JsonObject>> collectCancel(@Body Map<String, Object> vo);
/**
* 获取推荐书籍
*
* @return
*/
@POST("api/book/recommendv1")
Observable<BaseResponse<BookListBean>> getRecommendV1(@Body Map<String, Object> vo);
/**
* 获取文章详情
*
* @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/articleLike")
Observable<BaseResponse<BookListBean>> getArticleLike(@Body Map<String, Object> vo);
/**
* 搜索书籍
*
* @return
*/
@POST("api/book/articleList")
Observable<BaseResponse<BookListBean>> getArticleList(@Body Map<String, Object> vo);
>>>>>>> Stashed changes
/** /**
* 默认http工厂 * 默认http工厂
......
package com.mints.enjoyboxjia.ui.activitys
import android.os.Bundle
import android.view.View
import com.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.mvp.model.BookContentBean
import com.mints.enjoyboxjia.mvp.presenters.BookReadPresenter
import com.mints.enjoyboxjia.mvp.views.BookReadView
import com.mints.enjoyboxjia.ui.activitys.base.BaseActivity
import com.mints.enjoyboxjia.ui.widgets.BookSettingDialog
import com.mints.library.utils.GlideUtils
import com.mints.library.utils.Utils
import kotlinx.android.synthetic.main.activity_book_read.*
import kotlinx.android.synthetic.main.header_layout.*
import net.nightwhistler.htmlspanner.HtmlSpanner
class BookReadActivity : BaseActivity(), View.OnClickListener, BookReadView {
companion object {
const val BOOK_ID = "BOOK_ID"
}
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(BOOK_ID).toString()
}
}
override fun initViewsAndEvents() {
tv_title.text = "书"
iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
readPresenter.attachView(this)
readPresenter.getBookDetail(bookId)
readPresenter.addReadRecord(bookId)
initListener()
}
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 -> {
popBookSettingDialog()
}
R.id.tab_setting_share -> {
}
R.id.btn_submit -> {
}
}
}
private fun popBookSettingDialog() {
bookSettingDialog = BookSettingDialog(this)
bookSettingDialog?.setOnBookSettingCallback(object :
BookSettingDialog.OnBookSettingCallback {
override fun onFontSize(size: Int) {
tv_content.textSize = size.toFloat()
}
override fun onBgColor(color: Int) {
view_book.setBackgroundColor(color)
}
})
bookSettingDialog?.show()
}
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 = HtmlSpanner().fromHtml(data.free)
} else {
view_vip.visibility = View.GONE
tv_content.text = HtmlSpanner().fromHtml(data.free + data.charge)
}
}
private fun setBookThumb(data: BookContentBean) {
GlideUtils.loadImageViewNoAnim2(this, data.avatar, image_iv)
title_tv.text = data.title
info_tv.text = data.summary
label_tv.text = data.author
}
private fun setIsCollect(collect: Boolean) {
isCollect = collect
if (isCollect) {
tab_iv_bookshelf.setImageResource(R.mipmap.bookshelf)
tab_tv_bookshelf.text = "已收藏"
readPresenter.collect(bookId)
} else {
tab_iv_bookshelf.setImageResource(R.mipmap.bookshelf)
tab_tv_bookshelf.text = "收藏"
readPresenter.cancelCollect(bookId)
}
}
override fun getBookDetailFail() {
}
override fun onDestroy() {
super.onDestroy()
readPresenter.detachView()
}
}
package com.mints.enjoyboxjia.ui.activitys
import android.view.View
import com.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.mvp.presenters.BookSearchPresenter
import com.mints.enjoyboxjia.mvp.views.BookSearchView
import com.mints.enjoyboxjia.ui.activitys.base.BaseActivity
import kotlinx.android.synthetic.main.header_layout.*
class BookSearchActivity : BaseActivity(), View.OnClickListener, BookSearchView {
private val searchPresenter by lazy { BookSearchPresenter() }
override fun getContentViewLayoutID() = R.layout.activity_book_search
override fun isApplyKitKatTranslucency() = false
override fun initViewsAndEvents() {
tv_title.text = "书库搜索"
iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
searchPresenter.attachView(this)
initListener()
}
override fun onClick(v: View?) {
when (v?.id) {
R.id.iv_left_icon -> finish()
}
}
private fun initListener() {
iv_left_icon.setOnClickListener(this)
}
override fun getHotBookSuc(data: Any) {
}
override fun getHotBookFail() {
}
}
package com.mints.enjoyboxjia.ui.activitys package com.mints.enjoyboxjia.ui.activitys
import android.content.Context import android.content.Context
import android.content.Intent
import android.media.AudioManager import android.media.AudioManager
import android.os.Bundle import android.os.Bundle
import android.view.KeyEvent import android.view.KeyEvent
...@@ -12,11 +11,10 @@ import com.mints.enjoyboxjia.R ...@@ -12,11 +11,10 @@ import com.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.common.AppConfig import com.mints.enjoyboxjia.common.AppConfig
import com.mints.enjoyboxjia.common.Constant import com.mints.enjoyboxjia.common.Constant
import com.mints.enjoyboxjia.ui.activitys.base.BaseActivity import com.mints.enjoyboxjia.ui.activitys.base.BaseActivity
import com.mints.enjoyboxjia.ui.fragment.BillFragment import com.mints.enjoyboxjia.ui.fragment.BookCityFragment
import com.mints.enjoyboxjia.ui.fragment.CountFragment import com.mints.enjoyboxjia.ui.fragment.CountFragment
import com.mints.enjoyboxjia.ui.fragment.MainFragment import com.mints.enjoyboxjia.ui.fragment.BookShelfFragment
import com.mints.enjoyboxjia.ui.fragment.MyFragment import com.mints.enjoyboxjia.ui.fragment.MyFragment
import com.mints.enjoyboxjia.ui.service.BillService
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
/** /**
...@@ -29,8 +27,8 @@ class MainActivity : BaseActivity(), View.OnClickListener { ...@@ -29,8 +27,8 @@ class MainActivity : BaseActivity(), View.OnClickListener {
private var audioManager: AudioManager? = null private var audioManager: AudioManager? = null
// 底部标签切换的Fragment // 底部标签切换的Fragment
private var mainFragment: Fragment? = null private var bookShelfFragment: Fragment? = null
private var billFragment: Fragment? = null private var bookCityFragment: Fragment? = null
private var countFragment: Fragment? = null private var countFragment: Fragment? = null
private var myFragment: Fragment? = null private var myFragment: Fragment? = null
private var currentFragment: Fragment? = null private var currentFragment: Fragment? = null
...@@ -42,27 +40,26 @@ class MainActivity : BaseActivity(), View.OnClickListener { ...@@ -42,27 +40,26 @@ class MainActivity : BaseActivity(), View.OnClickListener {
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
audioManager = getSystemService(Context.AUDIO_SERVICE) as AudioManager audioManager = getSystemService(Context.AUDIO_SERVICE) as AudioManager
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_ONE AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_TWO
if (mainFragment == null) { if (bookCityFragment == null) {
mainFragment = MainFragment() bookCityFragment = BookCityFragment()
} }
if (!mainFragment!!.isAdded) { if (!bookCityFragment!!.isAdded) {
// 提交事务 // 提交事务
supportFragmentManager.beginTransaction() supportFragmentManager.beginTransaction()
.add(R.id.content_layout, mainFragment!!).commitAllowingStateLoss() .add(R.id.content_layout, bookCityFragment!!).commitAllowingStateLoss()
// 记录当前Fragment // 记录当前Fragment
currentFragment = mainFragment currentFragment = bookCityFragment
} }
tab_rl_main.setOnClickListener(this) tab_rl_bookshelf.setOnClickListener(this)
tab_rl_find.setOnClickListener(this) tab_rl_bookcity.setOnClickListener(this)
tab_rl_read.setOnClickListener(this) tab_rl_bookstore.setOnClickListener(this)
tab_rl_my.setOnClickListener(this) tab_rl_my.setOnClickListener(this)
tab_iv_center.setOnClickListener(this) tab_tv_bookcity.isSelected = true
tab_tv_main.isSelected = true tab_iv_bookcity.isSelected = true
tab_iv_main.isSelected = true
startService(Intent(this, BillService::class.java)) initEditView()
} }
override fun isApplyKitKatTranslucency(): Boolean { override fun isApplyKitKatTranslucency(): Boolean {
...@@ -115,42 +112,41 @@ class MainActivity : BaseActivity(), View.OnClickListener { ...@@ -115,42 +112,41 @@ class MainActivity : BaseActivity(), View.OnClickListener {
override fun onClick(view: View) { override fun onClick(view: View) {
when (view.id) { when (view.id) {
R.id.tab_rl_main -> clickTab1Layout() R.id.tab_rl_bookshelf -> clickTab1Layout()
R.id.tab_rl_find -> clickTab2Layout() R.id.tab_rl_bookcity -> clickTab2Layout()
R.id.tab_rl_read -> clickTab3Layout() R.id.tab_rl_bookstore -> clickTab3Layout()
R.id.tab_rl_my -> clickTab4Layout() R.id.tab_rl_my -> clickTab4Layout()
R.id.tab_iv_center -> showToast("center")
} }
} }
fun clickTab1Layout() { fun clickTab1Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_ONE AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_ONE
if (mainFragment == null) { if (bookShelfFragment == null) {
mainFragment = MainFragment() bookShelfFragment = BookShelfFragment()
} }
addOrShowFragment(supportFragmentManager.beginTransaction(), mainFragment!!) addOrShowFragment(supportFragmentManager.beginTransaction(), bookShelfFragment!!)
tab_tv_main.isSelected = true tab_tv_bookshelf.isSelected = true
tab_iv_main.isSelected = true tab_iv_bookshelf.isSelected = true
tab_tv_find.isSelected = false tab_tv_bookcity.isSelected = false
tab_iv_find.isSelected = false tab_iv_bookcity.isSelected = false
tab_tv_read.isSelected = false tab_tv_bookstore.isSelected = false
tab_iv_read.isSelected = false tab_iv_bookstore.isSelected = false
tab_tv_my.isSelected = false tab_tv_my.isSelected = false
tab_iv_my.isSelected = false tab_iv_my.isSelected = false
} }
fun clickTab2Layout() { fun clickTab2Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_TWO AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_TWO
if (billFragment == null) { if (bookCityFragment == null) {
billFragment = BillFragment() bookCityFragment = BookCityFragment()
} }
addOrShowFragment(supportFragmentManager.beginTransaction(), billFragment!!) addOrShowFragment(supportFragmentManager.beginTransaction(), bookCityFragment!!)
tab_tv_main.isSelected = false tab_tv_bookshelf.isSelected = false
tab_iv_main.isSelected = false tab_iv_bookshelf.isSelected = false
tab_tv_find.isSelected = true tab_tv_bookcity.isSelected = true
tab_iv_find.isSelected = true tab_iv_bookcity.isSelected = true
tab_tv_read.isSelected = false tab_tv_bookstore.isSelected = false
tab_iv_read.isSelected = false tab_iv_bookstore.isSelected = false
tab_tv_my.isSelected = false tab_tv_my.isSelected = false
tab_iv_my.isSelected = false tab_iv_my.isSelected = false
} }
...@@ -161,12 +157,12 @@ class MainActivity : BaseActivity(), View.OnClickListener { ...@@ -161,12 +157,12 @@ class MainActivity : BaseActivity(), View.OnClickListener {
countFragment = CountFragment() countFragment = CountFragment()
} }
addOrShowFragment(supportFragmentManager.beginTransaction(), countFragment!!) addOrShowFragment(supportFragmentManager.beginTransaction(), countFragment!!)
tab_tv_main.isSelected = false tab_tv_bookshelf.isSelected = false
tab_iv_main.isSelected = false tab_iv_bookshelf.isSelected = false
tab_tv_find.isSelected = false tab_tv_bookcity.isSelected = false
tab_iv_find.isSelected = false tab_iv_bookcity.isSelected = false
tab_tv_read.isSelected = true tab_tv_bookstore.isSelected = true
tab_iv_read.isSelected = true tab_iv_bookstore.isSelected = true
tab_tv_my.isSelected = false tab_tv_my.isSelected = false
tab_iv_my.isSelected = false tab_iv_my.isSelected = false
} }
...@@ -177,12 +173,12 @@ class MainActivity : BaseActivity(), View.OnClickListener { ...@@ -177,12 +173,12 @@ class MainActivity : BaseActivity(), View.OnClickListener {
myFragment = MyFragment() myFragment = MyFragment()
} }
addOrShowFragment(supportFragmentManager.beginTransaction(), myFragment!!) addOrShowFragment(supportFragmentManager.beginTransaction(), myFragment!!)
tab_tv_main.isSelected = false tab_tv_bookshelf.isSelected = false
tab_iv_main.isSelected = false tab_iv_bookshelf.isSelected = false
tab_tv_find.isSelected = false tab_tv_bookcity.isSelected = false
tab_iv_find.isSelected = false tab_iv_bookcity.isSelected = false
tab_tv_read.isSelected = false tab_tv_bookstore.isSelected = false
tab_iv_read.isSelected = false tab_iv_bookstore.isSelected = false
tab_tv_my.isSelected = true tab_tv_my.isSelected = true
tab_iv_my.isSelected = true tab_iv_my.isSelected = true
} }
...@@ -200,4 +196,26 @@ class MainActivity : BaseActivity(), View.OnClickListener { ...@@ -200,4 +196,26 @@ class MainActivity : BaseActivity(), View.OnClickListener {
} }
currentFragment = fragment currentFragment = fragment
} }
private fun initEditView() {
tv_full.setOnClickListener {
bookShelfFragment?.apply {
(this as BookShelfFragment).fullChoice()
}
}
tv_delete.setOnClickListener {
bookShelfFragment?.apply {
(this as BookShelfFragment).delete()
}
}
}
fun showEdit(isEdit: Boolean) {
if (isEdit) {
ll_edit.visibility = View.VISIBLE
} else {
ll_edit.visibility = View.GONE
}
}
} }
\ No newline at end of file
package com.mints.enjoyboxjia.ui.adapter
import android.app.Activity
import android.view.View
import android.widget.CheckBox
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.mvp.model.BookBean
import com.mints.library.utils.GlideUtils
/**
* @author Assen
* @date 2023/7/5
* @desc
*/
class BookShelfAdapter(var activity: Activity) :
BaseQuickAdapter<BookBean, BaseViewHolder>(R.layout.item_bookshelf) {
private var showEdit = false
override fun convert(holder: BaseViewHolder, item: BookBean) {
holder.getView<CheckBox>(R.id.cb).isChecked = item.isChecked
holder.getView<CheckBox>(R.id.cb).setOnCheckedChangeListener { buttonView, isChecked ->
item.isChecked = isChecked
}
holder.getView<View>(R.id.fm_mask).visibility = if (showEdit) View.VISIBLE else View.GONE
holder.getView<TextView>(R.id.title_tv).text = item.title
// holder.getView<TextView>(R.id.info_tv).text = "观看至第${item.seeIndex}集"
GlideUtils.loadImageView(context, item.avatar, holder.getView(R.id.image_iv))
}
// 设置编辑状态
fun setEditStyle(showEdit: Boolean) {
// 清除选中状态
if (!this.showEdit) {
for (datum in data) {
datum.isChecked = false
}
}
notifyDataSetChanged()
}
// 设置编辑状态
fun getEditStyle(): Boolean {
return this.showEdit
}
// 全选
fun fullChoice() {
for (datum in data) {
datum.isChecked = true
}
notifyDataSetChanged()
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.ui.adapter
import android.app.Activity
import android.text.SpannableString
import android.text.SpannableStringBuilder
import android.text.Spanned
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.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.mvp.model.BookBean
import com.mints.enjoyboxjia.utils.RoundBackgroundColorSpan
import com.mints.library.utils.GlideUtils
class HotBookAdapter(var activity: Activity) :
BaseQuickAdapter<BookBean, BaseViewHolder>(R.layout.item_booklike) {
override fun convert(holder: BaseViewHolder, item: BookBean) {
holder.getView<TextView>(R.id.title_tv).text = item.title
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(activity, R.color.color_FEF3F3),
ContextCompat.getColor(activity, 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))
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.ui.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.mints.enjoyboxjia.R;
import com.mints.enjoyboxjia.mvp.model.BookBean;
import com.mints.library.utils.GlideUtils;
import com.youth.banner.adapter.BannerAdapter;
import java.util.List;
/**
* 自定义布局,图片+标题
*/
public class ImageTitleAdapter extends BannerAdapter<BookBean, ImageTitleHolder> {
private Context context;
public ImageTitleAdapter(List<BookBean> datas) {
super(datas);
}
@Override
public ImageTitleHolder onCreateHolder(ViewGroup parent, int viewType) {
context = parent.getContext();
return new ImageTitleHolder(LayoutInflater.from(context).inflate(R.layout.banner_image_title, parent, false));
}
@Override
public void onBindView(ImageTitleHolder holder, BookBean data, int position, int size) {
if (data.getCarouselUrl() != null) {
GlideUtils.INSTANCE.loadImageViewGifForCenterCrop(context, data.getCarouselUrl(), holder.imageView);
}
holder.title.setText(data.getTitle());
}
}
package com.mints.enjoyboxjia.ui.adapter
import android.app.Activity
import android.text.SpannableString
import android.text.SpannableStringBuilder
import android.text.Spanned
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.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.mvp.model.BookBean
import com.mints.enjoyboxjia.utils.RoundBackgroundColorSpan
import com.mints.library.utils.GlideUtils
class LikeBookAdapter(var activity: Activity) :
BaseQuickAdapter<BookBean, BaseViewHolder>(R.layout.item_booklike) {
override fun convert(holder: BaseViewHolder, item: BookBean) {
holder.getView<TextView>(R.id.title_tv).text = item.title
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(activity, R.color.color_FEF3F3),
ContextCompat.getColor(activity, 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))
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.ui.adapter
import android.app.Activity
import android.text.SpannableString
import android.text.SpannableStringBuilder
import android.text.Spanned
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.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.mvp.model.BookBean
import com.mints.enjoyboxjia.utils.RoundBackgroundColorSpan
import com.mints.library.utils.GlideUtils
class NewBookAdapter(var activity: Activity) :
BaseQuickAdapter<BookBean, BaseViewHolder>(R.layout.item_newbook) {
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(activity, R.color.color_FEF3F3),
ContextCompat.getColor(activity, 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))
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.ui.fragment
import com.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.ui.fragment.base.BaseFragment
/**
* 账单
*/
class BillFragment : BaseFragment() {
override fun getContentViewLayoutID() = R.layout.fragment_main_bill
override fun initViewsAndEvents() {
}
override fun onHiddenChanged(hidden: Boolean) {
if (hidden) { // 不在最前端界面显示
onPause()
} else { // 重新显示到最前端中
onResume()
}
super.onHiddenChanged(hidden)
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.ui.fragment
import android.os.Bundle
import android.text.SpannableString
import android.text.SpannableStringBuilder
import android.text.Spanned
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.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.ad.AdManager
import com.mints.enjoyboxjia.common.AppConfig
import com.mints.enjoyboxjia.common.Constant
import com.mints.enjoyboxjia.manager.UserManager
import com.mints.enjoyboxjia.mvp.model.BookBean
import com.mints.enjoyboxjia.mvp.model.BookListBean
import com.mints.enjoyboxjia.mvp.presenters.BookCityPresenter
import com.mints.enjoyboxjia.mvp.views.BookCityView
import com.mints.enjoyboxjia.ui.activitys.BookReadActivity
import com.mints.enjoyboxjia.ui.adapter.HotBookAdapter
import com.mints.enjoyboxjia.ui.adapter.NewBookAdapter
import com.mints.enjoyboxjia.ui.adapter.ImageTitleAdapter
import com.mints.enjoyboxjia.ui.fragment.base.LazyLoadBaseFragment
import com.mints.enjoyboxjia.utils.GridSpacingItemDecoration
import com.mints.enjoyboxjia.utils.RoundBackgroundColorSpan
import com.mints.library.utils.GlideUtils
import com.mints.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.fragment_main_bookcity.*
/**
* 账单
*/
class BookCityFragment : LazyLoadBaseFragment(), BookCityView, View.OnClickListener {
private val bookCityPresenter by lazy { BookCityPresenter() }
private val userManager by lazy { UserManager.getInstance() }
private var hotBookAdapter: HotBookAdapter? = null
private var hotBookData: MutableList<BookBean> = mutableListOf()
private var newBookAdapter: NewBookAdapter? = null
private var newBookData: MutableList<BookBean> = mutableListOf()
override fun getContentViewLayoutID() = R.layout.fragment_main_bookcity
override fun initViewsAndEvents() {
bookCityPresenter.attachView(this)
if (!UserManager.getInstance().vipFlag) {
AdManager.instance.preLoadAd(requireActivity())
}
initView()
initListener()
}
private fun initView() {
initHotAdapter()
initNewAdapter()
}
private fun initListener() {
iv_change_hot.setOnClickListener(this)
iv_change_new.setOnClickListener(this)
view_search.setOnClickListener(this)
}
private fun initHotAdapter() {
hotBookAdapter = HotBookAdapter(requireActivity())
hotBookAdapter?.setOnItemClickListener { _, _, position ->
val bundle = Bundle()
bundle.putString(BookReadActivity.BOOK_ID, hotBookData[position].id)
readyGo(BookReadActivity::class.java, bundle)
}
rv_hotbook.layoutManager = GridLayoutManager(requireContext(), 4)
val itemDecoration = GridSpacingItemDecoration(5, 10, false)
rv_hotbook.addItemDecoration(itemDecoration)
rv_hotbook.adapter = hotBookAdapter
}
private fun getHotHeader(headData: BookBean): View {
val view = LayoutInflater.from(requireContext()).inflate(R.layout.item_hotbook, null)
view.findViewById<TextView>(R.id.title_tv).text = headData.title
view.findViewById<TextView>(R.id.info_tv).text = headData.summary
GlideUtils.loadImageViewNoAnim2(context, headData.avatar, view.findViewById(R.id.image_iv))
if (headData.tagList != null && headData.tagList.size > 0) {
val span = SpannableStringBuilder()
for (i in 0 until headData.tagList.size) {
val labelText = SpannableString(" " + headData.tagList[i].name + " ")
val start = 0
val end = headData.tagList[i].name.length + 4
labelText.setSpan(
RoundBackgroundColorSpan(
ContextCompat.getColor(requireContext(), R.color.color_FEF3F3),
ContextCompat.getColor(requireContext(), R.color.color_F1413C)
), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
span.append(labelText)
}
view.findViewById<TextView>(R.id.label_tv).text = span
}
view.setOnClickListener {
val bundle = Bundle()
bundle.putString(BookReadActivity.BOOK_ID, headData.id)
readyGo(BookReadActivity::class.java, bundle)
}
return view
}
private fun initNewAdapter() {
newBookAdapter = NewBookAdapter(requireActivity())
newBookAdapter?.setOnItemClickListener { _, _, position ->
val bundle = Bundle()
bundle.putString(BookReadActivity.BOOK_ID, newBookData[position].id)
readyGo(BookReadActivity::class.java, bundle)
}
rv_newbook.layoutManager = GridLayoutManager(requireContext(), 2)
rv_newbook.adapter = newBookAdapter
}
override fun onHiddenChanged(hidden: Boolean) {
if (hidden) { // 不在最前端界面显示
onPause()
} else { // 重新显示到最前端中
onResume()
}
super.onHiddenChanged(hidden)
}
override fun onFragmentFirstVisible() {
super.onFragmentFirstVisible()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_TWO) {
if (AntiShake.check(banner?.id)) return
banner?.start()
if (TextUtils.isEmpty(userManager?.userID)) {
//获取游客登录数据
bookCityPresenter.userLogin()
} else {
bookCityPresenter.getBannerBook()
bookCityPresenter.getHotBook()
bookCityPresenter.getNewBook()
}
}
}
override fun onFragmentResume() {
// if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_TWO) {
// if (AntiShake.check(banner?.id)) return
// banner?.start()
// if (TextUtils.isEmpty(userManager?.userID)) {
// //获取游客登录数据
// bookCityPresenter.userLogin()
// } else {
// bookCityPresenter.getBannerBook()
// bookCityPresenter.getHotBook()
// bookCityPresenter.getNewBook()
// }
// }
}
override fun getHotBookSuc(data: BookListBean) {
// hotBookData.clear()
// hotBookData.addAll(data.records)
// hotBookData.removeAt(0)
// hotBookAdapter?.addHeaderView(getHotHeader(data.records[0]))
// hotBookAdapter?.setNewInstance(hotBookData)
}
override fun getHotBookFail() {}
override fun getNewBookSuc(data: BookListBean) {
newBookData.clear()
newBookData.addAll(data.records)
newBookAdapter?.setNewInstance(newBookData)
hotBookData.clear()
hotBookData.addAll(data.records)
hotBookData.removeAt(0)
hotBookAdapter?.addHeaderView(getHotHeader(data.records[0]))
hotBookAdapter?.setNewInstance(hotBookData)
}
override fun getNewBookFail() {}
override fun getBannerBookSuc(data: BookListBean) {
banner.addBannerLifecycleObserver(this)
.setAdapter(ImageTitleAdapter(data.records))
.setOnBannerListener { data2, _ ->
val bundle = Bundle()
bundle.putString(BookReadActivity.BOOK_ID, (data2 as BookBean).id)
readyGo(BookReadActivity::class.java, bundle)
}
}
override fun getBannerBookFail() {}
override fun onClick(v: View?) {
v?.let {
when (it.id) {
R.id.iv_change_hot -> {
bookCityPresenter.getHotBook()
}
R.id.iv_change_new -> {
bookCityPresenter.getNewBook()
}
R.id.view_search -> {
}
}
}
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.ui.fragment
import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import com.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.common.AppConfig
import com.mints.enjoyboxjia.common.Constant
import com.mints.enjoyboxjia.mvp.model.BookBean
import com.mints.enjoyboxjia.mvp.model.BookListBean
import com.mints.enjoyboxjia.mvp.presenters.BookShelfPresenter
import com.mints.enjoyboxjia.mvp.views.BookShelfView
import com.mints.enjoyboxjia.ui.activitys.BookReadActivity
import com.mints.enjoyboxjia.ui.activitys.MainActivity
import com.mints.enjoyboxjia.ui.adapter.BookShelfAdapter
import com.mints.enjoyboxjia.ui.adapter.LikeBookAdapter
import com.mints.enjoyboxjia.ui.fragment.base.LazyLoadBaseFragment
import com.mints.enjoyboxjia.utils.GridSpacingItemDecoration
import kotlinx.android.synthetic.main.fragment_main_bookshelf.*
class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickListener {
private val bookShelfPresenter by lazy { BookShelfPresenter() }
private val shelfBookData = arrayListOf<BookBean>()
private var bookShelfAdapter: BookShelfAdapter? = null
private var likeBookAdapter: LikeBookAdapter? = null
private var likeBookData: MutableList<BookBean> = mutableListOf()
override fun getContentViewLayoutID() = R.layout.fragment_main_bookshelf
override fun initViewsAndEvents() {
bookShelfPresenter.attachView(this)
initListener()
initLikeAdapter()
}
private fun initLikeAdapter() {
likeBookAdapter = LikeBookAdapter(requireActivity())
likeBookAdapter?.setOnItemClickListener { _, _, position ->
val bundle = Bundle()
bundle.putString(BookReadActivity.BOOK_ID, likeBookData[position].id)
readyGo(BookReadActivity::class.java, bundle)
}
rv_booklike.layoutManager = GridLayoutManager(requireContext(), 4)
val itemDecoration = GridSpacingItemDecoration(5, 10, false)
rv_booklike.addItemDecoration(itemDecoration)
rv_booklike.adapter = likeBookAdapter
}
override fun onFragmentResume() {
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_ONE) {
bookShelfPresenter.getCollectList()
bookShelfPresenter.getArticleLike()
}
}
override fun onHiddenChanged(hidden: Boolean) {
if (hidden) { // 不在最前端界面显示
onPause()
} else { // 重新显示到最前端中
onResume()
}
super.onHiddenChanged(hidden)
}
override fun onDestroy() {
super.onDestroy()
bookShelfPresenter.detachView()
}
private fun initListener() {
iv_edit.setOnClickListener(this)
iv_close.setOnClickListener(this)
iv_change.setOnClickListener(this)
}
override fun getCollectListSuc(data: BookListBean) {
shelfBookData.clear()
shelfBookData.addAll(data.records)
bookShelfAdapter?.setNewInstance(shelfBookData)
bookShelfAdapter?.setEditStyle(false)
}
override fun getCollectListFail() {
}
override fun getArticleLikeSuc(data: BookListBean) {
likeBookData.clear()
likeBookData.addAll(data.records)
likeBookAdapter?.setNewInstance(likeBookData)
}
override fun getArticleLikeFail() {
}
override fun cancelCollectSuc() {
bookShelfPresenter.getCollectList()
(requireActivity() as MainActivity).showEdit(true)
}
override fun cancelCollectFail() {
}
private fun handleEditStyle(isEdit: Boolean) {
if (isEdit) {
iv_edit.visibility = View.GONE
iv_close.visibility = View.VISIBLE
} else {
iv_edit.visibility = View.VISIBLE
iv_close.visibility = View.GONE
}
(requireActivity() as MainActivity).showEdit(isEdit)
bookShelfAdapter?.setEditStyle(isEdit)
}
// 全选
fun fullChoice() {
for (datum in shelfBookData) {
datum.isChecked = true
}
bookShelfAdapter?.notifyDataSetChanged()
}
fun delete() {
val strArr = arrayListOf<String>()
for (datum in shelfBookData) {
if (datum.isChecked) {
strArr.add("" + datum.id)
}
}
bookShelfPresenter.cancelCollect(strArr)
}
override fun onClick(v: View?) {
v?.let {
when (it.id) {
R.id.iv_edit -> {
handleEditStyle(true)
}
R.id.iv_close -> {
handleEditStyle(false)
}
R.id.iv_change -> {
bookShelfPresenter.getArticleLike()
}
}
}
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.ui.fragment
import android.text.TextUtils
import com.mints.library.utils.nodoubleclick.AntiShake
import com.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.common.AppConfig
import com.mints.enjoyboxjia.common.Constant
import com.mints.enjoyboxjia.manager.UserManager
import com.mints.enjoyboxjia.mvp.presenters.HomePresenter
import com.mints.enjoyboxjia.mvp.views.HomeView
import com.mints.enjoyboxjia.ui.fragment.base.BaseFragment
import kotlinx.android.synthetic.main.fragment_main_first.*
class MainFragment : BaseFragment(), HomeView {
private val homePresenter by lazy { HomePresenter() }
private val userManager by lazy { UserManager.getInstance() }
override fun getContentViewLayoutID() = R.layout.fragment_main_first
override fun initViewsAndEvents() {
homePresenter.attachView(this)
}
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_ONE) {
// if (AntiShake.check(iv_location?.id)) return
if (!TextUtils.isEmpty(userManager?.userID)) {
homePresenter.getMyInfo()
} else {
//获取游客登录数据
homePresenter.userLogin()
}
}
}
override fun onPause() {
super.onPause()
}
override fun onHiddenChanged(hidden: Boolean) {
if (hidden) { // 不在最前端界面显示
onPause()
} else { // 重新显示到最前端中
onResume()
}
super.onHiddenChanged(hidden)
}
override fun onDestroy() {
super.onDestroy()
homePresenter.detachView()
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.ui.widgets
import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.KeyEvent
import android.view.View
import android.view.WindowManager
import android.widget.SeekBar
import com.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.common.BookConstant
import kotlinx.android.synthetic.main.dialog_book_setting.*
class BookSettingDialog(context: Context) : Dialog(context, R.style.dialog), View.OnClickListener {
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)
// setOnKeyListener { _, i, _ ->
// i == KeyEvent.KEYCODE_BACK
// }
(seekbar as SeekBar).setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
mOnBookSettingCallback?.onFontSize(progress)
tv_seek.text = "$progress"
}
override fun onStartTrackingTouch(seekBar: SeekBar?) {}
override fun onStopTrackingTouch(seekBar: SeekBar?) {}
})
rb_color1.setOnClickListener(this)
rb_color2.setOnClickListener(this)
rb_color3.setOnClickListener(this)
rb_color4.setOnClickListener(this)
rb_color5.setOnClickListener(this)
rb_color6.setOnClickListener(this)
}
override fun onClick(v: View?) {
when (v?.id) {
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)
}
}
}
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.mints.enjoyboxjia.utils
import android.content.Context
import com.mints.enjoyboxjia.mvp.model.CosumerAddressEntity
import com.mints.enjoyboxjia.mvp.model.JsonBean
import com.mints.enjoyboxjia.mvp.model.MainMultiItemEntity
import com.mints.enjoyboxjia.mvp.model.ProvinceCosumer
import com.google.gson.Gson
import org.json.JSONArray
object AddressData {
private var cosumerAddressEntity: CosumerAddressEntity? = null
/**
* 解析省市区
*/
fun getJsonData(context: Context): MainMultiItemEntity {
val data = MainMultiItemEntity()
try {
val options2Items = arrayListOf<ArrayList<String>>()
val options3Items = arrayListOf<ArrayList<ArrayList<String>>>()
//解析数据
val JsonData: String = GetJsonDataUtil().getJson(context, "province.json")
val jsonBean: ArrayList<JsonBean> = parseData(JsonData)
data.options1Items = jsonBean
for (i in jsonBean.indices) { //遍历省份
val cityList = ArrayList<String>() //该省的城市列表(第二级)
val province_AreaList = ArrayList<ArrayList<String>>() //该省的所有地区列表(第三极)
for (c in 0 until jsonBean[i].cityList.size) { //遍历该省份的所有城市
val cityName = jsonBean[i].cityList[c].name
cityList.add(cityName) //添加城市
val city_AreaList = ArrayList<String>() //该城市的所有地区列表
//如果无地区数据,建议添加空字符串,防止数据为null 导致三个选项长度不匹配造成崩溃
if (jsonBean[i].cityList[c].area == null
|| jsonBean[i].cityList[c].area.size == 0
) {
city_AreaList.add("")
} else {
city_AreaList.addAll(jsonBean[i].cityList[c].area);
}
// city_AreaList.addAll(jsonBean[i].cityList[c].area)
province_AreaList.add(city_AreaList) //添加该省所有地区数据
}
/**
* 添加城市数据
*/
options2Items.add(cityList)
/**
* 添加地区数据
*/
options3Items.add(province_AreaList)
}
data.options2Items = options2Items
data.options3Items = options3Items
} catch (e: Exception) {
e.printStackTrace()
}
return data
}
/**
* 解析省市
*/
fun getJsonDataForProvince(context: Context): MainMultiItemEntity {
val data = MainMultiItemEntity()
try {
//解析数据
data.options1Items = parseData(GetJsonDataUtil().getJson(context, "province.json"))
} catch (e: Exception) {
e.printStackTrace()
}
return data
}
private fun parseData(result: String?): ArrayList<JsonBean> { //Gson 解析
val detail = arrayListOf<JsonBean>()
try {
val data = JSONArray(result)
val gson = Gson()
for (i in 0 until data.length()) {
val entity = gson.fromJson(data.optJSONObject(i).toString(), JsonBean::class.java)
detail.add(entity)
}
} catch (e: Exception) {
e.printStackTrace()
}
return detail
}
fun setLocalCosumerAddress(item: ArrayList<JsonBean>) {
try {
cosumerAddressEntity = CosumerAddressEntity()
var options1Items = ArrayList<ProvinceCosumer>()
var options2Items = ArrayList<ArrayList<String>>()
for (i in 0 until item.size) {
val provinceTest =
ProvinceCosumer(
i.toLong(),
item[i].name,
"描述部分",
"其他数据"
)
val cityListTemp = arrayListOf<String>()
for (j in 0 until item[i].cityList.size) {
cityListTemp.add(item[i].cityList[j].name)
}
options1Items.add(provinceTest)
options2Items.add(cityListTemp)
}
cosumerAddressEntity?.options1Items = options1Items
cosumerAddressEntity?.options2Items = options2Items
} catch (e: Exception) {
e.printStackTrace()
}
}
fun getLocalCosumerAddress() = cosumerAddressEntity
}
\ No newline at end of file
package com.mints.enjoyboxjia.utils;
import android.graphics.Rect;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
public class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
private int spanCount;
private int spacing;
private boolean includeEdge;
public GridSpacingItemDecoration(int spanCount, int spacing, boolean includeEdge) {
this.spanCount = spanCount;
this.spacing = spacing;
this.includeEdge = includeEdge;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
int position = parent.getChildAdapterPosition(view);
int column = position % spanCount;
if (includeEdge) {
outRect.left = spacing - column * spacing / spanCount; // spacing - column * ((1f / spanCount) * spacing)
outRect.right = (column + 1) * spacing / spanCount; // (column + 1) * ((1f / spanCount) * spacing)
if (position < spanCount) { // top edge
outRect.top = spacing;
}
outRect.bottom = spacing; // item bottom
} else {
outRect.left = column * spacing / spanCount; // column * ((1f / spanCount) * spacing)
outRect.right = spacing - (column + 1) * spacing / spanCount; // spacing - (column + 1) * ((1f / spanCount) * spacing)
if (position >= spanCount) {
outRect.top = spacing; // item top
}
}
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.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
...@@ -111,7 +111,7 @@ object GlideUtils { ...@@ -111,7 +111,7 @@ object GlideUtils {
Glide.with(mContext!!).load(path).apply( Glide.with(mContext!!).load(path).apply(
RequestOptions().transform( RequestOptions().transform(
CenterCrop(), CenterCrop(),
RoundedCorners(BubbleUtils.dp2px(20)) RoundedCorners(BubbleUtils.dp2px(10))
) )
).dontAnimate().into(mImageView!!) ).dontAnimate().into(mImageView!!)
} }
......
<?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
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Non focused states --> <!-- Non focused states -->
<item android:color="@color/main_mints" android:state_selected="true" /> <item android:color="@color/red_F1413C" android:state_selected="true" />
<item android:color="@color/color_8D8F90" android:state_selected="false" /> <item android:color="@color/color_8D8F90" android:state_selected="false" />
</selector> </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_color1_s" android:state_checkable="true" android:state_selected="true" />
<item android:drawable="@drawable/shape_book_content_color1" android:state_checkable="false" android:state_selected="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_checkable="true" android:state_selected="true" />
<item android:drawable="@drawable/shape_book_content_color2" android:state_checkable="false" android:state_selected="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_checkable="true" android:state_selected="true" />
<item android:drawable="@drawable/shape_book_content_color3" android:state_checkable="false" android:state_selected="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_checkable="true" android:state_selected="true" />
<item android:drawable="@drawable/shape_book_content_color4" android:state_checkable="false" android:state_selected="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_checkable="true" android:state_selected="true" />
<item android:drawable="@drawable/shape_book_content_color5" android:state_checkable="false" android:state_selected="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_checkable="true" android:state_selected="true" />
<item android:drawable="@drawable/shape_book_content_color6" android:state_checkable="false" android:state_selected="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="@mipmap/ic_cb_selected" android:state_checked="true" />
<item android:drawable="@mipmap/ic_cb_selected" android:state_selected="true" />
<item android:drawable="@mipmap/ic_cb_selected" android:state_pressed="true" />
<item android:drawable="@mipmap/ic_cb_unselected" 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="@mipmap/bookcity_s" android:state_selected="true" />
<item android:drawable="@mipmap/bookcity" android:state_selected="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="@mipmap/bookshelf_s" android:state_selected="true" />
<item android:drawable="@mipmap/bookshelf" android:state_selected="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="@mipmap/bookstore_s" android:state_selected="true" />
<item android:drawable="@mipmap/bookstore" android:state_selected="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="@mipmap/my_s" android:state_selected="true" />
<item android:drawable="@mipmap/my" android:state_selected="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" />
<stroke
android:width="1dp"
android:color="@color/color_FFE2E2" />
<corners android:radius="40dp" />
</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"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<com.github.mikephil.charting.charts.LineChart
android:id="@+id/lineChart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<com.github.mikephil.charting.charts.BarChart
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<ImageView
android:id="@+id/btn_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_margin="20dp"
android:background="@drawable/shape_main"
android:padding="4dp"
android:src="@mipmap/ic_close" />
</RelativeLayout>
<?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: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: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: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:src="@drawable/selector_tab_bookshelf" />
<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="@drawable/selector_tab_bookshelf" />
<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">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:contentDescription="@null"
android:src="@drawable/selector_tab_bookshelf" />
<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>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="@color/white"
android:orientation="vertical">
<include layout="@layout/header_layout" />
<com.mints.enjoyboxjia.ui.widgets.ElasticScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:overScrollMode="never">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:background="@drawable/shape_bg_write"
android:elevation="2dp"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="36dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="热门推荐"
android:textColor="@color/black"
android:textSize="18sp" />
<TextView
android:id="@+id/iv_change"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="换一换" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_hot"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</com.mints.enjoyboxjia.ui.widgets.ElasticScrollView>
</LinearLayout>
...@@ -26,89 +26,85 @@ ...@@ -26,89 +26,85 @@
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout
android:id="@+id/tab_rl_main" android:id="@+id/tab_rl_bookshelf"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1.0" android:layout_weight="1.0"
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
<ImageView
android:id="@+id/tab_iv_bookshelf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:contentDescription="@null"
android:src="@drawable/selector_tab_bookshelf" />
<TextView <TextView
android:id="@+id/tab_tv_main" android:id="@+id/tab_tv_bookshelf"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="1dp" android:layout_marginTop="1dp"
android:text="@string/bottom_tab_loan" android:text="@string/bottom_tab_loan"
android:textColor="@drawable/item_txt_sel" android:textColor="@drawable/item_txt_sel"
android:textSize="16sp" /> android:textSize="14sp" />
<ImageView
android:id="@+id/tab_iv_main"
android:layout_width="30dp"
android:layout_height="4dp"
android:layout_marginTop="4dp"
android:contentDescription="@null"
android:src="@mipmap/ic_line" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/tab_rl_find" android:id="@+id/tab_rl_bookcity"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1.0" android:layout_weight="1.0"
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
<ImageView
android:id="@+id/tab_iv_bookcity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:contentDescription="@null"
android:src="@drawable/selector_tab_bookcity" />
<TextView <TextView
android:id="@+id/tab_tv_find" android:id="@+id/tab_tv_bookcity"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="1dp" android:layout_marginTop="1dp"
android:text="@string/bottom_tab_find" android:text="@string/bottom_tab_find"
android:textColor="@drawable/item_txt_sel" android:textColor="@drawable/item_txt_sel"
android:textSize="16sp" /> android:textSize="14sp" />
<ImageView
android:id="@+id/tab_iv_find"
android:layout_width="30dp"
android:layout_height="4dp"
android:layout_marginTop="4dp"
android:contentDescription="@null"
android:src="@mipmap/ic_line" />
</LinearLayout> </LinearLayout>
<ImageView
android:visibility="gone"
android:id="@+id/tab_iv_center"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginBottom="20dp"
android:src="@mipmap/ic_launcher_main" />
<LinearLayout <LinearLayout
android:id="@+id/tab_rl_read" android:id="@+id/tab_rl_bookstore"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1.0" android:layout_weight="1.0"
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
<ImageView
android:id="@+id/tab_iv_bookstore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:contentDescription="@null"
android:src="@drawable/selector_tab_bookstore" />
<TextView <TextView
android:id="@+id/tab_tv_read" android:id="@+id/tab_tv_bookstore"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="1dp" android:layout_marginTop="1dp"
android:text="@string/bottom_tab_read" android:text="@string/bottom_tab_read"
android:textColor="@drawable/item_txt_sel" android:textColor="@drawable/item_txt_sel"
android:textSize="16sp" /> android:textSize="14sp" />
<ImageView
android:id="@+id/tab_iv_read"
android:layout_width="30dp"
android:layout_height="4dp"
android:layout_marginTop="4dp"
android:contentDescription="@null"
android:src="@mipmap/ic_line" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
...@@ -119,6 +115,14 @@ ...@@ -119,6 +115,14 @@
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
<ImageView
android:id="@+id/tab_iv_my"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:contentDescription="@null"
android:src="@drawable/selector_tab_my" />
<TextView <TextView
android:id="@+id/tab_tv_my" android:id="@+id/tab_tv_my"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -127,16 +131,40 @@ ...@@ -127,16 +131,40 @@
android:layout_marginTop="1dp" android:layout_marginTop="1dp"
android:text="@string/bottom_tab_my" android:text="@string/bottom_tab_my"
android:textColor="@drawable/item_txt_sel" android:textColor="@drawable/item_txt_sel"
android:textSize="16sp" /> android:textSize="14sp" />
<ImageView
android:id="@+id/tab_iv_my" </LinearLayout>
android:layout_width="30dp"
android:layout_height="4dp"
android:layout_marginTop="4dp"
android:contentDescription="@null"
android:src="@mipmap/ic_line" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/ll_edit"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_alignParentBottom="true"
android:background="@color/white"
android:elevation="2dp"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:id="@+id/tv_full"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="全选"
android:textColor="@color/black" />
<TextView
android:id="@+id/tv_delete"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="删除"
android:textColor="@color/red" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
<?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="@color/white"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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:max="24"
android:maxHeight="5dp"
android:min="14"
android:minHeight="5dp"
android:progress="17" />
<TextView
android:id="@+id/tv_seek"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="17"
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" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center_horizontal"
android:orientation="horizontal">
<CheckBox
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" />
<CheckBox
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" />
<CheckBox
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" />
<CheckBox
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" />
<CheckBox
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" />
<CheckBox
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" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:attrs="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
</androidx.core.widget.NestedScrollView>
\ No newline at end of file
<com.mints.enjoyboxjia.ui.widgets.ElasticScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:overScrollMode="never">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="20dp">
<LinearLayout
android:id="@+id/view_search"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_margin="15dp"
android:background="@drawable/shape_bg_search"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginStart="15dp"
android:src="@mipmap/ic_search" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="搜索"
android:textColor="#A5A5AD"
android:textSize="14sp" />
</LinearLayout>
<com.youth.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:background="@drawable/shape_bg_write"
android:elevation="2dp"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="36dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="热门推荐"
android:textColor="@color/black"
android:textSize="18sp" />
<TextView
android:id="@+id/iv_change_hot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="换一换" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_hotbook"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="15dp"
android:background="@drawable/shape_bg_write"
android:elevation="2dp"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="36dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="新书推荐"
android:textColor="@color/black"
android:textSize="18sp" />
<TextView
android:id="@+id/iv_change_new"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="换一换" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_newbook"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</com.mints.enjoyboxjia.ui.widgets.ElasticScrollView>
<com.mints.enjoyboxjia.ui.widgets.ElasticScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:background="@drawable/shape_bg_write"
android:elevation="2dp"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="36dp"
android:layout_height="40dp"
android:src="@mipmap/readtext" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_edit"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@mipmap/edit" />
<ImageView
android:id="@+id/iv_close"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@mipmap/close"
android:visibility="gone" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_bookshelf"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="15dp"
android:background="@drawable/shape_bg_write"
android:elevation="2dp"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="36dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="猜你喜欢"
android:textColor="@color/black"
android:textSize="18sp" />
<TextView
android:id="@+id/iv_change"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="换一换" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_booklike"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</com.mints.enjoyboxjia.ui.widgets.ElasticScrollView>
\ 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="@color/white">
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="216dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="6dp"
android:orientation="vertical">
<ImageView
android:id="@+id/image_iv"
android:layout_width="match_parent"
android:layout_height="150dp"
android:scaleType="centerCrop"
android:src="@mipmap/ic_launcher_main"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/title_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:lines="2"
android:text="我去平行时空"
android:textColor="@color/black"
android:textSize="13sp"
app:layout_constraintStart_toStartOf="@id/image_iv"
app:layout_constraintTop_toBottomOf="@id/image_iv" />
<TextView
android:id="@+id/label_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:ellipsize="end"
android:maxLines="1"
android:text="重回80年代"
android:textColor="@color/gray"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="@id/image_iv"
app:layout_constraintTop_toBottomOf="@id/title_tv" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="178dp"
android:orientation="vertical"
android:paddingTop="6dp"
android:paddingBottom="6dp">
<ImageView
android:id="@+id/image_iv"
android:layout_width="match_parent"
android:layout_height="110dp"
android:scaleType="centerCrop"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/title_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:lines="2"
android:text="我去平行时空"
android:textColor="@color/black"
android:textSize="13sp"
app:layout_constraintStart_toStartOf="@id/image_iv"
app:layout_constraintTop_toBottomOf="@id/image_iv" />
<TextView
android:id="@+id/label_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:ellipsize="end"
android:maxLines="1"
android:text="重回80年代"
android:textColor="@color/gray"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="@id/image_iv"
app:layout_constraintTop_toBottomOf="@id/title_tv" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="206dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="6dp"
android:orientation="vertical"
android:paddingLeft="5dp"
android:paddingRight="5dp">
<ImageView
android:id="@+id/image_iv"
android:layout_width="match_parent"
android:layout_height="150dp"
android:scaleType="centerCrop"
android:src="@mipmap/ic_launcher_main"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/title_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:ellipsize="end"
android:maxLines="1"
android:text="重回80年代"
android:textColor="@color/black"
app:layout_constraintStart_toStartOf="@id/image_iv"
app:layout_constraintTop_toBottomOf="@id/image_iv" />
<TextView
android:id="@+id/info_tv"
android:layout_width="106dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:ellipsize="end"
android:maxLines="1"
android:text="重回80年代"
android:textColor="@color/gray"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="@id/image_iv"
app:layout_constraintTop_toBottomOf="@id/title_tv" />
<FrameLayout
android:id="@+id/fm_mask"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<CheckBox
android:id="@+id/cb"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:button="@null"
android:drawableEnd="@drawable/selector_cb"
android:minWidth="100dp"
android:paddingTop="10dp"
android:paddingEnd="6dp"
android:paddingBottom="170dp" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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="126dp"
android:layout_marginBottom="6dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/image_iv"
android:layout_width="90dp"
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="6dp"
android:lines="2"
android:text="我去平行时空"
android:textColor="@color/black"
android:textSize="14sp" />
<TextView
android:id="@+id/info_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
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="12dp"
android:ellipsize="end"
android:maxLines="1"
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:layout_width="match_parent"
android:layout_height="126dp"
android:layout_marginBottom="6dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/image_iv"
android:layout_width="0dp"
android:layout_height="126dp"
android:layout_weight="1"
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="6dp"
android:lines="2"
android:text="我去平行时空"
android:textColor="@color/black"
android:textSize="14sp" />
<TextView
android:id="@+id/info_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
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="12dp"
android:ellipsize="end"
android:maxLines="1"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
...@@ -25,6 +25,25 @@ ...@@ -25,6 +25,25 @@
<color name="color_8B560F">#8B560F</color> <color name="color_8B560F">#8B560F</color>
<color name="red_e73a3d">#e73a3d</color> <color name="red_e73a3d">#e73a3d</color>
<color name="half_transparent">#80000000</color> <color name="half_transparent">#80000000</color>
<color name="red_F1413C">#F1413C</color>
<color name="id_photo_gray">#E0E4E7</color> <color name="id_photo_gray">#E0E4E7</color>
<color name="color_815136">#815136</color> <color name="color_815136">#815136</color>
<color name="color_FFE2E2">#FFE2E2</color>
<color name="color_FEF3F3">#FEF3F3</color>
<color name="color_F1413C">#F1413C</color>
<color name="color_378eff">#378eff</color>
<color name="color_goldenrod">#daa520</color>
<color name="color_956244">#956244</color>
<color name="book_content_color1">#fff</color>
<color name="book_content_color2">#e7e7e7</color>
<color name="book_content_color3">#d4e0c6</color>
<color name="book_content_color4">#ccd8e4</color>
<color name="book_content_color5">#f9d4d4</color>
<color name="book_content_color6">#b1b1b1</color>
</resources> </resources>
\ No newline at end of file
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
<string name="cancel">取消</string> <string name="cancel">取消</string>
<string name="dialog_pos_text1">当前应用缺少 </string> <string name="dialog_pos_text1">当前应用缺少 </string>
<string name="dialog_pos_text2">授权\n\n请点击 设置-权限-打开所需权限 </string> <string name="dialog_pos_text2">授权\n\n请点击 设置-权限-打开所需权限 </string>
<string name="bottom_tab_loan">首页</string> <string name="bottom_tab_loan">书架</string>
<string name="bottom_tab_find">账单</string> <string name="bottom_tab_find">书城</string>
<string name="bottom_tab_read">统计</string> <string name="bottom_tab_read">书库</string>
<string name="bottom_tab_my">我的</string> <string name="bottom_tab_my">我的</string>
<string name="common_loading_message">正在加载</string> <string name="common_loading_message">正在加载</string>
<string name="common_empty_msg">抱歉,暂未获取到数据!\n请点击屏幕重试~</string> <string name="common_empty_msg">抱歉,暂未获取到数据!\n请点击屏幕重试~</string>
......
...@@ -80,4 +80,9 @@ ...@@ -80,4 +80,9 @@
<item name="android:windowContentOverlay">@null</item> <item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</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>
...@@ -4,7 +4,8 @@ buildscript { ...@@ -4,7 +4,8 @@ buildscript {
repositories { repositories {
google() google()
mavenCentral() // Maven Central repository mavenCentral() // Maven Central repository
jcenter() // jcenter()
maven { url "https://maven.aliyun.com/repository/jcenter" }
maven { url "https://jitpack.io" } maven { url "https://jitpack.io" }
maven { url "https://s01.oss.sonatype.org/content/groups/public" } maven { url "https://s01.oss.sonatype.org/content/groups/public" }
maven { url 'https://repo1.maven.org/maven2/' } maven { url 'https://repo1.maven.org/maven2/' }
...@@ -26,14 +27,16 @@ buildscript { ...@@ -26,14 +27,16 @@ buildscript {
classpath 'com.android.tools.build:gradle:7.1.1' classpath 'com.android.tools.build:gradle:7.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// sharesdk // sharesdk
classpath "com.mob.sdk:MobSDK:2018.0319.1724" // classpath "com.mob.sdk:MobSDK:2018.0319.1724"
classpath "com.mob.sdk:MobSDK:+"
} }
} }
allprojects { allprojects {
repositories { repositories {
google() google()
jcenter() // jcenter()
maven { url "https://maven.aliyun.com/repository/jcenter" }
mavenCentral() // Maven Central repository mavenCentral() // Maven Central repository
maven { url "https://jitpack.io" } maven { url "https://jitpack.io" }
maven { url "https://s01.oss.sonatype.org/content/groups/public" } maven { url "https://s01.oss.sonatype.org/content/groups/public" }
......
<?xml version="1.0" encoding="utf-8"?>
<DevInfor>
<Wechat AppId="null" AppSecret="null" UserName="gh_afb25ac019c9" Path="pages/index/index.html?id=1" WithShareTicket="true" MiniprogramType="0" />
<WechatMoments AppId="null" AppSecret="null" />
</DevInfor>
\ No newline at end of file
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