use of com.example.nftscmers.fragments.SkillsFragment in project HackFest2022-Pretzel by chuanshaof.
the class EditJobActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_employer_edit_job);
backButton = findViewById(R.id.back_button);
position = findViewById(R.id.edit_job_position);
description = findViewById(R.id.edit_job_description);
deadline = findViewById(R.id.edit_job_deadline);
location = findViewById(R.id.edit_job_location);
skills = findViewById(R.id.edit_job_skills);
confirm = findViewById(R.id.edit_job_confirm);
if (getIntent().getStringExtra(ViewJobActivity.TAG) != null) {
// Loading of previous job data
new JobDb(EditJobActivity.this, new JobDb.OnJobModel() {
@Override
public void onResult(JobModel jobModel) {
Log.d(TAG, "onResult: " + jobModel);
job = jobModel;
Utils.setValid(position, job.getPosition());
Utils.setValid(description, job.getDescription());
Utils.setValid(deadline, Globals.DATEFORMAT.format(job.getDeadline()));
Utils.setValid(location, job.getLocation());
position.setEnabled(false);
Utils.uneditableField(position);
SkillsFragment skillsFragment = new SkillsFragment(job.getSkills());
getSupportFragmentManager().beginTransaction().replace(R.id.applicant_skills_list, skillsFragment).commit();
}
}).getJobModel(getIntent().getStringExtra(ViewJobActivity.TAG));
} else {
job = new JobModel(LoggedInUser.getInstance().getUserDocRef());
}
backButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(EditJobActivity.this, ScrollApplicationActivity.class);
startActivity(intent);
}
});
deadline.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new DatePickerDialogFragment(new DatePickerDialogFragment.OnDateSetListener() {
@Override
public void onResult(Calendar calendar) {
deadlineCalendar = calendar;
Utils.setValid(deadline, Globals.DATEFORMAT.format(calendar.getTime()));
}
}).setMinDate(Calendar.getInstance()).show(getSupportFragmentManager(), TAG);
}
});
skills.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new SkillsDialogFragment(job.getSkills(), new SkillsDialogFragment.onConfirmListener() {
@Override
public void onResult(ArrayList<DocumentReference> skillsList) {
Log.d(TAG, "onResult: " + skillsList);
job.setSkills(skillsList);
SkillsFragment skillsFragment = new SkillsFragment(job.getSkills());
getSupportFragmentManager().beginTransaction().replace(R.id.edit_job_skills_list, skillsFragment).commit();
}
}).show(getSupportFragmentManager(), TAG);
}
});
confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (Utils.invalidData(position, deadline, description)) {
return;
}
job.setDeadline(deadlineCalendar.getTime());
job.setLocation(location.getText().toString());
job.setDescription(description.getText().toString());
job.setPosition(position.getText().toString());
JobDb jobDb = new JobDb(EditJobActivity.this, new JobDb.OnJobUploadSuccess() {
@Override
public void onResult() {
Intent intent = new Intent(EditJobActivity.this, ScrollApplicationActivity.class);
startActivity(intent);
}
});
// Handling if it is an existing job or new job
if (job.getDocumentId() == null) {
jobDb.createJob(job, LoggedInUser.getInstance().getEmail());
} else {
jobDb.updateJob(job);
}
}
});
}
use of com.example.nftscmers.fragments.SkillsFragment in project HackFest2022-Pretzel by chuanshaof.
the class ViewJobActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_job);
backButton = findViewById(R.id.job_back);
edit = findViewById(R.id.job_edit);
employer = findViewById(R.id.job_employer);
employerPic = findViewById(R.id.job_picture);
position = findViewById(R.id.job_position);
description = findViewById(R.id.job_description);
deadline = findViewById(R.id.job_deadline);
location = findViewById(R.id.job_location);
// Loading of previous job data, pass UUID into the intent
new JobDb(ViewJobActivity.this, new JobDb.OnJobModel() {
@Override
public void onResult(JobModel jobModel) {
Log.d(TAG, "onResult: " + jobModel);
job = jobModel;
Utils.loadImage(employerPic, job.getEmployerPic());
Utils.setValid(employer, job.getEmployerName());
Utils.setValid(position, job.getPosition());
Utils.setValid(description, job.getDescription());
Utils.setValid(deadline, Globals.DATEFORMAT.format(job.getDeadline()));
Utils.setValid(location, job.getLocation());
position.setEnabled(false);
Utils.uneditableField(position);
SkillsFragment skillsFragment = new SkillsFragment(job.getSkills());
getSupportFragmentManager().beginTransaction().replace(R.id.job_skills_list, skillsFragment).commit();
// Remove edit button if user viewing is not the employer
if (!LoggedInUser.getInstance().getUserDocRef().equals(job.getEmployer())) {
Utils.disableButton(edit);
}
}
}).getJobModel(getIntent().getStringExtra(ViewJobActivity.TAG));
backButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
use of com.example.nftscmers.fragments.SkillsFragment in project HackFest2022-Pretzel by chuanshaof.
the class FeedbackActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feedback);
backButton = findViewById(R.id.back_button);
feedbackTitle = findViewById(R.id.feedback_title);
feedback = findViewById(R.id.feedback);
skills = findViewById(R.id.feedback_skills);
submit = findViewById(R.id.feedback_submit);
new ApplicationDb(FeedbackActivity.this, new ApplicationDb.OnApplicationModel() {
@Override
public void onResult(ApplicationModel applicationModel) {
application = applicationModel;
feedback.setText(applicationModel.getFeedback());
SkillsFragment skillsFragment = new SkillsFragment(applicationModel.getFeedbackSkills());
getSupportFragmentManager().beginTransaction().replace(R.id.feedback_skills_list, skillsFragment).commit();
}
}).getApplicationModel(getIntent().getStringExtra(TAG));
if (LoggedInUser.getInstance().getAccountType() == Globals.EMPLOYER) {
Utils.disableButton(backButton);
feedbackTitle.setText(getString(R.string.feedback_set));
// When user clicks on skills
skills.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new SkillsDialogFragment(application.getFeedbackSkills(), new SkillsDialogFragment.onConfirmListener() {
@Override
public void onResult(ArrayList<DocumentReference> skillsList) {
Log.d(TAG, "onResult: " + skillsList);
application.setFeedbackSkills(skillsList);
SkillsFragment skillsFragment = new SkillsFragment(application.getFeedbackSkills());
getSupportFragmentManager().beginTransaction().replace(R.id.feedback_skills_list, skillsFragment).commit();
}
}).show(getSupportFragmentManager(), TAG);
}
});
} else {
Utils.disableButton(submit);
feedback.setKeyListener(null);
feedbackTitle.setText(getString(R.string.feedback_view));
}
backButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (Utils.invalidData(feedback)) {
return;
} else {
application.setFeedback(feedback.getText().toString());
new ApplicationDb(FeedbackActivity.this, new ApplicationDb.OnApplicationUploadSuccess() {
@Override
public void onResult() {
finish();
}
}).updateApplication(application, getIntent().getStringExtra(TAG));
}
}
});
}
use of com.example.nftscmers.fragments.SkillsFragment in project HackFest2022-Pretzel by chuanshaof.
the class EditProfileActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_applicant_edit_profile);
profilePic = findViewById(R.id.applicant_profile_pic);
name = findViewById(R.id.applicant_name);
email = findViewById(R.id.applicant_email);
about = findViewById(R.id.applicant_about);
linkedIn = findViewById(R.id.applicant_linkedin);
skills = findViewById(R.id.applicant_skills);
confirm = findViewById(R.id.applicant_edit_confirm);
Utils.uneditableField(name);
Utils.uneditableField(email);
// Loading of previous applicant data
new ApplicantDb(EditProfileActivity.this, new ApplicantDb.OnApplicantModel() {
@Override
public void onResult(ApplicantModel applicantModel) {
Log.d(TAG, "onResult: " + applicantModel);
applicant = applicantModel;
Utils.loadImage(profilePic, applicant.getImage());
Utils.setValid(name, applicant.getName());
Utils.setValid(about, applicant.getAbout());
Utils.setValid(linkedIn, applicant.getLinkedIn());
Utils.setValid(email, applicant.getEmail());
SkillsFragment skillsFragment = new SkillsFragment(applicant.getSkills());
getSupportFragmentManager().beginTransaction().replace(R.id.applicant_skills_list, skillsFragment).commit();
}
}).getApplicantModel(LoggedInUser.getInstance().getEmail());
// When user clicks on skills
skills.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new SkillsDialogFragment(applicant.getSkills(), new SkillsDialogFragment.onConfirmListener() {
@Override
public void onResult(ArrayList<DocumentReference> skillsList) {
Log.d(TAG, "onResult: " + skillsList);
applicant.setSkills(skillsList);
SkillsFragment skillsFragment = new SkillsFragment(applicant.getSkills());
getSupportFragmentManager().beginTransaction().replace(R.id.applicant_skills_list, skillsFragment).commit();
}
}).show(getSupportFragmentManager(), TAG);
}
});
profilePic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d(TAG, "onClick: test");
new CropDialogFragment(new CropDialogFragment.OnCropListener() {
@Override
public void onResult(Uri uri) {
new ApplicantDb(EditProfileActivity.this, new ApplicantDb.OnApplicantUploadSuccess() {
@Override
protected void onResult(String string) {
Utils.loadImage(profilePic, string);
applicant.setImage(string);
}
}).updateProfilePicture(uri, applicant.getEmail());
}
}).show(getSupportFragmentManager(), TAG);
}
});
confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (Utils.invalidData(name, about)) {
return;
}
applicant.setName(name.getText().toString());
applicant.setAbout(about.getText().toString());
applicant.setLinkedIn(linkedIn.getText().toString());
new ApplicantDb(EditProfileActivity.this, new ApplicantDb.OnApplicantUploadSuccess() {
@Override
protected void onResult() {
Intent intent = new Intent(EditProfileActivity.this, ProfileActivity.class);
intent.putExtra(ProfileActivity.TAG, LoggedInUser.getInstance().getEmail());
startActivity(intent);
}
}, new ApplicantDb.OnApplicantUploadFailure() {
@Override
public void onResult() {
Utils.fireStoreError(EditProfileActivity.this, TAG);
}
}).updateProfile(applicant);
}
});
}
use of com.example.nftscmers.fragments.SkillsFragment in project HackFest2022-Pretzel by chuanshaof.
the class ProfileActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_applicant_profile);
title = findViewById(R.id.applicant_title);
back = findViewById(R.id.applicant_back_arrow);
editProfile = findViewById(R.id.applicant_edit_profile);
profilePic = findViewById(R.id.applicant_profile_pic);
name = findViewById(R.id.applicant_name);
email = findViewById(R.id.applicant_email);
about = findViewById(R.id.applicant_about);
linkedIn = findViewById(R.id.applicant_linkedIn);
logout = findViewById(R.id.button_logout);
// Loading of previous applicant data
new ApplicantDb(ProfileActivity.this, new ApplicantDb.OnApplicantModel() {
@Override
public void onResult(ApplicantModel applicantModel) {
Log.d(TAG, "onResult: " + applicantModel);
applicant = applicantModel;
Utils.loadImage(profilePic, applicant.getImage());
Utils.setValid(name, applicant.getName());
Utils.setValid(about, applicant.getAbout());
Utils.setValid(linkedIn, applicant.getLinkedIn());
Utils.setValid(email, applicant.getEmail());
SkillsFragment skillsFragment = new SkillsFragment(applicant.getSkills());
getSupportFragmentManager().beginTransaction().replace(R.id.applicant_skills, skillsFragment).commit();
}
}).getApplicantModel(getIntent().getStringExtra(ProfileActivity.TAG));
if (!getIntent().getStringExtra(ProfileActivity.TAG).equals(LoggedInUser.getInstance().getEmail())) {
Utils.disableButton(editProfile);
Utils.disableButton(logout);
}
editProfile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(ProfileActivity.this, EditProfileActivity.class);
startActivity(intent);
}
});
logout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new YesNoDialogFragment("Confirm Logout?", new YesNoDialogFragment.OnClickListener() {
@Override
public void onResult(boolean bool) {
if (bool == true) {
LoggedInUser.getInstance().setUser(null, null, null);
Intent intent = new Intent(ProfileActivity.this, LoginActivity.class);
startActivity(intent);
}
}
}).show(getSupportFragmentManager(), TAG);
}
});
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation);
if (LoggedInUser.getInstance().getAccountType() == Globals.APPLICANT) {
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(ProfileActivity.this, ScrollJobActivity.class);
startActivity(intent);
}
});
// Set Home selected
bottomNavigationView.setSelectedItemId(R.id.profile);
// Perform item selected listener
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch(item.getItemId()) {
case R.id.history:
startActivity(new Intent(getApplicationContext(), ApplicationHistoryActivity.class));
overridePendingTransition(0, 0);
return true;
case R.id.home:
startActivity(new Intent(getApplicationContext(), ScrollJobActivity.class));
overridePendingTransition(0, 0);
return true;
case R.id.profile:
return true;
}
return false;
}
});
} else {
title.setText(getString(R.string.applicant_profile));
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(ProfileActivity.this, ScrollApplicationActivity.class);
startActivity(intent);
}
});
Utils.disableButton(bottomNavigationView);
}
}
Aggregations