Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
14 changes: 7 additions & 7 deletions app/src/main/java/com/fy/weibo/activity/ContentActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void initData() {
TextView commentCounts = findViewById(R.id.comment_counts);
TextView shareCounts = findViewById(R.id.share_counts);
TextView thumbUpCounts = findViewById(R.id.thumb_up_counts);
ImageView commentImage=findViewById(R.id.comment);//评论点击处,
Button commentButton=findViewById(R.id.comment_btn);//评论点击处,
weiBoText.setMaxLines(100);
weiBoText.setText(weiBo.getText());
RequestOptions options = new RequestOptions().placeholder(new ColorDrawable(Color.WHITE));
Expand Down Expand Up @@ -122,7 +122,7 @@ public void initData() {
imgRecyclerView.setAdapter(adapter);
}

commentImage.setOnClickListener(this);//评论点击事件
commentButton.setOnClickListener(this);//评论点击事件
}


Expand Down Expand Up @@ -163,7 +163,7 @@ public void setComments(List<Comments> comments) {
@Override
public void onClick(View v) {
switch(v.getId()){
case R.id.comment:
case R.id.comment_btn:
WeiBo userInfo = (WeiBo) getIntent().getSerializableExtra("weibo");
String id=userInfo.getIdstr();
showPopupWindow(ContentActivity.this,R.layout.comment_popupwindow, Constants.ACCESS_TOKEN,id);
Expand Down Expand Up @@ -194,16 +194,16 @@ public void onClick(View view) {
case R.id.btn_comfirm:
String CcommentText= String.valueOf(editText.getText());
Map<String,String> info=new HashMap<>() ;
info.put("token",access_token);
info.put("access_token",access_token);
info.put("id",id);
info.put("commentInfo",CcommentText);
info.put("comment",CcommentText);
HttpUtil.getHttpUtil().post(POST_WEIBO_COMMENT,info,new Callback() {
@Override
public void onFailure(Call call, IOException e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(ContentActivity.this, "fail", Toast.LENGTH_SHORT).show();
Toast.makeText(ContentActivity.this, "发送失败", Toast.LENGTH_SHORT).show();
finish();
}
});
Expand All @@ -214,7 +214,7 @@ public void onResponse(Call call, Response response) throws IOException {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(ContentActivity.this, "success", Toast.LENGTH_SHORT).show();
Toast.makeText(ContentActivity.this, "发送成功", Toast.LENGTH_SHORT).show();
}
});

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/fy/weibo/util/HttpUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public void post(String baseUrl, Map<String, String> params, Callback callback)

FormBody.Builder formBodyBuilder = new FormBody.Builder();
for (Entry<String, String> entry : params.entrySet()) {
Log.e("key",entry.getKey());
Log.e("Value",entry.getValue());
formBodyBuilder.add(entry.getKey(), entry.getValue());
}
FormBody formBody = formBodyBuilder.build();
Expand Down
5 changes: 1 addition & 4 deletions app/src/main/res/layout/comment_popupwindow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/black"/>

<TextView
android:id="@+id/title"
Expand All @@ -23,6 +19,7 @@
android:id="@+id/dialog_edit"
android:layout_width="match_parent"
android:layout_height="200dp"
android:gravity="top"
android:background="@android:color/white"
android:hint="请输入评论(不超过140字)" />
<View
Expand Down
16 changes: 13 additions & 3 deletions app/src/main/res/layout/content_layout.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
xmlns:tools="http://schemas.android.com/tools">

<android.support.v4.widget.NestedScrollView
android:layout_height="match_parent"
android:layout_width="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
Expand Down Expand Up @@ -71,6 +73,14 @@
</RelativeLayout>

</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.NestedScrollView>
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/comment_btn"
android:text="发表评论"
android:layout_alignParentBottom="true"
android:background="@android:color/holo_orange_light"/>
</RelativeLayout>

<!-- 微博正文 -->