parent
d8fc598509
commit
fc0b4e7c7b
@ -1,105 +1,14 @@
|
||||
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 androidx.fragment.app.FragmentManager;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
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 的适配器
|
||||
public class APNActivity extends BaseActivity {
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
@ -1,103 +1,39 @@
|
||||
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.HistoryQuestionAdapter;
|
||||
import com.example.leudaemialikeme.Adapter.QuestionAdapter;
|
||||
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 java.util.Map;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class ConcernedProblemActivity extends BaseActivity {
|
||||
|
||||
private List<Question> mData = new ArrayList<>();
|
||||
private RecyclerView recyclerView;
|
||||
private boolean isPause;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_concerned_problem);
|
||||
recyclerView = (RecyclerView) findViewById(R.id.questionList);//获得视图
|
||||
ImageView back_concerned = findViewById(R.id.back_concerned);
|
||||
getData();//获得数据
|
||||
RecyclerView recycleView = (RecyclerView) findViewById(R.id.questionList);//获得视图
|
||||
LinearLayoutManager layoutManager;
|
||||
layoutManager = new LinearLayoutManager(this);
|
||||
recyclerView.setLayoutManager(layoutManager);//建立线性布局
|
||||
QuestionAdapter adapter = new QuestionAdapter(mData, ConcernedProblemActivity.this);//创建适配器
|
||||
recyclerView.setAdapter(adapter);//将视图与适配器连接起来
|
||||
getData();//获得数据
|
||||
back_concerned.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
recycleView.setLayoutManager(layoutManager);//建立线性布局
|
||||
QuestionAdapter adapter = new QuestionAdapter(mData);//创建适配器
|
||||
recycleView.setAdapter(adapter);//将视图与适配器连接起来
|
||||
}
|
||||
|
||||
private void getData() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try{
|
||||
String url = ConcernedProblemActivity.SERVER_URL+"/my-servlet?action=concernedQuestion&uid="+ BaseActivity.owner.getNetId()+"&type="+3;
|
||||
Callback callback = new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
System.out.println("-----ERROR----");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
String jsonStr = response.body().string();
|
||||
Gson gson = new Gson();
|
||||
Map<String, String> jsonMap= gson.fromJson(jsonStr, new TypeToken<Map<String, String>>() {}.getType());
|
||||
final String message=(String) jsonMap.get("message");
|
||||
if (message.equals("success")) {
|
||||
List<Question> questionList = gson.fromJson(jsonMap.get("questionList"), new TypeToken <List<Question>>(){}.getType());
|
||||
mData = questionList;
|
||||
QuestionAdapter adapter = new QuestionAdapter(mData, ConcernedProblemActivity.this);//创建适配器
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
}
|
||||
};
|
||||
OkHttpUtil.asyGet(url,callback);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
Question q1 = new Question("白血病的早期症状和前兆有什么","24浏览","10:24");
|
||||
mData.add(q1);
|
||||
Question q2 = new Question("白血病是什么原因引起的","112浏览","15:11");
|
||||
mData.add(q2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
isPause = true; //记录页面已经被暂停
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (isPause){ //判断是否暂停
|
||||
isPause = false;
|
||||
getData();
|
||||
HistoryQuestionAdapter adapter = new HistoryQuestionAdapter(mData, ConcernedProblemActivity.this);//创建适配器
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,105 @@
|
||||
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);
|
||||
}
|
||||
}
|
@ -1,101 +1,37 @@
|
||||
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.Question;
|
||||
import com.example.leudaemialikeme.Model.MyQuestion;
|
||||
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<Question> questionList = new ArrayList<>();
|
||||
RecyclerView recycleView;
|
||||
private boolean isPause = false;
|
||||
private List<MyQuestion> mData = new ArrayList<>();
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_my_question);
|
||||
recycleView = findViewById(R.id.my_question_list);//获得视图
|
||||
getData();//获得数据
|
||||
RecyclerView recycleView = (RecyclerView) findViewById(R.id.myQuestionList);//获得视图
|
||||
LinearLayoutManager layoutManager;
|
||||
layoutManager = new LinearLayoutManager(this);
|
||||
recycleView.setLayoutManager(layoutManager);//建立线性布局
|
||||
MyQuestionAdapter adapter = new MyQuestionAdapter(questionList, MyQuestionActivity.this);//创建适配器
|
||||
MyQuestionAdapter adapter = new MyQuestionAdapter(mData);//创建适配器
|
||||
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 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();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
isPause = true; //记录页面已经被暂停
|
||||
private void getData() {
|
||||
MyQuestion q1 = new MyQuestion("成人白血病的早期症状有什么?","2浏览","22:24");
|
||||
mData.add(q1);
|
||||
MyQuestion q2 = new MyQuestion("幼儿易得白血病吗?","56浏览","09:11");
|
||||
mData.add(q2);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (isPause){ //判断是否暂停
|
||||
isPause = false;
|
||||
getMyQustionList();
|
||||
MyQuestionAdapter adapter = new MyQuestionAdapter(questionList, MyQuestionActivity.this);//创建适配器
|
||||
recycleView.setAdapter(adapter);//将视图与适配器连接起来
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,102 @@
|
||||
package com.example.leudaemialikeme.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.leudaemialikeme.Model.News;
|
||||
import com.example.leudaemialikeme.R;
|
||||
|
||||
public class NewsDetailActivity extends BaseActivity {
|
||||
TextView sTitleView;
|
||||
TextView sAuthorNameView;
|
||||
TextView sContentView;
|
||||
TextView sLikeNumView;
|
||||
TextView sColNumView;
|
||||
private int nid;
|
||||
private String nTitle;
|
||||
private String nContent;
|
||||
private String nBrowse;
|
||||
// TextView bComNumView;
|
||||
// EditText comEditView;
|
||||
// TextView comComView;//评论的部分
|
||||
ImageView detail_to;
|
||||
ImageView search;
|
||||
News news;
|
||||
// User author;//资讯不需要显示作者
|
||||
// List<Comment> commentList;
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_news_detail);//显示详情页的布局
|
||||
|
||||
Intent intent = getIntent();
|
||||
nid = intent.getIntExtra("nid",-1);
|
||||
nTitle = intent.getStringExtra("nTitle");//获取帖子标题
|
||||
nContent = intent.getStringExtra("nContent");//获取内容
|
||||
nBrowse = intent.getStringExtra("nBrowseNum") ;//获取浏览量
|
||||
|
||||
initView();//初始布局
|
||||
initClick();//初始化点击
|
||||
|
||||
// EventBus.getDefault().register(this);//进行EvenBus的注册
|
||||
// Log.e("news:EventBus", news.getStittle());
|
||||
// if (news != null) {
|
||||
// Log.i("NewsDetailActivity", "news not null");
|
||||
// } else
|
||||
// Log.i("NewsDetailActivity", "news is null");
|
||||
setNewsDetail();//设置资讯子项的对应内容
|
||||
Log.e("传输后资讯编号nid是",String.valueOf(nid));
|
||||
Log.e("传输后资讯标题是",nTitle);
|
||||
Log.e("传输后资讯内容是",nContent);
|
||||
Log.e("传输后在详情页的资讯的浏览量是",nBrowse);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// protected void onDestroy() {
|
||||
// super.onDestroy();
|
||||
// EventBus.getDefault().unregister(this);
|
||||
// }
|
||||
|
||||
// @Subscribe(sticky = true)//标记和发送消息的标记一样
|
||||
// public void onEvent(News news) {//接受消息
|
||||
// this.news = news;
|
||||
// Log.e("接受的消息是",news.getScontent());
|
||||
// }
|
||||
|
||||
private void initView() {//初始化视图
|
||||
sTitleView = findViewById(R.id.detail_theme);
|
||||
sAuthorNameView = findViewById(R.id.author);
|
||||
sContentView = findViewById(R.id.sContent);
|
||||
sLikeNumView = findViewById(R.id.detail_like_num);//资讯点赞数
|
||||
sColNumView = findViewById(R.id.detail_col_num);//资讯收藏数
|
||||
detail_to = findViewById(R.id.detail_to);
|
||||
search = findViewById(R.id.detail_to_search);
|
||||
}
|
||||
|
||||
private void setNewsDetail() {//显示单个子项的资讯
|
||||
sTitleView.setText(nTitle);
|
||||
sContentView.setText(nContent);
|
||||
sLikeNumView.setText(nBrowse);//设置资讯的浏览量
|
||||
// updateNewsBrowse();//更新资讯浏览量
|
||||
// sLikeNumView.setText(String.valueOf(news.getSbrowseNum()));//其实是点赞量,但是显示资讯浏览量
|
||||
// sColNumView.setText(String.valueOf(news.getBcollectNum()));
|
||||
}
|
||||
|
||||
private void initClick() {
|
||||
detail_to.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//搜索的点击事件去掉了
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
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 com.example.leudaemialikeme.R;
|
||||
|
||||
public class NewsSearchActivity extends BaseActivity {
|
||||
ImageView back;
|
||||
EditText newsSearchEdit;
|
||||
TextView newsSearchCommit;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_news_search);
|
||||
initView();
|
||||
initClick();
|
||||
}
|
||||
|
||||
private void initView(){
|
||||
back = findViewById(R.id.search_back);
|
||||
newsSearchEdit = findViewById(R.id.news_search_edit);
|
||||
newsSearchCommit = findViewById(R.id.news_search_commit);
|
||||
}
|
||||
|
||||
private void initClick(){
|
||||
|
||||
back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
newsSearchCommit.setOnClickListener(new View.OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String text = newsSearchEdit.getText().toString();
|
||||
Intent intent=new Intent(NewsSearchActivity.this,NewsSearchResultActivity.class);
|
||||
Log.e("传递到result页的text = ",text);
|
||||
intent.putExtra("text",text);//把搜索的值传递到显示搜索结果的活动中
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,24 +1,74 @@
|
||||
package com.example.leudaemialikeme.Activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.example.leudaemialikeme.R;
|
||||
|
||||
public class SearchActivity extends BaseActivity {
|
||||
|
||||
private EditText nEditText;
|
||||
private ImageView back;
|
||||
Context context;
|
||||
Cursor cursor;
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_search);
|
||||
ImageView back;
|
||||
back =findViewById(R.id.search_to_index);
|
||||
context = this ;
|
||||
initView();
|
||||
// ImageView back;
|
||||
// back =findViewById(R.id.search_to_index);
|
||||
//
|
||||
// back.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) { //回到首页的跳转
|
||||
// Intent i = new Intent(SearchActivity.this, MainActivity.class);
|
||||
// i.putExtra("flag",1);
|
||||
// startActivity(i);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
private void initView(){
|
||||
back=(ImageView)findViewById(R.id.search_to_index);
|
||||
nEditText = (EditText)findViewById(R.id.EditText);//搜索栏
|
||||
//设置回首页跳转的点击事件
|
||||
back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) { //回到首页的跳转
|
||||
Intent i = new Intent(SearchActivity.this, MainActivity.class);
|
||||
i.putExtra("flag",1);
|
||||
startActivity(i);
|
||||
}
|
||||
});
|
||||
|
||||
//搜索栏EditText添加监听
|
||||
nEditText.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}//文本改变之前执行
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
//文本改变的时候执行
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
//如果长度为0
|
||||
if (s.length() == 0) {
|
||||
// //隐藏“删除”图片
|
||||
// mImageView.setVisibility(View.GONE);
|
||||
} else {//长度不为0
|
||||
//显示“删除图片”
|
||||
// mImageView.setVisibility(View.VISIBLE);
|
||||
//显示ListView
|
||||
// showListView();显示搜索项
|
||||
}
|
||||
}
|
||||
|
||||
public void afterTextChanged(Editable s) { }//文本改变之后执行
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.example.leudaemialikeme.Adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.leudaemialikeme.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AdapterClock extends BaseAdapter {
|
||||
|
||||
private String[] names={"甘露聚糖肽胶囊","消癌平糖浆"};
|
||||
private String[] time={"每天 8:00 14:00 19:00","每天 8:00 14:00 19:00"};
|
||||
private List<Switch> list_switch;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private TextView tv1,tv2;
|
||||
private Switch aSwitch;
|
||||
|
||||
public AdapterClock(Context context) {
|
||||
mContext=context;
|
||||
list_switch=new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
public Switch getaSwitch(int position){
|
||||
|
||||
return list_switch.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return names.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return names[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
|
||||
view= LayoutInflater.from(mContext).inflate(R.layout.list_item,null);
|
||||
tv1=(TextView)view.findViewById(R.id.md_name);
|
||||
tv2=(TextView)view.findViewById(R.id.md_time);
|
||||
aSwitch=(Switch)view.findViewById(R.id.sw);
|
||||
|
||||
list_switch.add(aSwitch);
|
||||
|
||||
tv1.setText(names[i]);
|
||||
tv2.setText(time[i]);
|
||||
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.example.leudaemialikeme.Adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.leudaemialikeme.Model.Collect;
|
||||
import com.example.leudaemialikeme.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CollectAdapter extends RecyclerView.Adapter<CollectAdapter.ViewHolder>{
|
||||
private List<Collect> collectList;
|
||||
|
||||
//重写构造方法
|
||||
public CollectAdapter(List<Collect> collectList){
|
||||
this.collectList = collectList;
|
||||
}
|
||||
public int getItemCount(){
|
||||
return collectList.size();
|
||||
}
|
||||
//内部类
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView collectTitle,collectName,collectContent,collectRead;
|
||||
ImageView collectIcon,collectImg;
|
||||
|
||||
public ViewHolder(@NonNull View itemView){
|
||||
super(itemView);
|
||||
this.collectTitle = (TextView)itemView.findViewById(R.id.collectTitle);
|
||||
this.collectIcon = (ImageView)itemView.findViewById(R.id.collectIcon);
|
||||
this.collectName = (TextView)itemView.findViewById(R.id.collectName);
|
||||
this.collectContent = (TextView)itemView.findViewById(R.id.collectContent);
|
||||
this.collectImg = (ImageView)itemView.findViewById(R.id.collectImg);
|
||||
this.collectRead = (TextView)itemView.findViewById(R.id.collectRead);
|
||||
}
|
||||
}
|
||||
//重写 onCreateViewHolder()方法
|
||||
@Override
|
||||
public CollectAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.collect_item,parent,false);
|
||||
CollectAdapter.ViewHolder holder=new CollectAdapter.ViewHolder(view);
|
||||
return holder;
|
||||
}
|
||||
//重写onBindViewHolder()方法
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder,int position){
|
||||
Collect collect = collectList.get(position);
|
||||
holder.collectTitle.setText(collect.getCollectTitle());
|
||||
holder.collectName.setText(collect.getCollectName());
|
||||
holder.collectContent.setText(collect.getCollectContent());
|
||||
holder.collectRead.setText(collect.getCollectRead());
|
||||
holder.collectIcon.setImageResource(collect.getCollectIconId());
|
||||
holder.collectImg.setImageResource(collect.getCollectImgId());
|
||||
}
|
||||
}
|
@ -1,94 +1,54 @@
|
||||
package com.example.leudaemialikeme.Adapter;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.text.Layout;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.leudaemialikeme.Activity.AddEventActivity;
|
||||
import com.example.leudaemialikeme.Model.Event;
|
||||
import com.example.leudaemialikeme.R;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class EventAdapter extends RecyclerView.Adapter<EventAdapter.ViewHolder>{
|
||||
// private List<Event> meventList;
|
||||
private List<Map<String,String>> mcontentList;
|
||||
private List<Event> meventList;
|
||||
|
||||
//重写构造方法
|
||||
public EventAdapter(List<Map<String,String>> contentList){
|
||||
this.mcontentList = contentList;
|
||||
public EventAdapter(List<Event> meventList){
|
||||
this.meventList = meventList;
|
||||
}
|
||||
public int getItemCount(){
|
||||
return mcontentList.size();
|
||||
return meventList.size();
|
||||
}
|
||||
//内部类
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
View eventView;
|
||||
TextView event_day,event_month,event_info,event_time;
|
||||
TextView event_place,event_doctor_name,event_create_time;
|
||||
LinearLayout event_item_layout;
|
||||
|
||||
public ViewHolder(@NonNull View itemView){
|
||||
super(itemView);
|
||||
eventView = itemView;
|
||||
this.event_day = (TextView)itemView.findViewById(R.id.event_day);
|
||||
this.event_month = (TextView)itemView.findViewById(R.id.event_month);
|
||||
this.event_info = (TextView)itemView.findViewById(R.id.event_info);
|
||||
this.event_time = (TextView)itemView.findViewById(R.id.event_time);
|
||||
this.event_place = itemView.findViewById(R.id.event_place);
|
||||
this.event_doctor_name = itemView.findViewById(R.id.event_doctor_name);
|
||||
this.event_create_time = itemView.findViewById(R.id.event_create_time);
|
||||
this.event_item_layout = itemView.findViewById(R.id.event_item_layout);
|
||||
}
|
||||
}
|
||||
//重写 onCreateViewHolder()方法
|
||||
@Override
|
||||
public EventAdapter.ViewHolder onCreateViewHolder(final ViewGroup parent, int viewType) {
|
||||
public EventAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.event_item,parent,false);
|
||||
// EventAdapter.ViewHolder holder=new EventAdapter.ViewHolder(view);
|
||||
final ViewHolder holder = new ViewHolder(view);
|
||||
holder.eventView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int position = holder.getAdapterPosition();
|
||||
String event_day = mcontentList.get(position).get("event_day");
|
||||
String event_month = mcontentList.get(position).get("event_month");
|
||||
String event_info = mcontentList.get(position).get("event_info");
|
||||
String event_place = mcontentList.get(position).get("event_place");
|
||||
String event_doctor_name = mcontentList.get(position).get("event_doctor_name");
|
||||
String event_time = mcontentList.get(position).get("event_time");
|
||||
String event_create_time = mcontentList.get(position).get("event_create_time");
|
||||
Intent intent = new Intent(parent.getContext(), AddEventActivity.class);
|
||||
intent.putExtra(AddEventActivity.EVENT_DAY,event_day);
|
||||
intent.putExtra(AddEventActivity.EVENT_MONTH,event_month);
|
||||
intent.putExtra(AddEventActivity.EVENT_INFO,event_info);
|
||||
intent.putExtra(AddEventActivity.EVENT_PLACE,event_place);
|
||||
intent.putExtra(AddEventActivity.EVENT_DOCTOR_NAME,event_doctor_name);
|
||||
intent.putExtra(AddEventActivity.EVENT_TIME,event_time);
|
||||
intent.putExtra(AddEventActivity.EVENT_CREATE_TIME,event_create_time);
|
||||
parent.getContext().startActivity(intent);
|
||||
}
|
||||
});
|
||||
EventAdapter.ViewHolder holder=new EventAdapter.ViewHolder(view);
|
||||
return holder;
|
||||
}
|
||||
//重写onBindViewHolder()方法
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder,int position){
|
||||
holder.event_day.setText(mcontentList.get(position).get("event_day"));
|
||||
holder.event_month.setText(mcontentList.get(position).get("event_month"));
|
||||
holder.event_info.setText(mcontentList.get(position).get("event_info"));
|
||||
holder.event_time.setText(mcontentList.get(position).get("event_time"));
|
||||
holder.event_place.setText(mcontentList.get(position).get("event_place"));
|
||||
holder.event_doctor_name.setText(mcontentList.get(position).get("event_doctor_name"));
|
||||
holder.event_create_time.setText(mcontentList.get(position).get("event_create_time"));
|
||||
|
||||
Event event = meventList.get(position);
|
||||
holder.event_day.setText(event.getEvent_day());
|
||||
holder.event_month.setText(event.getEvent_month());
|
||||
holder.event_info.setText(event.getEvent_info());
|
||||
holder.event_time.setText(event.getEvent_time());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
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.InfoChannelFragment;
|
||||
|
||||
public class InfoPageFragmentAdapter extends FragmentPagerAdapter {
|
||||
private String[] channelList;
|
||||
private FragmentManager fm;
|
||||
public InfoPageFragmentAdapter(@NonNull FragmentManager fm, String[] channelList) {
|
||||
super(fm);
|
||||
this.channelList = channelList;
|
||||
this.fm = fm;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
String InfoCategoryTitle = channelList[position];
|
||||
return InfoChannelFragment.newInstance(InfoCategoryTitle,position);
|
||||
// return InfoChannelFragment.newInstance(InfoCategoryTitle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return channelList.length;
|
||||
}//返回有效视图的数量
|
||||
}
|
@ -1,96 +1,55 @@
|
||||
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.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.leudaemialikeme.Activity.BaseActivity;
|
||||
import com.example.leudaemialikeme.Activity.LoginActivity;
|
||||
import com.example.leudaemialikeme.Activity.QuestionDetailActivity;
|
||||
import com.example.leudaemialikeme.Model.Question;
|
||||
import com.example.leudaemialikeme.R;
|
||||
import com.example.leudaemialikeme.Utils.OkHttpUtil;
|
||||
import com.example.leudaemialikeme.Utils.TimeUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class QuestionAdapter extends RecyclerView.Adapter<QuestionAdapter.ViewHolder>{
|
||||
private List<Question> questionList;
|
||||
private Context context;
|
||||
|
||||
//重写构造方法
|
||||
public QuestionAdapter(List<Question> questionList, Context context){
|
||||
public QuestionAdapter(List<Question> questionList){
|
||||
this.questionList = questionList;
|
||||
this.context = context;
|
||||
}
|
||||
public QuestionAdapter(){
|
||||
|
||||
}
|
||||
|
||||
public int getItemCount(){
|
||||
return questionList.size();
|
||||
}
|
||||
//内部类
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView questionId, questiontitle,questionInfo,questionRead,questionTime;
|
||||
TextView questionInfo,questionRead,questionTime;
|
||||
LinearLayout questionMore;
|
||||
|
||||
public ViewHolder(@NonNull View itemView){
|
||||
super(itemView);
|
||||
this.questionId = itemView.findViewById(R.id.question_id);
|
||||
this.questiontitle = itemView.findViewById(R.id.questionTitle);
|
||||
this.questionInfo = (TextView)itemView.findViewById(R.id.questionInfo);
|
||||
this.questionRead = (TextView)itemView.findViewById(R.id.questionRead);
|
||||
this.questionTime = (TextView)itemView.findViewById(R.id.questionTime);
|
||||
this.questionMore = (LinearLayout) itemView.findViewById(R.id.questionMore);
|
||||
}
|
||||
}
|
||||
|
||||
public void setQuestionList(List<Question> questionList){
|
||||
this.questionList=questionList;
|
||||
}
|
||||
//重写 onCreateViewHolder()方法
|
||||
@Override
|
||||
public QuestionAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.question_item,parent,false);
|
||||
QuestionAdapter.ViewHolder holder=new QuestionAdapter.ViewHolder(view);
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int qid = Integer.parseInt(holder.questionId.getText().toString());
|
||||
addQuestionBrowse(qid);
|
||||
Intent intent = new Intent(context, QuestionDetailActivity.class);
|
||||
intent.putExtra("qid", qid);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
return holder;
|
||||
}
|
||||
|
||||
private void addQuestionBrowse(int qid) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try{
|
||||
String url = LoginActivity.SERVER_URL+"/main-servlet?action=addQuestionBrowse&qid="+qid+"&iduser="+ BaseActivity.owner.getNetId();
|
||||
OkHttpUtil.synGet(url);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
//重写onBindViewHolder()方法
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull QuestionAdapter.ViewHolder holder, int position){
|
||||
Question question = questionList.get(position);
|
||||
holder.questionId.setText(String.valueOf(question.getQid()));
|
||||
holder.questiontitle.setText(question.getQtittle());
|
||||
holder.questionInfo.setText(question.getQcontent());
|
||||
holder.questionRead.setText(String.valueOf(question.getQbrowseNum()));
|
||||
holder.questionTime.setText(TimeUtil.timeToString(question.getQtime()));
|
||||
holder.questionInfo.setText(question.getQuestionInfo());
|
||||
holder.questionRead.setText(question.getQuestionRead());
|
||||
holder.questionTime.setText(question.getQuestionTime());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
package com.example.leudaemialikeme.Model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Collect implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String collectTitle;
|
||||
private int collectIconId;
|
||||
private String collectName;
|
||||
private String collectContent;
|
||||
private int collectImgId;
|
||||
private String collectRead;
|
||||
|
||||
public Collect(String collectTitle, int collectIconId, String collectName,
|
||||
String collectContent, int collectImgId, String collectRead){
|
||||
this.collectTitle = collectTitle;
|
||||
this.collectIconId = collectIconId;
|
||||
this.collectName = collectName;
|
||||
this.collectContent = collectContent;
|
||||
this.collectRead = collectRead;
|
||||
this.collectImgId = collectImgId;
|
||||
}
|
||||
|
||||
public String getCollectTitle() {
|
||||
return collectTitle;
|
||||
}
|
||||
|
||||
public void setCollectTitle(String collectTitle) {
|
||||
this.collectTitle = collectTitle;
|
||||
}
|
||||
|
||||
public int getCollectIconId() {
|
||||
return collectIconId;
|
||||
}
|
||||
|
||||
public void setCollectIconId(int collectIconId) {
|
||||
this.collectIconId = collectIconId;
|
||||
}
|
||||
|
||||
public String getCollectName() {
|
||||
return collectName;
|
||||
}
|
||||
|
||||
public void setCollectName(String collectName) {
|
||||
this.collectName = collectName;
|
||||
}
|
||||
|
||||
public String getCollectContent() {
|
||||
return collectContent;
|
||||
}
|
||||
|
||||
public void setCollectContent(String collectContent) {
|
||||
this.collectContent = collectContent;
|
||||
}
|
||||
|
||||
public int getCollectImgId() {
|
||||
return collectImgId;
|
||||
}
|
||||
|
||||
public void setCollectImgId(int collectImgId) {
|
||||
this.collectImgId = collectImgId;
|
||||
}
|
||||
|
||||
public String getCollectRead() {
|
||||
return collectRead;
|
||||
}
|
||||
|
||||
public void setCollectRead(String collectRead) {
|
||||
this.collectRead = collectRead;
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,98 +1,41 @@
|
||||
package com.example.leudaemialikeme.Model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public class Question implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private int qid;
|
||||
private int uid;
|
||||
private String qtittle;
|
||||
private String qcontent;
|
||||
private Timestamp qtime;
|
||||
private int qfollowNum;
|
||||
private int qanswerNum;
|
||||
private int qbrowseNum;
|
||||
private int flag;
|
||||
//声明所有变量
|
||||
private String questionInfo;
|
||||
private String questionRead;
|
||||
private String questionTime;
|
||||
|
||||
public Question() {}
|
||||
public Question(int uid,String qtitle,String qcontent,Timestamp qtime,
|
||||
int qfollowNum,int qanswerNum,int qbrowseNum,int flag) {
|
||||
this.uid=uid;
|
||||
this.qtittle=qtitle;
|
||||
this.qcontent=qcontent;
|
||||
this.qtime=qtime;
|
||||
this.qfollowNum=qfollowNum;
|
||||
this.qanswerNum=qanswerNum;
|
||||
this.qbrowseNum=qbrowseNum;
|
||||
this.flag=flag;
|
||||
public Question(String questionInfo,String questionRead,String questionTime){
|
||||
this. questionInfo = questionInfo;
|
||||
this.questionRead = questionRead;
|
||||
this.questionTime = questionTime;
|
||||
}
|
||||
|
||||
public Question(int qid, int uid, String qtittle, String qcontent, Timestamp timestamp, int qfollowNum, int qanswerNum,
|
||||
int qbrowseNum, int flag) {
|
||||
super();
|
||||
this.qid = qid;
|
||||
this.uid = uid;
|
||||
this.qtittle = qtittle;
|
||||
this.qcontent = qcontent;
|
||||
this.qtime = timestamp;
|
||||
this.qfollowNum = qfollowNum;
|
||||
this.qanswerNum = qanswerNum;
|
||||
this.qbrowseNum = qbrowseNum;
|
||||
this.flag = flag;
|
||||
public String getQuestionInfo() {
|
||||
return questionInfo;
|
||||
}
|
||||
public int getQid() {
|
||||
return qid;
|
||||
}
|
||||
public void setQid(int qid) {
|
||||
this.qid = qid;
|
||||
}
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
public String getQtittle() {
|
||||
return qtittle;
|
||||
}
|
||||
public void setQtittle(String qtittle) {
|
||||
this.qtittle = qtittle;
|
||||
}
|
||||
public String getQcontent() {
|
||||
return qcontent;
|
||||
}
|
||||
public void setQcontent(String qcontent) {
|
||||
this.qcontent = qcontent;
|
||||
}
|
||||
public Timestamp getQtime() {
|
||||
return qtime;
|
||||
}
|
||||
public void setQtime(Timestamp qtime) {
|
||||
this.qtime = qtime;
|
||||
}
|
||||
public int getQfollowNum() {
|
||||
return qfollowNum;
|
||||
}
|
||||
public void setQfollowNum(int qfollowNum) {
|
||||
this.qfollowNum = qfollowNum;
|
||||
}
|
||||
public int getQanswerNum() {
|
||||
return qanswerNum;
|
||||
}
|
||||
public void setQanswerNum(int qanswerNum) {
|
||||
this.qanswerNum = qanswerNum;
|
||||
|
||||
public void setQuestionInfo(String questionInfo) {
|
||||
this.questionInfo = questionInfo;
|
||||
}
|
||||
public int getQbrowseNum() {
|
||||
return qbrowseNum;
|
||||
|
||||
public String getQuestionRead() {
|
||||
return questionRead;
|
||||
}
|
||||
public void setQbrowseNum(int qbrowseNum) {
|
||||
this.qbrowseNum = qbrowseNum;
|
||||
|
||||
public void setQuestionRead(String questionRead) {
|
||||
this.questionRead = questionRead;
|
||||
}
|
||||
public int getFlag() {
|
||||
return flag;
|
||||
|
||||
public String getQuestionTime() {
|
||||
return questionTime;
|
||||
}
|
||||
public void setFlag(int flag) {
|
||||
this.flag = flag;
|
||||
|
||||
public void setQuestionTime(String questionTime) {
|
||||
this.questionTime = questionTime;
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,37 @@
|
||||
package com.example.leudaemialikeme.Utils;
|
||||
|
||||
import com.example.leudaemialikeme.Model.User;
|
||||
import com.example.leudaemialikeme.Model.News;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Data extends android.app.Application {
|
||||
private User user=new User(1,"123","123","13877673546","女");
|
||||
// private User user;
|
||||
public void setUser(User user){
|
||||
this.user=user;
|
||||
public int uid=1;
|
||||
public String id="430481200101220131";
|
||||
public String name="abc";
|
||||
|
||||
public int getUid(){
|
||||
return uid;
|
||||
}
|
||||
public User getUser(){
|
||||
return user;
|
||||
public void setUid(int uid){
|
||||
this.uid= uid;
|
||||
}
|
||||
|
||||
public String getId(){
|
||||
return this.id;
|
||||
}
|
||||
public void setId(String id){
|
||||
this.id= id;
|
||||
}
|
||||
|
||||
//1.6下午两点加的
|
||||
private List<News> newsList =new ArrayList<>();
|
||||
public void setNewsList(List<News> newsList){
|
||||
this.newsList=newsList;
|
||||
}
|
||||
|
||||
//下午五点加的
|
||||
public List<News> getNewsList() {
|
||||
return this.newsList ;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,162 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<!--定义一个SearchView-->
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/search_back"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
|
||||
android:src="@drawable/back" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/shape_round_corner"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<SearchView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
</SearchView>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/news_search_edit"
|
||||
android:layout_width="220dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:gravity="center_vertical"
|
||||
android:hint="请输入搜索内容" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/news_search_commit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="18dp"
|
||||
android:text="搜索"
|
||||
android:textColor="#f47920"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="搜索发现"
|
||||
android:textSize="20dp"
|
||||
android:layout_margin="30dp"
|
||||
android:textColor="#000000"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_round_corner"
|
||||
android:gravity="center"
|
||||
android:text="科普" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_round_corner"
|
||||
android:gravity="center"
|
||||
android:text="食疗" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_round_corner"
|
||||
android:gravity="center"
|
||||
android:text="政策" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_round_corner"
|
||||
android:gravity="center"
|
||||
android:text="药物" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_round_corner"
|
||||
android:gravity="center"
|
||||
android:text="暖心故事" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_round3_corner"
|
||||
android:textColor="#f47920"
|
||||
android:gravity="center"
|
||||
android:text="专家问答" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<!--定义一个SearchView-->
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/news_search_back"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_marginBottom="28dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
|
||||
android:src="@drawable/back" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/shape_round_corner"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<SearchView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
</SearchView>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/news_search_text"
|
||||
android:layout_width="220dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:gravity="center_vertical"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/news_result_back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="18dp"
|
||||
android:text="取消"
|
||||
android:textColor="#f47920"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/result_recyclerView"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="10dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/shape_round_corner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/collectTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="60dp"
|
||||
android:layout_weight="3"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:id="@+id/collectIcon"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/collectName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textSize="14dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_gravity="center"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16dp"
|
||||
android:id="@+id/collectContent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_weight="1"
|
||||
|
||||
/>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/collectImg"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/collectRead"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
/>
|
||||
</LinearLayout>
|
@ -0,0 +1,23 @@
|
||||
<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="com.example.leudaemialikeme.Fragment.AnswerCollectFragment">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/refresh_layout"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/APNList"
|
||||
android:background="@color/light_grey"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</FrameLayout>
|
@ -0,0 +1,84 @@
|
||||
<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="com.example.leudaemialikeme.Fragment.InfoFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginLeft="10dp"-->
|
||||
<!-- android:layout_marginTop="10dp"-->
|
||||
<!-- android:layout_margin="10dp"-->
|
||||
<!-- android:layout_marginRight="10dp"-->
|
||||
<!-- android:orientation="horizontal">-->
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:layout_width="350dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:background="@drawable/search_background"-->
|
||||
<!-- android:orientation="horizontal">-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/imageView5"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:src="@mipmap/img_search" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/searchtext"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:text="搜索资讯" />-->
|
||||
<!-- </LinearLayout>-->
|
||||
|
||||
<!-- </LinearLayout>-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp">
|
||||
<!-- 导航标签,包含一个单选按钮组-->
|
||||
<!-- 任意数量不能显示时的缩略符号 -->
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/hvChannel20"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/ivShowChannel"
|
||||
android:scrollbars="none">
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/rgChannel20"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" />
|
||||
</HorizontalScrollView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivShowChannel20"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@mipmap/channel_down_narrow" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/vpNewsListInfo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp" android:layout_weight="1"/>
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
@ -0,0 +1,13 @@
|
||||
<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="com.example.leudaemialikeme.Fragment.InfoChannelFragment">
|
||||
|
||||
<!-- TODO: Update blank fragment layout -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/hello_blank_fragment" />
|
||||
|
||||
</FrameLayout>
|
@ -1,88 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/todetail"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="18dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
<LinearLayout
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="60dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/hour"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:text="07"
|
||||
android:textSize="38sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/net"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_toRightOf="@id/hour"
|
||||
android:text=" : "
|
||||
android:textSize="28sp" />
|
||||
<TextView
|
||||
android:layout_toRightOf="@id/net"
|
||||
android:id="@+id/minute"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textStyle="bold"
|
||||
android:text="28"
|
||||
android:textSize="38sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/content_name"
|
||||
android:id="@+id/md_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/time"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="药品名"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="18sp" />
|
||||
android:layout_marginTop="7dp"
|
||||
android:paddingTop="5dp"
|
||||
android:text="甘露聚糖肽胶囊"
|
||||
android:textSize="16dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/content_dosage"
|
||||
android:id="@+id/md_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/time"
|
||||
android:layout_toRightOf="@id/content_name"
|
||||
android:text="剂量"
|
||||
android:textColor="@color/colorBlack"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/switch_control"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginRight="15dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:background="#B6B5B5" />
|
||||
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="每天 8:00 14:00 19:00" />
|
||||
</LinearLayout>
|
||||
|
||||
<Switch
|
||||
android:id="@+id/sw"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="60dp"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:focusable="false"
|
||||
android:clickable="false"
|
||||
android:padding="10dp"
|
||||
android:layout_alignParentRight="true"/>
|
||||
</LinearLayout>
|
||||
|
@ -1,67 +1,50 @@
|
||||
<?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"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="334dp"
|
||||
android:background="@drawable/background"
|
||||
android:elevation="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical"
|
||||
android:padding="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_my_question_id"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:text="" />
|
||||
android:background="@color/white"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_my_question_title"
|
||||
android:id="@+id/myQuestionInfo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="问题标题"
|
||||
android:textSize="15dp"
|
||||
android:textStyle="bold"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"/>
|
||||
android:textSize="20dp"
|
||||
android:layout_margin="15dp"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1"
|
||||
android:gravity="bottom"
|
||||
android:layout_marginTop="5dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_my_question_browse"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="--"
|
||||
android:textSize="12dp"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/myQuestionRead"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="浏览 "
|
||||
android:textSize="11dp"/>
|
||||
android:layout_weight="1"
|
||||
android:textSize="16dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_my_question_time"
|
||||
android:id="@+id/myQuestionTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="xxxx-xx-xx xx:xx:xx"
|
||||
android:textSize="11dp"/>
|
||||
android:layout_weight="2"
|
||||
android:textSize="16dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_my_question_flag"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="right"
|
||||
android:textColor="#f30"
|
||||
android:text="未审核" />
|
||||
|
||||
android:id="@+id/question"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in new issue