fix: 修复回贴时添加小尾巴
This commit is contained in:
parent
3da25a4c49
commit
3a0387487b
|
|
@ -288,71 +288,16 @@ public class ReplyActivity extends BaseActivity implements View.OnClickListener
|
||||||
return needUpload;
|
return needUpload;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
private void getReplyContent(ReplyContentCallback callback) {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
if (replyInfoBean.isSubFloor() && (replyInfoBean.getReplyUser() != null)) {
|
|
||||||
builder.append("回复 ");
|
|
||||||
builder.append(replyInfoBean.getReplyUser());
|
|
||||||
builder.append(" : ");
|
|
||||||
builder.append(editText.getText().toString());
|
|
||||||
callback.onSuccess(builder.toString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
builder.append(editText.getText().toString());
|
|
||||||
if (!needUpload()) {
|
|
||||||
if (hasPhoto()) {
|
|
||||||
for (PhotoInfoBean photoInfoBean : insertPhotoAdapter.getFileList()) {
|
|
||||||
if (photoInfoBean.getUploadResult() != null && photoInfoBean.getUploadResult().getInfo() != null) {
|
|
||||||
builder.append(photoInfoBean.getUploadResult().getInfo().getPic());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
callback.onSuccess(builder.toString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
StringBuilder picString = new StringBuilder();
|
|
||||||
UploadHelper.with(this)
|
|
||||||
.setFileList(insertPhotoAdapter.getFileList())
|
|
||||||
.setCallback(new UploadCallback() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(List<PhotoInfoBean> photoInfoBeans) {
|
|
||||||
for (PhotoInfoBean photoInfoBean : photoInfoBeans) {
|
|
||||||
if (photoInfoBean.getUploadResult() != null && photoInfoBean.getUploadResult().getInfo() != null) {
|
|
||||||
picString.append(photoInfoBean.getUploadResult().getInfo().getPic());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
builder.append(picString.toString());
|
|
||||||
callback.onSuccess(builder.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStart(int total) {
|
|
||||||
callback.onStart(total);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onProgress(int current, int total) {
|
|
||||||
callback.onProgress(current, total);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(String error) {
|
|
||||||
callback.onFailure(error);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.start();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
private String getReplyContent() {
|
private String getReplyContent() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
if (replyInfoBean.isSubFloor() && (replyInfoBean.getReplyUser() != null)) {
|
if (replyInfoBean.isSubFloor() && (replyInfoBean.getReplyUser() != null)) {
|
||||||
builder.append("回复 ");
|
builder.append("回复 ")
|
||||||
builder.append(replyInfoBean.getReplyUser());
|
.append(replyInfoBean.getReplyUser())
|
||||||
builder.append(" :");
|
.append(" :");
|
||||||
}
|
}
|
||||||
builder.append(editText.getText().toString());
|
builder.append(editText.getText().toString())
|
||||||
|
.append("\n")
|
||||||
|
.append(getAppPreferences().getLittleTail());
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -515,14 +460,17 @@ public class ReplyActivity extends BaseActivity implements View.OnClickListener
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String bsk) {
|
public void onSuccess(String bsk) {
|
||||||
if (replyInfoBean.getPid() == null && replyInfoBean.getFloorNum() == null) {
|
if (replyInfoBean.getPid() == null && replyInfoBean.getFloorNum() == null) {
|
||||||
TiebaApi.getInstance().webReply(replyInfoBean.getForumId(), replyInfoBean.getForumName(),
|
TiebaApi.getInstance().webReply(
|
||||||
|
replyInfoBean.getForumId(),
|
||||||
|
replyInfoBean.getForumName(),
|
||||||
replyInfoBean.getThreadId(),
|
replyInfoBean.getThreadId(),
|
||||||
replyInfoBean.getTbs(),
|
replyInfoBean.getTbs(),
|
||||||
getReplyContent(),
|
getReplyContent(),
|
||||||
data,
|
data,
|
||||||
replyInfoBean.getNickName(),
|
replyInfoBean.getNickName(),
|
||||||
replyInfoBean.getPn(),
|
replyInfoBean.getPn(),
|
||||||
bsk).enqueue(mCallback);
|
bsk
|
||||||
|
).enqueue(mCallback);
|
||||||
} else {
|
} else {
|
||||||
if (replyInfoBean.isSubFloor() && replyInfoBean.getSpid() != null) {
|
if (replyInfoBean.isSubFloor() && replyInfoBean.getSpid() != null) {
|
||||||
TiebaApi.getInstance().webReply(replyInfoBean.getForumId(), replyInfoBean.getForumName(),
|
TiebaApi.getInstance().webReply(replyInfoBean.getForumId(), replyInfoBean.getForumName(),
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,8 @@ import cn.jzvd.Jzvd
|
||||||
import com.billy.android.preloader.PreLoader
|
import com.billy.android.preloader.PreLoader
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils
|
import com.huanchengfly.tieba.post.R
|
||||||
|
import com.huanchengfly.tieba.post.adapters.RecyclerThreadAdapter
|
||||||
import com.huanchengfly.tieba.post.api.TiebaApi
|
import com.huanchengfly.tieba.post.api.TiebaApi
|
||||||
import com.huanchengfly.tieba.post.api.interfaces.CommonAPICallback
|
import com.huanchengfly.tieba.post.api.interfaces.CommonAPICallback
|
||||||
import com.huanchengfly.tieba.post.api.models.AgreeBean
|
import com.huanchengfly.tieba.post.api.models.AgreeBean
|
||||||
|
|
@ -35,14 +36,13 @@ import com.huanchengfly.tieba.post.api.models.CommonResponse
|
||||||
import com.huanchengfly.tieba.post.api.models.ThreadContentBean
|
import com.huanchengfly.tieba.post.api.models.ThreadContentBean
|
||||||
import com.huanchengfly.tieba.post.api.models.ThreadContentBean.PostListItemBean
|
import com.huanchengfly.tieba.post.api.models.ThreadContentBean.PostListItemBean
|
||||||
import com.huanchengfly.tieba.post.api.retrofit.exception.TiebaException
|
import com.huanchengfly.tieba.post.api.retrofit.exception.TiebaException
|
||||||
import com.huanchengfly.tieba.post.R
|
|
||||||
import com.huanchengfly.tieba.post.adapters.RecyclerThreadAdapter
|
|
||||||
import com.huanchengfly.tieba.post.components.MyLinearLayoutManager
|
import com.huanchengfly.tieba.post.components.MyLinearLayoutManager
|
||||||
import com.huanchengfly.tieba.post.components.dialogs.EditTextDialog
|
import com.huanchengfly.tieba.post.components.dialogs.EditTextDialog
|
||||||
import com.huanchengfly.tieba.post.components.dividers.ThreadDivider
|
import com.huanchengfly.tieba.post.components.dividers.ThreadDivider
|
||||||
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
|
||||||
|
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils
|
||||||
import com.huanchengfly.tieba.post.utils.*
|
import com.huanchengfly.tieba.post.utils.*
|
||||||
import com.huanchengfly.tieba.post.utils.preload.PreloadUtil
|
import com.huanchengfly.tieba.post.utils.preload.PreloadUtil
|
||||||
import com.huanchengfly.tieba.post.utils.preload.loaders.ThreadContentLoader
|
import com.huanchengfly.tieba.post.utils.preload.loaders.ThreadContentLoader
|
||||||
|
|
@ -599,7 +599,7 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
||||||
|
|
||||||
private fun collect(commonAPICallback: CommonAPICallback<CommonResponse>?, update: Boolean) {
|
private fun collect(commonAPICallback: CommonAPICallback<CommonResponse>?, update: Boolean) {
|
||||||
if (dataBean == null || tid == null) return
|
if (dataBean == null || tid == null) return
|
||||||
val postListItemBean = lastVisibleItem ?: return
|
val postListItemBean = firstVisibleItem ?: 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) {
|
override fun onFailure(call: Call<CommonResponse>, t: Throwable) {
|
||||||
if (t is TiebaException) {
|
if (t is TiebaException) {
|
||||||
|
|
@ -695,7 +695,7 @@ class ThreadActivity : BaseActivity(), View.OnClickListener {
|
||||||
private fun exit(): Boolean {
|
private fun exit(): Boolean {
|
||||||
if (collect) {
|
if (collect) {
|
||||||
DialogUtil.build(this)
|
DialogUtil.build(this)
|
||||||
.setTitle("是否更新收藏楼层")
|
.setMessage(R.string.message_update_store_floor)
|
||||||
.setPositiveButton(R.string.button_yes) { dialog: DialogInterface, _ ->
|
.setPositiveButton(R.string.button_yes) { dialog: DialogInterface, _ ->
|
||||||
collect(object : CommonAPICallback<CommonResponse> {
|
collect(object : CommonAPICallback<CommonResponse> {
|
||||||
override fun onSuccess(data: CommonResponse) {
|
override fun onSuccess(data: CommonResponse) {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ open class AppPreferencesUtils(context: Context) {
|
||||||
//PreferenceManager.getDefaultSharedPreferences(context)
|
//PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
|
||||||
var loadPictureWhenScroll by SharedPreferenceDelegates.boolean(true)
|
var loadPictureWhenScroll by SharedPreferenceDelegates.boolean(true)
|
||||||
|
var littleTail by SharedPreferenceDelegates.string(key = "little_tail")
|
||||||
|
|
||||||
private object SharedPreferenceDelegates {
|
private object SharedPreferenceDelegates {
|
||||||
fun int(defaultValue: Int = 0) = object : ReadWriteProperty<AppPreferencesUtils, Int> {
|
fun int(defaultValue: Int = 0) = object : ReadWriteProperty<AppPreferencesUtils, Int> {
|
||||||
|
|
@ -81,13 +82,16 @@ open class AppPreferencesUtils(context: Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun string(defaultValue: String? = null) =
|
fun string(
|
||||||
|
defaultValue: String? = null,
|
||||||
|
key: String? = null
|
||||||
|
) =
|
||||||
object : ReadWriteProperty<AppPreferencesUtils, String?> {
|
object : ReadWriteProperty<AppPreferencesUtils, String?> {
|
||||||
override fun getValue(
|
override fun getValue(
|
||||||
thisRef: AppPreferencesUtils,
|
thisRef: AppPreferencesUtils,
|
||||||
property: KProperty<*>
|
property: KProperty<*>
|
||||||
): String? {
|
): String? {
|
||||||
return thisRef.preferences.getString(property.name, defaultValue)
|
return thisRef.preferences.getString(key ?: property.name, defaultValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setValue(
|
override fun setValue(
|
||||||
|
|
@ -95,7 +99,7 @@ open class AppPreferencesUtils(context: Context) {
|
||||||
property: KProperty<*>,
|
property: KProperty<*>,
|
||||||
value: String?
|
value: String?
|
||||||
) {
|
) {
|
||||||
thisRef.preferences.edit().putString(property.name, value).apply()
|
thisRef.preferences.edit().putString(key ?: property.name, value).apply()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -358,4 +358,5 @@
|
||||||
<string name="hint_reply">回复 %1$s</string>
|
<string name="hint_reply">回复 %1$s</string>
|
||||||
<string name="title_emotion_classic">经典</string>
|
<string name="title_emotion_classic">经典</string>
|
||||||
<string name="title_emotion_emoji">符号</string>
|
<string name="title_emotion_emoji">符号</string>
|
||||||
|
<string name="message_update_store_floor">是否更新收藏楼层</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue