fix: 修复 Bug
This commit is contained in:
parent
6f72e2b373
commit
7539406b38
|
|
@ -161,7 +161,11 @@ class PhotoViewActivity : BaseActivity(), OnChangeBottomBarVisibilityListener,
|
|||
isFrs = intent.getBooleanExtra(EXTRA_IS_FRS, false)
|
||||
photoViewBeans = mutableListOf()
|
||||
startPosition = intent.getIntExtra(EXTRA_POSITION, 0)
|
||||
val parcelables = intent.getParcelableArrayExtra(EXTRA_BEANS)!!
|
||||
val parcelables = intent.getParcelableArrayExtra(EXTRA_BEANS)
|
||||
if (parcelables == null) {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
photoViewBeans.addAll(parcelables.map { it as PhotoViewBean })
|
||||
amount = photoViewBeans.size.toString()
|
||||
mAdapter = PhotoViewAdapter(this, photoViewBeans)
|
||||
|
|
|
|||
|
|
@ -236,12 +236,16 @@ class ThreadMainPostAdapter(
|
|||
}
|
||||
val forumNameView = forumView.findViewById<TextView>(R.id.forum_bar_name)
|
||||
val forumAvatarView: ImageView = forumView.findViewById(R.id.forum_bar_avatar)
|
||||
if (!showForum || !context.appPreferences.showShortcutInThread || "0" == forumInfoBean.isExists || forumInfoBean.name?.isEmpty() == true) {
|
||||
if (!showForum ||
|
||||
!context.appPreferences.showShortcutInThread ||
|
||||
"0" == forumInfoBean.isExists ||
|
||||
forumInfoBean.name.isNullOrEmpty()
|
||||
) {
|
||||
forumView.visibility = View.GONE
|
||||
return
|
||||
}
|
||||
forumView.visibility = View.VISIBLE
|
||||
forumView.setOnClickListener(View.OnClickListener { launch(context, forumInfoBean.name!!) })
|
||||
forumView.setOnClickListener(View.OnClickListener { launch(context, forumInfoBean.name) })
|
||||
forumNameView.text = forumInfoBean.name
|
||||
ImageUtil.load(forumAvatarView, ImageUtil.LOAD_TYPE_AVATAR, forumInfoBean.avatar)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ import com.google.gson.annotations.SerializedName
|
|||
|
||||
@Keep
|
||||
data class GetForumListBean(
|
||||
@SerializedName("anti_info")
|
||||
val antiInfo: List<Any>,
|
||||
@SerializedName("button_content")
|
||||
val buttonContent: String,
|
||||
@SerializedName("can_use")
|
||||
|
|
@ -20,7 +18,7 @@ data class GetForumListBean(
|
|||
@SerializedName("forum_info")
|
||||
val forumInfo: List<ForumInfo>,
|
||||
val level: String,
|
||||
val logid: Int,
|
||||
val logid: Long,
|
||||
@SerializedName("msign_step_num")
|
||||
val msignStepNum: String,
|
||||
@SerializedName("num_notice")
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ data class MSignBean(
|
|||
val info: List<Info>,
|
||||
@SerializedName("is_timeout")
|
||||
val isTimeout: String,
|
||||
val logid: Int,
|
||||
val logid: Long,
|
||||
@SerializedName("server_time")
|
||||
val serverTime: String,
|
||||
@SerializedName("show_dialog")
|
||||
|
|
|
|||
|
|
@ -20,16 +20,14 @@ import com.huanchengfly.tieba.post.api.TiebaApi
|
|||
import com.huanchengfly.tieba.post.api.models.ForumPageBean
|
||||
import com.huanchengfly.tieba.post.api.retrofit.doIfFailure
|
||||
import com.huanchengfly.tieba.post.api.retrofit.doIfSuccess
|
||||
import com.huanchengfly.tieba.post.api.retrofit.exception.TiebaException
|
||||
import com.huanchengfly.tieba.post.api.retrofit.exception.getErrorCode
|
||||
import com.huanchengfly.tieba.post.api.retrofit.exception.getErrorMessage
|
||||
import com.huanchengfly.tieba.post.components.dividers.ForumDivider
|
||||
import com.huanchengfly.tieba.post.interfaces.OnSwitchListener
|
||||
import com.huanchengfly.tieba.post.interfaces.Refreshable
|
||||
import com.huanchengfly.tieba.post.interfaces.ScrollTopable
|
||||
import com.huanchengfly.tieba.post.utils.Util
|
||||
import com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class ForumFragment : BaseFragment(), Refreshable, OnSwitchListener, ScrollTopable {
|
||||
private var page = 1
|
||||
|
|
@ -198,50 +196,49 @@ class ForumFragment : BaseFragment(), Refreshable, OnSwitchListener, ScrollTopab
|
|||
delegateAdapter.clear()
|
||||
delegateAdapter.notifyDataSetChanged()
|
||||
page = 1
|
||||
TiebaApi.getInstance().forumPage(forumName!!, page, sortType, classifyId)
|
||||
.enqueue(object : Callback<ForumPageBean> {
|
||||
override fun onFailure(call: Call<ForumPageBean>, t: Throwable) {
|
||||
var errorCode = -1
|
||||
if (t is TiebaException) {
|
||||
errorCode = t.code
|
||||
}
|
||||
launchIO {
|
||||
TiebaApi.getInstance()
|
||||
.forumPageAsync(forumName!!, page, sortType, classifyId)
|
||||
.doIfSuccess {
|
||||
if (!isGood) {
|
||||
if (attachContext is OnRefreshedListener) {
|
||||
(attachContext as OnRefreshedListener).onFailure(errorCode, t.message)
|
||||
}
|
||||
}
|
||||
refreshLayout?.finishRefresh(false)
|
||||
if (errorCode == -1) {
|
||||
Util.showNetworkErrorSnackbar(mRecyclerView) {
|
||||
refreshLayout?.autoRefresh()
|
||||
}
|
||||
return
|
||||
}
|
||||
Toast.makeText(
|
||||
attachContext,
|
||||
attachContext.getString(R.string.toast_error, errorCode, t.message),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<ForumPageBean>,
|
||||
response: Response<ForumPageBean>
|
||||
) {
|
||||
val forumPageBean = response.body()!!
|
||||
if (!isGood) {
|
||||
if (attachContext is OnRefreshedListener) {
|
||||
(attachContext as OnRefreshedListener).onSuccess(forumPageBean)
|
||||
(attachContext as OnRefreshedListener).onSuccess(it)
|
||||
}
|
||||
}
|
||||
refreshLayout?.finishRefresh()
|
||||
mDataBean = forumPageBean
|
||||
pageSize = forumPageBean.page?.pageSize?.toInt()!!
|
||||
forumAdapter.setData(forumPageBean)
|
||||
refreshLayout?.setNoMoreData(mDataBean!!.page?.hasMore == "0")
|
||||
mDataBean = it
|
||||
pageSize = it.page?.pageSize?.toInt()!!
|
||||
forumAdapter.setData(it)
|
||||
refreshLayout?.setNoMoreData(it.page?.hasMore == "0")
|
||||
reloadAdapters()
|
||||
}
|
||||
})
|
||||
.doIfFailure {
|
||||
if (!isGood) {
|
||||
if (attachContext is OnRefreshedListener) {
|
||||
(attachContext as OnRefreshedListener).onFailure(
|
||||
it.getErrorCode(),
|
||||
it.getErrorMessage()
|
||||
)
|
||||
}
|
||||
}
|
||||
refreshLayout?.finishRefresh(false)
|
||||
if (it.getErrorCode() == -1) {
|
||||
Util.showNetworkErrorSnackbar(mRecyclerView) {
|
||||
refreshLayout?.autoRefresh()
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(
|
||||
attachContext,
|
||||
attachContext.getString(
|
||||
R.string.toast_error,
|
||||
it.getErrorCode(),
|
||||
it.getErrorMessage()
|
||||
),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRefresh() {
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ class MessageFragment : BaseFragment(), Refreshable, OnTabSelectedListener,
|
|||
}
|
||||
|
||||
private fun loadMore() {
|
||||
if (dataBean!!.page!!.hasMore == "1") {
|
||||
if (dataBean?.page?.hasMore == "1") {
|
||||
page += 1
|
||||
load(false)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -74,10 +74,17 @@ public class PhotoViewFragment extends BaseFragment {
|
|||
@SuppressLint("ClickableViewAccessibility")
|
||||
private void loadByBigImageView() {
|
||||
if (!canLoad()) return;
|
||||
String url = photoViewBean.getOriginUrl();
|
||||
if (url == null) {
|
||||
url = photoViewBean.getUrl();
|
||||
}
|
||||
if (url == null) {
|
||||
return;
|
||||
}
|
||||
bigImageView.setVisibility(View.VISIBLE);
|
||||
bigImageView.setImageViewFactory(new GlideImageViewFactory());
|
||||
bigImageView.setProgressIndicator(new CircleProgressIndicator());
|
||||
bigImageView.showImage(Uri.parse(photoViewBean.getOriginUrl()));
|
||||
bigImageView.showImage(Uri.parse(url));
|
||||
bigImageView.setOnTouchListener((view, event) -> {
|
||||
showBottomBar(true);
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ class OKSignService : IntentService(TAG), CoroutineScope, ProgressListener {
|
|||
private var position = 0
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
override fun onStart(intent: Intent?, startId: Int) {
|
||||
super.onStart(intent, startId)
|
||||
updateNotification(
|
||||
getString(R.string.title_fetching_forum_list),
|
||||
getString(R.string.text_please_wait)
|
||||
|
|
@ -67,6 +67,7 @@ class OKSignService : IntentService(TAG), CoroutineScope, ProgressListener {
|
|||
.setSubText(getString(R.string.title_oksign))
|
||||
.setSmallIcon(R.drawable.ic_oksign)
|
||||
.setAutoCancel(true)
|
||||
.setStyle(NotificationCompat.BigTextStyle())
|
||||
.setColor(ThemeUtils.getColorByAttr(this, R.attr.colorPrimary))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
|
@ -16,7 +17,7 @@ public class AppIntroFragment extends BaseIntroFragment {
|
|||
private CharSequence title;
|
||||
private CharSequence subtitle;
|
||||
|
||||
private AppIntroFragment(Builder builder) {
|
||||
private AppIntroFragment(@NonNull Builder builder) {
|
||||
this.iconRes = builder.getIconRes();
|
||||
this.title = builder.getTitle();
|
||||
this.subtitle = builder.getSubtitle();
|
||||
|
|
|
|||
Loading…
Reference in New Issue