Conflicts:
	Code/LeudaemiaLikeMe/app/src/main/AndroidManifest.xml
master
hjw 3 years ago
commit 3d1ed5c727

@ -9,7 +9,6 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.LeudaemiaLikeMe"> android:theme="@style/Theme.LeudaemiaLikeMe">
<activity android:name=".Activity.DetailActivity"/>
<activity android:name=".Activity.MdctRmdActivity"/> <activity android:name=".Activity.MdctRmdActivity"/>
<activity android:name=".Activity.SearchActivity"/> <activity android:name=".Activity.SearchActivity"/>
<activity android:name=".Activity.InfoActivity" /> <activity android:name=".Activity.InfoActivity" />

@ -0,0 +1,38 @@
package com.example.leudaemialikeme.Activity;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import com.example.leudaemialikeme.Adapter.EventAdapter;
import com.example.leudaemialikeme.Event;
import com.example.leudaemialikeme.R;
import java.util.ArrayList;
import java.util.List;
public class EventActivity extends AppCompatActivity {
private List<Event> mData = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_event);
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);//将视图与适配器连接起来
}
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);
}
}

@ -48,7 +48,7 @@ public class InfoActivity extends AppCompatActivity {
// parent 为控件Spinner view显示文字的TextView position下拉选项的位置从0开始 // parent 为控件Spinner view显示文字的TextView position下拉选项的位置从0开始
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
//获取Spinner控件的适配器 //获取Spinner控件的适配器
ArrayAdapter<String> adapter = (ArrayAdapter<String>) parent.getAdapter(); ArrayAdapter<String> adapter = (ArrayAdapter<String>) parent.getAdapter();
//tvResult.setText(adapter.getItem(position)); //tvResult.setText(adapter.getItem(position));
Toast.makeText(getBaseContext(),adapter.getItem(position),Toast.LENGTH_SHORT).show(); Toast.makeText(getBaseContext(),adapter.getItem(position),Toast.LENGTH_SHORT).show();

@ -0,0 +1,54 @@
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.Event;
import com.example.leudaemialikeme.R;
import java.util.List;
public class EventAdapter extends RecyclerView.Adapter<EventAdapter.ViewHolder>{
private List<Event> meventList;
//重写构造方法
public EventAdapter(List<Event> meventList){
this.meventList = meventList;
}
public int getItemCount(){
return meventList.size();
}
//内部类
static class ViewHolder extends RecyclerView.ViewHolder {
TextView event_day,event_month,event_info,event_time;
public ViewHolder(@NonNull View itemView){
super(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);
}
}
//重写 onCreateViewHolder()方法
@Override
public EventAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.event_item,parent,false);
EventAdapter.ViewHolder holder=new EventAdapter.ViewHolder(view);
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());
}
}

@ -0,0 +1,50 @@
package com.example.leudaemialikeme;
import java.io.Serializable;
public class Event implements Serializable {
private static final long serialVersionUID = 1L;
//声明所有的变量
private String event_day;
private String event_month;
private String event_info;
private String event_time;
public Event(String event_day,String event_month,String event_info,String event_time){
this.event_day = event_day;
this.event_info = event_info;
this.event_month =event_month;
this.event_time = event_time;
}
public String getEvent_day() {
return event_day;
}
public void setEvent_day(String event_day) {
this.event_day = event_day;
}
public String getEvent_month() {
return event_month;
}
public void setEvent_month(String event_month) {
this.event_month = event_month;
}
public String getEvent_info() {
return event_info;
}
public void setEvent_info(String event_info) {
this.event_info = event_info;
}
public String getEvent_time() {
return event_time;
}
public void setEvent_time(String event_time) {
this.event_time = event_time;
}
}

@ -38,6 +38,7 @@ public class CommunityFragment extends Fragment implements ViewPager.OnPageChang
private Button bar_send_invitation; private Button bar_send_invitation;
private Button bar_send_question; private Button bar_send_question;
private Button bar_answer; private Button bar_answer;
//列表数据
public CommunityFragment() { public CommunityFragment() {
// Required empty public constructor // Required empty public constructor
@ -167,4 +168,5 @@ public class CommunityFragment extends Fragment implements ViewPager.OnPageChang
hvChannel.smoothScrollTo(len,0); hvChannel.smoothScrollTo(len,0);
} }
} }

