style: 移动 CommonCallback

This commit is contained in:
HuanCheng65 2023-03-23 18:39:18 +08:00
parent 79088ecf36
commit 75273ec896
No known key found for this signature in database
GPG Key ID: E9031EF91A805148
4 changed files with 17 additions and 9 deletions

View File

@ -32,7 +32,6 @@ import com.huanchengfly.tieba.post.adapters.ThreadHeaderAdapter
import com.huanchengfly.tieba.post.adapters.ThreadMainPostAdapter import com.huanchengfly.tieba.post.adapters.ThreadMainPostAdapter
import com.huanchengfly.tieba.post.adapters.ThreadReplyAdapter import com.huanchengfly.tieba.post.adapters.ThreadReplyAdapter
import com.huanchengfly.tieba.post.api.TiebaApi import com.huanchengfly.tieba.post.api.TiebaApi
import com.huanchengfly.tieba.post.api.interfaces.CommonCallback
import com.huanchengfly.tieba.post.api.models.AgreeBean import com.huanchengfly.tieba.post.api.models.AgreeBean
import com.huanchengfly.tieba.post.api.models.CommonResponse import com.huanchengfly.tieba.post.api.models.CommonResponse
import com.huanchengfly.tieba.post.api.models.ThreadContentBean import com.huanchengfly.tieba.post.api.models.ThreadContentBean
@ -46,6 +45,7 @@ import com.huanchengfly.tieba.post.components.dialogs.EditTextDialog
import com.huanchengfly.tieba.post.fragments.threadmenu.IThreadMenuFragment import com.huanchengfly.tieba.post.fragments.threadmenu.IThreadMenuFragment
import com.huanchengfly.tieba.post.fragments.threadmenu.ThreadMenuFragment import com.huanchengfly.tieba.post.fragments.threadmenu.ThreadMenuFragment
import com.huanchengfly.tieba.post.goToActivity import com.huanchengfly.tieba.post.goToActivity
import com.huanchengfly.tieba.post.interfaces.CommonCallback
import com.huanchengfly.tieba.post.models.ReplyInfoBean import com.huanchengfly.tieba.post.models.ReplyInfoBean
import com.huanchengfly.tieba.post.models.ThreadHistoryInfoBean import com.huanchengfly.tieba.post.models.ThreadHistoryInfoBean
import com.huanchengfly.tieba.post.models.database.History import com.huanchengfly.tieba.post.models.database.History
@ -687,7 +687,8 @@ class ThreadActivity : BaseActivity(), View.OnClickListener, IThreadMenuFragment
DialogUtil.build(this) DialogUtil.build(this)
.setMessage(R.string.message_update_store_floor) .setMessage(R.string.message_update_store_floor)
.setPositiveButton(R.string.button_yes) { dialog: DialogInterface, _ -> .setPositiveButton(R.string.button_yes) { dialog: DialogInterface, _ ->
collect(object : CommonCallback<CommonResponse> { collect(object :
CommonCallback<CommonResponse> {
override fun onSuccess(data: CommonResponse) { override fun onSuccess(data: CommonResponse) {
Toast.makeText( Toast.makeText(
this@ThreadActivity, this@ThreadActivity,
@ -1003,7 +1004,8 @@ class ThreadActivity : BaseActivity(), View.OnClickListener, IThreadMenuFragment
}) })
} else { } else {
collect(object : CommonCallback<CommonResponse> { collect(object :
CommonCallback<CommonResponse> {
override fun onSuccess(data: CommonResponse) { override fun onSuccess(data: CommonResponse) {
Toast.makeText( Toast.makeText(
this@ThreadActivity, this@ThreadActivity,

View File

@ -13,12 +13,17 @@ import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import com.huanchengfly.tieba.post.App import com.huanchengfly.tieba.post.App
import com.huanchengfly.tieba.post.R import com.huanchengfly.tieba.post.R
import com.huanchengfly.tieba.post.api.interfaces.CommonCallback
import com.huanchengfly.tieba.post.dpToPx import com.huanchengfly.tieba.post.dpToPx
import com.huanchengfly.tieba.post.interfaces.CommonCallback
import com.huanchengfly.tieba.post.ui.common.theme.utils.ThemeUtils import com.huanchengfly.tieba.post.ui.common.theme.utils.ThemeUtils
import com.huanchengfly.tieba.post.utils.* import com.huanchengfly.tieba.post.utils.DialogUtil
import com.huanchengfly.tieba.post.utils.ImageUtil
import com.huanchengfly.tieba.post.utils.QuickPreviewUtil
import com.huanchengfly.tieba.post.utils.Util
import com.huanchengfly.tieba.post.utils.getClipBoardText
import com.huanchengfly.tieba.post.utils.getClipBoardTimestamp
import org.intellij.lang.annotations.RegExp import org.intellij.lang.annotations.RegExp
import java.util.* import java.util.Objects
import java.util.regex.Pattern import java.util.regex.Pattern
object ClipBoardLinkDetector : Application.ActivityLifecycleCallbacks { object ClipBoardLinkDetector : Application.ActivityLifecycleCallbacks {
@ -144,7 +149,8 @@ object ClipBoardLinkDetector : Application.ActivityLifecycleCallbacks {
QuickPreviewUtil.getPreviewInfo( QuickPreviewUtil.getPreviewInfo(
activity, activity,
url, url,
object : CommonCallback<QuickPreviewUtil.PreviewInfo> { object :
CommonCallback<QuickPreviewUtil.PreviewInfo> {
override fun onSuccess(data: QuickPreviewUtil.PreviewInfo) { override fun onSuccess(data: QuickPreviewUtil.PreviewInfo) {
updatePreviewView(activity, previewView, data) updatePreviewView(activity, previewView, data)
} }

View File

@ -1,4 +1,4 @@
package com.huanchengfly.tieba.post.api.interfaces; package com.huanchengfly.tieba.post.interfaces;
public interface CommonCallback<T> { public interface CommonCallback<T> {
void onSuccess(T data); void onSuccess(T data);

View File

@ -6,10 +6,10 @@ import android.text.TextUtils
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import com.huanchengfly.tieba.post.R import com.huanchengfly.tieba.post.R
import com.huanchengfly.tieba.post.api.TiebaApi import com.huanchengfly.tieba.post.api.TiebaApi
import com.huanchengfly.tieba.post.api.interfaces.CommonCallback
import com.huanchengfly.tieba.post.api.models.ForumPageBean import com.huanchengfly.tieba.post.api.models.ForumPageBean
import com.huanchengfly.tieba.post.api.models.ThreadContentBean import com.huanchengfly.tieba.post.api.models.ThreadContentBean
import com.huanchengfly.tieba.post.api.retrofit.exception.TiebaException import com.huanchengfly.tieba.post.api.retrofit.exception.TiebaException
import com.huanchengfly.tieba.post.interfaces.CommonCallback
import retrofit2.Call import retrofit2.Call
import retrofit2.Callback import retrofit2.Callback
import retrofit2.Response import retrofit2.Response