Skip to content

Commit

Permalink
Merge pull request #41 from limciana/rayven-branch
Browse files Browse the repository at this point in the history
Rayven branch
  • Loading branch information
limciana authored Mar 23, 2018
2 parents 2996d21 + b49597f commit 000498e
Show file tree
Hide file tree
Showing 15 changed files with 766 additions and 23 deletions.
1 change: 1 addition & 0 deletions Android Studio Files/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies {
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Ciana Lim 3/6/18 Included the non-volatility aspect of the app
* Ciana Lim 3/7/18 Added methods and logic to include the calculation of coreqs
* Rayven Ely Cruz 3/8/18 Added methods for junior/senior standing based on recommended subjects
* Ciana Lim 3/9/18 Remove coreqs restriction
* Rayven Ely Cruz 3/23/18 Added methods for passing visible subjects
*/

/*
Expand Down Expand Up @@ -73,7 +75,8 @@ public class InputSubjectFragment extends Fragment {
AlertDialog.Builder builder; // instance to be used for the dialog
StringBuffer buffer; // buffer string to show the data stored in the database
int isDeleted; // the number of rows that were deleted from the student_table
int units_taken = 0;
int units_taken = 0; // total number of units taken by the student
ArrayList<Subject> resultArray; // the subjects that can be taken

Student student; // the student object
public InputSubjectFragment() {
Expand Down Expand Up @@ -121,6 +124,45 @@ public void passTitle(String data) {
dataPasser.onTitlePass(data);
}
/*
* Name: passStanding
* Creation Date: 3/23/18
* Purpose: pass standing
* Arguments:
* data - standing
* Other Requirements:
* none
* Return Value: void
*/
public void passStanding(String data) {
dataPasser.onStandingPass(data);
}
/*
* Name: passSubjects
* Creation Date: 3/23/18
* Purpose: pass subjects
* Arguments:
* data - subjects
* Other Requirements:
* none
* Return Value: void
*/
public void passSubjects(ArrayList<Subject> data) {
dataPasser.onSubjectsPass(data);
}
/*
* Name: passUnits
* Creation Date: 3/23/18
* Purpose: pass units
* Arguments:
* data - units
* Other Requirements:
* none
* Return Value: void
*/
public void passUnits(int data) {
dataPasser.onUnitsPass(data);
}
/*
* Name: onDataPass
* Creation Date: 2/22/18
* Purpose: interface to pass data to activity
Expand All @@ -132,8 +174,10 @@ public void passTitle(String data) {
*/
public interface OnDataPass {
public void onDataPass(String data);

public void onStandingPass(String data);
public void onUnitsPass(int data);
public void onTitlePass(String data);
public void onSubjectsPass(ArrayList<Subject> data);
}
/*
* Name: onCreateView
Expand All @@ -154,11 +198,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
/* Pass title to the activity, receive curriculum from the activity */
passTitle("Mark Subjects");
curriculum = ((MainDrawer) getActivity()).getCurriculum();
Log.d("curriculum", curriculum.getName());
//Log.d("curriculum", curriculum.getName());
// Inflate the layout for this fragment
UPCCdb = new DatabaseHelper(getActivity());
UPCCdb.createDB();

resultArray = new ArrayList<Subject>();

/* List the subjects of the curriculum */
if (curriculum != null) {
Expand Down Expand Up @@ -256,8 +301,6 @@ public void onClick(View view) {
/* get the total number of units taken by the student */
units_taken = student.getTotalUnits();



/* iterate over all the subjects in the curriculum */
for(int i = 0; i < curriculum.getSubjects().size(); i++) {
TextView tv_s = v.findViewById(curriculum.getSubjects().size() * 2 + (i + 1));
Expand Down Expand Up @@ -330,13 +373,15 @@ public void onClick(View view) {
}
}
}

} else { // not set visible
RelativeLayout r_row_check = v.findViewById(curriculum.getSubjects().size() + (i + 1));
CheckBox cb_checked = v.findViewById(i + 1);
cb_checked.setChecked(false);
r_row_check.setVisibility(View.GONE);
}
Log.d("units", String.valueOf(units_taken));

}

/* to check if the coreq is already visible. Loop through entire subject list */
Expand Down Expand Up @@ -378,7 +423,20 @@ public void onClick(View view) {
}
}
}*/
//passStanding(UPCC.yearToString(student.getStanding()));
//passUnits(student.getTotalUnits());
resultArray.clear();
for( int x = 0; x < curriculum.getSubjects().size(); x++){
RelativeLayout r_row_visib = v.findViewById(curriculum.getSubjects().size() + (x + 1));
CheckBox cb_check = v.findViewById(x + 1);
if(!cb_check.isChecked() && r_row_visib.getVisibility() == View.VISIBLE){
resultArray.add(curriculum.getSubjects().get(x));
}
}
passSubjects(resultArray);

}

});
/* Display details on long press */
r_row.setOnLongClickListener(new View.OnLongClickListener() {
Expand All @@ -395,6 +453,8 @@ public boolean onLongClick(View view) {
return false;
}
});


}

/* same logic with the logic on onClick */
Expand Down Expand Up @@ -474,6 +534,15 @@ public boolean onLongClick(View view) {
}
Log.d("units", String.valueOf(units_taken));
}
resultArray.clear();
for( int x = 0; x < curriculum.getSubjects().size(); x++){
RelativeLayout r_row_visib = v.findViewById(curriculum.getSubjects().size() + (x + 1));
CheckBox cb_check = v.findViewById(x + 1);
if(!cb_check.isChecked() && r_row_visib.getVisibility() == View.VISIBLE){
resultArray.add(curriculum.getSubjects().get(x));
}
}
passSubjects(resultArray);
/*for(int i = 0; i < curriculum.getSubjects().size(); i++) {
TextView tv_s = v.findViewById(curriculum.getSubjects().size() * 2 + (i + 1));
String cbtext = tv_s.getText().toString();
Expand Down Expand Up @@ -513,10 +582,23 @@ public boolean onLongClick(View view) {
}
}*/
// Log.d("units", String.valueOf(units_taken));

}
return v;
}

/*
* Name: createDivider
* Creation Date: 2/19/18
* Purpose: creates a divider
* Arguments:
* none
* Other Requirements:
* none
* Return Value: View - the divider v
*
* vipul mittal. https://stackoverflow.com/questions/21098618/how-to-make-horizontal-line-in-android-programmatically. Last Accessed: 1/28/18
*/
private View createDivider() {
View v_d = new View(v.getContext());
v_d.setLayoutParams(new LinearLayout.LayoutParams(
Expand All @@ -528,9 +610,6 @@ private View createDivider() {
return v_d;
}

private void onClickMisc(View view) {

}

/*
* Name: setClickEffect
Expand Down Expand Up @@ -637,14 +716,14 @@ public void printBuffer(String aName, ArrayList<String> details) {
}

/*
* Name: setUpFAB
* Name: convertDptoPx
* Creation Date: 2/02/18
* Purpose: setups the floating action button and its events
* Purpose: converts Dp to Px
* Arguments:
* none
* Other Requirements:
* fabNext - the floating action button as specified in the layout of the activity
* Return Value: void
* dp
* Return Value: int px
*
* Vicky Chijwani. https://stackoverflow.com/questions/8295986/how-to-calculate-dp-from-pixels-in-android-programmatically. Last Accessed: 2/07/18
*/
Expand Down
Loading

0 comments on commit 000498e

Please sign in to comment.