@ -7,13 +7,21 @@ import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.leudaemialikeme.Adapter.RecnewsAdapter;
import com.example.leudaemialikeme.R; import com.example.leudaemialikeme.R;
import com.example.leudaemialikeme.Recnews;
import java.util.ArrayList;
import java.util.List;
public class InvitationChannelFragment extends Fragment { public class InvitationChannelFragment extends Fragment {
private static final String ARG_CATEGORY_TITLE = "category_title"; private static final String ARG_CATEGORY_TITLE = "category_title";
private String invitationCategoryTitle = "Default"; private String invitationCategoryTitle = "Default";
private TextView mTitleField; private TextView mTitleField;
private List<Recnews> recNews=new ArrayList<>();
public InvitationChannelFragment() { public InvitationChannelFragment() {
// Required empty public constructor // Required empty public constructor
@ -35,15 +43,55 @@ public class InvitationChannelFragment extends Fragment {
}catch (java.lang.NullPointerException e){ }catch (java.lang.NullPointerException e){
System.out.println("TesFragment getArg error!"); System.out.println("TesFragment getArg error!");
} }
initRecNews();
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view; View view;
if(invitationCategoryTitle.equals("全部")){
view = inflater.inflate(R.layout.recyclerview,container,false);
RecyclerView recyclerView = (RecyclerView)view.findViewById(R.id.list_community);
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
RecnewsAdapter adapter = new RecnewsAdapter(recNews);
recyclerView.setAdapter(adapter);
}
else {
view = inflater.inflate(R.layout.fragment_invitation_channel, container, false); view = inflater.inflate(R.layout.fragment_invitation_channel, container, false);
mTitleField = (TextView)view.findViewById(R.id.invitationCategoryTitle); mTitleField = (TextView)view.findViewById(R.id.invitationCategoryTitle);
mTitleField.setText(invitationCategoryTitle); mTitleField.setText(invitationCategoryTitle);
}
return view; return view;
} }
private void initRecNews(){
for(int i=0;i<2;i++){
Recnews news1=new Recnews(R.drawable.rec_news1,
"儿童急性B淋巴细胞白血病,除了传统疗法还有哪些前沿治疗方法呢?",
"急性淋巴细胞白血病ALL是儿童最常见的恶性肿瘤其中约85%为……"
,102,"2021-11-6 09:19:54"
);
recNews.add(news1);
Recnews news2=new Recnews(R.drawable.rec_news2,
"儿童急性B淋巴细胞白血病,除了传统疗法还有哪些前沿治疗方法呢?",
"急性淋巴细胞白血病ALL是儿童最常见的恶性肿瘤其中约85%为……"
,100,"2021-12-6 03:19:54"
);
recNews.add(news2);
Recnews news3=new Recnews(R.drawable.rec_news3,
"儿童急性B淋巴细胞白血病,除了传统疗法还有哪些前沿治疗方法呢?",
"急性淋巴细胞白血病ALL是儿童最常见的恶性肿瘤其中约85%为……"
,100,"2021-12-6 03:19:54"
);
recNews.add(news3);
Recnews news4=new Recnews(R.drawable.rec_news4,
"儿童急性B淋巴细胞白血病,除了传统疗法还有哪些前沿治疗方法呢?",
"急性淋巴细胞白血病ALL是儿童最常见的恶性肿瘤其中约85%为……"
,100,"2021-12-6 03:19:54"
);
recNews.add(news4);
}
}
} }

