diff --git a/app/src/main/java/com/mobilecomputing/sahayak/Fragments/proposalShowFragment.java b/app/src/main/java/com/mobilecomputing/sahayak/Fragments/proposalShowFragment.java index bda8ad3..1f796b8 100644 --- a/app/src/main/java/com/mobilecomputing/sahayak/Fragments/proposalShowFragment.java +++ b/app/src/main/java/com/mobilecomputing/sahayak/Fragments/proposalShowFragment.java @@ -6,20 +6,21 @@ import android.view.ViewGroup; import android.widget.Button; import android.widget.CheckBox; -import android.widget.RadioButton; +import android.widget.CompoundButton; +import android.widget.LinearLayout; import android.widget.TextView; -import android.widget.Toast; import androidx.fragment.app.Fragment; -import com.google.firebase.database.DatabaseReference; -import com.google.firebase.database.FirebaseDatabase; import com.mobilecomputing.sahayak.JavaClasses.Proposal; import com.mobilecomputing.sahayak.JavaClasses.Session; import com.mobilecomputing.sahayak.JavaClasses.SessionLab; import com.mobilecomputing.sahayak.R; +import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Calendar; +import java.util.Date; import cn.pedant.SweetAlert.SweetAlertDialog; @@ -42,10 +43,15 @@ public proposalShowFragment() { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + final int[] numberOfChecks = {0}; + final ArrayList checkedTimes = new ArrayList(); // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_proposal_show, container, false); + final Button b = (Button) v.findViewById(R.id.submitButton); final Proposal mProposal = (Proposal) getArguments().getSerializable("PROPOSAL_INFO"); + LinearLayout sessionsLayout= (LinearLayout) v.findViewById(R.id.sessionsList); + TextView mProposal_skill = (TextView) v.findViewById(R.id.proposal_skill); mProposal_skill.setText(mProposal.getSkill()); @@ -56,72 +62,54 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, mProposal_description.setText("Category: " + mProposal.getCategory()); //mProposal_description.setText("Description: " + mProposal.getDescription()); + final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm"); Calendar startCalendar = Calendar.getInstance(); startCalendar.setTime(mProposal.getStartDate()); - int sh = startCalendar.HOUR_OF_DAY; - int sm = startCalendar.MINUTE; - if(sm<30){ - sm=0; - } - else{ - sm=1; - } - String tmp[] = {"00", "30"}; - final CheckBox rb1 = (CheckBox) v.findViewById(R.id.radioButton); - String xyz = ""; + int quanta = 15; + int running_sum = 0; + while(running_sum0){ + b.setEnabled(true); + } + } + }); - // TODO: Use proper variable names so that purpose of code is clear - if (sm == 1) { - xyz = ""; - if (sh < 10) { - xyz = "0"; - } - xyz += sh + "" + tmp[sm] + "-"; - if (sh + 1 < 10) { - xyz += "0"; - } - xyz += (sh + 1) + "" + tmp[sm - 1]; - rb1.setText(xyz); - } else { - xyz = ""; - if (sh < 10) { - xyz = "0"; - } - xyz += sh + "" + tmp[sm] + "-" + sh + "" + tmp[sm + 1]; - rb1.setText(xyz); } - final CheckBox rb2 = (CheckBox) v.findViewById(R.id.radioButton2); - if (sm == 1) { - xyz = ""; - if (sh + 1 < 10) { - xyz += "0" + (sh + 1) + "" + tmp[sm - 1] + "-0" + (sh + 1) + tmp[sm]; - } else { - xyz += (sh + 1) + "" + tmp[sm - 1] + "-" + (sh + 1) + tmp[sm]; - } - rb2.setText(xyz); - } else { - xyz = ""; - if (sh < 10) { - xyz = "0"; - } - xyz += sh + "" + tmp[sm + 1] + "-"; - if (sh + 1 < 10) { - xyz += "0"; - } - xyz += (sh + 1) + "" + tmp[sm]; - rb2.setText(xyz); - } - - final Button b = (Button) v.findViewById(R.id.submitButton); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { SessionLab sl = SessionLab.get(view.getContext()); - Session newSession = new Session(sl.getSessions().size(), mProposal); - sl.AddSession(newSession); + + for(int i=0; i - - + - - -