|
@ -130,7 +130,7 @@ public class UploadActivity extends BaseActivity { |
|
|
private EditText uploadTitle; |
|
|
private EditText uploadTitle; |
|
|
private EditText uploadFilename; |
|
|
private EditText uploadFilename; |
|
|
private EditText uploadDescription; |
|
|
private EditText uploadDescription; |
|
|
private AppCompatButton titleDescriptionBuilderButton; |
|
|
private AppCompatButton generateFieldsButton; |
|
|
private LinearLayout filesListView; |
|
|
private LinearLayout filesListView; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -174,9 +174,9 @@ public class UploadActivity extends BaseActivity { |
|
|
rootCategorySpinner = findViewById(R.id.upload_spinner_category_root); |
|
|
rootCategorySpinner = findViewById(R.id.upload_spinner_category_root); |
|
|
rootCategorySpinner.setOnItemSelectedListener(new CustomOnItemSelectedListener(uploadRootCategories)); |
|
|
rootCategorySpinner.setOnItemSelectedListener(new CustomOnItemSelectedListener(uploadRootCategories)); |
|
|
|
|
|
|
|
|
titleDescriptionBuilderButton = findViewById(R.id.upload_title_description_builder); |
|
|
generateFieldsButton = findViewById(R.id.upload_title_description_builder); |
|
|
titleDescriptionBuilderButton.setEnabled(false); |
|
|
generateFieldsButton.setEnabled(false); |
|
|
titleDescriptionBuilderButton.setOnClickListener(view -> { |
|
|
generateFieldsButton.setOnClickListener(view -> { |
|
|
if(uploadsCourse!=null && !uploadsCourse.getName().equals("") && !semester.equals("")){ |
|
|
if(uploadsCourse!=null && !uploadsCourse.getName().equals("") && !semester.equals("")){ |
|
|
Intent intent = new Intent(UploadActivity.this, UploadFieldsBuilderActivity.class); |
|
|
Intent intent = new Intent(UploadActivity.this, UploadFieldsBuilderActivity.class); |
|
|
Bundle builderExtras = new Bundle(); |
|
|
Bundle builderExtras = new Bundle(); |
|
@ -410,7 +410,7 @@ public class UploadActivity extends BaseActivity { |
|
|
} else { |
|
|
} else { |
|
|
//Renders the already parsed data
|
|
|
//Renders the already parsed data
|
|
|
updateUIElements(); |
|
|
updateUIElements(); |
|
|
titleDescriptionBuilderButton.setEnabled(true); |
|
|
generateFieldsButton.setEnabled(true); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Resources res = getResources(); |
|
|
Resources res = getResources(); |
|
@ -841,7 +841,7 @@ public class UploadActivity extends BaseActivity { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
categorySelected = parentCategories.get(position).getValue(); |
|
|
categorySelected = parentCategories.get(position).getValue(); |
|
|
setCourseAndSemester(); |
|
|
generateFieldsButton.setEnabled(false); |
|
|
|
|
|
|
|
|
//Adds new sub-category spinner
|
|
|
//Adds new sub-category spinner
|
|
|
if (parentCategories.get(position).hasSubCategories()) { |
|
|
if (parentCategories.get(position).hasSubCategories()) { |
|
@ -882,6 +882,8 @@ public class UploadActivity extends BaseActivity { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
setCourseAndSemester(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -890,21 +892,13 @@ public class UploadActivity extends BaseActivity { |
|
|
private void setCourseAndSemester(){ |
|
|
private void setCourseAndSemester(){ |
|
|
uploadsCourse = null; |
|
|
uploadsCourse = null; |
|
|
semester = ""; |
|
|
semester = ""; |
|
|
|
|
|
if (categorySelected.equals("-1")) return; |
|
|
if (categorySelected.equals("-1")) { |
|
|
|
|
|
titleDescriptionBuilderButton.setEnabled(false); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int numberOfSpinners = categoriesSpinners.getChildCount(); |
|
|
int numberOfSpinners = categoriesSpinners.getChildCount(); |
|
|
|
|
|
|
|
|
if (numberOfSpinners < 3) { |
|
|
if (numberOfSpinners < 3) return; |
|
|
titleDescriptionBuilderButton.setEnabled(false); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String maybeSemester = ""; |
|
|
String maybeSemester, maybeCourse; |
|
|
String maybeCourse = ""; |
|
|
|
|
|
|
|
|
|
|
|
if (numberOfSpinners == 5) { |
|
|
if (numberOfSpinners == 5) { |
|
|
if (((AppCompatSpinnerWithoutDefault) categoriesSpinners.getChildAt(numberOfSpinners - 1)). |
|
|
if (((AppCompatSpinnerWithoutDefault) categoriesSpinners.getChildAt(numberOfSpinners - 1)). |
|
@ -927,15 +921,8 @@ public class UploadActivity extends BaseActivity { |
|
|
categoriesSpinners.getChildAt(numberOfSpinners - 1)).getSelectedItem(); |
|
|
categoriesSpinners.getChildAt(numberOfSpinners - 1)).getSelectedItem(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!maybeSemester.contains("εξάμηνο") && !maybeSemester.contains("Εξάμηνο")) { |
|
|
if (!maybeSemester.contains("εξάμηνο") && !maybeSemester.contains("Εξάμηνο")) return; |
|
|
titleDescriptionBuilderButton.setEnabled(false); |
|
|
if (maybeCourse == null) return; |
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (maybeCourse == null) { |
|
|
|
|
|
titleDescriptionBuilderButton.setEnabled(false); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String retrievedCourse = maybeCourse.replaceAll("-", "").replace("(ΝΠΣ)", "").trim(); |
|
|
String retrievedCourse = maybeCourse.replaceAll("-", "").replace("(ΝΠΣ)", "").trim(); |
|
|
String retrievedSemester = maybeSemester.replaceAll("-", "").trim().substring(0, 1); |
|
|
String retrievedSemester = maybeSemester.replaceAll("-", "").trim().substring(0, 1); |
|
@ -947,12 +934,9 @@ public class UploadActivity extends BaseActivity { |
|
|
uploadsCourse = foundUploadsCourse; |
|
|
uploadsCourse = foundUploadsCourse; |
|
|
semester = retrievedSemester; |
|
|
semester = retrievedSemester; |
|
|
Timber.d("Selected course: %s, semester: %s", uploadsCourse.getName(), semester); |
|
|
Timber.d("Selected course: %s, semester: %s", uploadsCourse.getName(), semester); |
|
|
titleDescriptionBuilderButton.setEnabled(true); |
|
|
generateFieldsButton.setEnabled(true); |
|
|
return; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
titleDescriptionBuilderButton.setEnabled(false); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|