服药提醒,大事记的增删改查基本完成

master
Jane 3 years ago
parent 360d4520d5
commit 64a919a3f9

@ -18,10 +18,16 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.LeudaemiaLikeMe">
<activity android:name=".Activity.AddEventActivity"></activity>
<activity android:name=".Activity.AddClock" />
<activity android:name=".Activity.AlarmAlert" />
<activity android:name=".ClockDetail" />
<meta-data
android:name="com.google.android.actions"
android:resource="@xml/network_security_config" />
<activity android:name=".Activity.BaseActivity"/>
<activity android:name=".Activity.BaseActivity" />
<activity android:name=".Activity.MainActivity" />
<activity android:name=".Activity.ChatActivity" />
<activity android:name=".Activity.AttentionActivity" />
@ -40,6 +46,11 @@
<activity android:name=".Activity.SendQuestionActivity" />
<activity android:name=".Activity.APNActivity" />
<activity android:name=".Activity.EventActivity" />
<receiver
android:name=".CallAlarm"
android:process=".remote" />
<activity android:name=".Activity.LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

@ -3,12 +3,14 @@
<dbname value="leukemia" />
<version value="2" />
<version value="4" />
<list>
<mapping class="com.example.leudaemialikeme.Model.Owner"/>
<mapping class="com.example.leudaemialikeme.Model.Friend"/>
<mapping class="com.example.leudaemialikeme.Model.Message"/>
<mapping class="com.example.leudaemialikeme.Model.Clock"/>
<mapping class="com.example.leudaemialikeme.Model.Event"/>
</list>
</litepal>

@ -0,0 +1,131 @@
package com.example.leudaemialikeme.Activity;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.TimePickerDialog;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;
import com.example.leudaemialikeme.CallAlarm;
import com.example.leudaemialikeme.Model.Clock;
import com.example.leudaemialikeme.R;
import java.util.Calendar;
import static com.example.leudaemialikeme.Activity.MdctRmdActivity.list;
import static com.example.leudaemialikeme.Activity.MdctRmdActivity.timeAdapter;
public class AddClock extends BaseActivity implements View.OnClickListener {
private Calendar calendar;
private TextView show_hour;
private TextView show_minute;
private EditText content_name;
private EditText content_dosage;
private Button set;
private Button save;
private ImageView back;
String hourformat;
String minuteformat;
Clock clock = new Clock();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_clock);
show_hour = findViewById(R.id.hour);
show_minute = findViewById(R.id.minute);
content_name = findViewById(R.id.content_name);
content_dosage = findViewById(R.id.content_dosage);
set = findViewById(R.id.set_time);
set.setOnClickListener(this);
save = findViewById(R.id.save);
back = findViewById(R.id.back_list_clock);
back.setImageResource(R.drawable.ic_back);
back.setOnClickListener(this);
save.setOnClickListener(this);
calendar = Calendar.getInstance();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.set_time:
calendar.setTimeInMillis(System.currentTimeMillis());
int mhour = calendar.get(Calendar.HOUR_OF_DAY);
int mminute = calendar.get(Calendar.MINUTE);
new TimePickerDialog(AddClock.this, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
//calendar.setTimeInMillis(System.currentTimeMillis());
calendar.set(Calendar.HOUR_OF_DAY, hourOfDay);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
hourformat = format(hourOfDay);
minuteformat = format(minute);
Toast.makeText(AddClock.this, "" + hourformat + ":" + minuteformat, Toast.LENGTH_SHORT).show();
show_hour.setText(hourformat);
show_minute.setText(minuteformat);
}
}, mhour, mminute, true).show();
break;
case R.id.save:
Intent intent = new Intent(AddClock.this, CallAlarm.class);
PendingIntent sender = PendingIntent.getBroadcast(
AddClock.this, 0, intent, 0);
AlarmManager am;
am = (AlarmManager) getSystemService(ALARM_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (System.currentTimeMillis()>calendar.getTimeInMillis()+40000){
//加24小时
am.setExact(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis()+86400000, sender);
}else {
am.setExact(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender);
}
}
clock.setHour(hourformat);
clock.setMinute(minuteformat);
clock.setName("" + content_name.getText().toString());
clock.setDosage("" + content_dosage.getText().toString());
clock.setClockType(Clock.clock_open);
if (clock.getHour()!=null&&clock.getMinute()!=null) {
clock.save();
list.add(clock);
timeAdapter.notifyDataSetChanged();
Log.e("Listnumber======",list.size()+"");
finish();
}else {
Toast.makeText(this, "请选择闹钟时间", Toast.LENGTH_SHORT).show();
}
break;
case R.id.back_list_clock:
finish();
break;
}
}
private String format(int x) {
String s = "" + x;
if (s.length() == 1) {
s = "0" + s;
}
return s;
}
}

@ -0,0 +1,203 @@
package com.example.leudaemialikeme.Activity;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;
import com.example.leudaemialikeme.Model.Event;
import com.example.leudaemialikeme.R;
import org.litepal.LitePal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
public class AddEventActivity extends BaseActivity {
public static final String EVENT_DAY = "event_day";
public static final String EVENT_MONTH= "event_month";
public static final String EVENT_INFO = "event_info";
public static final String EVENT_PLACE = "event_place";
public static final String EVENT_DOCTOR_NAME = "event_doctor_name";
public static final String EVENT_TIME = "event_time";
public static final String EVENT_CREATE_TIME = "event_create_time";
private TextView event_day,event_month,event_info;
private TextView event_place,event_doctor_name,event_time,event_create_time;
private String show_event_day,show_event_month,show_event_info;
private String show_event_place,show_event_doctor_name,show_event_time,show_event_create_time;
private ImageView delete,save;
private Button add_date,add_time;
private ImageView back;
DateFormat format= DateFormat.getDateTimeInstance();
Calendar calendar= Calendar.getInstance(Locale.CHINA);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_event);
event_day = findViewById(R.id.add_event_day);
event_month = findViewById(R.id.add_event_month);
event_info = findViewById(R.id.add_event_info);
event_place = findViewById(R.id.add_event_place);
event_doctor_name = findViewById(R.id.add_event_doctor_name);
event_time = findViewById(R.id.add_event_time);
event_create_time = findViewById(R.id.show_time);
delete = findViewById(R.id.delete_event);
save = findViewById(R.id.save_event);
add_date = findViewById(R.id.add_date);
add_time = findViewById(R.id.add_time);
back = findViewById(R.id.back_event_list);
Intent intent = getIntent();
show_event_day = intent.getStringExtra(EVENT_DAY);
show_event_month = intent.getStringExtra(EVENT_MONTH);
show_event_info = intent.getStringExtra(EVENT_INFO);
show_event_place = intent.getStringExtra(EVENT_PLACE);
show_event_doctor_name = intent.getStringExtra(EVENT_DOCTOR_NAME);
show_event_time = intent.getStringExtra(EVENT_TIME);
show_event_create_time = intent.getStringExtra(EVENT_CREATE_TIME);
event_day.setText(show_event_day);
event_month.setText(show_event_month);
event_info.setText(show_event_info);
event_place.setText(show_event_place);
event_doctor_name.setText(show_event_doctor_name);
event_time.setText(show_event_time);
event_create_time.setText(show_event_create_time);
//点击事项
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(AddEventActivity.this,EventActivity.class);
startActivity(intent);
}
});
delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String deleteContent=event_info.getText().toString();
LitePal.deleteAll(Event.class,"event_info=?",deleteContent);
finish();
}
});
save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//创建时间不为空,表明为修改
if(show_event_create_time!=null){
String inputDay = event_day.getText().toString();
String inputMonth = event_month.getText().toString();
String inputInfo = event_info.getText().toString();
String inputPlace = event_place.getText().toString();
String inputName = event_doctor_name.getText().toString();
String inputTime = event_time.getText().toString();
Event event = new Event();
event.setEvent_day(inputDay);
event.setEvent_month(inputMonth);
event.setEvent_info(inputInfo);
event.setEvent_place(inputPlace);
event.setEvent_doctor_name(inputName);
event.setEvent_time(inputTime);
// LitePal.where("ownerNetId = ?", String.valueOf(ownerNetId)).find(Friend.class);
event.updateAll("event_create_time=?",show_event_create_time);
finish();
}else{
SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
Date date=new Date(System.currentTimeMillis());
String inputDay = event_day.getText().toString();
String inputMonth = event_month.getText().toString();
String inputInfo = event_info.getText().toString();
String inputPlace = event_place.getText().toString();
String inputName = event_doctor_name.getText().toString();
String inputTime = event_time.getText().toString();
Event event = new Event();
event.setEvent_day(inputDay);
event.setEvent_month(inputMonth);
event.setEvent_info(inputInfo);
event.setEvent_place(inputPlace);
event.setEvent_doctor_name(inputName);
event.setEvent_time(inputTime);
event.setEvent_create_time(simpleDateFormat.format(date));
if(inputInfo.equals(LitePal.find(Event.class,3))){
Toast.makeText(AddEventActivity.this,"该大事记已存在",Toast.LENGTH_LONG).show();
finish();
}
event.save();
Toast.makeText(AddEventActivity.this,"保存成功",Toast.LENGTH_SHORT).show();
finish();//操作完成结束当前活动
}
}
});
//获取选择的月,日
add_date.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showDatePickerDialog(AddEventActivity.this, 4, event_month,event_day, calendar);;
}
});
//获取选择的时间
add_time.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showTimePickerDialog(AddEventActivity.this, 4, event_time, calendar);
}
});
}
public static void showTimePickerDialog(Activity activity,int themeResId, final TextView event_time, Calendar calendar) {
new TimePickerDialog( activity,themeResId,
// 绑定监听器
new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
// event_time.setText("您选择了:" + hourOfDay + "时" + minute + "分");
event_time.setText(hourOfDay+"时"+minute+"分");
}
}
// 设置初始时间
, calendar.get(Calendar.HOUR_OF_DAY)
, calendar.get(Calendar.MINUTE)
// true表示采用24小时制
,true).show();
}
public static void showDatePickerDialog(Activity activity, int themeResId, final TextView event_month,final TextView event_day, Calendar calendar) {
new DatePickerDialog(activity, themeResId, new DatePickerDialog.OnDateSetListener() {
// 绑定监听器(How the parent is notified that the date is set.)
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
// 此处得到选择的时间,可以进行你想要的操作
// tv.setText("您选择了:" + year + "年" + (monthOfYear + 1) + "月" + dayOfMonth + "日");
event_day.setText(String.valueOf(dayOfMonth));
event_month.setText(String.valueOf(monthOfYear+1));
}
}
// 设置初始日期
, calendar.get(Calendar.YEAR)
, calendar.get(Calendar.MONTH)
, calendar.get(Calendar.DAY_OF_MONTH)).show();
}
}

@ -0,0 +1,33 @@
package com.example.leudaemialikeme.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.media.MediaPlayer;
import android.os.Bundle;
import com.example.leudaemialikeme.R;
public class AlarmAlert extends BaseActivity {
private MediaPlayer mediaPlayer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int position = getIntent().getIntExtra("position",-1);
mediaPlayer = MediaPlayer.create(this,R.raw.clockmusic2);
mediaPlayer.start();
new AlertDialog.Builder(AlarmAlert.this)
.setIcon(R.drawable.clock)
.setTitle("闹钟响了")
.setCancelable(false)
.setMessage("时间到了!")
.setPositiveButton("关掉"
, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
AlarmAlert.this.finish();
mediaPlayer.stop();
}
}).show();
}
}

