“我的”部分大事记部分

master
Jane 3 years ago
parent a9560edcd8
commit 909cdbf717

@ -9,10 +9,12 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.LeudaemiaLikeMe">
<activity android:name=".Activity.APNActivity"></activity>
<activity android:name=".Activity.CommunityActivity" />
<activity android:name=".Activity.EventActivity"></activity>
<activity android:name=".Activity.APNActivity" />
<activity android:name=".Activity.SearchActivity" />
<activity android:name=".Activity.SendInvitationActivity" />
<activity android:name=".Activity.GoAnswerActivity" />
<activity android:name=".Activity.MdctRmdActivity" />
<activity android:name=".Activity.SendQuestionActivity" />
<activity android:name=".Activity.MainActivity">
<intent-filter>

@ -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开始
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
//获取Spinner控件的适配器
//获取Spinner控件的适配器
ArrayAdapter<String> adapter = (ArrayAdapter<String>) parent.getAdapter();
//tvResult.setText(adapter.getItem(position));
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;
}
}

@ -1,12 +1,18 @@
package com.example.leudaemialikeme.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
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;
/**
@ -60,6 +66,58 @@ public class MyFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// 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_marginLeft="30dp"
android:layout_marginRight="30dp"
android:src="@mipmap/img_default_avatar"
android:src="@mipmap/img_my_person"
/>
<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_marginLeft="20dp"
android:layout_weight="1"
android:src="@mipmap/img_default_avatar" />
android:src="@mipmap/img_my_person" />
<LinearLayout
android:layout_width="wrap_content"
@ -70,7 +70,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/textView13"
android:id="@+id/my_answer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
@ -79,7 +79,7 @@
android:textSize="20dp" />
<TextView
android:id="@+id/textView14"
android:id="@+id/my_invitation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
@ -87,7 +87,7 @@
android:textSize="20dp" />
<TextView
android:id="@+id/textView15"
android:id="@+id/my_consent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
@ -233,6 +233,7 @@
android:layout_marginRight="20dp"
android:background="@drawable/shape_round_corner"
android:orientation="horizontal"
android:id="@+id/my_remind_linear"
android:layout_weight="1">
<TextView
@ -249,6 +250,7 @@
android:layout_height="50dp"
android:layout_margin="10dp"
android:layout_weight="1"
android:id="@+id/my_remind"
android:src="@mipmap/img_remind" />
</LinearLayout>
@ -257,6 +259,7 @@
android:layout_height="70dp"
android:background="@drawable/shape_round_corner"
android:orientation="horizontal"
android:id="@+id/my_note_linear"
android:layout_weight="1">
<TextView
@ -275,6 +278,7 @@
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:layout_weight="1"
android:id="@+id/my_note"
android:src="@mipmap/img_note" />
</LinearLayout>
</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