parent
ae15e8e9ff
commit
40d0895e2b
|
|
@ -56,10 +56,10 @@ class LiteApi private constructor(context: Context) {
|
|||
}
|
||||
|
||||
override fun onSuccess(statusCode: Int, response: NewUpdateBean) {
|
||||
if (response.isSuccess) {
|
||||
if (response.isSuccess == true) {
|
||||
apiCallback.onSuccess(response)
|
||||
} else {
|
||||
apiCallback.onFailure(response.errorCode, response.errorMsg)
|
||||
response.errorCode?.let { apiCallback.onFailure(it, response.errorMsg) }
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ import com.huanchengfly.tieba.post.models.ErrorBean
|
|||
|
||||
class ForumPageBean : ErrorBean() {
|
||||
var forum: ForumBean? = null
|
||||
private set
|
||||
var anti: AntiBean? = null
|
||||
private set
|
||||
var user: UserBean? = null
|
||||
var page: PageBean? = null
|
||||
|
||||
|
|
@ -90,6 +92,11 @@ class ForumPageBean : ErrorBean() {
|
|||
return this
|
||||
}
|
||||
|
||||
fun setIsExists(isExists: String?): ForumBean {
|
||||
this.isExists = isExists
|
||||
return this
|
||||
}
|
||||
|
||||
class SignInInfo {
|
||||
@SerializedName("user_info")
|
||||
val userInfo: UserInfo? = null
|
||||
|
|
|
|||
|
|
@ -26,22 +26,29 @@ class SearchForumBean : BaseBean() {
|
|||
open class ForumInfoBean {
|
||||
@SerializedName("forum_id")
|
||||
var forumId: Int? = null
|
||||
private set
|
||||
|
||||
@SerializedName("forum_name")
|
||||
var forumName: String? = null
|
||||
private set
|
||||
|
||||
@SerializedName("forum_name_show")
|
||||
var forumNameShow: String? = null
|
||||
private set
|
||||
var avatar: String? = null
|
||||
private set
|
||||
|
||||
@SerializedName("post_num")
|
||||
var postNum: String? = null
|
||||
private set
|
||||
|
||||
@SerializedName("concern_num")
|
||||
var concernNum: String? = null
|
||||
private set
|
||||
|
||||
@SerializedName("has_concerned")
|
||||
var hasConcerned: Int? = null
|
||||
private set
|
||||
|
||||
fun setForumId(forumId: Int): ForumInfoBean {
|
||||
this.forumId = forumId
|
||||
|
|
|
|||
|
|
@ -31,18 +31,25 @@ class SearchUserBean : BaseBean() {
|
|||
|
||||
class UserBean {
|
||||
var id: String? = null
|
||||
private set
|
||||
var intro: String? = null
|
||||
private set
|
||||
|
||||
@SerializedName("user_nickname")
|
||||
var userNickname: String? = null
|
||||
private set
|
||||
var name: String? = null
|
||||
private set
|
||||
var portrait: String? = null
|
||||
private set
|
||||
|
||||
@SerializedName("fans_num")
|
||||
var fansNum: String? = null
|
||||
private set
|
||||
|
||||
@SerializedName("has_concerned")
|
||||
var hasConcerned = 0
|
||||
private set
|
||||
|
||||
fun setId(id: String?): UserBean {
|
||||
this.id = id
|
||||
|
|
|
|||
|
|
@ -460,8 +460,8 @@ class ForumActivity : BaseActivity(), View.OnClickListener, OnRefreshedListener
|
|||
|
||||
override fun onResponse(call: Call<ForumPageBean>, response: Response<ForumPageBean>) {
|
||||
val forumPageBean = response.body()!!
|
||||
mDataBean!!.forum = forumPageBean.forum
|
||||
mDataBean!!.anti = forumPageBean.anti
|
||||
mDataBean!!.setForum(forumPageBean.forum)
|
||||
mDataBean!!.setAnti(forumPageBean.anti)
|
||||
refreshHeaderView()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -369,20 +369,20 @@ open class MainActivity : BaseActivity(), BottomNavigationView.OnNavigationItemS
|
|||
instance!!.newCheckUpdate(object : CommonAPICallback<NewUpdateBean?> {
|
||||
override fun onSuccess(data: NewUpdateBean?) {
|
||||
if (data != null) {
|
||||
if (data.isHasUpdate) {
|
||||
val cancelable = data.result.isCancelable
|
||||
if (data.isHasUpdate!!) {
|
||||
val cancelable = data.result?.isCancelable
|
||||
val ignored = SharedPreferencesUtil.get(this@MainActivity, SharedPreferencesUtil.SP_IGNORE_VERSIONS)
|
||||
.getBoolean(data.result.versionName + "_" + data.result.versionCode, false)
|
||||
if (ignored && cancelable) {
|
||||
.getBoolean(data.result?.versionName + "_" + (data.result?.versionCode), false)
|
||||
if (ignored && cancelable!!) {
|
||||
return
|
||||
}
|
||||
val builder = SpannableStringBuilder()
|
||||
if (data.result.versionType == 1) {
|
||||
if (data.result?.versionType == 1) {
|
||||
val betaTip = getString(R.string.tip_beta_version)
|
||||
builder.append(betaTip, ForegroundColorSpan(resources.getColor(R.color.red, null)), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
builder.setSpan(StyleSpan(Typeface.BOLD), 0, betaTip.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
}
|
||||
for (content in data.result.updateContent) {
|
||||
for (content in data.result?.updateContent!!) {
|
||||
builder.append(content)
|
||||
builder.append("\n")
|
||||
}
|
||||
|
|
@ -390,7 +390,7 @@ open class MainActivity : BaseActivity(), BottomNavigationView.OnNavigationItemS
|
|||
.setTitle(getString(R.string.title_dialog_update, data.result.versionName))
|
||||
.setMessage(builder)
|
||||
.setPositiveButton(R.string.button_go_to_download) { _: DialogInterface?, _: Int -> VersionUtil.showDownloadDialog(this@MainActivity, data.result) }
|
||||
.setCancelable(cancelable)
|
||||
.setCancelable(cancelable!!)
|
||||
if (cancelable) {
|
||||
dialogBuilder.setNegativeButton(R.string.button_next_time, null)
|
||||
dialogBuilder.setNeutralButton(R.string.button_ignore_this_version) { _: DialogInterface?, _: Int ->
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
|
||||
private fun refreshTitle() {
|
||||
if (dataBean != null && dataBean!!.thread != null && isTitleVisible) {
|
||||
toolbar.title = dataBean!!.thread.title
|
||||
toolbar.title = dataBean!!.thread?.title
|
||||
//toolbar.setSubtitle(getString(R.string.title_forum, dataBean.getForum().getName()));
|
||||
} else {
|
||||
toolbar.title = null
|
||||
|
|
@ -266,7 +266,7 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
}
|
||||
|
||||
fun hasMore(): Boolean {
|
||||
if (dataBean!!.page.hasMore != "1") {
|
||||
if (dataBean!!.page?.hasMore != "1") {
|
||||
mAdapter.loadEnd()
|
||||
return false
|
||||
}
|
||||
|
|
@ -275,8 +275,8 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
|
||||
private fun loadMoreSuccess(threadContentBean: ThreadContentBean) {
|
||||
dataBean = threadContentBean
|
||||
page = Integer.valueOf(threadContentBean.page.currentPage)
|
||||
totalPage = Integer.valueOf(threadContentBean.page.totalPage)
|
||||
page = Integer.valueOf(threadContentBean.page?.currentPage!!)
|
||||
totalPage = Integer.valueOf(threadContentBean.page.totalPage!!)
|
||||
mAdapter.addData(dataBean!!)
|
||||
hasMore()
|
||||
invalidateOptionsMenu()
|
||||
|
|
@ -324,15 +324,15 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
|
||||
private fun refreshSuccess(threadContentBean: ThreadContentBean) {
|
||||
dataBean = threadContentBean
|
||||
page = Integer.valueOf(threadContentBean.page.currentPage)
|
||||
totalPage = Integer.valueOf(threadContentBean.page.totalPage)
|
||||
page = Integer.valueOf(threadContentBean.page?.currentPage!!)
|
||||
totalPage = Integer.valueOf(threadContentBean.page.totalPage!!)
|
||||
mAdapter.reset()
|
||||
mAdapter.setData(threadContentBean)
|
||||
setTitle(threadContentBean.thread.title)
|
||||
title = threadContentBean.thread?.title
|
||||
collect = threadContentBean.thread != null && "0" != threadContentBean.thread.collectStatus
|
||||
agree = threadContentBean.thread != null && threadContentBean.thread.agree != null && "0" != threadContentBean.thread.agree.hasAgree
|
||||
agreeNumTextView.text = threadContentBean.thread.agreeNum
|
||||
agreeNum = Integer.valueOf(if (TextUtils.isEmpty(threadContentBean.thread.agreeNum)) "0" else threadContentBean.thread.agreeNum)
|
||||
agree = threadContentBean.thread?.agree != null && "0" != threadContentBean.thread.agree.hasAgree
|
||||
agreeNumTextView.text = threadContentBean.thread?.agreeNum
|
||||
agreeNum = Integer.valueOf(if (TextUtils.isEmpty(threadContentBean.thread?.agreeNum)) "0" else threadContentBean.thread?.agreeNum!!)
|
||||
invalidateOptionsMenu()
|
||||
hasMore()
|
||||
refreshLayout.isRefreshing = false
|
||||
|
|
@ -416,7 +416,7 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
.show()
|
||||
}
|
||||
}
|
||||
if (pid != threadContentBean.postList[0].id) {
|
||||
if (pid != threadContentBean.postList?.get(0)?.id) {
|
||||
val position = mAdapter.allData.indexOf(postListItemBean)
|
||||
if (position >= 0) mLayoutManager.scrollToPositionWithOffset(position, 0)
|
||||
}
|
||||
|
|
@ -444,8 +444,8 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
override fun onResponse(call: Call<ThreadContentBean>, response: Response<ThreadContentBean>) {
|
||||
val threadContentBean = response.body()!!
|
||||
dataBean = threadContentBean
|
||||
page = Integer.valueOf(threadContentBean.page.currentPage)
|
||||
totalPage = Integer.valueOf(threadContentBean.page.totalPage)
|
||||
page = Integer.valueOf(threadContentBean.page?.currentPage!!)
|
||||
totalPage = Integer.valueOf(threadContentBean.page.totalPage!!)
|
||||
refresh(pid)
|
||||
}
|
||||
|
||||
|
|
@ -476,18 +476,18 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
}
|
||||
|
||||
private fun isLz(postListItemBean: PostListItemBean?): Boolean {
|
||||
return dataBean!!.thread != null && dataBean!!.thread.author != null && postListItemBean != null &&
|
||||
TextUtils.equals(dataBean!!.thread.author.id, postListItemBean.authorId)
|
||||
return dataBean!!.thread != null && dataBean!!.thread?.author != null && postListItemBean != null &&
|
||||
TextUtils.equals(dataBean!!.thread?.author?.id, postListItemBean.authorId)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.menu_report -> navigationHelper!!.navigationByData(NavigationHelper.ACTION_URL,
|
||||
getString(R.string.url_post_report,
|
||||
dataBean!!.forum.id,
|
||||
dataBean!!.thread.threadId,
|
||||
dataBean!!.thread.postId))
|
||||
R.id.menu_share -> TiebaUtil.shareText(this, url, if (dataBean == null) null else dataBean!!.thread.title)
|
||||
dataBean!!.forum?.id,
|
||||
dataBean!!.thread?.threadId,
|
||||
dataBean!!.thread?.postId))
|
||||
R.id.menu_share -> TiebaUtil.shareText(this, url, if (dataBean == null) null else dataBean!!.thread?.title)
|
||||
R.id.menu_jump_page -> {
|
||||
val dialog = EditTextDialog(this)
|
||||
.setInputType(InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_VARIATION_NORMAL)
|
||||
|
|
@ -511,7 +511,7 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
if (postListItemBean == null || !isLz(postListItemBean)) {
|
||||
refresh()
|
||||
} else {
|
||||
refreshByPid(postListItemBean.id)
|
||||
refreshByPid(postListItemBean.id!!)
|
||||
}
|
||||
}
|
||||
R.id.menu_sort -> {
|
||||
|
|
@ -528,7 +528,7 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
} else {
|
||||
mAdapter.isImmersive = false
|
||||
}
|
||||
R.id.menu_delete -> TiebaApi.getInstance().delThread(dataBean!!.forum.id, dataBean!!.forum.name, dataBean!!.thread.id, dataBean!!.anti.tbs).enqueue(object : Callback<CommonResponse> {
|
||||
R.id.menu_delete -> TiebaApi.getInstance().delThread(dataBean!!.forum?.id!!, dataBean!!.forum?.name!!, dataBean!!.thread?.id!!, dataBean!!.anti?.tbs!!).enqueue(object : Callback<CommonResponse> {
|
||||
override fun onFailure(call: Call<CommonResponse>, t: Throwable) {
|
||||
Toast.makeText(this@ThreadActivity, getString(R.string.toast_delete_error, t.message), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
|
@ -542,7 +542,7 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
R.id.menu_collect -> {
|
||||
if (dataBean != null) {
|
||||
if (collect) {
|
||||
TiebaApi.getInstance().removeStore(tid!!, dataBean!!.anti.tbs).enqueue(object : Callback<CommonResponse> {
|
||||
TiebaApi.getInstance().removeStore(tid!!, dataBean!!.anti?.tbs!!).enqueue(object : Callback<CommonResponse> {
|
||||
override fun onFailure(call: Call<CommonResponse>, t: Throwable) {
|
||||
Toast.makeText(this@ThreadActivity, getString(R.string.toast_collect_remove_error, t.message), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
|
@ -601,7 +601,7 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
private fun collect(commonAPICallback: CommonAPICallback<CommonResponse>?, update: Boolean) {
|
||||
if (dataBean == null || tid == null) return
|
||||
val postListItemBean = lastVisibleItem ?: return
|
||||
TiebaApi.getInstance().addStore(tid!!, postListItemBean.id, tbs = dataBean!!.anti.tbs).enqueue(object : Callback<CommonResponse> {
|
||||
TiebaApi.getInstance().addStore(tid!!, postListItemBean.id!!, tbs = dataBean!!.anti?.tbs!!).enqueue(object : Callback<CommonResponse> {
|
||||
override fun onFailure(call: Call<CommonResponse>, t: Throwable) {
|
||||
if (t is TiebaException) {
|
||||
commonAPICallback?.onFailure(t.code, t.message)
|
||||
|
|
@ -615,7 +615,7 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
}
|
||||
|
||||
})
|
||||
if (!update) Util.miuiFav(this, getString(R.string.title_miui_fav, dataBean!!.thread.title), url)
|
||||
if (!update) Util.miuiFav(this, getString(R.string.title_miui_fav, dataBean!!.thread?.title), url)
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
|
|
@ -665,7 +665,7 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
} else {
|
||||
itemPure.setTitle(R.string.title_pure_read)
|
||||
}
|
||||
itemDelete.isVisible = dataBean != null && TextUtils.equals(dataBean!!.user.id, dataBean!!.thread.author.id)
|
||||
itemDelete.isVisible = dataBean != null && TextUtils.equals(dataBean!!.user?.id, dataBean!!.thread?.author?.id)
|
||||
return super.onPrepareOptionsMenu(menu)
|
||||
}
|
||||
|
||||
|
|
@ -682,11 +682,11 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
val history = History()
|
||||
.setData(tid)
|
||||
.setExtras(extras)
|
||||
.setTitle(dataBean!!.thread.title)
|
||||
.setTitle(dataBean!!.thread?.title)
|
||||
.setType(HistoryHelper.TYPE_THREAD)
|
||||
if (dataBean!!.thread.author != null) {
|
||||
history.avatar = dataBean!!.thread.author.portrait
|
||||
history.username = dataBean!!.thread.author.nameShow
|
||||
if (dataBean!!.thread?.author != null) {
|
||||
history.avatar = dataBean!!.thread?.author?.portrait
|
||||
history.username = dataBean!!.thread?.author?.nameShow
|
||||
}
|
||||
historyHelper!!.writeHistory(history)
|
||||
}
|
||||
|
|
@ -735,11 +735,11 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
when (v.id) {
|
||||
R.id.thread_reply_bar -> if (dataBean != null && dataBean!!.thread != null) {
|
||||
startActivity(Intent(this@ThreadActivity, ReplyActivity::class.java)
|
||||
.putExtra("data", ReplyInfoBean(dataBean!!.thread.id,
|
||||
dataBean!!.forum.id,
|
||||
dataBean!!.forum.name,
|
||||
dataBean!!.anti.tbs,
|
||||
dataBean!!.user.nameShow).setPn(dataBean!!.page.offset).toString()))
|
||||
.putExtra("data", ReplyInfoBean(dataBean!!.thread?.id,
|
||||
dataBean!!.forum?.id,
|
||||
dataBean!!.forum?.name,
|
||||
dataBean!!.anti?.tbs,
|
||||
dataBean!!.user?.nameShow).setPn(dataBean!!.page?.offset).toString()))
|
||||
}
|
||||
R.id.toolbar -> recyclerView.scrollToPosition(0)
|
||||
R.id.thread_bottom_bar_agree -> if (dataBean != null && dataBean!!.thread != null) {
|
||||
|
|
@ -747,7 +747,7 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
agree = true
|
||||
agreeNum += 1
|
||||
invalidateAgreeStatus()
|
||||
TiebaApi.getInstance().agree(dataBean!!.thread.threadInfo.threadId, dataBean!!.thread.threadInfo.firstPostId).enqueue(object : Callback<AgreeBean> {
|
||||
TiebaApi.getInstance().agree(dataBean!!.thread?.threadInfo?.threadId!!, dataBean!!.thread?.threadInfo?.firstPostId!!).enqueue(object : Callback<AgreeBean> {
|
||||
override fun onFailure(call: Call<AgreeBean>, t: Throwable) {
|
||||
agree = false
|
||||
agreeNum -= 1
|
||||
|
|
@ -766,7 +766,7 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
|||
agree = false
|
||||
agreeNum -= 1
|
||||
invalidateAgreeStatus()
|
||||
TiebaApi.getInstance().disagree(dataBean!!.thread.threadInfo.threadId, dataBean!!.thread.threadInfo.firstPostId).enqueue(object : Callback<AgreeBean> {
|
||||
TiebaApi.getInstance().disagree(dataBean!!.thread?.threadInfo?.threadId!!, dataBean!!.thread?.threadInfo?.firstPostId!!).enqueue(object : Callback<AgreeBean> {
|
||||
override fun onFailure(call: Call<AgreeBean>, t: Throwable) {
|
||||
agree = true
|
||||
agreeNum += 1
|
||||
|
|
|
|||
|
|
@ -83,14 +83,16 @@ class PhotoViewActivity : BaseActivity(), OnChangeBottomBarVisibilityListener, T
|
|||
updateCounter(mViewPager.currentItem)
|
||||
val picBeans: MutableList<PicPageBean.PicBean> = ArrayList()
|
||||
val imgInfoBeans: MutableList<ImgInfoBean> = ArrayList()
|
||||
if (data.picList.isNotEmpty()) {
|
||||
val index = data.picList.last().overAllIndex.toInt()
|
||||
loadFinished = index >= amount!!.toInt()
|
||||
if (data.picList?.isNotEmpty()!!) {
|
||||
val index = data.picList.last().overAllIndex?.toInt()
|
||||
if (index != null) {
|
||||
loadFinished = index >= amount!!.toInt()
|
||||
}
|
||||
picBeans.addAll(data.picList)
|
||||
picBeans.forEach {
|
||||
imgInfoBeans.add(it.img.original)
|
||||
it.img?.original?.let { it1 -> imgInfoBeans.add(it1) }
|
||||
}
|
||||
lastIndex = picBeans.first().overAllIndex.toInt()
|
||||
lastIndex = picBeans.first().overAllIndex?.toInt()!!
|
||||
for (photoViewBean in photoViewBeans) {
|
||||
val ind = lastIndex - (photoViewBeans.size - 1 - photoViewBeans.indexOf(photoViewBean))
|
||||
photoViewBean.index = ind.toString()
|
||||
|
|
|
|||
|
|
@ -9,11 +9,9 @@ import android.widget.ImageView;
|
|||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.gridlayout.widget.GridLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.huanchengfly.tieba.api.models.ForumPageBean;
|
||||
import com.huanchengfly.tieba.post.R;
|
||||
|
|
@ -23,13 +21,7 @@ import com.huanchengfly.tieba.post.components.MyLinearLayoutManager;
|
|||
import com.huanchengfly.tieba.post.components.dividers.SpacesItemDecoration;
|
||||
import com.huanchengfly.tieba.post.interfaces.OnSwitchListener;
|
||||
import com.huanchengfly.tieba.post.models.PhotoViewBean;
|
||||
import com.huanchengfly.tieba.post.utils.BlockUtil;
|
||||
import com.huanchengfly.tieba.post.utils.DisplayUtil;
|
||||
import com.huanchengfly.tieba.post.utils.ImageUtil;
|
||||
import com.huanchengfly.tieba.post.utils.NavigationHelper;
|
||||
import com.huanchengfly.tieba.post.utils.SharedPreferencesUtil;
|
||||
import com.huanchengfly.tieba.post.utils.StringUtil;
|
||||
import com.huanchengfly.tieba.post.utils.Util;
|
||||
import com.huanchengfly.tieba.post.utils.*;
|
||||
import com.huanchengfly.tieba.post.utils.preload.PreloadUtil;
|
||||
import com.huanchengfly.tieba.post.utils.preload.loaders.ThreadContentLoader;
|
||||
import com.huanchengfly.tieba.widgets.MarkedImageView;
|
||||
|
|
@ -169,7 +161,7 @@ public class ForumAdapter extends MultiBaseAdapter<ForumPageBean.ThreadBean> {
|
|||
for (ForumPageBean.MediaInfoBean media : mediaInfoBeans) {
|
||||
photoViewBeans.add(new PhotoViewBean(ImageUtil.getNonNullString(media.getBigPic(), media.getSrcPic(), media.getOriginPic()),
|
||||
ImageUtil.getNonNullString(media.getOriginPic(), media.getSrcPic(), media.getBigPic()),
|
||||
"1".equals(media.getIsLongPic())));
|
||||
"1".equals(media.isLongPic())));
|
||||
}
|
||||
ImageUtil.initImageView(imageView,
|
||||
photoViewBeans,
|
||||
|
|
@ -205,13 +197,13 @@ public class ForumAdapter extends MultiBaseAdapter<ForumPageBean.ThreadBean> {
|
|||
return;
|
||||
}
|
||||
viewHolder.setText(R.id.forum_item_comment_count_text, threadBean.getReplyNum());
|
||||
if ("1".equals(threadBean.getIsGood())) {
|
||||
if ("1".equals(threadBean.isGood())) {
|
||||
viewHolder.setVisibility(R.id.forum_item_good_tip, View.VISIBLE);
|
||||
} else {
|
||||
viewHolder.setVisibility(R.id.forum_item_good_tip, View.GONE);
|
||||
}
|
||||
viewHolder.setOnClickListener(R.id.forum_item, view -> startActivity(threadBean));
|
||||
if ("1".equals(threadBean.getIsNoTitle())) {
|
||||
if ("1".equals(threadBean.isNoTitle())) {
|
||||
viewHolder.setVisibility(R.id.forum_item_title_holder, View.GONE);
|
||||
} else {
|
||||
viewHolder.setVisibility(R.id.forum_item_title_holder, View.VISIBLE);
|
||||
|
|
@ -241,7 +233,7 @@ public class ForumAdapter extends MultiBaseAdapter<ForumPageBean.ThreadBean> {
|
|||
imageView.setLayoutParams(getLayoutParams((RelativeLayout.LayoutParams) imageView.getLayoutParams()));
|
||||
setListenerForImageView(threadBean.getMedia(), imageView, 0, threadBean);
|
||||
ForumPageBean.MediaInfoBean mediaInfoBean = threadBean.getMedia().get(0);
|
||||
if ("1".equals(mediaInfoBean.getIsGif())) {
|
||||
if ("1".equals(mediaInfoBean.isGif())) {
|
||||
imageView.setMarkText("GIF");
|
||||
imageView.setMarkVisible(true);
|
||||
} else {
|
||||
|
|
@ -346,7 +338,7 @@ public class ForumAdapter extends MultiBaseAdapter<ForumPageBean.ThreadBean> {
|
|||
|
||||
@Override
|
||||
protected int getViewType(int position, ForumPageBean.ThreadBean threadBean) {
|
||||
if ("1".equals(threadBean.getIsTop())) {
|
||||
if ("1".equals(threadBean.isTop())) {
|
||||
return TYPE_THREAD_TOP;
|
||||
}
|
||||
if (threadBean.getVideoInfo() != null) {
|
||||
|
|
|
|||
|
|
@ -9,10 +9,8 @@ import android.view.ViewGroup;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.gridlayout.widget.GridLayout;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.huanchengfly.tieba.api.models.ForumPageBean;
|
||||
import com.huanchengfly.tieba.api.models.PersonalizedBean;
|
||||
|
|
@ -21,11 +19,7 @@ import com.huanchengfly.tieba.post.R;
|
|||
import com.huanchengfly.tieba.post.base.Config;
|
||||
import com.huanchengfly.tieba.post.components.dialogs.DislikeDialog;
|
||||
import com.huanchengfly.tieba.post.models.PhotoViewBean;
|
||||
import com.huanchengfly.tieba.post.utils.DisplayUtil;
|
||||
import com.huanchengfly.tieba.post.utils.ImageUtil;
|
||||
import com.huanchengfly.tieba.post.utils.NavigationHelper;
|
||||
import com.huanchengfly.tieba.post.utils.SharedPreferencesUtil;
|
||||
import com.huanchengfly.tieba.post.utils.Util;
|
||||
import com.huanchengfly.tieba.post.utils.*;
|
||||
import com.huanchengfly.tieba.widgets.MarkedImageView;
|
||||
import com.huanchengfly.tieba.widgets.VideoPlayerStandard;
|
||||
import com.othershe.baseadapter.ViewHolder;
|
||||
|
|
@ -168,7 +162,7 @@ public class PersonalizedFeedAdapter extends MultiBaseAdapter<PersonalizedBean.T
|
|||
dislikeDialog.show();
|
||||
}
|
||||
});
|
||||
if ("1".equals(threadBean.getIsGood())) {
|
||||
if ("1".equals(threadBean.isGood())) {
|
||||
viewHolder.setVisibility(R.id.forum_item_good_tip, View.VISIBLE);
|
||||
} else {
|
||||
viewHolder.setVisibility(R.id.forum_item_good_tip, View.GONE);
|
||||
|
|
@ -178,7 +172,7 @@ public class PersonalizedFeedAdapter extends MultiBaseAdapter<PersonalizedBean.T
|
|||
map.put("tid", threadBean.getTid());
|
||||
navigationHelper.navigationByData(NavigationHelper.ACTION_THREAD, map);
|
||||
});
|
||||
if ("1".equals(threadBean.getIsNoTitle())) {
|
||||
if ("1".equals(threadBean.isNoTitle())) {
|
||||
viewHolder.setVisibility(R.id.forum_item_title_holder, View.GONE);
|
||||
} else {
|
||||
viewHolder.setVisibility(R.id.forum_item_title_holder, View.VISIBLE);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.huanchengfly.tieba.api.TiebaApi;
|
||||
import com.huanchengfly.tieba.api.models.CommonResponse;
|
||||
|
|
@ -32,28 +31,20 @@ import com.huanchengfly.tieba.post.fragments.ConfirmDialogFragment;
|
|||
import com.huanchengfly.tieba.post.fragments.MenuDialogFragment;
|
||||
import com.huanchengfly.tieba.post.models.PhotoViewBean;
|
||||
import com.huanchengfly.tieba.post.models.ReplyInfoBean;
|
||||
import com.huanchengfly.tieba.post.utils.AccountUtil;
|
||||
import com.huanchengfly.tieba.post.utils.EmotionUtil;
|
||||
import com.huanchengfly.tieba.post.utils.ImageUtil;
|
||||
import com.huanchengfly.tieba.post.utils.NavigationHelper;
|
||||
import com.huanchengfly.tieba.post.utils.StringUtil;
|
||||
import com.huanchengfly.tieba.post.utils.ThemeUtil;
|
||||
import com.huanchengfly.tieba.post.utils.Util;
|
||||
import com.huanchengfly.tieba.post.utils.*;
|
||||
import com.huanchengfly.tieba.widgets.ContentLayout;
|
||||
import com.huanchengfly.tieba.widgets.VoicePlayerView;
|
||||
import com.huanchengfly.tieba.widgets.theme.TintTextView;
|
||||
import com.othershe.baseadapter.ViewHolder;
|
||||
import com.othershe.baseadapter.base.CommonBaseAdapter;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RecyclerFloorAdapter extends CommonBaseAdapter<SubFloorListBean.PostInfo> {
|
||||
public static final String TAG = "RecyclerFloorAdapter";
|
||||
private static final int TEXT_VIEW_TYPE_CONTENT = 0;
|
||||
|
|
@ -374,7 +365,7 @@ public class RecyclerFloorAdapter extends CommonBaseAdapter<SubFloorListBean.Pos
|
|||
List<PhotoViewBean> photoViewBeans = new ArrayList<>();
|
||||
photoViewBeans.add(new PhotoViewBean(ImageUtil.getNonNullString(contentBean.getSrc(), contentBean.getOriginSrc()),
|
||||
ImageUtil.getNonNullString(contentBean.getOriginSrc(), contentBean.getSrc()),
|
||||
"1".equals(contentBean.getIsLongPic())));
|
||||
"1".equals(contentBean.isLongPic())));
|
||||
ImageUtil.initImageView(imageView, photoViewBeans, 0);
|
||||
views.add(imageView);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -12,14 +12,8 @@ import android.util.Log;
|
|||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import android.widget.*;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.allen.library.SuperTextView;
|
||||
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
|
|
@ -40,15 +34,7 @@ import com.huanchengfly.tieba.post.fragments.FloorFragment;
|
|||
import com.huanchengfly.tieba.post.fragments.MenuDialogFragment;
|
||||
import com.huanchengfly.tieba.post.models.PhotoViewBean;
|
||||
import com.huanchengfly.tieba.post.models.ReplyInfoBean;
|
||||
import com.huanchengfly.tieba.post.utils.AccountUtil;
|
||||
import com.huanchengfly.tieba.post.utils.BlockUtil;
|
||||
import com.huanchengfly.tieba.post.utils.DisplayUtil;
|
||||
import com.huanchengfly.tieba.post.utils.EmotionUtil;
|
||||
import com.huanchengfly.tieba.post.utils.ImageUtil;
|
||||
import com.huanchengfly.tieba.post.utils.NavigationHelper;
|
||||
import com.huanchengfly.tieba.post.utils.StringUtil;
|
||||
import com.huanchengfly.tieba.post.utils.ThemeUtil;
|
||||
import com.huanchengfly.tieba.post.utils.Util;
|
||||
import com.huanchengfly.tieba.post.utils.*;
|
||||
import com.huanchengfly.tieba.widgets.ContentLayout;
|
||||
import com.huanchengfly.tieba.widgets.MyImageView;
|
||||
import com.huanchengfly.tieba.widgets.VideoPlayerStandard;
|
||||
|
|
@ -56,19 +42,13 @@ import com.huanchengfly.tieba.widgets.VoicePlayerView;
|
|||
import com.huanchengfly.tieba.widgets.theme.TintTextView;
|
||||
import com.othershe.baseadapter.ViewHolder;
|
||||
import com.othershe.baseadapter.base.MultiBaseAdapter;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.huanchengfly.tieba.post.activities.PhotoViewActivity.OBJ_TYPE_THREAD_PAGE;
|
||||
import static com.huanchengfly.tieba.post.utils.Util.alphaColor;
|
||||
|
||||
|
|
@ -175,7 +155,7 @@ public class RecyclerThreadAdapter extends MultiBaseAdapter<ThreadContentBean.Po
|
|||
if (forumView == null || dividerView == null || forumInfoBean == null) {
|
||||
return;
|
||||
}
|
||||
if (!showForum || !mContext.getSharedPreferences("settings", Context.MODE_PRIVATE).getBoolean("showShortcutInThread", true) || "0".equals(forumInfoBean.getIsExists()) || forumInfoBean.getName().isEmpty()) {
|
||||
if (!showForum || !mContext.getSharedPreferences("settings", Context.MODE_PRIVATE).getBoolean("showShortcutInThread", true) || "0".equals(forumInfoBean.isExists()) || forumInfoBean.getName().isEmpty()) {
|
||||
forumView.setVisibility(View.GONE);
|
||||
dividerView.setVisibility(View.GONE);
|
||||
return;
|
||||
|
|
@ -233,7 +213,7 @@ public class RecyclerThreadAdapter extends MultiBaseAdapter<ThreadContentBean.Po
|
|||
if (contentBean.getType().equals("3")) {
|
||||
photoViewBeans.add(new PhotoViewBean(url,
|
||||
ImageUtil.getNonNullString(contentBean.getOriginSrc(), contentBean.getBigCdnSrc(), contentBean.getCdnSrcActive(), contentBean.getCdnSrc()),
|
||||
"1".equals(contentBean.getIsLongPic())));
|
||||
"1".equals(contentBean.isLongPic())));
|
||||
}/* else if (contentBean.getType().equals("20")) {
|
||||
photoViewBeans.add(new PhotoViewBean(contentBean.getSrc(), contentBean.getSrc(), false));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,17 +5,12 @@ import android.text.SpannableStringBuilder;
|
|||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.huanchengfly.theme.utils.ThemeUtils;
|
||||
import com.huanchengfly.tieba.api.models.ThreadStoreBean;
|
||||
import com.huanchengfly.tieba.post.R;
|
||||
import com.huanchengfly.tieba.post.components.spans.RoundBackgroundColorSpan;
|
||||
import com.huanchengfly.tieba.post.interfaces.OnDeleteListener;
|
||||
import com.huanchengfly.tieba.post.utils.DisplayUtil;
|
||||
import com.huanchengfly.tieba.post.utils.ImageUtil;
|
||||
import com.huanchengfly.tieba.post.utils.StringUtil;
|
||||
import com.huanchengfly.tieba.post.utils.ThemeUtil;
|
||||
import com.huanchengfly.tieba.post.utils.Util;
|
||||
import com.huanchengfly.tieba.post.utils.*;
|
||||
import com.othershe.baseadapter.ViewHolder;
|
||||
import com.othershe.baseadapter.base.CommonBaseAdapter;
|
||||
|
||||
|
|
@ -35,7 +30,7 @@ public class ThreadStoreAdapter extends CommonBaseAdapter<ThreadStoreBean.Thread
|
|||
@Override
|
||||
protected void convert(ViewHolder viewHolder, ThreadStoreBean.ThreadStoreInfo threadStoreInfo, int position) {
|
||||
TextView textView = viewHolder.getView(R.id.collect_item_title);
|
||||
if ("1".equals(threadStoreInfo.getIsDeleted())) {
|
||||
if ("1".equals(threadStoreInfo.isDeleted())) {
|
||||
textView.setTextColor(ThemeUtil.getSecondaryTextColor(mContext));
|
||||
viewHolder.setText(R.id.collect_item_header_title, R.string.tip_store_deleted);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ import com.huanchengfly.tieba.post.adapters.DislikeAdapter
|
|||
import com.huanchengfly.tieba.post.components.dividers.SpacesItemDecoration
|
||||
import com.huanchengfly.tieba.post.models.DislikeBean
|
||||
import com.huanchengfly.tieba.post.utils.AccountUtil
|
||||
import com.huanchengfly.toDp
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
import com.huanchengfly.toDp
|
||||
import java.util.*
|
||||
|
||||
class DislikeDialog(
|
||||
|
|
@ -53,11 +53,11 @@ class DislikeDialog(
|
|||
if (v.id == R.id.submit_btn) {
|
||||
val selectIds: MutableList<String> = ArrayList()
|
||||
val extras: MutableList<String> = ArrayList()
|
||||
threadPersonalizedBean.dislikeResource.filter {
|
||||
threadPersonalizedBean.dislikeResource?.filter {
|
||||
dislikeAdapter!!.selectedIds.contains(it.dislikeId)
|
||||
}.forEach {
|
||||
selectIds.add(it.dislikeId)
|
||||
extras.add(it.extra)
|
||||
}?.forEach {
|
||||
it.dislikeId?.let { it1 -> selectIds.add(it1) }
|
||||
it.extra?.let { it1 -> extras.add(it1) }
|
||||
}
|
||||
TiebaApi.getInstance().submitDislike(
|
||||
DislikeBean(
|
||||
|
|
|
|||
|
|
@ -170,9 +170,9 @@ class ForumFragment : BaseFragment(), Refreshable, OnSwitchListener, ScrollTopab
|
|||
override fun onResponse(call: Call<ForumPageBean>, response: Response<ForumPageBean>) {
|
||||
val forumPageBean = response.body()!!
|
||||
mDataBean = forumPageBean
|
||||
pageSize = forumPageBean.page.pageSize.toInt()
|
||||
pageSize = forumPageBean.page?.pageSize?.toInt()!!
|
||||
mAdapter.addData(forumPageBean)
|
||||
if (mDataBean!!.page.hasMore == "0") {
|
||||
if (mDataBean!!.page?.hasMore == "0") {
|
||||
mAdapter.loadEnd()
|
||||
}
|
||||
}
|
||||
|
|
@ -211,8 +211,8 @@ class ForumFragment : BaseFragment(), Refreshable, OnSwitchListener, ScrollTopab
|
|||
}
|
||||
mRefreshLayout.isRefreshing = false
|
||||
mDataBean = forumPageBean
|
||||
pageSize = forumPageBean.page.pageSize.toInt()
|
||||
if (mDataBean!!.page.hasMore == "0") {
|
||||
pageSize = forumPageBean.page?.pageSize?.toInt()!!
|
||||
if (mDataBean!!.page?.hasMore == "0") {
|
||||
mAdapter.loadEnd()
|
||||
}
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ class ForumFragment : BaseFragment(), Refreshable, OnSwitchListener, ScrollTopab
|
|||
|
||||
override fun onSwitch(which: Int) {
|
||||
if (isGood && mDataBean != null) {
|
||||
classifyId = mDataBean!!.forum.goodClassify[which].classId
|
||||
classifyId = mDataBean!!.forum?.goodClassify?.get(which)?.classId!!
|
||||
refresh()
|
||||
}
|
||||
}
|
||||
|
|
@ -250,9 +250,9 @@ class ForumFragment : BaseFragment(), Refreshable, OnSwitchListener, ScrollTopab
|
|||
}
|
||||
mRefreshLayout.isRefreshing = false
|
||||
mDataBean = forumPageBean
|
||||
pageSize = forumPageBean.page.pageSize.toInt()
|
||||
pageSize = forumPageBean.page?.pageSize?.toInt()!!
|
||||
mAdapter.setData(forumPageBean)
|
||||
if ("1" != mDataBean!!.page.hasMore) {
|
||||
if ("1" != mDataBean!!.page?.hasMore) {
|
||||
mAdapter.loadEnd()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,12 +35,16 @@ class PersonalizedFeedFragment : BaseFragment(), PersonalizedFeedAdapter.OnRefre
|
|||
private var adapter: PersonalizedFeedAdapter? = null
|
||||
private var personalizedBean: PersonalizedBean? = null
|
||||
private var page = 1
|
||||
|
||||
@BindView(R.id.refresh)
|
||||
lateinit var swipeRefreshLayout: SwipeRefreshLayout
|
||||
|
||||
@BindView(R.id.recycler_view)
|
||||
lateinit var recyclerView: RecyclerView
|
||||
|
||||
@BindView(R.id.refresh_tip)
|
||||
lateinit var refreshTip: ShadowLayout
|
||||
|
||||
@BindView(R.id.refresh_tip_text)
|
||||
lateinit var refreshTipText: TextView
|
||||
|
||||
|
|
@ -111,12 +115,12 @@ class PersonalizedFeedFragment : BaseFragment(), PersonalizedFeedAdapter.OnRefre
|
|||
override fun onResponse(call: Call<PersonalizedBean>, response: Response<PersonalizedBean>) {
|
||||
val personalizedBean = response.body()!!
|
||||
this@PersonalizedFeedFragment.personalizedBean = personalizedBean
|
||||
personalizedBean.threadList.forEachIndexed { index, threadBean ->
|
||||
threadBean.threadPersonalizedBean = personalizedBean.threadPersonalized[index]
|
||||
}
|
||||
val newThreadBeans: List<PersonalizedBean.ThreadBean> = personalizedBean.threadList.filterNot {
|
||||
(it.abstractBeans.size > 0 && BlockUtil.needBlock(it.abstractBeans[0].text)) || BlockUtil.needBlock(it.author.nameShow, it.author.id)
|
||||
personalizedBean.threadList?.forEachIndexed { index, threadBean ->
|
||||
threadBean.threadPersonalizedBean = personalizedBean.threadPersonalized?.get(index)
|
||||
}
|
||||
val newThreadBeans: List<PersonalizedBean.ThreadBean> = personalizedBean.threadList?.filterNot {
|
||||
(it.abstractBeans?.size!! > 0 && BlockUtil.needBlock(it.abstractBeans[0].text)) || BlockUtil.needBlock(it.author?.nameShow, it.author?.id)
|
||||
}!!
|
||||
val threadBeans: MutableList<PersonalizedBean.ThreadBean> = ArrayList(adapter!!.allData)
|
||||
adapter!!.apply {
|
||||
setData(personalizedBean)
|
||||
|
|
@ -158,12 +162,12 @@ class PersonalizedFeedFragment : BaseFragment(), PersonalizedFeedAdapter.OnRefre
|
|||
override fun onResponse(call: Call<PersonalizedBean>, response: Response<PersonalizedBean>) {
|
||||
val personalizedBean = response.body()!!
|
||||
this@PersonalizedFeedFragment.personalizedBean = personalizedBean
|
||||
personalizedBean.threadList.forEachIndexed { index, threadBean ->
|
||||
threadBean.threadPersonalizedBean = personalizedBean.threadPersonalized[index]
|
||||
}
|
||||
val newThreadBeans: List<PersonalizedBean.ThreadBean> = personalizedBean.threadList.filterNot {
|
||||
(it.abstractBeans.size > 0 && BlockUtil.needBlock(it.abstractBeans[0].text)) || BlockUtil.needBlock(it.author.nameShow, it.author.id)
|
||||
personalizedBean.threadList?.forEachIndexed { index, threadBean ->
|
||||
threadBean.threadPersonalizedBean = personalizedBean.threadPersonalized?.get(index)
|
||||
}
|
||||
val newThreadBeans: List<PersonalizedBean.ThreadBean> = personalizedBean.threadList?.filterNot {
|
||||
(it.abstractBeans?.size!! > 0 && BlockUtil.needBlock(it.abstractBeans[0].text)) || BlockUtil.needBlock(it.author?.nameShow, it.author?.id)
|
||||
}!!
|
||||
adapter!!.apply {
|
||||
setData(personalizedBean)
|
||||
setLoadMoreData(newThreadBeans)
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class SearchUserFragment : BaseFragment() {
|
|||
mData = searchUserDataBean
|
||||
mAdapter!!.setData(searchUserDataBean)
|
||||
mRefreshLayout.isRefreshing = false
|
||||
if (searchUserDataBean.hasMore == 0) mAdapter!!.loadEnd()
|
||||
if (searchUserDataBean?.hasMore == 0) mAdapter!!.loadEnd()
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<SearchUserBean>, t: Throwable) {
|
||||
|
|
|
|||
|
|
@ -159,8 +159,8 @@ class SettingsFragment : PreferencesFragment() {
|
|||
instance!!.newCheckUpdate(object : CommonAPICallback<NewUpdateBean?> {
|
||||
override fun onSuccess(data: NewUpdateBean?) {
|
||||
if (data != null) {
|
||||
if (data.isHasUpdate) {
|
||||
aboutPreference!!.summary = attachContext.getString(R.string.tip_new_version, data.result.versionName)
|
||||
if (data.isHasUpdate == true) {
|
||||
aboutPreference!!.summary = attachContext.getString(R.string.tip_new_version, data.result?.versionName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,23 +57,27 @@ class NotifyJobService : JobService() {
|
|||
val msgBean = response.body() ?: return
|
||||
if (notificationManager != null) {
|
||||
var total = 0
|
||||
if ("0" != msgBean.message.replyMe) {
|
||||
val replyCount = Integer.valueOf(msgBean.message.replyMe)
|
||||
total += replyCount
|
||||
if ("0" != msgBean.message?.replyMe) {
|
||||
val replyCount = msgBean.message?.replyMe?.let { Integer.valueOf(it) }
|
||||
if (replyCount != null) {
|
||||
total += replyCount
|
||||
}
|
||||
sendBroadcast(Intent()
|
||||
.setAction(ACTION_NEW_MESSAGE)
|
||||
.putExtra("channel", CHANNEL_REPLY)
|
||||
.putExtra("count", replyCount))
|
||||
updateNotification(getString(R.string.tips_message_reply, msgBean.message.replyMe), ID_REPLY, CHANNEL_REPLY, CHANNEL_REPLY_NAME, MessageActivity.createIntent(this@NotifyJobService, MessageFragment.TYPE_REPLY_ME))
|
||||
updateNotification(getString(R.string.tips_message_reply, msgBean.message?.replyMe), ID_REPLY, CHANNEL_REPLY, CHANNEL_REPLY_NAME, MessageActivity.createIntent(this@NotifyJobService, MessageFragment.TYPE_REPLY_ME))
|
||||
}
|
||||
if ("0" != msgBean.message.atMe) {
|
||||
val atCount = Integer.valueOf(msgBean.message.atMe)
|
||||
total += atCount
|
||||
if ("0" != msgBean.message?.atMe) {
|
||||
val atCount = msgBean.message?.atMe?.let { Integer.valueOf(it) }
|
||||
if (atCount != null) {
|
||||
total += atCount
|
||||
}
|
||||
sendBroadcast(Intent()
|
||||
.setAction(ACTION_NEW_MESSAGE)
|
||||
.putExtra("channel", CHANNEL_AT)
|
||||
.putExtra("count", msgBean.message.atMe))
|
||||
updateNotification(getString(R.string.tips_message_at, msgBean.message.atMe), ID_AT, CHANNEL_AT, CHANNEL_AT_NAME, MessageActivity.createIntent(this@NotifyJobService, MessageFragment.TYPE_AT_ME))
|
||||
.putExtra("count", msgBean.message?.atMe))
|
||||
updateNotification(getString(R.string.tips_message_at, msgBean.message?.atMe), ID_AT, CHANNEL_AT, CHANNEL_AT_NAME, MessageActivity.createIntent(this@NotifyJobService, MessageFragment.TYPE_AT_ME))
|
||||
}
|
||||
sendBroadcast(Intent()
|
||||
.setAction(ACTION_NEW_MESSAGE)
|
||||
|
|
|
|||
|
|
@ -72,10 +72,10 @@ object QuickPreviewUtil {
|
|||
override fun onResponse(call: Call<ThreadContentBean>, response: Response<ThreadContentBean>) {
|
||||
val threadContentBean = response.body()!!
|
||||
callback.onSuccess(PreviewInfo()
|
||||
.setTitle(threadContentBean.thread.title)
|
||||
.setSubtitle(context.getString(R.string.subtitle_quick_preview_thread, threadContentBean.forum.name, threadContentBean.thread.replyNum))
|
||||
.setTitle(threadContentBean.thread?.title)
|
||||
.setSubtitle(context.getString(R.string.subtitle_quick_preview_thread, threadContentBean.forum?.name, threadContentBean.thread?.replyNum))
|
||||
.setUrl(uri.toString())
|
||||
.setIconUrl(threadContentBean.thread.author.portrait))
|
||||
.setIconUrl(threadContentBean.thread?.author?.portrait))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -90,10 +90,10 @@ object QuickPreviewUtil {
|
|||
override fun onResponse(call: Call<ForumPageBean>, response: Response<ForumPageBean>) {
|
||||
val forumPageBean = response.body()!!
|
||||
callback.onSuccess(PreviewInfo()
|
||||
.setTitle(context.getString(R.string.title_forum, forumPageBean.forum.name))
|
||||
.setSubtitle(forumPageBean.forum.slogan)
|
||||
.setTitle(context.getString(R.string.title_forum, forumPageBean.forum?.name))
|
||||
.setSubtitle(forumPageBean.forum?.slogan)
|
||||
.setUrl(uri.toString())
|
||||
.setIconUrl(forumPageBean.forum.avatar))
|
||||
.setIconUrl(forumPageBean.forum?.avatar))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue