From 2d00bc2ccb7aa149785755260b7499f6be096cc4 Mon Sep 17 00:00:00 2001 From: kidozh Date: Tue, 21 Apr 2020 16:16:07 +0800 Subject: [PATCH] using sendreply api to rewrite the commenting module --- .../adapter/bbsForumThreadAdapter.java | 18 ++++++++++++++++++ .../discuzhub/utilities/bbsURLUtils.java | 16 ++++++++++++++-- .../main/res/layout/item_bbs_forum_thread.xml | 2 -- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/kidozh/discuzhub/adapter/bbsForumThreadAdapter.java b/app/src/main/java/com/kidozh/discuzhub/adapter/bbsForumThreadAdapter.java index 6b3925e3..2de9b6e3 100644 --- a/app/src/main/java/com/kidozh/discuzhub/adapter/bbsForumThreadAdapter.java +++ b/app/src/main/java/com/kidozh/discuzhub/adapter/bbsForumThreadAdapter.java @@ -4,6 +4,7 @@ import android.app.ActivityOptions; import android.content.Context; import android.content.Intent; +import android.media.Image; import android.os.Bundle; import android.text.Html; import android.text.SpannableString; @@ -210,9 +211,11 @@ public void onBindViewHolder(@NonNull bbsForumThreadAdapter.bbsForumThreadViewHo int readPermissionVal = Integer.parseInt(threadInfo.readperm); if(curUser == null || curUser.readPerm < readPermissionVal){ holder.mReadPerm.setTextColor(mContext.getColor(R.color.colorWarn)); + holder.mReadPermIcon.setImageDrawable(mContext.getDrawable(R.drawable.vector_drawable_close)); } else { holder.mReadPerm.setTextColor(mContext.getColor(R.color.colorTextDefault)); + holder.mReadPermIcon.setImageDrawable(mContext.getDrawable(R.drawable.vector_drawable_read_permission)); } } @@ -229,6 +232,17 @@ public void onBindViewHolder(@NonNull bbsForumThreadAdapter.bbsForumThreadViewHo } } + if(threadInfo.price !=0 ){ + holder.mPriceImage.setVisibility(View.VISIBLE); + holder.mPriceNumber.setText(String.valueOf(threadInfo.price)); + holder.mPriceNumber.setVisibility(View.VISIBLE); + } + else { + holder.mPriceImage.setVisibility(View.GONE); + // holder.mPriceNumber.setText(String.valueOf(threadInfo.price)); + holder.mPriceNumber.setVisibility(View.GONE); + } + holder.mAttachmentNumber.setText(numberFormatUtils.getShortNumberText(threadInfo.attachment)); if(threadInfo.shortReplyInfoList!=null && threadInfo.shortReplyInfoList.size()>0){ @@ -331,6 +345,10 @@ public class bbsForumThreadViewHolder extends RecyclerView.ViewHolder{ ImageView mAttachmentIcon; @BindView(R.id.bbs_thread_attachment_number) TextView mAttachmentNumber; + @BindView(R.id.bbs_thread_price_image) + ImageView mPriceImage; + @BindView(R.id.bbs_thread_price_number) + TextView mPriceNumber; public bbsForumThreadViewHolder(@NonNull View itemView) { super(itemView); ButterKnife.bind(this,itemView); diff --git a/app/src/main/java/com/kidozh/discuzhub/utilities/bbsURLUtils.java b/app/src/main/java/com/kidozh/discuzhub/utilities/bbsURLUtils.java index 95479ed4..32da7faf 100644 --- a/app/src/main/java/com/kidozh/discuzhub/utilities/bbsURLUtils.java +++ b/app/src/main/java/com/kidozh/discuzhub/utilities/bbsURLUtils.java @@ -222,11 +222,23 @@ public static String getDefaultAvatarUrlByUid(String uid){ return UC_SERVER_URL+String.format("/avatar.php?uid=%s",uid); } +// public static String getLoginUrl(){ +// return BASE_URL + "/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1"; +// //return "https://bbs.nwpu.edu.cn/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1"; +// } + public static String getLoginUrl(){ - return BASE_URL + "/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1"; - //return "https://bbs.nwpu.edu.cn/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1"; + Uri uri = Uri.parse(BASE_URL+"/api/mobile/index.php").buildUpon() + .appendQueryParameter("version","4") + .appendQueryParameter("module","login") + .appendQueryParameter("lssubmit","yes") + .appendQueryParameter("loginsubmit","yes") + .build(); + return uri.toString(); } + + public static String getLoginWebUrl(){ return BASE_URL+"/member.php?mod=logging&action=login"; } diff --git a/app/src/main/res/layout/item_bbs_forum_thread.xml b/app/src/main/res/layout/item_bbs_forum_thread.xml index e3ab10db..73a16d5a 100644 --- a/app/src/main/res/layout/item_bbs_forum_thread.xml +++ b/app/src/main/res/layout/item_bbs_forum_thread.xml @@ -174,7 +174,6 @@ android:layout_width="16dp" android:layout_height="16dp" android:layout_marginStart="8dp" - android:visibility="gone" app:layout_constraintStart_toEndOf="@+id/bbs_thread_read_perm_number" app:layout_constraintTop_toTopOf="@+id/bbs_thread_view_textview" app:srcCompat="@drawable/vector_drawable_price_tag" /> @@ -194,7 +193,6 @@ android:layout_height="wrap_content" android:layout_marginStart="8dp" android:textSize="12sp" - android:visibility="gone" app:layout_constraintStart_toEndOf="@+id/bbs_thread_price_image" app:layout_constraintTop_toTopOf="@+id/bbs_thread_reply_image" tools:text="@tools:sample/us_zipcodes" />