use of com.example.nftscmers.fragments.SkillsDialogFragment 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.SkillsDialogFragment 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.SkillsDialogFragment 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);
}
});
}
Aggregations