@ -0,0 +1,56 @@
|
|||||||
|
package com.example.dxsdpdb;
|
||||||
|
|
||||||
|
public class Mission {
|
||||||
|
private int id;
|
||||||
|
private double money;
|
||||||
|
private String type;
|
||||||
|
private String content;
|
||||||
|
private int index;
|
||||||
|
|
||||||
|
public Mission(int id, double money, String type, int index) {
|
||||||
|
this.id = id;
|
||||||
|
this.money = money;
|
||||||
|
this.type = type;
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIndex() {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndex(int index) {
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getMoney() {
|
||||||
|
return money;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMoney(double money) {
|
||||||
|
this.money = money;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.example.dxsdpdb;
|
||||||
|
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentPagerAdapter;
|
||||||
|
|
||||||
|
public class MissionFragmentAdapter extends FragmentPagerAdapter {
|
||||||
|
private String[] channelList;
|
||||||
|
|
||||||
|
private FragmentManager fm;
|
||||||
|
public MissionFragmentAdapter(FragmentManager fm, String[] channelList) {
|
||||||
|
super(fm);
|
||||||
|
this.channelList = channelList;
|
||||||
|
this.fm=fm;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Fragment getItem(int idx) {
|
||||||
|
//Log.e("LIUZHEN",""+idx);
|
||||||
|
return new MissionListFragment(idx);
|
||||||
|
//return new MissionListFragment();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return channelList.length;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package com.example.dxsdpdb;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
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 java.util.List;
|
||||||
|
|
||||||
|
public class MissionItemAdapter extends RecyclerView.Adapter<MissionItemAdapter.ViewHolder> {
|
||||||
|
private List<Mission> missionList;
|
||||||
|
private Context context;
|
||||||
|
static class ViewHolder extends RecyclerView.ViewHolder{
|
||||||
|
TextView form_id;
|
||||||
|
TextView form_money;
|
||||||
|
TextView form_type;
|
||||||
|
public ViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
this.form_id = (TextView)itemView.findViewById(R.id.form_id);
|
||||||
|
this.form_money = (TextView)itemView.findViewById(R.id.form_money);
|
||||||
|
this.form_type = (TextView)itemView.findViewById(R.id.form_type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MissionItemAdapter(List<Mission> list){ this.missionList = list; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull MissionItemAdapter.ViewHolder holder, int position) {
|
||||||
|
Mission ms = missionList.get(position);
|
||||||
|
holder.form_id.setText("编号:"+ms.getId());
|
||||||
|
holder.form_money.setText("酬金:¥"+ms.getMoney());
|
||||||
|
holder.form_type.setText("类型:"+ms.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MissionItemAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_view,parent,false);
|
||||||
|
final ViewHolder holder = new ViewHolder(view);
|
||||||
|
Log.e("LIUZHEN","onCreateViewHolder");
|
||||||
|
return holder;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return missionList.size();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
package com.example.dxsdpdb;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MissionListFragment extends Fragment {
|
||||||
|
private List<Mission> mData = new ArrayList<>();
|
||||||
|
private int index;
|
||||||
|
private View view;
|
||||||
|
public RecyclerView recycleView;
|
||||||
|
private MissionItemAdapter adapter;
|
||||||
|
|
||||||
|
|
||||||
|
public MissionListFragment() {
|
||||||
|
// Required empty public constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
public MissionListFragment(int index) {
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
view = inflater.inflate(R.layout.fragment_mission_list, container, false);
|
||||||
|
recycleView = (RecyclerView)view.findViewById(R.id.mission_list);
|
||||||
|
getData(index);
|
||||||
|
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
|
||||||
|
recycleView.setLayoutManager(layoutManager);
|
||||||
|
adapter = new MissionItemAdapter(mData);
|
||||||
|
recycleView.setAdapter(adapter);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getData(int index){
|
||||||
|
List<Mission> allMission = new ArrayList<>();
|
||||||
|
mData.clear();
|
||||||
|
Mission mission1 = new Mission(1,2,"跑腿",1);
|
||||||
|
allMission.add(mission1);
|
||||||
|
Mission mission2 = new Mission(2,10,"代办",3);
|
||||||
|
allMission.add(mission2);
|
||||||
|
Mission mission3 = new Mission(3,20,"代办",3);
|
||||||
|
allMission.add(mission3);
|
||||||
|
Mission mission4 = new Mission(4,3,"跑腿",2);
|
||||||
|
allMission.add(mission4);
|
||||||
|
Mission mission5 = new Mission(5,1,"跑腿",1);
|
||||||
|
allMission.add(mission5);
|
||||||
|
Mission mission6 = new Mission(6,3,"跑腿",5);
|
||||||
|
allMission.add(mission6);
|
||||||
|
Mission mission7 = new Mission(7,2,"跑腿",5);
|
||||||
|
allMission.add(mission7);
|
||||||
|
Mission mission8 = new Mission(9,1.5,"跑腿",2);
|
||||||
|
allMission.add(mission8);
|
||||||
|
Mission mission9 = new Mission(9,4,"代办",4);
|
||||||
|
allMission.add(mission9);
|
||||||
|
Mission mission10 = new Mission(10,1,"跑腿",3);
|
||||||
|
allMission.add(mission10);
|
||||||
|
if(index==0){
|
||||||
|
mData = allMission;
|
||||||
|
}else {
|
||||||
|
for (int i=0;i<allMission.size();i++){
|
||||||
|
if(allMission.get(i).getIndex()==index){
|
||||||
|
mData.add(allMission.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 141 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 2.0 KiB |
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
<item android:state_checked="true" >
|
||||||
|
<layer-list >
|
||||||
|
<item >
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<stroke android:width="5dp" android:color="#ff0000"/>
|
||||||
|
</shape>
|
||||||
|
|
||||||
|
</item>
|
||||||
|
<item android:bottom="5dp" >
|
||||||
|
<shape android:shape="rectangle" >
|
||||||
|
<solid android:color="#fff"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
|
|
||||||
|
|
||||||
|
</item>
|
||||||
|
<item android:state_selected="true" >
|
||||||
|
<layer-list >
|
||||||
|
<item >
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<stroke android:width="5dp" android:color="#ff0000"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item android:bottom="5dp" >
|
||||||
|
<shape android:shape="rectangle" >
|
||||||
|
<solid android:color="#fff"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
|
</item>
|
||||||
|
<item >
|
||||||
|
<shape >
|
||||||
|
<solid android:color="#ffF"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
After Width: | Height: | Size: 4.5 KiB |
@ -0,0 +1,14 @@
|
|||||||
|
<?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=".MissionListFragment">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/mission_list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</LinearLayout>
|
@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
app:cardCornerRadius="5dp"
|
||||||
|
app:cardElevation="2dp">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="5dp">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/form_id"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="编号:" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/form_money"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="酬金:¥"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginLeft="100dp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/form_type"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="类型:"
|
||||||
|
android:textSize="14sp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RadioButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:text=""
|
||||||
|
android:background="@drawable/tab_selector"
|
||||||
|
android:paddingLeft="15dp"
|
||||||
|
android:paddingRight="15dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:button="@null"/>
|
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<dimen name="text_margin">16dp</dimen>
|
||||||
|
</resources>
|