Delete 'Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Activity/DetailActivity.java'
parent
fc0b4e7c7b
commit
dcb99cc1b4
@ -1,105 +0,0 @@
|
|||||||
package com.example.leudaemialikeme.Activity;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.example.leudaemialikeme.R;
|
|
||||||
import com.example.leudaemialikeme.Utils.Data;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
//import com.example.leudaemialikeme.Dao.CommentDao;
|
|
||||||
|
|
||||||
public class DetailActivity extends BaseActivity {
|
|
||||||
EditText commentView;
|
|
||||||
String comment_content;
|
|
||||||
TextView commitView;//发布评论按钮
|
|
||||||
// CommentDao comment=new CommentDao();//评论
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_detail);//显示详情页的布局
|
|
||||||
|
|
||||||
initView();
|
|
||||||
setClick();
|
|
||||||
|
|
||||||
ImageView detail_to=findViewById(R.id.detail_to);//返回的小三角的图标
|
|
||||||
detail_to.setOnClickListener(new View.OnClickListener(){
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ImageView search=findViewById(R.id.detail_to_search);//详情页的搜索图标
|
|
||||||
search.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
Intent intent=new Intent(DetailActivity.this,SearchActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setClick() {//提交评论的方法
|
|
||||||
commentView.setOnClickListener(new View.OnClickListener(){
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) { //onClick方法
|
|
||||||
DetailActivity.this.finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
commitView.setOnClickListener(new View.OnClickListener(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
comment_content=commentView.getText().toString();
|
|
||||||
long timeCurrent = System.currentTimeMillis();
|
|
||||||
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
|
|
||||||
final String time = sdf.format(timeCurrent);
|
|
||||||
//final String time = "12月5日";
|
|
||||||
Log.e("输入的time:", time);
|
|
||||||
new Thread(new Runnable(){
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
Data app = (Data)getApplication();
|
|
||||||
//comment.cInsert(app.bid,app.uid,comment_content,time,0);
|
|
||||||
Log.e("已经插入评论表:",comment_content);
|
|
||||||
runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Toast.makeText(DetailActivity.this,
|
|
||||||
"评论成功",Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (Exception exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Toast.makeText(DetailActivity.this,
|
|
||||||
"评论失败,请检查您的网络状况",Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initView(){
|
|
||||||
commentView=(EditText)findViewById(R.id.editTextTextPersonName);
|
|
||||||
commitView=(TextView)findViewById(R.id.comment_commit);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue