use of com.example.nftscmers.adapters.JobHistoryAdapter in project HackFest2022-Pretzel by chuanshaof.
the class JobHistoryActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_job_history);
jobListView = findViewById(R.id.job_history_list);
ArrayAdapter arrayAdapter = new JobHistoryAdapter(JobHistoryActivity.this, R.layout.item_job_history, jobDetailsList, new JobHistoryAdapter.OnItemClickListener() {
@Override
public void onResult(int position) {
Intent intent = new Intent(JobHistoryActivity.this, ViewJobActivity.class);
intent.putExtra(ViewJobActivity.TAG, jobsList.get(position).getId());
startActivityForResult(intent, 0);
}
});
jobListView.setAdapter(arrayAdapter);
new EmployerDb(JobHistoryActivity.this, new EmployerDb.OnEmployerModel() {
@Override
public void onResult(EmployerModel employerModel) {
jobsList = employerModel.getJobs();
for (DocumentReference job : jobsList) {
Log.d(TAG, "onResult: " + job.getId());
new JobDb(JobHistoryActivity.this, new JobDb.OnJobModel() {
@Override
public void onResult(JobModel jobModel) {
HashMap<String, String> jobDetails = new HashMap<>();
jobDetails.put(JobModel.POSITION, jobModel.getPosition());
jobDetails.put(JobModel.DEADLINE, Globals.DATEFORMAT.format(jobModel.getDeadline()));
jobDetailsList.add(jobDetails);
arrayAdapter.notifyDataSetChanged();
}
}).getJobModel(job);
}
}
}).getEmployerModel(LoggedInUser.getInstance().getEmail());
// Initialize and assign variable
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation);
// Set Home selected
bottomNavigationView.setSelectedItemId(R.id.history);
// Perform item selected listener
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch(item.getItemId()) {
case R.id.history:
return true;
case R.id.home:
startActivity(new Intent(getApplicationContext(), ScrollApplicationActivity.class));
overridePendingTransition(0, 0);
return true;
case R.id.create:
startActivity(new Intent(getApplicationContext(), EditJobActivity.class));
overridePendingTransition(0, 0);
return true;
case R.id.profile:
Intent intent = new Intent(JobHistoryActivity.this, ProfileActivity.class);
intent.putExtra(ProfileActivity.TAG, LoggedInUser.getInstance().getEmail());
startActivity(intent);
overridePendingTransition(0, 0);
return true;
}
return false;
}
});
}
Aggregations