package com.hong.job_management;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;
import static com.hong.job_management.MainActivity.chinese;
import static com.hong.job_management.MainActivity.chinese_finish;
import static com.hong.job_management.MainActivity.biology;
import static com.hong.job_management.MainActivity.biology_finish;
import static com.hong.job_management.MainActivity.chemistry;
import static com.hong.job_management.MainActivity.chemistry_finish;
import static com.hong.job_management.MainActivity.english;
import static com.hong.job_management.MainActivity.english_finish;
import static com.hong.job_management.MainActivity.geography;
import static com.hong.job_management.MainActivity.geography_finish;
import static com.hong.job_management.MainActivity.history;
import static com.hong.job_management.MainActivity.history_finish;
import static com.hong.job_management.MainActivity.math;
import static com.hong.job_management.MainActivity.math_finish;
import static com.hong.job_management.MainActivity.other;
import static com.hong.job_management.MainActivity.other_finish;
import static com.hong.job_management.MainActivity.physics;
import static com.hong.job_management.MainActivity.physics_finish;
import static com.hong.job_management.MainActivity.politics;
import static com.hong.job_management.MainActivity.politics_finish;
import static com.hong.job_management.MainActivity.sum;
import static com.hong.job_management.MainActivity.sum_finish;

public class ScheduleActivity extends AppCompatActivity {
    public List<Subject_schedule> subject_schedule=new ArrayList<Subject_schedule>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_schedule);
        final ScheduleActivity thisActivity=this;
        initSubject_schedule();
        update_Schedule(subject_schedule);
        myAdapter_Schedule myAdapter_schedule= new myAdapter_Schedule(ScheduleActivity.this,subject_schedule);
        ListView listView=(ListView)findViewById(R.id.schedule_list);
        listView.setAdapter(myAdapter_schedule);
    }
    private void initSubject_schedule()
    {
        Subject_schedule subject_schedule1= new Subject_schedule("语文");
        subject_schedule.add(subject_schedule1);
        Subject_schedule subject_schedule2= new Subject_schedule("数学");
        subject_schedule.add(subject_schedule2);
        Subject_schedule subject_schedule3= new Subject_schedule("英语");
        subject_schedule.add(subject_schedule3);
        Subject_schedule subject_schedule4= new Subject_schedule("历史");
        subject_schedule.add(subject_schedule4);
        Subject_schedule subject_schedule5= new Subject_schedule("地理");
        subject_schedule.add(subject_schedule5);
        Subject_schedule subject_schedule6= new Subject_schedule("政治");
        subject_schedule.add(subject_schedule6);
        Subject_schedule subject_schedule7= new Subject_schedule("物理");
        subject_schedule.add(subject_schedule7);
        Subject_schedule subject_schedule8= new Subject_schedule("化学");
        subject_schedule.add(subject_schedule8);
        Subject_schedule subject_schedule9= new Subject_schedule("生物");
        subject_schedule.add(subject_schedule9);
        Subject_schedule subject_schedule10= new Subject_schedule("其他");
        subject_schedule.add(subject_schedule10);
        Subject_schedule subject_schedule11= new Subject_schedule("总");
        subject_schedule.add(subject_schedule11);
    }
    private void update_Schedule (List <Subject_schedule> subject_schedule)
    {
        subject_schedule.get(0).max=chinese;
        subject_schedule.get(0).progress=chinese_finish;
        subject_schedule.get(1).max=math;
        subject_schedule.get(1).progress=math_finish;
        subject_schedule.get(2).max=english;
        subject_schedule.get(2).progress=english_finish;
        subject_schedule.get(3).max=history;
        subject_schedule.get(3).progress=history_finish;
        subject_schedule.get(4).max=geography;
        subject_schedule.get(4).progress=geography_finish;
        subject_schedule.get(5).max=politics;
        subject_schedule.get(5).progress=politics_finish;
        subject_schedule.get(6).max=physics;
        subject_schedule.get(6).progress=physics_finish;
        subject_schedule.get(7).max=chemistry;
        subject_schedule.get(7).progress=chemistry_finish;
        subject_schedule.get(8).max=biology;
        subject_schedule.get(8).progress=biology_finish;
        subject_schedule.get(9).max=other;
        subject_schedule.get(9).progress=other_finish;
        subject_schedule.get(10).max=sum;
        subject_schedule.get(10).progress=sum_finish;
    }
}