@ -31,7 +31,7 @@ public class BaseActivity extends AppCompatActivity {
public static Owner owner;
//服务器链接
public static String SERVER_IP = "172.30.87.197";
public static String SERVER_IP = "192.168.186.23";
// static {
// try {

@ -8,9 +8,20 @@ import androidx.recyclerview.widget.RecyclerView;
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.example.leudaemialikeme.Utils.TimeUtil;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import java.sql.Timestamp;
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 {
@ -30,10 +41,53 @@ public class ConcernedProblemActivity extends BaseActivity {
}
private void getData() {
Question q1 = new Question("白血病的早期症状和前兆有什么","24浏览","10:24");
mData.add(q1);
Question q2 = new Question("白血病是什么原因引起的","112浏览","15:11");
mData.add(q2);
// Question q1 = new Question("问题标题","白血病的早期症状和前兆有什么",24,TimeUtil.stringToTime("2022-01-07 12:12:12"));
// mData.add(q1);
// Question q2 = new Question("问题标题","白血病是什么原因引起的",112, TimeUtil.stringToTime("2022-01-07 12:12:12"));
// mData.add(q2);
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());
for(int i=0;i<questionList.size();i++){
Question startQuestion = questionList.get(i);
int qid = startQuestion.getQid();
int uid = startQuestion.getUid();
String qtittle = startQuestion.getQtittle();
String qcontent = startQuestion.getQcontent();
Timestamp qtime = startQuestion.getQtime();
int qfollowNum = startQuestion.getQfollowNum();
int qanswerNum = startQuestion.getQanswerNum();
int qbrowseNum = startQuestion.getQbrowseNum();
int flag = startQuestion.getFlag();
Question endQuestion = new Question(qid,uid,qtittle,qcontent,qtime,qfollowNum,qanswerNum,qbrowseNum,flag);
mData.add(endQuestion);
}
}
}
};
OkHttpUtil.asyGet(url,callback);
}catch (Exception e){
e.printStackTrace();
}
}
}).start();
}
}

@ -1,6 +1,9 @@
package com.example.leudaemialikeme.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -9,29 +12,88 @@ import com.example.leudaemialikeme.Adapter.EventAdapter;
import com.example.leudaemialikeme.Model.Event;
import com.example.leudaemialikeme.R;
import org.litepal.LitePal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class EventActivity extends BaseActivity {
private List<Event> mData = new ArrayList<>();
// private List<Event> mData = new ArrayList<>();
private List<Map<String,String>> contentList = new ArrayList<Map<String,String>>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_event);
getData();//获得数据
ImageView addContent = (ImageView) findViewById(R.id.add_event);
addContent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(EventActivity.this,AddEventActivity.class);
startActivity(intent);
}
});
ImageView back_my = findViewById(R.id.back_my);
back_my.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Intent intent = new Intent(EventActivity.this,MainActivity.class);
// startActivity(intent);
finish();
}
});
// getData();//获得数据
// RecyclerView recycleView = (RecyclerView) findViewById(R.id.eventList);//获得视图
// LinearLayoutManager layoutManager;
// layoutManager = new LinearLayoutManager(this);
// recycleView.setLayoutManager(layoutManager);//建立线性布局
// EventAdapter adapter = new EventAdapter(mData);//创建适配器
// recycleView.setAdapter(adapter);//将视图与适配器连接起来
}
@Override
protected void onStart(){
super.onStart();
contentList.clear();
initContent();
RecyclerView recycleView = (RecyclerView) findViewById(R.id.eventList);//获得视图
LinearLayoutManager layoutManager;
layoutManager = new LinearLayoutManager(this);
recycleView.setLayoutManager(layoutManager);//建立线性布局
EventAdapter adapter = new EventAdapter(mData);//创建适配器
EventAdapter adapter = new EventAdapter(contentList);//创建适配器
recycleView.setAdapter(adapter);//将视图与适配器连接起来
adapter.notifyDataSetChanged();
}
private void getData() {
Event event1 = new Event("04","10月","第三次化疗","08:00");
mData.add(event1);
Event event2 = new Event("11","5月","检查","09:00");
mData.add(event2);
private void initContent() {
List<Event> events = LitePal.order("id desc").find(Event.class);
for(Event event:events){
String event_day = event.getEvent_day();
String event_month = event.getEvent_month();
String event_info = event.getEvent_info();
String event_place = event.getEvent_place();
String event_doctor_name = event.getEvent_doctor_name();
String event_time = event.getEvent_time();
String event_create_time = event.getEvent_create_time();
Map<String,String> map = new HashMap<String,String>();
map.put("event_day",event_day);
map.put("event_month",event_month);
map.put("event_info",event_info);
map.put("event_place",event_place);
map.put("event_doctor_name",event_doctor_name);
map.put("event_time",event_time);
map.put("event_create_time",event_create_time);
contentList.add(map);
}
}
// private void getData() {
// Event event1 = new Event("04","10月","第三次化疗","08:00");
// mData.add(event1);
// Event event2 = new Event("11","5月","检查","09:00");
// mData.add(event2);
// }
}

@ -6,6 +6,7 @@ import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import com.example.leudaemialikeme.Fragment.CollectFragment;
import com.example.leudaemialikeme.Fragment.HistoryFragment;
import com.example.leudaemialikeme.R;
public class HistoryActivity extends BaseActivity {
@ -17,7 +18,7 @@ public class HistoryActivity extends BaseActivity {
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction trans = fm.beginTransaction();
String title = "浏览历史";
trans.replace(R.id.collect_frag_layout, new CollectFragment(title));
trans.replace(R.id.history_frag_layout, new HistoryFragment(title));
trans.commit();
}
}

