Skip to content

Commit

Permalink
using sendreply api to rewrite the commenting module
Browse files Browse the repository at this point in the history
  • Loading branch information
kidozh committed Apr 21, 2020
1 parent 19c5e22 commit 2d00bc2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
}

Expand All @@ -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){
Expand Down Expand Up @@ -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);
Expand Down
16 changes: 14 additions & 2 deletions app/src/main/java/com/kidozh/discuzhub/utilities/bbsURLUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/layout/item_bbs_forum_thread.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand All @@ -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" />
Expand Down

0 comments on commit 2d00bc2

Please sign in to comment.