@ -1,12 +1,18 @@
package com.example.leudaemialikeme.Fragment; package com.example.leudaemialikeme.Fragment;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import com.example.leudaemialikeme.Activity.APNActivity;
import com.example.leudaemialikeme.Activity.EventActivity;
import com.example.leudaemialikeme.Activity.MdctRmdActivity;
import com.example.leudaemialikeme.R; import com.example.leudaemialikeme.R;
/** /**
@ -60,6 +66,58 @@ public class MyFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
// Inflate the layout for this fragment // Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_my, container, false); View view = inflater.inflate(R.layout.fragment_my, container, false);
initClick(view);
return view;
}
private void initClick(View view) {
//提醒和大事记的线性布局
LinearLayout remindLinear = view.findViewById(R.id.my_remind_linear);
LinearLayout noteLinear = view.findViewById(R.id.my_note_linear);
//三个TextView 回答,帖子,赞同
TextView answer = view.findViewById(R.id.my_answer);
TextView invitation = view.findViewById(R.id.my_invitation);
TextView consent = view.findViewById(R.id.my_consent);
//设置文本点击之后的跳转
answer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getContext(), APNActivity.class);
startActivity(intent);
}
});
invitation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getContext(), APNActivity.class);
startActivity(intent);
}
});
consent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getContext(), APNActivity.class);
startActivity(intent);
}
});
//服药提醒的跳转
remindLinear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getContext(), MdctRmdActivity.class);
startActivity(intent);
}
});
//大事记的提醒
noteLinear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getContext(), EventActivity.class);
startActivity(intent);
}
});
} }
} }

@ -30,7 +30,7 @@
android:layout_weight="1" android:layout_weight="1"
android:layout_marginLeft="30dp" android:layout_marginLeft="30dp"
android:layout_marginRight="30dp" android:layout_marginRight="30dp"
android:src="@mipmap/img_default_avatar" android:src="@mipmap/img_my_person"
/> />
<LinearLayout <LinearLayout

@ -0,0 +1,51 @@
<?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.EventActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_margin="15dp"
android:src="@mipmap/img_go_answer_return" />
<TextView
android:id="@+id/textView30"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="18dp"
android:layout_margin="15dp"
android:gravity="center"
android:text="大事记" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_margin="15dp"
android:src="@mipmap/img_add"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_round_corner"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/eventList"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/event_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="28dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="30dp"
/>
<TextView
android:id="@+id/event_month"
android:layout_width="10dp"
android:layout_height="wrap_content"
android:textSize="18dp"
android:layout_marginTop="40dp"
android:layout_marginLeft="-10dp"
android:layout_weight="1"
/>
<LinearLayout
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="start"
android:src="@mipmap/event_dot"
/>
<TextView
android:id="@+id/event_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="18dp"
android:layout_gravity="center"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/event_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="40dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:layout_weight="3"
android:textSize="12dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginBottom="10dp"
android:layout_gravity="right"
android:src="@mipmap/img_go_more" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -27,7 +27,7 @@
android:layout_margin="10dp" android:layout_margin="10dp"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_weight="1" android:layout_weight="1"
android:src="@mipmap/img_default_avatar" /> android:src="@mipmap/img_my_person" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -70,7 +70,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/textView13" android:id="@+id/my_answer"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="30dp" android:layout_marginLeft="30dp"
@ -79,7 +79,7 @@
android:textSize="20dp" /> android:textSize="20dp" />
<TextView <TextView
android:id="@+id/textView14" android:id="@+id/my_invitation"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
@ -87,7 +87,7 @@
android:textSize="20dp" /> android:textSize="20dp" />
<TextView <TextView
android:id="@+id/textView15" android:id="@+id/my_consent"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
@ -233,6 +233,7 @@
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:background="@drawable/shape_round_corner" android:background="@drawable/shape_round_corner"
android:orientation="horizontal" android:orientation="horizontal"
android:id="@+id/my_remind_linear"
android:layout_weight="1"> android:layout_weight="1">
<TextView <TextView
@ -249,6 +250,7 @@
android:layout_height="50dp" android:layout_height="50dp"
android:layout_margin="10dp" android:layout_margin="10dp"
android:layout_weight="1" android:layout_weight="1"
android:id="@+id/my_remind"
android:src="@mipmap/img_remind" /> android:src="@mipmap/img_remind" />
</LinearLayout> </LinearLayout>
@ -257,6 +259,7 @@
android:layout_height="70dp" android:layout_height="70dp"
android:background="@drawable/shape_round_corner" android:background="@drawable/shape_round_corner"
android:orientation="horizontal" android:orientation="horizontal"
android:id="@+id/my_note_linear"
android:layout_weight="1"> android:layout_weight="1">
<TextView <TextView
@ -275,6 +278,7 @@
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:layout_weight="1" android:layout_weight="1"
android:id="@+id/my_note"
android:src="@mipmap/img_note" /> android:src="@mipmap/img_note" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

@ -4,13 +4,14 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="wrap_content">
<LinearLayout <LinearLayout
android:id="@+id/news" android:id="@+id/news"
android:layout_width="334dp" android:layout_width="334dp"
android:layout_height="150dp" android:layout_height="150dp"
android:layout_marginLeft="18dp" android:layout_marginLeft="18dp"
android:layout_marginBottom="6dp"
android:background="@drawable/background" android:background="@drawable/background"
android:elevation="10dp" android:elevation="10dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:background="#ffffff">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_community"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Loading…
Cancel
Save