@ -193,10 +193,10 @@ public class LoginActivity extends BaseActivity {
final String message=(String) jsonMap.get("message");
if (message.equals("success")){
//进行本地消息存储
List<Message> msgList = gson.fromJson(jsonMap.get("msgList"), new TypeToken <List<Message>>() {}.getType());
List<Message> msgList = gson.fromJson(jsonMap.get("msgList"), new TypeToken <List<Message>>(){}.getType());
for (int i=0;i<msgList.size();i++){
Message unReadMsg = msgList.get(i);
// System.out.println(unReadMsg.getSenderNetId());//////////////////////////////
// System.out.println(unReadMsg.getSenderNetId());
String content = unReadMsg.getContent();
int messageType = unReadMsg.getMessageType();
int receiverId = unReadMsg.getReceiverNetId();
@ -214,7 +214,7 @@ public class LoginActivity extends BaseActivity {
}
});
}
private void getNewFriendRequest(int senderId) {
private void getNewFriendRequest(final int senderId) {
new Thread(new Runnable() {
@Override
public void run() {
@ -228,7 +228,7 @@ public class LoginActivity extends BaseActivity {
}
}).start();
}
private void getNewFriendResponse(String jsonStr, int senderId) {
private void getNewFriendResponse(final String jsonStr, final int senderId) {
runOnUiThread(new Runnable() {
private MessageDao messageDao=new MessageDao();
@Override

@ -1,21 +1,32 @@
package com.example.leudaemialikeme.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.Switch;
import com.example.leudaemialikeme.Adapter.AdapterClock;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.leudaemialikeme.Adapter.TimeAdapter;
import com.example.leudaemialikeme.Model.Clock;
import com.example.leudaemialikeme.R;
import org.litepal.LitePal;
import org.litepal.crud.LitePalSupport;
import java.util.ArrayList;
import java.util.List;
public class MdctRmdActivity extends BaseActivity {
private ListView lv;
private AdapterClock adapter;
private RecyclerView lv;
public static TimeAdapter timeAdapter;
private ImageView add_md;
public static List<Clock> list = new ArrayList<>();
Context context = MdctRmdActivity.this;
@Override
@ -34,24 +45,53 @@ public class MdctRmdActivity extends BaseActivity {
}
});
lv=(ListView)findViewById(R.id.lv_list_data);
adapter=new AdapterClock(MdctRmdActivity.this);
lv.setAdapter(adapter);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
add_md = findViewById(R.id.add_md);
add_md.setOnClickListener(new View.OnClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Switch aSwitch=adapter.getaSwitch(i);
if(aSwitch.isChecked()){
aSwitch.setChecked(false);
//进行业务处理
}else {
aSwitch.setChecked(true);
//进行业务处理
}
public void onClick(View view) {
Intent intent1 = new Intent(MdctRmdActivity.this, AddClock.class);
startActivity(intent1);
}
});
lv=(RecyclerView)findViewById(R.id.rv_list_data);
LitePal.getDatabase();
initRecycleView();
// adapter=new TimeAdapter(MdctRmdActivity.this);
//
//
// lv.setAdapter(adapter);
// lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
// @Override
// public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
// Switch aSwitch=adapter.getaSwitch(i);
// if(aSwitch.isChecked()){
// aSwitch.setChecked(false);
// //进行业务处理
// }else {
// aSwitch.setChecked(true);
// //进行业务处理
// }
// }
// });
}
@Override
protected void onRestart(){
super.onRestart();
initRecycleView();
}
private void initRecycleView() {
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
lv.setLayoutManager(layoutManager);
timeAdapter = new TimeAdapter(list, context);
lv.setAdapter(timeAdapter);
list.clear();
List<Clock> list1 = LitePal.findAll(Clock.class);
for (Clock clock : list1) {
list.add(clock);
}
timeAdapter.notifyDataSetChanged();
}
}

@ -71,7 +71,7 @@ public class SendInvitationActivity extends BaseActivity {
try {
Data app = (Data)getApplication();
Log.e("type",type);
invitation.iInsert(app.uid,type,title,detail,time,0,0);
// invitation.iInsert(app.uid,type,title,detail,time,0,0);
runOnUiThread(new Runnable() {
@Override
public void run() {

@ -60,14 +60,14 @@ public class SendQuestionActivity extends BaseActivity {
else{
long timeCurrent = System.currentTimeMillis();
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
String time = sdf.format(timeCurrent);
Log.e("输入的time:", time);
// String time = sdf.format(timeCurrent);
// Log.e("输入的time:", time);
new Thread(new Runnable(){
@Override
public void run() {
try {
Data app = (Data)getApplication();
question.qInsert(app.uid,title,detail,time,0,0,0);
// question.qInsert(app.uid,title,detail,time,0,0,0);
runOnUiThread(new Runnable() {
@Override
public void run() {

@ -1,69 +0,0 @@
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;
}
}

@ -1,60 +0,0 @@
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());
}
}

@ -0,0 +1,56 @@
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.Blog;
import com.example.leudaemialikeme.R;
import com.example.leudaemialikeme.Utils.TimeUtil;
import java.util.List;
public class CollectBlogAdapter extends RecyclerView.Adapter<CollectBlogAdapter.ViewHolder>{
private List<Blog> collectBlogList;
//重写构造方法
public CollectBlogAdapter(List<Blog> collectBlogList){
this.collectBlogList = collectBlogList;
}
public int getItemCount(){
return collectBlogList.size();
}
//内部类
static class ViewHolder extends RecyclerView.ViewHolder {
TextView blog_title,blog_info,blog_read,blog_time;
public ViewHolder(@NonNull View itemView){
super(itemView);
this.blog_title = itemView.findViewById(R.id.blog_title);
this.blog_info = itemView.findViewById(R.id.blog_info);
this.blog_read = itemView.findViewById(R.id.blog_read);
this.blog_time = itemView.findViewById(R.id.blog_time);
}
}
//重写 onCreateViewHolder()方法
@Override
public CollectBlogAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.collect_blog_item,parent,false);
CollectBlogAdapter.ViewHolder holder=new CollectBlogAdapter.ViewHolder(view);
return holder;
}
//重写onBindViewHolder()方法
@Override
public void onBindViewHolder(@NonNull ViewHolder holder,int position){
Blog blog = collectBlogList.get(position);
holder.blog_title.setText(blog.getBtittle());
holder.blog_info.setText(blog.getBcontent());
holder.blog_read.setText(String.valueOf(blog.getBbrowse()));
holder.blog_time.setText(TimeUtil.timeToString(blog.getBtime()));
}
}

@ -0,0 +1,59 @@
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.News;
import com.example.leudaemialikeme.R;
import com.example.leudaemialikeme.Utils.TimeUtil;
import org.w3c.dom.Text;
import java.util.List;
public class CollectNewsAdapter extends RecyclerView.Adapter<CollectNewsAdapter.ViewHolder>{
private List<News> collectNewsList;
//重写构造方法
public CollectNewsAdapter(List<News> collectNewsList){
this.collectNewsList = collectNewsList;
}
public int getItemCount(){
return collectNewsList.size();
}
//内部类
static class ViewHolder extends RecyclerView.ViewHolder {
TextView news_title,news_info,news_read,news_time;
public ViewHolder(@NonNull View itemView){
super(itemView);
this.news_title = (TextView)itemView.findViewById(R.id.News_title);
this.news_info = (TextView)itemView.findViewById(R.id.News_info);
this.news_read = (TextView)itemView.findViewById(R.id.News_read);
this.news_time = (TextView)itemView.findViewById(R.id.News_time);
}
}
//重写 onCreateViewHolder()方法
@Override
public CollectNewsAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.collect_news_item,parent,false);
CollectNewsAdapter.ViewHolder holder=new CollectNewsAdapter.ViewHolder(view);
return holder;
}
//重写onBindViewHolder()方法
@Override
public void onBindViewHolder(@NonNull ViewHolder holder,int position){
News news = collectNewsList.get(position);
holder.news_title.setText(news.getStittle());
holder.news_info.setText(news.getScontent());
holder.news_read.setText(String.valueOf(news.getSbrowseNum()));
holder.news_time.setText(TimeUtil.timeToString(news.getStime()));
}
}

@ -1,54 +1,94 @@
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<Event> meventList;
private List<Map<String,String>> mcontentList;
//重写构造方法
public EventAdapter(List<Event> meventList){
this.meventList = meventList;
public EventAdapter(List<Map<String,String>> contentList){
this.mcontentList = contentList;
}
public int getItemCount(){
return meventList.size();
return mcontentList.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(ViewGroup parent, int viewType) {
public EventAdapter.ViewHolder onCreateViewHolder(final ViewGroup parent, int viewType) {
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.event_item,parent,false);
EventAdapter.ViewHolder holder=new EventAdapter.ViewHolder(view);
// 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);
}
});
return holder;
}
//重写onBindViewHolder()方法
@Override
public void onBindViewHolder(@NonNull ViewHolder holder,int position){
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());
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"));
}
}

@ -0,0 +1,56 @@
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.List;
public class HistoryBlogAdapter extends RecyclerView.Adapter<HistoryBlogAdapter.ViewHolder>{
private List<Blog> historyBlogList;
//重写构造方法
public HistoryBlogAdapter(List<Blog> historyBlogList){
this.historyBlogList = historyBlogList;
}
public int getItemCount(){
return historyBlogList.size();
}
//内部类
static class ViewHolder extends RecyclerView.ViewHolder {
TextView blog_title,blog_info,blog_read,blog_time;
public ViewHolder(@NonNull View itemView){
super(itemView);
this.blog_title = itemView.findViewById(R.id.blog_title);
this.blog_info = itemView.findViewById(R.id.blog_info);
this.blog_read = itemView.findViewById(R.id.blog_read);
this.blog_time = itemView.findViewById(R.id.blog_time);
}
}
//重写 onCreateViewHolder()方法
@Override
public HistoryBlogAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.collect_blog_item,parent,false);
HistoryBlogAdapter.ViewHolder holder=new HistoryBlogAdapter.ViewHolder(view);
return holder;
}
//重写onBindViewHolder()方法
@Override
public void onBindViewHolder(@NonNull ViewHolder holder,int position){
Blog blog = historyBlogList.get(position);
holder.blog_title.setText(blog.getBtittle());
holder.blog_info.setText(blog.getBcontent());
holder.blog_read.setText(String.valueOf(blog.getBbrowse()));
holder.blog_time.setText(TimeUtil.timeToString(blog.getBtime()));
}
}

@ -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.News;
import com.example.leudaemialikeme.R;
import com.example.leudaemialikeme.Utils.TimeUtil;
import java.util.List;
public class HistoryNewsAdapter extends RecyclerView.Adapter<HistoryNewsAdapter.ViewHolder>{
private List<News> historyNewsList;
//重写构造方法
public HistoryNewsAdapter(List<News> historyNewsList){
this.historyNewsList = historyNewsList;
}
public int getItemCount(){
return historyNewsList.size();
}
//内部类
static class ViewHolder extends RecyclerView.ViewHolder {
TextView news_title,news_info,news_read,news_time;
public ViewHolder(@NonNull View itemView){
super(itemView);
this.news_title = (TextView)itemView.findViewById(R.id.News_title);
this.news_info = (TextView)itemView.findViewById(R.id.News_info);
this.news_read = (TextView)itemView.findViewById(R.id.News_read);
this.news_time = (TextView)itemView.findViewById(R.id.News_time);
}
}
//重写 onCreateViewHolder()方法
@Override
public HistoryNewsAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.collect_news_item,parent,false);
HistoryNewsAdapter.ViewHolder holder=new HistoryNewsAdapter.ViewHolder(view);
return holder;
}
//重写onBindViewHolder()方法
@Override
public void onBindViewHolder(@NonNull ViewHolder holder,int position){
News news = historyNewsList.get(position);
holder.news_title.setText(news.getStittle());
holder.news_info.setText(news.getScontent());
holder.news_read.setText(String.valueOf(news.getSbrowseNum()));
holder.news_time.setText(TimeUtil.timeToString(news.getStime()));
}
}

@ -0,0 +1,36 @@
package com.example.leudaemialikeme.Adapter;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import com.example.leudaemialikeme.Fragment.BlogHistoryFragment;
import com.example.leudaemialikeme.Fragment.NewsHistoryFragment;
import com.example.leudaemialikeme.Fragment.QuestionHistoryFragment;
public class HistoryPageFragmentAdapter extends FragmentPagerAdapter {
private String[] channelList;
private FragmentManager fm;
public HistoryPageFragmentAdapter(FragmentManager fm, String[] channelList) {
super(fm);
this.channelList = channelList;
this.fm=fm;
}
@Override
public Fragment getItem(int idx) {
String collectCategoryTitle = channelList[idx];
if(collectCategoryTitle.equals(" 资讯 "))
{
return NewsHistoryFragment.newInstance(collectCategoryTitle);
}
else if(collectCategoryTitle.equals(" 问题 ")){
return QuestionHistoryFragment.newInstance(collectCategoryTitle);
}else{
return BlogHistoryFragment.newInstance(collectCategoryTitle);
}
}
@Override
public int getCount() {
return channelList.length;
} }

@ -0,0 +1,56 @@
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.Question;
import com.example.leudaemialikeme.R;
import com.example.leudaemialikeme.Utils.TimeUtil;
import java.util.List;
public class HistoryQuestionAdapter extends RecyclerView.Adapter<HistoryQuestionAdapter.ViewHolder>{
private List<Question> historyQuestionList;
//重写构造方法
public HistoryQuestionAdapter(List<Question> historyQuestionList){
this.historyQuestionList = historyQuestionList;
}
public int getItemCount(){
return historyQuestionList.size();
}
//内部类
static class ViewHolder extends RecyclerView.ViewHolder {
TextView questionTitle,questionInfo,questionRead,questionTime;
public ViewHolder(@NonNull View itemView){
super(itemView);
this.questionTitle = itemView.findViewById(R.id.questionTitle);
this.questionInfo = itemView.findViewById(R.id.questionInfo);
this.questionRead = itemView.findViewById(R.id.questionRead);
this.questionTime = itemView.findViewById(R.id.questionTime);
}
}
//重写 onCreateViewHolder()方法
@Override
public HistoryQuestionAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.question_item,parent,false);
HistoryQuestionAdapter.ViewHolder holder=new HistoryQuestionAdapter.ViewHolder(view);
return holder;
}
//重写onBindViewHolder()方法
@Override
public void onBindViewHolder(@NonNull ViewHolder holder,int position){
Question question = historyQuestionList.get(position);
holder.questionTitle.setText(question.getQtittle());
holder.questionInfo.setText(question.getQcontent());
holder.questionRead.setText(String.valueOf(question.getQbrowseNum()));
holder.questionTime.setText(TimeUtil.timeToString(question.getQtime()));
}
}

