# Conflicts: # Code/LeudaemiaLikeMe/app/src/main/AndroidManifest.xml # Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Activity/BaseActivity.java # Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Activity/ConcernedProblemActivity.java # Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Adapter/QuestionAdapter.java # Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Fragment/MyFragment.java # Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Model/Blog.java # Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Model/Question.java # Code/LeudaemiaLikeMe/app/src/main/res/layout/question_item.xmlmaster
commit
9a9a6cd05d
@ -1,14 +1,105 @@
|
||||
package com.example.leudaemialikeme.Activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.HorizontalScrollView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import com.example.leudaemialikeme.R;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
public class APNActivity extends BaseActivity {
|
||||
import com.example.leudaemialikeme.Adapter.APNPageActivityAdapter;
|
||||
import com.example.leudaemialikeme.R;
|
||||
|
||||
public class APNActivity extends BaseActivity implements ViewPager.OnPageChangeListener{
|
||||
private static final String ARG_CHANNEL_LIST = "channel_list";
|
||||
private View view=null; // 碎片的布局实例
|
||||
private ViewPager viewPager; //内导航的碎片的容器
|
||||
private RadioGroup rgChannel=null; // 内导航由单选按钮组构成
|
||||
private HorizontalScrollView hvChannel=null; //单选按钮组可滚动动
|
||||
private ImageView apn_back;
|
||||
private String[] channelList = {"回答","帖子"}; //默认的内导航栏目
|
||||
private APNPageActivityAdapter adapter; //viewPager 的适配器
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_apn);
|
||||
viewPager = findViewById(R.id.vpNewsList);
|
||||
initViewPager(); //设置 ViewPager
|
||||
rgChannel = findViewById(R.id.rgChannel);
|
||||
hvChannel = findViewById(R.id.hvChannel);
|
||||
initTab(getLayoutInflater());
|
||||
rgChannel.setOnCheckedChangeListener(
|
||||
new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
viewPager.setCurrentItem(checkedId);
|
||||
}
|
||||
}
|
||||
);
|
||||
apn_back = findViewById(R.id.apn_back);
|
||||
apn_back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initViewPager() {
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
adapter = new APNPageActivityAdapter(fragmentManager, channelList);
|
||||
//参数 channelList 将被适配器用来在动态切换碎片的时候实时创建碎片 //设置 ViewPager 的适配器
|
||||
viewPager.setAdapter(adapter);
|
||||
viewPager.setOffscreenPageLimit(2);
|
||||
//设置显示第 1 个碎片
|
||||
viewPager.setCurrentItem(0);
|
||||
//设置 ViewPager 的切换监听
|
||||
viewPager.addOnPageChangeListener(this);
|
||||
}
|
||||
|
||||
private void initTab(LayoutInflater inflater) {
|
||||
for(int i=0;i<channelList.length;i++){
|
||||
RadioButton rb=(RadioButton)inflater.inflate(R.layout.invitation_tab_rb,null);
|
||||
rb.setId(i);
|
||||
rb.setText(channelList[i]);
|
||||
RadioGroup.LayoutParams params = new
|
||||
RadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT,
|
||||
RadioGroup.LayoutParams.WRAP_CONTENT);
|
||||
rgChannel.addView(rb,params);
|
||||
}
|
||||
rgChannel.check(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
setTab(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
|
||||
private void setTab(int idx){
|
||||
RadioButton rb=(RadioButton)rgChannel.getChildAt(idx);
|
||||
rb.setChecked(true);
|
||||
int left=rb.getLeft();
|
||||
int width=rb.getMeasuredWidth();
|
||||
DisplayMetrics metrics=new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
int screenWidth=metrics.widthPixels;
|
||||
int len=left+width/2-screenWidth/2;
|
||||
hvChannel.smoothScrollTo(len,0);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,117 @@
|
||||
package com.example.leudaemialikeme.Activity;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.example.leudaemialikeme.R;
|
||||
import com.example.leudaemialikeme.Utils.OkHttpUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class AnswerActivity extends AppCompatActivity {
|
||||
private TextView text_answer_cancel;
|
||||
private TextView text_answer_commit;
|
||||
private TextView text_question_name;
|
||||
private EditText edit_answer_detail;
|
||||
private int qid;
|
||||
private String qtitle;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Intent intent = getIntent();
|
||||
qid = intent.getIntExtra("qid", -1);
|
||||
qtitle = intent.getStringExtra("qtitle");
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_answer);
|
||||
|
||||
text_answer_cancel = findViewById(R.id.text_answer_cancel);
|
||||
text_answer_commit = findViewById(R.id.text_answer_commit);
|
||||
text_question_name = findViewById(R.id.text_question_name);
|
||||
edit_answer_detail = findViewById(R.id.text_answer_detail);
|
||||
text_question_name.setText(qtitle);
|
||||
|
||||
text_answer_cancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
text_answer_commit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(edit_answer_detail.getText().toString().equals("")){
|
||||
Toast.makeText(AnswerActivity.this, "请输入回答内容", Toast.LENGTH_SHORT).show();
|
||||
}else{
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(AnswerActivity.this);
|
||||
builder.setTitle("是否确认提交回答?");
|
||||
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Toast.makeText(AnswerActivity.this, "已取消回答", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String content = edit_answer_detail.getText().toString();
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("answerContent", content);
|
||||
sendAnswer(params);
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sendAnswer(Map params){
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try{
|
||||
String url = LoginActivity.SERVER_URL+"/main-servlet?action=sendAnswer&iduser="+ BaseActivity.owner.getNetId()+"&qid="+qid;
|
||||
OkHttpUtil.asyPost(url, params,new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
String jsonStr = response.body().string();
|
||||
runOnUiThread(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
if(jsonStr.equals("success")){
|
||||
Toast.makeText(getApplicationContext(), "回答成功", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}else {
|
||||
Toast.makeText(getApplicationContext(), "回答失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
@ -1,37 +1,82 @@
|
||||
package com.example.leudaemialikeme.Activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.leudaemialikeme.Adapter.MyQuestionAdapter;
|
||||
import com.example.leudaemialikeme.Model.MyQuestion;
|
||||
import com.example.leudaemialikeme.Model.Question;
|
||||
import com.example.leudaemialikeme.R;
|
||||
import com.example.leudaemialikeme.Utils.OkHttpUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class MyQuestionActivity extends BaseActivity {
|
||||
|
||||
private List<MyQuestion> mData = new ArrayList<>();
|
||||
private List<Question> questionList = new ArrayList<>();
|
||||
RecyclerView recycleView;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_my_question);
|
||||
getData();//获得数据
|
||||
RecyclerView recycleView = (RecyclerView) findViewById(R.id.myQuestionList);//获得视图
|
||||
recycleView = findViewById(R.id.my_question_list);//获得视图
|
||||
LinearLayoutManager layoutManager;
|
||||
layoutManager = new LinearLayoutManager(this);
|
||||
recycleView.setLayoutManager(layoutManager);//建立线性布局
|
||||
MyQuestionAdapter adapter = new MyQuestionAdapter(mData);//创建适配器
|
||||
MyQuestionAdapter adapter = new MyQuestionAdapter(questionList, MyQuestionActivity.this);//创建适配器
|
||||
recycleView.setAdapter(adapter);//将视图与适配器连接起来
|
||||
getMyQustionList();
|
||||
ImageView my_question_back = findViewById(R.id.my_question_back);
|
||||
my_question_back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getData() {
|
||||
MyQuestion q1 = new MyQuestion("成人白血病的早期症状有什么?","2浏览","22:24");
|
||||
mData.add(q1);
|
||||
MyQuestion q2 = new MyQuestion("幼儿易得白血病吗?","56浏览","09:11");
|
||||
mData.add(q2);
|
||||
private void getMyQustionList() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try{
|
||||
String url = LoginActivity.SERVER_URL+"/my-servlet?action=getMyQuestionList&iduser="+ BaseActivity.owner.getNetId();
|
||||
OkHttpUtil.asyGet(url, new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
String jsonStr = response.body().string();
|
||||
Gson gson = new Gson();
|
||||
questionList = gson.fromJson(jsonStr, new TypeToken<List<Question>>() {}.getType());
|
||||
runOnUiThread(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
MyQuestionAdapter adapter = new MyQuestionAdapter(questionList, MyQuestionActivity.this);//创建适配器
|
||||
recycleView.setAdapter(adapter);//将视图与适配器连接起来
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package com.example.leudaemialikeme.Adapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
|
||||
import com.example.leudaemialikeme.Fragment.APNChannelFragment;
|
||||
|
||||
public class APNPageActivityAdapter extends FragmentPagerAdapter {
|
||||
private String[] channelList;
|
||||
private FragmentManager fm;
|
||||
public APNPageActivityAdapter(@NonNull FragmentManager fm, String[] channelList) {
|
||||
super(fm);
|
||||
this.channelList = channelList;
|
||||
this.fm = fm;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
String APNCategoryTitle = channelList[position];
|
||||
return APNChannelFragment.newInstance(APNCategoryTitle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return channelList.length;
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.example.leudaemialikeme.Adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.leudaemialikeme.Activity.QuestionDetailActivity;
|
||||
import com.example.leudaemialikeme.Model.MyAnswerItemView;
|
||||
import com.example.leudaemialikeme.R;
|
||||
import com.example.leudaemialikeme.Utils.TimeUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MyAnswerAdapter extends RecyclerView.Adapter<MyAnswerAdapter.ViewHolder>{
|
||||
private List<MyAnswerItemView> answerList;
|
||||
private Context context;
|
||||
|
||||
public MyAnswerAdapter(List<MyAnswerItemView> answerList, Context context) {
|
||||
this.answerList = answerList;
|
||||
this.context = context;
|
||||
}
|
||||
static class ViewHolder extends RecyclerView.ViewHolder{
|
||||
private TextView text_answer_qid;
|
||||
private TextView text_my_answer_title;
|
||||
private TextView text_my_answer;
|
||||
private TextView text_answer_time;
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
text_answer_qid = itemView.findViewById(R.id.text_answer_qid);
|
||||
text_my_answer_title = itemView.findViewById(R.id.text_my_answer_title);
|
||||
text_my_answer = itemView.findViewById(R.id.text_my_answer);
|
||||
text_answer_time = itemView.findViewById(R.id.text_answer_time);
|
||||
}
|
||||
}
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.my_answer_item,parent,false);
|
||||
MyAnswerAdapter.ViewHolder holder=new MyAnswerAdapter.ViewHolder(view);
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(context, QuestionDetailActivity.class);
|
||||
intent.putExtra("qid", Integer.parseInt(holder.text_answer_qid.getText().toString()));
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
MyAnswerItemView answer = answerList.get(position);
|
||||
holder.text_answer_qid.setText(String.valueOf(answer.getQid()));
|
||||
holder.text_my_answer_title.setText(answer.getQtitle());
|
||||
holder.text_my_answer.setText(answer.getAcontent());
|
||||
holder.text_answer_time.setText(TimeUtil.timeToString(answer.getAnswerTime()));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return answerList.size();
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package com.example.leudaemialikeme.Adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.leudaemialikeme.Model.Blog;
|
||||
import com.example.leudaemialikeme.R;
|
||||
import com.example.leudaemialikeme.Utils.TimeUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MyBlogAdapter extends RecyclerView.Adapter<MyBlogAdapter.ViewHolder>{
|
||||
List<Blog> blogList = new ArrayList<>();
|
||||
|
||||
public MyBlogAdapter(List<Blog> blogList){
|
||||
this.blogList = blogList;
|
||||
}
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder{
|
||||
private TextView text_my_blog_id;
|
||||
private TextView text_my_blog_title;
|
||||
private TextView text_my_blog_content;
|
||||
private TextView text_my_blog_browse;
|
||||
private TextView text_my_blog_time;
|
||||
private TextView text_my_blog_flag;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
text_my_blog_id = itemView.findViewById(R.id.text_my_blog_id);
|
||||
text_my_blog_title = itemView.findViewById(R.id.text_my_blog_title);
|
||||
text_my_blog_content = itemView.findViewById(R.id.text_my_blog_content);
|
||||
text_my_blog_browse = itemView.findViewById(R.id.text_my_blog_browse);
|
||||
text_my_blog_time = itemView.findViewById(R.id.text_my_blog_time);
|
||||
text_my_blog_flag = itemView.findViewById(R.id.text_my_blog_flag);
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MyBlogAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.my_blog_item,parent,false);
|
||||
MyBlogAdapter.ViewHolder holder = new MyBlogAdapter.ViewHolder(view);
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//TODO 跳转到帖子的详情页
|
||||
}
|
||||
});
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyBlogAdapter.ViewHolder holder, int position) {
|
||||
Blog blog = blogList.get(position);
|
||||
holder.text_my_blog_id.setText(String.valueOf(blog.getBid()));
|
||||
holder.text_my_blog_title.setText(blog.getBtittle());
|
||||
holder.text_my_blog_content.setText(blog.getBcontent());
|
||||
holder.text_my_blog_browse.setText(String.valueOf(blog.getBbrowse()));
|
||||
holder.text_my_blog_time.setText(TimeUtil.timeToString(blog.getBtime()));
|
||||
if(blog.getFlag()==1)
|
||||
holder.text_my_blog_flag.setText("已审核");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return blogList.size();
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.example.leudaemialikeme.Adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.leudaemialikeme.Model.AnswerItemView;
|
||||
import com.example.leudaemialikeme.R;
|
||||
import com.example.leudaemialikeme.Utils.TimeUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class QuestionDetailAdapter extends RecyclerView.Adapter<QuestionDetailAdapter.ViewHolder>{
|
||||
List<AnswerItemView> answerList = new ArrayList<>();
|
||||
public QuestionDetailAdapter(List<AnswerItemView> answerList){
|
||||
this.answerList = answerList;
|
||||
}
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView text_answer_username;
|
||||
private TextView text_answer_content;
|
||||
private TextView text_answer_time;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
text_answer_username = itemView.findViewById(R.id.text_answer_username);
|
||||
text_answer_content = itemView.findViewById(R.id.text_answer_content);
|
||||
text_answer_time = itemView.findViewById(R.id.text_answer_time);
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public QuestionDetailAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.answer_item,parent,false);
|
||||
QuestionDetailAdapter.ViewHolder holder = new QuestionDetailAdapter.ViewHolder(view);
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull QuestionDetailAdapter.ViewHolder holder, int position) {
|
||||
AnswerItemView answer = answerList.get(position);
|
||||
holder.text_answer_username.setText(answer.getAnswerAuthor());
|
||||
holder.text_answer_content.setText(answer.getAnswerContent());
|
||||
holder.text_answer_time.setText(TimeUtil.timeToString(answer.getAnswerTime()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return answerList.size();
|
||||
}
|
||||
}
|
@ -0,0 +1,160 @@
|
||||
package com.example.leudaemialikeme.Fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.leudaemialikeme.Activity.BaseActivity;
|
||||
import com.example.leudaemialikeme.Adapter.MyAnswerAdapter;
|
||||
import com.example.leudaemialikeme.Adapter.MyBlogAdapter;
|
||||
import com.example.leudaemialikeme.Model.Blog;
|
||||
import com.example.leudaemialikeme.Model.MyAnswerItemView;
|
||||
import com.example.leudaemialikeme.R;
|
||||
import com.example.leudaemialikeme.Utils.OkHttpUtil;
|
||||
import com.example.leudaemialikeme.Utils.TimeUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class APNChannelFragment extends Fragment {
|
||||
private static final String ARG_CATEGORY_TITLE = "category_title";
|
||||
private String APNCategoryTitle = "Default";
|
||||
private List<MyAnswerItemView> answerList = new ArrayList<>();
|
||||
private List<Blog> blogList = new ArrayList<>();
|
||||
private RecyclerView answerRecyclerview;
|
||||
private RecyclerView blogRecyclerview;
|
||||
public APNChannelFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public static APNChannelFragment newInstance(String APNCategoryTitle) {
|
||||
APNChannelFragment fragment = new APNChannelFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_CATEGORY_TITLE, APNCategoryTitle);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
try {
|
||||
APNCategoryTitle = getArguments().getString(ARG_CATEGORY_TITLE);
|
||||
} catch (java.lang.NullPointerException e) {
|
||||
System.out.println("TesFragment getArg error!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view;
|
||||
if (APNCategoryTitle.equals("回答")) {
|
||||
view = inflater.inflate(R.layout.recyclerview, container, false);
|
||||
answerRecyclerview = view.findViewById(R.id.list_community);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
|
||||
answerRecyclerview.setLayoutManager(layoutManager);
|
||||
MyAnswerAdapter adapter = new MyAnswerAdapter(answerList, getContext());
|
||||
answerRecyclerview.setAdapter(adapter);
|
||||
getMyAnswerList();
|
||||
} else if (APNCategoryTitle.equals("帖子")) {
|
||||
view = inflater.inflate(R.layout.recyclerview, container, false);
|
||||
blogRecyclerview = view.findViewById(R.id.list_community);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
|
||||
blogRecyclerview.setLayoutManager(layoutManager);
|
||||
MyBlogAdapter adapter = new MyBlogAdapter(blogList);
|
||||
blogRecyclerview.setAdapter(adapter);
|
||||
getMyBlogList();
|
||||
} else {
|
||||
view = inflater.inflate(R.layout.fragment_a_p_n_channel, container, false);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
private void getMyBlogList() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try{
|
||||
String url = BaseActivity.SERVER_URL+"/my-servlet?action=getMyBlogList&iduser="+BaseActivity.owner.getNetId();
|
||||
OkHttpUtil.asyGet(url, new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
String jsonStr = response.body().string();
|
||||
Gson gson = new Gson();
|
||||
List<Blog> blogList = gson.fromJson(jsonStr, new TypeToken<List<Blog>>() {}.getType());
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MyBlogAdapter adapter = new MyBlogAdapter(blogList);
|
||||
blogRecyclerview.setAdapter(adapter);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void getMyAnswerList() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try{
|
||||
String url = BaseActivity.SERVER_URL+"/my-servlet?action=getMyAnswerList&iduser="+BaseActivity.owner.getNetId();
|
||||
OkHttpUtil.asyGet(url, new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
String jsonStr = response.body().string();
|
||||
Gson gson = new Gson();
|
||||
List<Map<String,String>> list = gson.fromJson(jsonStr, new TypeToken<List<Map<String, String>>>() {}.getType());
|
||||
for(int i=0; i<list.size(); i++){
|
||||
Map<String, String> jsonMap = list.get(i);
|
||||
MyAnswerItemView myAnswerItemView = new MyAnswerItemView();
|
||||
myAnswerItemView.setQid(Integer.parseInt(jsonMap.get("qid")));
|
||||
myAnswerItemView.setQtitle(jsonMap.get("qtitle"));
|
||||
myAnswerItemView.setAcontent(jsonMap.get("content"));
|
||||
myAnswerItemView.setAnswerTime(TimeUtil.stringToTime(jsonMap.get("answerTime")));
|
||||
answerList.add(myAnswerItemView);
|
||||
}
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MyAnswerAdapter adapter = new MyAnswerAdapter(answerList, getContext());
|
||||
answerRecyclerview.setAdapter(adapter);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.example.leudaemialikeme.Model;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public class AnswerItemView {
|
||||
private String answerAuthor;
|
||||
private String answerContent;
|
||||
private Timestamp answerTime;
|
||||
|
||||
public AnswerItemView(){
|
||||
|
||||
}
|
||||
|
||||
public AnswerItemView(String answerAuthor, String answerContent, Timestamp answerTime) {
|
||||
this.answerAuthor = answerAuthor;
|
||||
this.answerContent = answerContent;
|
||||
this.answerTime = answerTime;
|
||||
}
|
||||
|
||||
public String getAnswerAuthor() {
|
||||
return answerAuthor;
|
||||
}
|
||||
|
||||
public void setAnswerAuthor(String answerAuthor) {
|
||||
this.answerAuthor = answerAuthor;
|
||||
}
|
||||
|
||||
public String getAnswerContent() {
|
||||
return answerContent;
|
||||
}
|
||||
|
||||
public void setAnswerContent(String answerContent) {
|
||||
this.answerContent = answerContent;
|
||||
}
|
||||
|
||||
public Timestamp getAnswerTime() {
|
||||
return answerTime;
|
||||
}
|
||||
|
||||
public void setAnswerTime(Timestamp answerTime) {
|
||||
this.answerTime = answerTime;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.example.leudaemialikeme.Model;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public class MyAnswerItemView {
|
||||
private int qid;
|
||||
private String qtitle;
|
||||
private String acontent;
|
||||
private Timestamp answerTime;
|
||||
|
||||
public MyAnswerItemView(){
|
||||
|
||||
}
|
||||
|
||||
public MyAnswerItemView(int qid, String qtitle, String acontent, Timestamp answerTime) {
|
||||
this.qid = qid;
|
||||
this.qtitle = qtitle;
|
||||
this.acontent = acontent;
|
||||
this.answerTime = answerTime;
|
||||
}
|
||||
|
||||
public int getQid() {
|
||||
return qid;
|
||||
}
|
||||
|
||||
public void setQid(int qid) {
|
||||
this.qid = qid;
|
||||
}
|
||||
|
||||
public String getQtitle() {
|
||||
return qtitle;
|
||||
}
|
||||
|
||||
public void setQtitle(String qtitle) {
|
||||
this.qtitle = qtitle;
|
||||
}
|
||||
|
||||
public String getAcontent() {
|
||||
return acontent;
|
||||
}
|
||||
|
||||
public void setAcontent(String acontent) {
|
||||
this.acontent = acontent;
|
||||
}
|
||||
|
||||
public Timestamp getAnswerTime() {
|
||||
return answerTime;
|
||||
}
|
||||
|
||||
public void setAnswerTime(Timestamp answerTime) {
|
||||
this.answerTime = answerTime;
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
package com.example.leudaemialikeme.Model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class MyQuestion implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
//声明所有变量
|
||||
private String MyQuestionInfo;
|
||||
private String MyQuestionRead;
|
||||
private String MyQuestionTime;
|
||||
|
||||
public MyQuestion(String MyQuestionInfo,String MyQuestionRead,String MyQuestionTime){
|
||||
this. MyQuestionInfo = MyQuestionInfo;
|
||||
this.MyQuestionRead = MyQuestionRead;
|
||||
this.MyQuestionTime = MyQuestionTime;
|
||||
}
|
||||
|
||||
public String getMyQuestionInfo() {
|
||||
return MyQuestionInfo;
|
||||
}
|
||||
|
||||
public void setMyQuestionInfo(String myQuestionInfo) {
|
||||
MyQuestionInfo = myQuestionInfo;
|
||||
}
|
||||
|
||||
public String getMyQuestionRead() {
|
||||
return MyQuestionRead;
|
||||
}
|
||||
|
||||
public void setMyQuestionRead(String myQuestionRead) {
|
||||
MyQuestionRead = myQuestionRead;
|
||||
}
|
||||
|
||||
public String getMyQuestionTime() {
|
||||
return MyQuestionTime;
|
||||
}
|
||||
|
||||
public void setMyQuestionTime(String myQuestionTime) {
|
||||
MyQuestionTime = myQuestionTime;
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context="com.example.leudaemialikeme.Activity.SendInvitationActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_answer_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textSize="20dp"
|
||||
android:gravity="center"
|
||||
android:text="取消" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center"
|
||||
android:textSize="25dp"
|
||||
android:text="回答问题" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_answer_commit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textSize="20dp"
|
||||
android:gravity="center"
|
||||
android:text="提交" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="#efefef"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_question_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textSize="20dp"
|
||||
android:text="问题是什么呢?"
|
||||
android:textColor="#000"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/text_answer_detail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="280dp"
|
||||
android:ems="10"
|
||||
android:maxLines="4"
|
||||
android:gravity="start"
|
||||
android:layout_margin="10dp"
|
||||
android:hint="分享你的经验,互帮互助,大家一起好起来呀!" />
|
||||
<ImageButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/img_upload_img"
|
||||
android:layout_margin="10dp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,239 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/background"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/question_back"
|
||||
android:layout_width="47dp"
|
||||
android:layout_height="34dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/back" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="306dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="问题详情"
|
||||
android:textSize="19dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/detail_to_search"
|
||||
android:layout_width="66dp"
|
||||
android:layout_height="match_parent"
|
||||
app:srcCompat="@android:drawable/ic_menu_search" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_question_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000"
|
||||
android:text="问题标题"
|
||||
android:textSize="20dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="#FFFFFF">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView13"
|
||||
android:layout_width="104dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/person" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginLeft="5dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_author"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="用户名"
|
||||
android:textSize="18dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="管住嘴,迈开腿,多喝水" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_question_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="内容"
|
||||
android:layout_gravity="center"
|
||||
android:paddingTop="15dp"
|
||||
android:layout_margin="10dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_margin="20dp">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_invite_to_answer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:srcCompat="@mipmap/invite_to_answer" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="邀请回答" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_go_write_answer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:srcCompat="@mipmap/go_write_answer" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView52"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="去回答" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_follow_question"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:srcCompat="@mipmap/follow_question" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_follow_question"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="关注问题" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="#ffffff">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:background="#FFFFFF"
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView45"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="回答"
|
||||
android:textSize="19dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_answer_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="(0)"
|
||||
android:textSize="17dp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="#FFFFFF">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView_answer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@ -0,0 +1,60 @@
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardBackgroundColor="#FFFFFF">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/text_answer_user_image"
|
||||
android:layout_width="95dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_weight="1"
|
||||
android:src="@drawable/person" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_answer_username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="用户名"
|
||||
android:textSize="15dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_answer_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="太棒啦"
|
||||
android:textSize="14dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_answer_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="210dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="2021-11-06 09:19:54"
|
||||
android:textSize="12dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardBackgroundColor="#FFFFFF">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/comment_user_image"
|
||||
android:layout_width="104dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_weight="1"
|
||||
android:src="@drawable/person" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_user_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="亚子读书"
|
||||
android:textSize="15dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
|
||||
android:text="太棒啦"
|
||||
android:textSize="14dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView47"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="210dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="2021-11-06 09:19:54"
|
||||
android:textSize="12dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".Fragment.APNChannelFragment">
|
||||
|
||||
<!-- TODO: Update blank fragment layout -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/hello_blank_fragment" />
|
||||
|
||||
</FrameLayout>
|
@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="334dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/background"
|
||||
android:elevation="8dp"
|
||||
android:padding="15dp"
|
||||
android:layout_margin="12dp">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_answer_qid"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:text="" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_my_answer_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="标题"
|
||||
android:textSize="15dp"
|
||||
android:textStyle="bold"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_my_answer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textSize="11dp"
|
||||
android:text="内容"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1"
|
||||
android:gravity="bottom"
|
||||
android:layout_marginTop="5dp"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_answer_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="xxxx-xx-xx xx:xx:xx"
|
||||
android:textSize="11dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="right"
|
||||
android:text="问题详情 " />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/img_go_more" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="334dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/background"
|
||||
android:elevation="8dp"
|
||||
android:padding="15dp"
|
||||
android:layout_margin="12dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_my_blog_id"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:text="" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_my_blog_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="标题"
|
||||
android:textSize="15dp"
|
||||
android:textStyle="bold"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_my_blog_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="内容"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1"
|
||||
android:gravity="bottom"
|
||||
android:layout_marginTop="5dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_my_blog_browse"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="--"
|
||||
android:textSize="12dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="浏览 "
|
||||
android:textSize="11dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_my_blog_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="xxxx-xx-xx xx:xx:xx"
|
||||
android:textSize="11dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_my_blog_flag"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="right"
|
||||
android:text="未审核"
|
||||
android:textColor="#f30"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -1,50 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="334dp"
|
||||
android:background="@drawable/background"
|
||||
android:elevation="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:orientation="vertical"
|
||||
android:padding="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_my_question_id"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:text="" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/myQuestionInfo"
|
||||
android:id="@+id/text_my_question_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20dp"
|
||||
android:layout_margin="15dp"
|
||||
/>
|
||||
android:text="问题标题"
|
||||
android:textSize="15dp"
|
||||
android:textStyle="bold"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:orientation="horizontal">
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1"
|
||||
android:gravity="bottom"
|
||||
android:layout_marginTop="5dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/myQuestionRead"
|
||||
android:id="@+id/text_my_question_browse"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textSize="16dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
/>
|
||||
android:text="--"
|
||||
android:textSize="12dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/myQuestionTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:textSize="16dp"
|
||||
/>
|
||||
android:text="浏览 "
|
||||
android:textSize="11dp"/>
|
||||
|
||||
<LinearLayout
|
||||
<TextView
|
||||
android:id="@+id/text_my_question_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="xxxx-xx-xx xx:xx:xx"
|
||||
android:textSize="11dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_my_question_flag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/question"
|
||||
android:orientation="horizontal">
|
||||
android:gravity="right"
|
||||
android:textColor="#f30"
|
||||
android:text="未审核" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 836 B |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
Loading…
Reference in new issue