@ -64,8 +64,8 @@ public class MsgAdapter extends RecyclerView.Adapter<MsgAdapter.ViewHolder> {
}
@Override
public void onBindViewHolder(@NonNull MsgAdapter.ViewHolder holder, int position) {
Chat chat = chatList.get(position);
public void onBindViewHolder(@NonNull final MsgAdapter.ViewHolder holder, int position) {
final Chat chat = chatList.get(position);
holder.introduction.setText(String.valueOf(chat.getLastMessage()));
holder.nickname.setText(chat.getFriendName());
holder.chat_friend_id.setText(String.valueOf(chat.getFriendId()));

@ -11,6 +11,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.example.leudaemialikeme.Model.Question;
import com.example.leudaemialikeme.R;
import com.example.leudaemialikeme.Utils.TimeUtil;
import java.util.List;
@ -26,11 +27,12 @@ public class QuestionAdapter extends RecyclerView.Adapter<QuestionAdapter.ViewHo
}
//内部类
static class ViewHolder extends RecyclerView.ViewHolder {
TextView questionInfo,questionRead,questionTime;
TextView questiontitle,questionInfo,questionRead,questionTime;
LinearLayout questionMore;
public ViewHolder(@NonNull View itemView){
super(itemView);
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);
@ -48,8 +50,9 @@ public class QuestionAdapter extends RecyclerView.Adapter<QuestionAdapter.ViewHo
@Override
public void onBindViewHolder(@NonNull QuestionAdapter.ViewHolder holder, int position){
Question question = questionList.get(position);
holder.questionInfo.setText(question.getQuestionInfo());
holder.questionRead.setText(question.getQuestionRead());
holder.questionTime.setText(question.getQuestionTime());
holder.questiontitle.setText(question.getQtittle());
holder.questionInfo.setText(question.getQcontent());
holder.questionRead.setText(String.valueOf(question.getQbrowseNum()));
holder.questionTime.setText(TimeUtil.timeToString(question.getQtime()));
}
}

@ -0,0 +1,176 @@
package com.example.leudaemialikeme.Adapter;
import android.annotation.SuppressLint;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.leudaemialikeme.CallAlarm;
import com.example.leudaemialikeme.ClockDetail;
import com.example.leudaemialikeme.Model.Clock;
import com.example.leudaemialikeme.R;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import static android.content.Context.ALARM_SERVICE;
public class TimeAdapter extends RecyclerView.Adapter<TimeAdapter.ViewHolder> {
List<Clock> list;
LayoutInflater layoutInflater;
Context context;
Calendar calendar = Calendar.getInstance();
public static int pos;
public TimeAdapter(List<Clock> list, Context context) {
this.list = list;
this.context = context;
layoutInflater = LayoutInflater.from(context);
}
@Override
public TimeAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = layoutInflater.inflate(R.layout.list_item, null);
ViewHolder viewHolder = new ViewHolder(view);
return viewHolder;
}
@SuppressLint({"ResourceAsColor", "SetTextI18n"})
@Override
public void onBindViewHolder(@NonNull final TimeAdapter.ViewHolder viewHolder, final int i) {
final Clock clock = list.get(i);
System.out.println(i+"闹钟的位置");
pos = i;
Log.e("i=======",i+" "+clock.getClockType());
if (clock.getClockType() == Clock.clock_open){
viewHolder.aSwitch.setChecked(true);
viewHolder.hour.setTextColor(context.getResources().getColor(R.color.colorBlack));
viewHolder.minute.setTextColor(context.getResources().getColor(R.color.colorBlack));
viewHolder.net.setTextColor(context.getResources().getColor(R.color.colorBlack));
viewHolder.content_name.setTextColor(context.getResources().getColor(R.color.colorBlack));
viewHolder.content_dosage.setTextColor(context.getResources().getColor(R.color.colorBlack));
}else if (clock.getClockType() == Clock.clock_close){
viewHolder.aSwitch.setChecked(false);
viewHolder.hour.setTextColor(context.getResources().getColor(R.color.colorGray));
viewHolder.minute.setTextColor(context.getResources().getColor(R.color.colorGray));
viewHolder.net.setTextColor(context.getResources().getColor(R.color.colorGray));
viewHolder.content_name.setTextColor(context.getResources().getColor(R.color.colorGray));
viewHolder.content_dosage.setTextColor(context.getResources().getColor(R.color.colorGray));
}
viewHolder.hour.setText(clock.getHour()+"");
viewHolder.minute.setText(clock.getMinute()+"");
viewHolder.content_name.setText(clock.getName());
viewHolder.content_dosage.setText(clock.getDosage());
viewHolder.todetail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.e("TODETAIL",clock.getClockType()+"");
Intent intent = new Intent(context, ClockDetail.class);
intent.putExtra("position", i);
context.startActivity(intent);
}
});
viewHolder.aSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@SuppressLint("ResourceAsColor")
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
clock.setClockType(Clock.clock_open);
//clock.updateAll();
clock.save();
Toast.makeText(context, "开启闹钟", Toast.LENGTH_SHORT).show();
viewHolder.hour.setTextColor(context.getResources().getColor(R.color.colorBlack));
viewHolder.minute.setTextColor(context.getResources().getColor(R.color.colorBlack));
viewHolder.net.setTextColor(context.getResources().getColor(R.color.colorBlack));
viewHolder.content_name.setTextColor(context.getResources().getColor(R.color.colorBlack));
viewHolder.content_dosage.setTextColor(context.getResources().getColor(R.color.colorBlack));
Intent intent = new Intent(context, CallAlarm.class);
PendingIntent sender = PendingIntent.getBroadcast(
context, 0, intent, 0);
AlarmManager am;
am = (AlarmManager) context.getSystemService(ALARM_SERVICE);
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(clock.getHour()));
calendar.set(Calendar.MINUTE, Integer.parseInt(clock.getMinute()));
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
Log.e("TAG",calendar.getTimeInMillis()+"");
Log.e("TAG",System.currentTimeMillis()+"");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (System.currentTimeMillis()>calendar.getTimeInMillis()+40000){
//加24小时
am.setExact(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis()+86400000, sender);
}else {
am.setExact(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender);
}
}
} else if (!isChecked){
clock.setClockType(Clock.clock_close);
//clock.updateAll();
clock.save();
Log.e("status------",clock.getHour()+clock.getMinute()+clock.getMinute()+clock.getClockType()+"");
Log.e("关闭闹钟",clock.getClockType()+"");
Intent intent = new Intent(context, CallAlarm.class);
PendingIntent sender=PendingIntent.getBroadcast(
context,0, intent, 0);
AlarmManager am;
am =(AlarmManager)context.getSystemService(ALARM_SERVICE);
am.cancel(sender);
Toast.makeText(context, "关闭闹钟", Toast.LENGTH_SHORT).show();
viewHolder.hour.setTextColor(context.getResources().getColor(R.color.colorGray));
viewHolder.minute.setTextColor(context.getResources().getColor(R.color.colorGray));
viewHolder.net.setTextColor(context.getResources().getColor(R.color.colorGray));
viewHolder.content_name.setTextColor(context.getResources().getColor(R.color.colorGray));
viewHolder.content_dosage.setTextColor(context.getResources().getColor(R.color.colorGray));
}
}
});
}
@Override
public int getItemCount() {
return list.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
TextView hour;
TextView minute;
TextView content_name,content_dosage;
TextView net;
Switch aSwitch;
LinearLayout todetail;
public ViewHolder(@NonNull View itemView) {
super(itemView);
hour = itemView.findViewById(R.id.hour);
minute = itemView.findViewById(R.id.minute);
net = itemView.findViewById(R.id.net);
content_name = itemView.findViewById(R.id.content_name);
content_dosage = itemView.findViewById(R.id.content_dosage);
aSwitch = itemView.findViewById(R.id.switch_control);
todetail = itemView.findViewById(R.id.todetail);
}
}
}

@ -0,0 +1,22 @@
package com.example.leudaemialikeme;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.example.leudaemialikeme.Activity.AlarmAlert;
public class CallAlarm extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Intent intent1 = new Intent(context, AlarmAlert.class);
Bundle bundle = new Bundle();
//String content = intent.getStringExtra("content");
//Log.e("content===sadsad",content);
bundle.putString("STR_CALLER","");
intent1.putExtras(bundle);
intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent1);
}
}

@ -0,0 +1,174 @@
package com.example.leudaemialikeme;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;
import com.example.leudaemialikeme.Model.Clock;
import java.util.Calendar;
import static com.example.leudaemialikeme.Activity.MdctRmdActivity.list;
import static com.example.leudaemialikeme.Activity.MdctRmdActivity.timeAdapter;
public class ClockDetail extends Activity implements View.OnClickListener{
private Calendar calendar;
private TextView show_hour;
private TextView show_minute;
private EditText content_name;
private EditText content_dosage;
private ImageView back;
private TextView title;
private Button set;
private Button save;
private Button delete;
Clock clock;
int position;
String hourformat;
String minuteformat;
Context context = ClockDetail.this;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_clock_detail);
show_hour = findViewById(R.id.hour);
show_minute = findViewById(R.id.minute);
content_name = findViewById(R.id.content_name);
content_dosage = findViewById(R.id.content_dosage);
set = findViewById(R.id.set_time);
set.setOnClickListener(this);
save = findViewById(R.id.save);
save.setOnClickListener(this);
delete = findViewById(R.id.delete);
delete.setOnClickListener(this);
back = findViewById(R.id.back_list_clock);
back.setOnClickListener(this);
back.setImageResource(R.drawable.ic_back);
title = findViewById(R.id.title);
title.setText("服药提醒详情");
calendar = Calendar.getInstance();
initView();
}
@SuppressLint("SetTextI18n")
private void initView() {
position = getIntent().getIntExtra("position", -1);
clock = list.get(position);
Log.e("position", position + "");
if (clock.getHour() != null && clock.getMinute() != null) {
hourformat = formatString(clock.getHour());
minuteformat = formatString(clock.getMinute());
}
content_name.setText(clock.getName());
content_dosage.setText(clock.getDosage());
show_hour.setText(clock.getHour() + "");
show_minute.setText(clock.getMinute() + "");
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.set_time:
calendar.setTimeInMillis(System.currentTimeMillis());
int mhour = calendar.get(Calendar.HOUR_OF_DAY);
int mminute = calendar.get(Calendar.MINUTE);
new TimePickerDialog(ClockDetail.this, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
//calendar.setTimeInMillis(System.currentTimeMillis());
calendar.set(Calendar.HOUR_OF_DAY, hourOfDay);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
hourformat = format(hourOfDay);
minuteformat = format(minute);
Toast.makeText(ClockDetail.this, "" + hourformat + ":" + minuteformat, Toast.LENGTH_SHORT).show();
show_hour.setText(hourformat);
show_minute.setText(minuteformat);
}
}, mhour, mminute, true).show();
break;
case R.id.save:
clock.setHour(hourformat);
clock.setMinute(minuteformat);
clock.setName("" + content_name.getText().toString());
clock.setDosage("" + content_dosage.getText().toString());
clock.setClockType(Clock.clock_open);
clock.save();
Intent intent = new Intent(ClockDetail.this, CallAlarm.class);
// intent.putExtra("content",clock.getContent());
//sendBroadcast(intent);
PendingIntent sender = PendingIntent.getBroadcast(
ClockDetail.this, 0, intent, 0);
AlarmManager am;
am = (AlarmManager) getSystemService(ALARM_SERVICE);
Log.e("gethour",clock.getHour());
Log.e("gethour",clock.getMinute());
calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(clock.getHour()));
calendar.set(Calendar.MINUTE, Integer.parseInt(clock.getMinute()));
Log.e("TAG",calendar.getTimeInMillis()+"");
Log.e("TAG",System.currentTimeMillis()+"");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (System.currentTimeMillis()>calendar.getTimeInMillis()+60000){
//加24小时
am.setExact(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis()+86400000, sender);
}else {
am.setExact(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender);
}
}
timeAdapter.notifyDataSetChanged();
finish();
break;
case R.id.delete:
clock.delete();
timeAdapter.notifyDataSetChanged();
Intent intent1 = new Intent(context, CallAlarm.class);
PendingIntent sender1=PendingIntent.getBroadcast(
context,0, intent1, 0);
am =(AlarmManager)context.getSystemService(ALARM_SERVICE);
am.cancel(sender1);
finish();
break;
case R.id.back_list_clock:
finish();
break;
}
}
private String format(int x) {
String s = "" + x;
if (s.length() == 1) {
s = "0" + s;
}
return s;
}
private String formatString(String x) {
String s = x;
if (s.length() == 1) {
s = "0" + s;
}
return s;
}
}

@ -12,13 +12,26 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.example.leudaemialikeme.Adapter.CollectAdapter;
import com.example.leudaemialikeme.Model.Collect;
import com.example.leudaemialikeme.Activity.BaseActivity;
import com.example.leudaemialikeme.Activity.MainActivity;
import com.example.leudaemialikeme.Adapter.CollectBlogAdapter;
import com.example.leudaemialikeme.Model.Blog;
import com.example.leudaemialikeme.Model.News;
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.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
/**
@ -31,7 +44,8 @@ import java.util.List;
public class BlogCollectFragment extends Fragment {
private static final String ARG_CATEGORY_TITLE = "category_title";
private String collectCategoryTitle = "Default";
private List<Collect> collectList = new ArrayList<>();
private List<Blog> collectList = new ArrayList<>();
private RecyclerView blogCollectrecycleView;
private SwipeRefreshLayout mSwipeRefreshLayout;
public BlogCollectFragment() {
@ -63,13 +77,13 @@ public class BlogCollectFragment extends Fragment {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_blog_collect, container, false);
getData();//获得数据
RecyclerView recycleView = (RecyclerView) view.findViewById(R.id.APNList);//获得视图
blogCollectrecycleView = (RecyclerView) view.findViewById(R.id.blogCollectList);//获得视图
LinearLayoutManager layoutManager;
layoutManager = new LinearLayoutManager(getActivity());
recycleView.setLayoutManager(layoutManager);//建立线性布局
final CollectAdapter adapter = new CollectAdapter(collectList);//创建适配器
recycleView.setItemAnimator(new DefaultItemAnimator());//设置动画效果
recycleView.setAdapter(adapter);
blogCollectrecycleView.setLayoutManager(layoutManager);//建立线性布局
final CollectBlogAdapter adapter = new CollectBlogAdapter(collectList);//创建适配器
blogCollectrecycleView.setItemAnimator(new DefaultItemAnimator());//设置动画效果
blogCollectrecycleView.setAdapter(adapter);
mSwipeRefreshLayout = view.findViewById(R.id.refresh_layout);
// mTextView = view.findViewById(R.id.tv_pull_down_refresh);
handleDownPullUpdate();
@ -100,11 +114,53 @@ public class BlogCollectFragment extends Fragment {
}
private void getData() {
Collect collect1 = new Collect("临时的测算", R.mipmap.img_my_person, "病因很重要", "加油加油"
, R.mipmap.img_search, "12浏览");
collectList.add(collect1);
Collect collect2 = new Collect("临时的测算", R.mipmap.img_my_person, "病因很重要", "加油加油"
, R.mipmap.img_search, "12浏览");
collectList.add(collect2);
// Blog collect1 = new Blog(1,1,"2","临时测试博客版","博客内容", TimeUtil.stringToTime("2022-01-07 12:12:12"),1,1,1,0);
// collectList.add(collect1);
// Blog collect2 = new Blog(1,1,"2","临时测试博客版2","博客内容", TimeUtil.stringToTime("2022-01-07 12:12:12"),1,1,5,0);
// collectList.add(collect2);
new Thread(new Runnable() {
@Override
public void run() {
try{
String url = MainActivity.SERVER_URL+"/my-servlet?action=collectBlog&uid="+ BaseActivity.owner.getNetId()+"&type="+2;
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<Blog> blogList = gson.fromJson(jsonMap.get("blogList"), new TypeToken <List<Blog>>(){}.getType());
for(int i=0;i<blogList.size();i++){
Blog startBlog = blogList.get(i);
int bid = startBlog.getBid();
int uid = startBlog.getUid();
String btype = startBlog.getBtype();
String btittle = startBlog.getBtittle();
String bcontent = startBlog.getBcontent();
Timestamp btime = startBlog.getBtime();
int blikeNum = startBlog.getBlikeNum();
int bcollectNum = startBlog.getBcollectNum();
int bbrowse = startBlog.getBbrowse();
int flag = startBlog.getFlag();
Blog endBlog = new Blog(bid,uid,btype,btittle,bcontent,btime,blikeNum,bcollectNum,bbrowse,flag);
collectList.add(endBlog);
}
}
}
};
OkHttpUtil.asyGet(url,callback);
}catch (Exception e){
e.printStackTrace();
}
}
}).start();
}
}

@ -0,0 +1,167 @@
package com.example.leudaemialikeme.Fragment;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.leudaemialikeme.Activity.BaseActivity;
import com.example.leudaemialikeme.Activity.MainActivity;
import com.example.leudaemialikeme.Adapter.HistoryBlogAdapter;
import com.example.leudaemialikeme.Model.Blog;
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.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* to handle interaction events.
* Use the {@link BlogHistoryFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class BlogHistoryFragment extends Fragment {
private static final String ARG_CATEGORY_TITLE = "category_title";
private String collectCategoryTitle = "Default";
private List<Blog> collectList = new ArrayList<>();
private SwipeRefreshLayout mSwipeRefreshLayout;
public BlogHistoryFragment() {
// Required empty public constructor
}
public static BlogHistoryFragment newInstance(String collectCategoryTitle) {
Bundle args = new Bundle();
args.putString(ARG_CATEGORY_TITLE, collectCategoryTitle);
BlogHistoryFragment fragment = new BlogHistoryFragment();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
collectCategoryTitle = (String) getArguments().getString(ARG_CATEGORY_TITLE);
}catch (java.lang.NullPointerException e)
{
System.out.println("TestFragment getArg error!");
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_blog_history, container, false);
getData();//获得数据
RecyclerView recycleView = (RecyclerView) view.findViewById(R.id.blogHistoryList);//获得视图
LinearLayoutManager layoutManager;
layoutManager = new LinearLayoutManager(getActivity());
recycleView.setLayoutManager(layoutManager);//建立线性布局
final HistoryBlogAdapter adapter = new HistoryBlogAdapter(collectList);//创建适配器
recycleView.setItemAnimator(new DefaultItemAnimator());//设置动画效果
recycleView.setAdapter(adapter);
mSwipeRefreshLayout = view.findViewById(R.id.refresh_layout);
// mTextView = view.findViewById(R.id.tv_pull_down_refresh);
handleDownPullUpdate();
return view;
}
private void handleDownPullUpdate() {
mSwipeRefreshLayout.setEnabled(true);
mSwipeRefreshLayout.setColorSchemeResources(R.color.colorAccent,R.color.colorPrimary,R.color.light_grey);
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
//不再显示提示正在刷新和刷新成功
// mTextView.setText("正在刷新...");
//被刷新时的操作
//更新UI
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
//更新成功后设置UI停止更新
// mTextView.setText("刷新成功!!!");
mSwipeRefreshLayout.setRefreshing(false);
}
},3000);
}
});
}
private void getData() {
// Blog collect1 = new Blog(1,1,"2","测试博客浏览版","博客内容", TimeUtil.stringToTime("2022-01-07 12:12:12"),1,1,1,0);
// collectList.add(collect1);
// Blog collect2 = new Blog(1,1,"2","测试博客浏览版2","博客内容", TimeUtil.stringToTime("2022-01-07 12:12:12"),1,1,5,0);
// collectList.add(collect2);
new Thread(new Runnable() {
@Override
public void run() {
try{
String url = MainActivity.SERVER_URL+"/my-servlet?action=historyBlog&uid="+ BaseActivity.owner.getNetId()+"&type="+2;
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<Blog> blogList = gson.fromJson(jsonMap.get("blogList"), new TypeToken <List<Blog>>(){}.getType());
for(int i=0;i<blogList.size();i++){
Blog startBlog = blogList.get(i);
int bid = startBlog.getBid();
int uid = startBlog.getUid();
String btype = startBlog.getBtype();
String btittle = startBlog.getBtittle();
String bcontent = startBlog.getBcontent();
Timestamp btime = startBlog.getBtime();
int blikeNum = startBlog.getBlikeNum();
int bcollectNum = startBlog.getBcollectNum();
int bbrowse = startBlog.getBbrowse();
int flag = startBlog.getFlag();
Blog endBlog = new Blog(bid,uid,btype,btittle,bcontent,btime,blikeNum,bcollectNum,bbrowse,flag);
collectList.add(endBlog);
}
}
}
};
OkHttpUtil.asyGet(url,callback);
}catch (Exception e){
e.printStackTrace();
}
}
}).start();
}
}

@ -29,7 +29,7 @@ public class CollectFragment extends Fragment implements ViewPager.OnPageChangeL
private ViewPager viewPager; //内导航的碎片的容器
private RadioGroup rgChannelCollect=null; // 内导航由单选按钮组构成
private HorizontalScrollView hvChannelCollect=null; //单选按钮组可滚动动
private String[] channelList = {" 资讯 "," 文章 ",
private String[] channelList = {" 资讯 "," 帖子 ",
}; //默认的内导航栏目
private CollectPageFragmentAdapter adapter; //viewPager 的适配器
private TextView Name;

@ -0,0 +1,123 @@
package com.example.leudaemialikeme.Fragment;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.viewpager.widget.ViewPager;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.HorizontalScrollView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import com.example.leudaemialikeme.Adapter.HistoryPageFragmentAdapter;
import com.example.leudaemialikeme.R;
public class HistoryFragment extends Fragment implements ViewPager.OnPageChangeListener{
// private static final String ARG_CHANNEL_LIST = "channel_list";
private View view=null; // 碎片的布局实例
private ViewPager viewPager; //内导航的碎片的容器
private RadioGroup rgChannelCollect=null; // 内导航由单选按钮组构成
private HorizontalScrollView hvChannelCollect=null; //单选按钮组可滚动动
private String[] channelList = {" 资讯 "," 问题 "," 帖子 "
}; //默认的内导航栏目
private HistoryPageFragmentAdapter adapter; //viewPager 的适配器
private TextView Name;
private String title;
public HistoryFragment() {
// Required empty public constructor
}
public HistoryFragment(String title){
this.title = title;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if(view==null){
view=inflater.inflate(R.layout.fragment_history, container, false);
viewPager=(ViewPager)view.findViewById(R.id.vpNewsListHistory);
initViewPager(); //设置 ViewPager
rgChannelCollect=(RadioGroup)view.findViewById(R.id.rgChannelHistory);
hvChannelCollect=(HorizontalScrollView)view.findViewById(R.id.hvChannelHistory);
initTab(inflater);
Name = (TextView)view.findViewById(R.id.Name);
Name.setText(title);
rgChannelCollect.setOnCheckedChangeListener(
new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
viewPager.setCurrentItem(checkedId);
}
}
);
}
return view;
}
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);
rgChannelCollect.addView(rb,params);
}
rgChannelCollect.check(0);
}
private void initViewPager() { //初始化ViewPager
FragmentManager fragmentManager = super.getActivity().getSupportFragmentManager();
// adapter=new MessagePageFragmentAdapter(fragmentManager, channelList);
adapter=new HistoryPageFragmentAdapter(fragmentManager, channelList);
//参数 channelList 将被适配器用来在动态切换碎片的时候实时创建碎片 //设置 ViewPager 的适配器
viewPager.setAdapter(adapter);
viewPager.setOffscreenPageLimit(2);
//设置显示第 1 个碎片
viewPager.setCurrentItem(0);//这里设置显示第一个碎片
//设置 ViewPager 的切换监听
viewPager.addOnPageChangeListener(this);
}
@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)rgChannelCollect.getChildAt(idx);
rb.setChecked(true);
int left=rb.getLeft();
int width=rb.getMeasuredWidth();
DisplayMetrics metrics=new DisplayMetrics();
super.getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
int screenWidth=metrics.widthPixels;
int len=left+width/2-screenWidth/2;
hvChannelCollect.smoothScrollTo(len,0);
}
}

@ -24,7 +24,6 @@ import com.example.leudaemialikeme.R;
/**
* A simple {@link Fragment} subclass.
* Use the {@link MyFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class MyFragment extends Fragment {

@ -13,12 +13,26 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.leudaemialikeme.Adapter.CollectAdapter;
import com.example.leudaemialikeme.Model.Collect;
import com.example.leudaemialikeme.Activity.BaseActivity;
import com.example.leudaemialikeme.Activity.MainActivity;
import com.example.leudaemialikeme.Adapter.CollectNewsAdapter;
import com.example.leudaemialikeme.Model.News;
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.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
/**
* A simple {@link Fragment} subclass.
@ -30,8 +44,9 @@ import java.util.List;
public class NewsCollectFragment extends Fragment {
private static final String ARG_CATEGORY_TITLE = "category_title";
private String collectCategoryTitle = "Default";
private List<Collect> collectList = new ArrayList<>();
private List<News> collectList = new ArrayList<>();
private SwipeRefreshLayout mSwipeRefreshLayout;
private RecyclerView newsCollectrecycleView;
public NewsCollectFragment() {
// Required empty public constructor
@ -61,14 +76,14 @@ public class NewsCollectFragment extends Fragment {
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_news_collect, container, false);
getData();//获得数据
RecyclerView recycleView = (RecyclerView) view.findViewById(R.id.APNList);//获得视图
newsCollectrecycleView = (RecyclerView) view.findViewById(R.id.newsCollectList);//获得视图
LinearLayoutManager layoutManager;
layoutManager = new LinearLayoutManager(getActivity());
recycleView.setLayoutManager(layoutManager);//建立线性布局
final CollectAdapter adapter = new CollectAdapter(collectList);//创建适配器
recycleView.setItemAnimator(new DefaultItemAnimator());//设置动画效果
recycleView.setAdapter(adapter);
newsCollectrecycleView.setLayoutManager(layoutManager);//建立线性布局
final CollectNewsAdapter adapter = new CollectNewsAdapter(collectList);//创建适配器
newsCollectrecycleView.setItemAnimator(new DefaultItemAnimator());//设置动画效果
newsCollectrecycleView.setAdapter(adapter);
getData();//获得数据
mSwipeRefreshLayout = view.findViewById(R.id.refresh_layout);
// mTextView = view.findViewById(R.id.tv_pull_down_refresh);
handleDownPullUpdate();
@ -99,11 +114,50 @@ public class NewsCollectFragment extends Fragment {
}
private void getData(){
Collect collect1 = new Collect("临时测算",R.mipmap.img_my_person,"病因很重要","加油加油"
,R.mipmap.img_search,"12浏览");
collectList.add(collect1);
Collect collect2 = new Collect("临时测算",R.mipmap.img_my_person,"病因很重要","加油加油"
,R.mipmap.img_search,"12浏览");
collectList.add(collect2);
// News collect1 = new News(1,1,"1","临时测试","能解决的!",TimeUtil.stringToTime("2022-01-07 12:12:12"),3);
// collectList.add(collect1);
// News collect2 = new News(1,1,"1","临时测试2","能解决的!",TimeUtil.stringToTime("2022-01-07 12:12:12"),5);
// collectList.add(collect2);
new Thread(new Runnable() {
@Override
public void run() {
try{
String url = MainActivity.SERVER_URL+"/my-servlet?action=collectNews&uid="+BaseActivity.owner.getNetId()+"&type="+1;
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<News> newsList = gson.fromJson(jsonMap.get("newsList"), new TypeToken <List<News>>(){}.getType());
for(int i=0;i<newsList.size();i++){
News startNews = newsList.get(i);
int nid = startNews.getNid();
int sid = startNews.getSid();
String stype = startNews.getStype();
String stittle = startNews.getStittle();
String scontent = startNews.getScontent();
Timestamp stime = startNews.getStime();
int sbrowseNum = startNews.getSbrowseNum();
News endNews = new News(nid,sid,stype,stittle,scontent,stime,sbrowseNum);
collectList.add(endNews);
}
}
}
};
OkHttpUtil.asyGet(url,callback);
}catch (Exception e){
e.printStackTrace();
}
}
}).start();
}
}

@ -0,0 +1,164 @@
package com.example.leudaemialikeme.Fragment;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.leudaemialikeme.Activity.BaseActivity;
import com.example.leudaemialikeme.Activity.MainActivity;
import com.example.leudaemialikeme.Adapter.HistoryNewsAdapter;
import com.example.leudaemialikeme.Model.News;
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.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* to handle interaction events.
* Use the {@link NewsHistoryFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class NewsHistoryFragment extends Fragment {
private static final String ARG_CATEGORY_TITLE = "category_title";
private String collectCategoryTitle = "Default";
private List<News> collectList = new ArrayList<>();
private SwipeRefreshLayout mSwipeRefreshLayout;
public NewsHistoryFragment() {
// Required empty public constructor
}
public static NewsHistoryFragment newInstance(String collectCategoryTitle) {
Bundle args = new Bundle();
args.putString(ARG_CATEGORY_TITLE, collectCategoryTitle);
NewsHistoryFragment fragment = new NewsHistoryFragment();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
collectCategoryTitle = (String) getArguments().getString(ARG_CATEGORY_TITLE);
}catch (java.lang.NullPointerException e)
{
System.out.println("TestFragment getArg error!");
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_news_history, container, false);
getData();//获得数据
RecyclerView recycleView = (RecyclerView) view.findViewById(R.id.newsHistoryList);//获得视图
LinearLayoutManager layoutManager;
layoutManager = new LinearLayoutManager(getActivity());
recycleView.setLayoutManager(layoutManager);//建立线性布局
final HistoryNewsAdapter adapter = new HistoryNewsAdapter(collectList);//创建适配器
recycleView.setItemAnimator(new DefaultItemAnimator());//设置动画效果
recycleView.setAdapter(adapter);
mSwipeRefreshLayout = view.findViewById(R.id.refresh_layout);
// mTextView = view.findViewById(R.id.tv_pull_down_refresh);
handleDownPullUpdate();
return view;
}
private void handleDownPullUpdate() {
mSwipeRefreshLayout.setEnabled(true);
mSwipeRefreshLayout.setColorSchemeResources(R.color.colorAccent,R.color.colorPrimary,R.color.light_grey);
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
//不再显示提示正在刷新和刷新成功
// mTextView.setText("正在刷新...");
//被刷新时的操作
//更新UI
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
//更新成功后设置UI停止更新
// mTextView.setText("刷新成功!!!");
mSwipeRefreshLayout.setRefreshing(false);
}
},3000);
}
});
}
private void getData(){
// News collect1 = new News(1,1,"1","临时测试浏览记录版","能解决的!", TimeUtil.stringToTime("2022-01-07 12:12:12"),3);
// collectList.add(collect1);
// News collect2 = new News(1,1,"1","临时测试2浏览记录版","能解决的!",TimeUtil.stringToTime("2022-01-07 12:12:12"),5);
// collectList.add(collect2);
new Thread(new Runnable() {
@Override
public void run() {
try{
String url = MainActivity.SERVER_URL+"/my-servlet?action=historyNews&uid="+ BaseActivity.owner.getNetId()+"&type="+1;
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<News> newsList = gson.fromJson(jsonMap.get("newsList"), new TypeToken <List<News>>(){}.getType());
for(int i=0;i<newsList.size();i++){
News startNews = newsList.get(i);
int nid = startNews.getNid();
int sid = startNews.getSid();
String stype = startNews.getStype();
String stittle = startNews.getStittle();
String scontent = startNews.getScontent();
Timestamp stime = startNews.getStime();
int sbrowseNum = startNews.getSbrowseNum();
News endNews = new News(nid,sid,stype,stittle,scontent,stime,sbrowseNum);
collectList.add(endNews);
}
}
}
};
OkHttpUtil.asyGet(url,callback);
}catch (Exception e){
e.printStackTrace();
}
}
}).start();
}
}

@ -0,0 +1,165 @@
package com.example.leudaemialikeme.Fragment;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.leudaemialikeme.Activity.BaseActivity;
import com.example.leudaemialikeme.Activity.MainActivity;
import com.example.leudaemialikeme.Adapter.HistoryQuestionAdapter;
import com.example.leudaemialikeme.Model.Question;
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.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* to handle interaction events.
* Use the {@link QuestionHistoryFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class QuestionHistoryFragment extends Fragment {
private static final String ARG_CATEGORY_TITLE = "category_title";
private String collectCategoryTitle = "Default";
private List<Question> questionAllList = new ArrayList<>();
private SwipeRefreshLayout mSwipeRefreshLayout;
public QuestionHistoryFragment() {
// Required empty public constructor
}
public static QuestionHistoryFragment newInstance(String collectCategoryTitle) {
Bundle args = new Bundle();
args.putString(ARG_CATEGORY_TITLE, collectCategoryTitle);
QuestionHistoryFragment fragment = new QuestionHistoryFragment();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
collectCategoryTitle = (String) getArguments().getString(ARG_CATEGORY_TITLE);
}catch (java.lang.NullPointerException e)
{
System.out.println("TestFragment getArg error!");
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_question_history, container, false);
getData();//获得数据
RecyclerView recycleView = (RecyclerView) view.findViewById(R.id.questionHistoryList);//获得视图
LinearLayoutManager layoutManager;
layoutManager = new LinearLayoutManager(getActivity());
recycleView.setLayoutManager(layoutManager);//建立线性布局
final HistoryQuestionAdapter adapter = new HistoryQuestionAdapter(questionAllList);//创建适配器
recycleView.setItemAnimator(new DefaultItemAnimator());//设置动画效果
recycleView.setAdapter(adapter);
mSwipeRefreshLayout = view.findViewById(R.id.refresh_layout);
// mTextView = view.findViewById(R.id.tv_pull_down_refresh);
handleDownPullUpdate();
return view;
}
private void handleDownPullUpdate() {
mSwipeRefreshLayout.setEnabled(true);
mSwipeRefreshLayout.setColorSchemeResources(R.color.colorAccent,R.color.colorPrimary,R.color.light_grey);
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
//不再显示提示正在刷新和刷新成功
// mTextView.setText("正在刷新...");
//被刷新时的操作
//更新UI
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
//更新成功后设置UI停止更新
// mTextView.setText("刷新成功!!!");
mSwipeRefreshLayout.setRefreshing(false);
}
},3000);
}
});
}
private void getData() {
// Question collect1 = new Question(1,1,"测试问题浏览版","博客内容", TimeUtil.stringToTime("2022-01-07 12:12:12"),1,1,1,0);
// questionList.add(collect1);
// Question collect2 = new Question(1,1,"测试问题浏览版2","博客内容", TimeUtil.stringToTime("2022-01-07 12:12:12"),1,1,5,0);
// questionList.add(collect2);
new Thread(new Runnable() {
@Override
public void run() {
try{
String url = MainActivity.SERVER_URL+"/my-servlet?action=historyQuestion&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());
for(int i=0;i<questionList.size();i++){
Question startQuestion = questionList.get(i);
int qid = startQuestion.getQid();
int uid = startQuestion.getUid();
String qtittle = startQuestion.getQtittle();
String qcontent = startQuestion.getQcontent();
Timestamp qtime = startQuestion.getQtime();
int qfollowNum = startQuestion.getQfollowNum();
int qanswerNum = startQuestion.getQanswerNum();
int qbrowseNum = startQuestion.getQbrowseNum();
int flag = startQuestion.getFlag();
Question endQuestion = new Question(qid,uid,qtittle,qcontent,qtime,qfollowNum,qanswerNum,qbrowseNum,flag);
questionAllList.add(endQuestion);
}
}
}
};
OkHttpUtil.asyGet(url,callback);
}catch (Exception e){
e.printStackTrace();
}
}
}).start();
}
}

@ -0,0 +1,114 @@
package com.example.leudaemialikeme.Model;
import java.io.Serializable;
import java.sql.Timestamp;
public class Blog implements Serializable {
private static final long serialVersionUID = 1L;
private int bid;
private int uid;
private String btype;
private String btittle;
private String bcontent;
private Timestamp btime;
private int blikeNum;
private int bcollectNum;
private int bbrowse;
private int flag;
public Blog(){}
public Blog(int bid, int uid, String btype, String btittle, String bcontent, Timestamp btime, int blikeNum, int bcollectNum, int bbrowse, int flag) {
this.bid = bid;
this.uid = uid;
this.btype = btype;
this.btittle = btittle;
this.bcontent = bcontent;
this.btime = btime;
this.blikeNum = blikeNum;
this.bcollectNum = bcollectNum;
this.bbrowse = bbrowse;
this.flag = flag;
}
public int getBid() {
return bid;
}
public int getUid() {
return uid;
}
public String getBtype() {
return btype;
}
public String getBtittle() {
return btittle;
}
public String getBcontent() {
return bcontent;
}
public Timestamp getBtime() {
return btime;
}
public int getBlikeNum() {
return blikeNum;
}
public int getBcollectNum() {
return bcollectNum;
}
public int getBbrowse() {
return bbrowse;
}
public int getFlag() {
return flag;
}
public void setBid(int bid) {
this.bid = bid;
}
public void setUid(int uid) {
this.uid = uid;
}
public void setBtype(String btype) {
this.btype = btype;
}
public void setBtittle(String btittle) {
this.btittle = btittle;
}
public void setBcontent(String bcontent) {
this.bcontent = bcontent;
}
public void setBtime(Timestamp btime) {
this.btime = btime;
}
public void setBlikeNum(int blikeNum) {
this.blikeNum = blikeNum;
}
public void setBcollectNum(int bcollectNum) {
this.bcollectNum = bcollectNum;
}
public void setBbrowse(int bbrowse) {
this.bbrowse = bbrowse;
}
public void setFlag(int flag) {
this.flag = flag;
}
}

@ -0,0 +1,63 @@
package com.example.leudaemialikeme.Model;
import org.litepal.crud.LitePalSupport;
public class Clock extends LitePalSupport {
public static final int clock_open = 1;
public static final int clock_close = 0;
String hour;
String minute;
String name;
String dosage;
int ClockType;
public Clock(String hour, String minute, String name, String dosage, int clockType) {
this.hour = hour;
this.minute = minute;
this.name = name;
this.dosage = dosage;
ClockType = clockType;
}
public Clock(){}
public String getMinute() {
return minute;
}
public String getHour() {
return hour;
}
public void setHour(String hour) {
this.hour = hour;
}
public void setMinute(String minute) {
this.minute = minute;
}
public int getClockType() {
return ClockType;
}
public void setClockType(int clockType) {
ClockType = clockType;
}
public String getName() {
return name;
}
public String getDosage() {
return dosage;
}
public void setName(String name) {
this.name = name;
}
public void setDosage(String dosage) {
this.dosage = dosage;
}
}

@ -1,72 +0,0 @@
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;
}
}

@ -1,21 +1,34 @@
package com.example.leudaemialikeme.Model;
import org.litepal.annotation.Column;
import org.litepal.crud.LitePalSupport;
import java.io.Serializable;
public class Event implements Serializable {
public class Event extends LitePalSupport implements Serializable {
private static final long serialVersionUID = 1L;
//声明所有的变量
private String event_day;
private String event_month;
@Column(unique = true)
private String event_info;
private String event_place;
private String event_doctor_name;
private String event_time;
private String event_create_time;
public Event(){}
public Event(String event_day,String event_month,String event_info,String event_time){
public Event(String event_day, String event_month, String event_info, String event_place, String event_doctor_name, String event_time, String event_create_time) {
this.event_day = event_day;
this.event_month = event_month;
this.event_info = event_info;
this.event_month =event_month;
this.event_place = event_place;
this.event_doctor_name = event_doctor_name;
this.event_time = event_time;
this.event_create_time = event_create_time;
}
public String getEvent_day() {
return event_day;
}
@ -47,4 +60,28 @@ public class Event implements Serializable {
public void setEvent_time(String event_time) {
this.event_time = event_time;
}
public String getEvent_place() {
return event_place;
}
public String getEvent_doctor_name() {
return event_doctor_name;
}
public String getEvent_create_time() {
return event_create_time;
}
public void setEvent_place(String event_place) {
this.event_place = event_place;
}
public void setEvent_doctor_name(String event_doctor_name) {
this.event_doctor_name = event_doctor_name;
}
public void setEvent_create_time(String event_create_time) {
this.event_create_time = event_create_time;
}
}

@ -0,0 +1,86 @@
package com.example.leudaemialikeme.Model;
import java.io.Serializable;
import java.sql.Timestamp;
public class News implements Serializable {
private static final long serialVersionUID = 1L;
private int nid;
private int sid;
private String stype;
private String stittle;
private String scontent;
private Timestamp stime;
private int sbrowseNum;
public News(){
}
public News(int nid, int sid, String stype, String stittle, String scontent, Timestamp stime, int sbrowseNum) {
this.nid = nid;
this.sid = sid;
this.stype = stype;
this.stittle = stittle;
this.scontent = scontent;
this.stime = stime;
this.sbrowseNum = sbrowseNum;
}
public int getNid() {
return nid;
}
public int getSid() {
return sid;
}
public String getStype() {
return stype;
}
public String getStittle() {
return stittle;
}
public String getScontent() {
return scontent;
}
public int getSbrowseNum() {
return sbrowseNum;
}
public Timestamp getStime() {
return stime;
}
public void setNid(int nid) {
this.nid = nid;
}
public void setSid(int sid) {
this.sid = sid;
}
public void setStype(String stype) {
this.stype = stype;
}
public void setStittle(String stittle) {
this.stittle = stittle;
}
public void setScontent(String scontent) {
this.scontent = scontent;
}
public void setStime(Timestamp stime) {
this.stime = stime;
}
public void setSbrowseNum(int sbrowseNum) {
this.sbrowseNum = sbrowseNum;
}
}

@ -1,41 +1,111 @@
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 String questionInfo;
private String questionRead;
private String questionTime;
public Question(String questionInfo,String questionRead,String questionTime){
this. questionInfo = questionInfo;
this.questionRead = questionRead;
this.questionTime = questionTime;
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;
public Question(){}
public Question(String qtittle,String qcontent, int qfollowNum, Timestamp qtime) {
this.qtittle = qtittle;
this.qcontent = qcontent;
this.qtime = qtime;
this.qfollowNum = qfollowNum;
}
public Question(int qid, int uid, String qtittle, String qcontent, Timestamp qtime, int qfollowNum, int qanswerNum, int qbrowseNum, int flag) {
this.qid = qid;
this.uid = uid;
this.qtittle = qtittle;
this.qcontent = qcontent;
this.qtime = qtime;
this.qfollowNum = qfollowNum;
this.qanswerNum = qanswerNum;
this.qbrowseNum = qbrowseNum;
this.flag = flag;
}
public int getQid() {
return qid;
}
public int getUid() {
return uid;
}
public String getQtittle() {
return qtittle;
}
public String getQcontent() {
return qcontent;
}
public Timestamp getQtime() {
return qtime;
}
public int getQfollowNum() {
return qfollowNum;
}
public int getQanswerNum() {
return qanswerNum;
}
public int getQbrowseNum() {
return qbrowseNum;
}
public int getFlag() {
return flag;
}
public void setQid(int qid) {
this.qid = qid;
}
public void setUid(int uid) {
this.uid = uid;
}
public void setQtittle(String qtittle) {
this.qtittle = qtittle;
}
public String getQuestionInfo() {
return questionInfo;
public void setQcontent(String qcontent) {
this.qcontent = qcontent;
}
public void setQuestionInfo(String questionInfo) {
this.questionInfo = questionInfo;
public void setQtime(Timestamp qtime) {
this.qtime = qtime;
}
public String getQuestionRead() {
return questionRead;
public void setQfollowNum(int qfollowNum) {
this.qfollowNum = qfollowNum;
}
public void setQuestionRead(String questionRead) {
this.questionRead = questionRead;
public void setQanswerNum(int qanswerNum) {
this.qanswerNum = qanswerNum;
}
public String getQuestionTime() {
return questionTime;
public void setQbrowseNum(int qbrowseNum) {
this.qbrowseNum = qbrowseNum;
}
public void setQuestionTime(String questionTime) {
this.questionTime = questionTime;
public void setFlag(int flag) {
this.flag = flag;
}
}

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M13,7h-2v4L7,11v2h4v4h2v-4h4v-2h-4L13,7zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#fe6969"
android:centerColor="#fb7a6a"
android:endColor="#ff976d"
android:angle="45"
/>
<corners
android:radius="15dp"/>
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
</vector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M4,8h4L8,4L4,4v4zM10,20h4v-4h-4v4zM4,20h4v-4L4,16v4zM4,14h4v-4L4,10v4zM10,14h4v-4h-4v4zM16,4v4h4L20,4h-4zM10,8h4L14,4h-4v4zM16,14h4v-4h-4v4zM16,20h4v-4h-4v4z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

@ -0,0 +1,113 @@
<?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=".ClockDetail">
<LinearLayout
android:layout_marginTop="38dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:id="@+id/back_list_clock"
android:textSize="20sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/hour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:text="null"
android:textSize="39sp" />
<TextView
android:id="@+id/net"
android:layout_marginTop="5dp"
android:layout_toRightOf="@id/hour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" : "
android:textSize="29dp" />
<TextView
android:layout_toRightOf="@id/net"
android:id="@+id/minute"
android:layout_marginTop="7dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="null"
android:textSize="29sp" />
<Button
android:id="@+id/set_time"
android:text="设置时间"
android:textStyle="bold"
android:textColor="#fff"
android:layout_alignParentRight="true"
android:layout_marginRight="35dp"
android:background="@drawable/button_shape"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
<LinearLayout
android:layout_marginTop="38dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="药品名称"
android:textSize="20sp" />
<EditText
android:id="@+id/content_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:textSize="18dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="38dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="剂量"
android:textSize="20sp" />
<EditText
android:id="@+id/content_dosage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:textSize="18dp"
android:textStyle="bold" />
</LinearLayout>
<Button
android:id="@+id/save"
android:layout_marginTop="18sp"
android:text="保存"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="#fff"
android:background="@drawable/button_shape"
android:layout_gravity="center"
android:layout_margin="35dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

@ -0,0 +1,225 @@
<?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.AddEventActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_margin="10dp"
android:id="@+id/back_event_list"
android:src="@drawable/back"/>
<TextView
android:id="@+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="10dp"
android:layout_gravity="center"
android:gravity="center"
android:textSize="18dp"
android:text="添加大事记" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="11"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/textView52"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="18dp"
android:layout_margin="8dp"
android:text="事件" />
<EditText
android:id="@+id/add_event_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="textPersonName"
android:text="事件名" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/textView53"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="18dp"
android:layout_margin="8dp"
android:text="地点" />
<EditText
android:id="@+id/add_event_place"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="textPersonName"
android:text="地点名" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/textView54"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="18dp"
android:layout_margin="8dp"
android:text="医生" />
<EditText
android:id="@+id/add_event_doctor_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="textPersonName"
android:text="医生名" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/add_event_month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="18dp"
android:layout_margin="8dp"
android:text="月" />
<TextView
android:id="@+id/textView58"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="18dp"
android:layout_margin="8dp"
android:text="月" />
<TextView
android:id="@+id/add_event_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="18dp"
android:layout_margin="8dp"
android:text="天" />
<TextView
android:id="@+id/textView61"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="18dp"
android:layout_margin="8dp"
android:text="号" />
<Button
android:id="@+id/add_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="textPersonName"
android:text="选择日期" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/add_event_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="18dp"
android:layout_margin="8dp"
android:text="时间" />
<Button
android:id="@+id/add_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="textPersonName"
android:text="选择时间" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="显示时间"
android:id="@+id/show_time"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="6"
android:orientation="horizontal">
<ImageView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:src="@drawable/delete"
android:id="@+id/delete_event"
/>
<ImageView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_margin="30dp"
android:layout_height="wrap_content"
android:id="@+id/save_event"
android:src="@drawable/save"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,141 @@
<?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=".ClockDetail">
<LinearLayout
android:layout_marginTop="38dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:id="@+id/back_list_clock"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="服药提醒详情"
android:id="@+id/title"
android:textSize="20sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/hour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:text="07"
android:textSize="39sp" />
<TextView
android:id="@+id/net"
android:layout_marginTop="5dp"
android:layout_toRightOf="@id/hour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" : "
android:textSize="29dp" />
<TextView
android:layout_toRightOf="@id/net"
android:id="@+id/minute"
android:layout_marginTop="7dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="59"
android:textSize="29sp" />
<Button
android:id="@+id/set_time"
android:text="设置时间"
android:background="@drawable/button_shape"
android:textColor="#fff"
android:textSize="18sp"
android:layout_alignParentRight="true"
android:layout_marginRight="35dp"
android:layout_width="100dp"
android:layout_height="50dp" />
</RelativeLayout>
<LinearLayout
android:layout_marginTop="38dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="药品名称"
android:textSize="20sp" />
<EditText
android:id="@+id/content_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:textSize="18dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="38dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="剂量"
android:textSize="20sp" />
<EditText
android:id="@+id/content_dosage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:textSize="18dp"
android:textStyle="bold" />
</LinearLayout>
<Button
android:id="@+id/save"
android:text="保存"
android:textSize="20sp"
android:textColor="#fff"
android:textStyle="bold"
android:background="@drawable/button_shape"
android:layout_marginTop="35dp"
android:layout_gravity="center"
android:layout_marginLeft="35dp"
android:layout_marginRight="35dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/delete"
android:text="删除"
android:layout_marginTop="15dp"
android:layout_marginLeft="35dp"
android:layout_marginRight="35dp"
android:textSize="20sp"
android:textColor="#fff"
android:textStyle="bold"
android:background="@drawable/button_shape"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

@ -16,6 +16,7 @@
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_margin="15dp"
android:id="@+id/back_my"
android:src="@mipmap/img_go_answer_return" />
<TextView
@ -32,6 +33,7 @@
android:layout_height="30dp"
android:layout_margin="15dp"
android:src="@mipmap/img_add"
android:id="@+id/add_event"
/>
</LinearLayout>

@ -10,6 +10,6 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/collect_frag_layout">
android:id="@+id/history_frag_layout">
</FrameLayout>
</LinearLayout>

@ -63,9 +63,9 @@
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
<androidx.recyclerview.widget.RecyclerView
android:layout_margin="18dp"
android:id="@+id/lv_list_data"
android:id="@+id/rv_list_data"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

@ -0,0 +1,88 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/news"
android:layout_width="334dp"
android:layout_height="150dp"
android:layout_gravity="center"
android:layout_marginBottom="6dp"
android:background="@drawable/background"
android:elevation="10dp"
android:layout_marginTop="10dp"
android:orientation="vertical"
android:padding="11dp"
tools:ignore="MissingConstraints">
<TextView
android:id="@+id/blog_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="儿童急性B淋巴细胞白血病,除了传统疗法还有哪些前沿治疗方法呢?"
android:textSize="15dp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="71dp"
android:orientation="horizontal">
<TextView
android:id="@+id/blog_info"
android:layout_width="200dp"
android:layout_height="56dp"
android:layout_marginTop="14dp"
android:text="急性淋巴细胞白血病ALL是儿童最常见的恶性肿瘤其中约85%为
"
android:textSize="11dp" />
<ImageView
android:id="@+id/recNews_image"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
app:srcCompat="@drawable/rec_news1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/blog_read"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="102"
android:textSize="12dp" />
<TextView
android:id="@+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="浏览 "
android:textSize="11dp" />
<TextView
android:id="@+id/blog_time"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="2021-11-6 09:19:54"
android:textSize="11dp" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>

@ -1,80 +0,0 @@
<?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,88 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/news"
android:layout_width="334dp"
android:layout_height="150dp"
android:layout_gravity="center"
android:layout_marginBottom="6dp"
android:background="@drawable/background"
android:elevation="10dp"
android:layout_marginTop="10dp"
android:orientation="vertical"
android:padding="11dp"
tools:ignore="MissingConstraints">
<TextView
android:id="@+id/News_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="儿童急性B淋巴细胞白血病,除了传统疗法还有哪些前沿治疗方法呢?"
android:textSize="15dp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="71dp"
android:orientation="horizontal">
<TextView
android:id="@+id/News_info"
android:layout_width="200dp"
android:layout_height="56dp"
android:layout_marginTop="14dp"
android:text="急性淋巴细胞白血病ALL是儿童最常见的恶性肿瘤其中约85%为
"
android:textSize="11dp" />
<ImageView
android:id="@+id/recNews_image"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
app:srcCompat="@drawable/rec_news1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/News_read"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="102"
android:textSize="12dp" />
<TextView
android:id="@+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="浏览 "
android:textSize="11dp" />
<TextView
android:id="@+id/News_time"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="2021-11-6 09:19:54"
android:textSize="11dp" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/event_item_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -9,7 +11,16 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="28dp"
android:layout_marginLeft="20dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="30dp"
/>
<TextView
android:id="@+id/a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="20dp"
android:text="号"
android:layout_marginTop="30dp"
/>
@ -19,14 +30,24 @@
android:layout_height="wrap_content"
android:textSize="18dp"
android:layout_marginTop="40dp"
android:layout_marginLeft="-10dp"
android:layout_marginLeft="-20dp"
android:layout_weight="1"
/>
<TextView
android:id="@+id/aa"
android:layout_width="10dp"
android:layout_height="wrap_content"
android:textSize="18dp"
android:layout_marginTop="40dp"
android:layout_marginLeft="-10dp"
android:text="月"
android:layout_weight="1"
/>
<LinearLayout
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:layout_weight="8"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:background="@color/white"
@ -38,21 +59,117 @@
android:layout_margin="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="start"
android:src="@mipmap/event_dot"
android:foregroundGravity="center"
/>
<LinearLayout
android:layout_width="211dp"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="5dp"
android:layout_weight="1">
<TextView
android:id="@+id/textView55"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="事件信息:"
android:textSize="16dp" />
<TextView
android:id="@+id/event_info"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="事件信息"
android:textSize="18dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="5dp"
android:layout_weight="1">
<TextView
android:id="@+id/textView57"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="事件地点:"
android:textSize="16dp" />
<TextView
android:id="@+id/event_place"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="事件地点"
android:textSize="18dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="5dp"
android:layout_weight="1">
<TextView
android:id="@+id/textView56"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="事件医生名:"
android:textSize="16dp" />
<TextView
android:id="@+id/event_doctor_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="事件医生名"
android:textSize="18dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/event_info"
android:id="@+id/textView59"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="18dp"
android:layout_gravity="center"
/>
android:textSize="16dp"
android:layout_marginLeft="5dp"
android:text="事件提醒时间:" />
<TextView
android:id="@+id/textView60"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="16dp"
android:layout_marginLeft="5dp"
android:text="创建时间:" />
</LinearLayout>
<LinearLayout
@ -66,19 +183,20 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="40dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:layout_weight="3"
android:layout_weight="1"
android:textSize="12dp" />
<ImageView
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/event_create_time"
android:layout_marginBottom="10dp"
android:layout_gravity="right"
android:src="@mipmap/img_go_more" />
/>
</LinearLayout>
</LinearLayout>

@ -14,7 +14,7 @@
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/APNList"
android:id="@+id/blogCollectList"
android:background="@color/light_grey"
android:layout_width="match_parent"
android:layout_height="match_parent" />

@ -0,0 +1,24 @@
<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.BlogHistoryFragment">
<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/blogHistoryList"
android:background="@color/light_grey"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</FrameLayout>

@ -15,7 +15,7 @@
android:layout_height="match_parent"
android:layout_weight="20">
<ImageView
android:id="@+id/imageButton2"
android:id="@+id/back_collect"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_margin="10dp"

@ -0,0 +1,73 @@
<LinearLayout
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"
android:orientation="vertical"
tools:context="com.example.leudaemialikeme.Fragment.HistoryFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="265dp"
android:layout_height="match_parent"
android:layout_weight="20">
<ImageView
android:id="@+id/back_history"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_margin="10dp"
android:src="@mipmap/img_go_answer_return" />
<TextView
android:id="@+id/Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="20"
android:gravity="center"
android:textSize="20dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<!-- 导航标签,包含一个单选按钮组-->
<!-- 任意数量不能显示时的缩略符号 -->
<HorizontalScrollView
android:id="@+id/hvChannelHistory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/ivShowChannel"
android:scrollbars="none">
<RadioGroup
android:id="@+id/rgChannelHistory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" />
</HorizontalScrollView>
</RelativeLayout>
</LinearLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/vpNewsListHistory"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
</LinearLayout>

@ -15,7 +15,7 @@
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/APNList"
android:id="@+id/newsCollectList"
android:background="@color/light_grey"
android:layout_width="match_parent"
android:layout_height="match_parent" />

@ -0,0 +1,24 @@
<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.NewsHistoryFragment">
<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/newsHistoryList"
android:background="@color/light_grey"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</FrameLayout>

@ -0,0 +1,24 @@
<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.QuestionHistoryFragment">
<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/questionHistoryList"
android:background="@color/light_grey"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</FrameLayout>

@ -1,40 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/todetail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="18dp"
android:orientation="horizontal">
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="200dp"
android:layout_height="60dp"
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
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/md_name"
android:id="@+id/content_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:paddingTop="5dp"
android:text="甘露聚糖肽胶囊"
android:textSize="16dp" />
android:layout_below="@+id/time"
android:layout_marginLeft="15dp"
android:layout_marginRight="10dp"
android:text="药品名"
android:textColor="@color/colorBlack"
android:textSize="18sp" />
<TextView
android:id="@+id/md_time"
android:id="@+id/content_dosage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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"/>
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" />
</LinearLayout>

@ -1,24 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="@color/white"
android:layout_height="wrap_content"
android:id="@+id/news"
android:layout_width="334dp"
android:layout_marginLeft="35dp"
android:layout_marginBottom="10dp"
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="11dp">
<TextView
android:id="@+id/questionTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="15dp"
android:layout_marginBottom="5dp"
/>
<TextView
android:id="@+id/questionInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20dp"
android:layout_margin="15dp"
android:textSize="15dp"
android:layout_margin="5dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginTop="30dp"
android:orientation="horizontal">
<TextView
@ -26,7 +39,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="16dp"
android:textSize="11dp"
android:layout_marginLeft="5dp"
/>
@ -35,7 +48,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2"
android:textSize="16dp"
android:textSize="11dp"
/>
<LinearLayout
@ -50,13 +63,15 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="16dp"
android:textSize="13dp"
android:gravity="right"
android:layout_marginRight="10dp"
android:text="我要回答" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/img_go_more"
android:layout_gravity="center"
/>

@ -7,5 +7,13 @@
<color name="hair_grey">#66c18c</color>
<color name="white">#fff</color>
<color name="grey">#F1EEEE</color>
<color name="colorPrimaryBackups">#3F51B5</color>
<color name="colorPrimaryDarkBackups">#303F9F</color>
<color name="colorAccentBackups">#4CAF50</color>
<color name="colorOrange">#ff8c00</color>
<color name="colorWhite">#ffffff</color>
<color name="colorGray">#D3D3D3</color>
<color name="colorBlack">#000000</color>
<color name="colorRed">#ff3700</color>
</resources>
Loading…
Cancel
Save