Search in sources :

Example 1 with ApplicantModel

use of com.example.nftscmers.objectmodels.ApplicantModel in project HackFest2022-Pretzel by chuanshaof.

the class ScrollApplicationActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scroll_application);
    FirebaseFirestore db = FirebaseFirestore.getInstance();
    flingAdapterView = findViewById(R.id.swipe);
    ArrayList<ApplicantModel> item = new ArrayList<>();
    jobTracker = new HashMap<>();
    ApplicantAdapter arrayAdapter = new ApplicantAdapter(ScrollApplicationActivity.this, R.layout.item_in_cardview, item);
    flingAdapterView.setAdapter(arrayAdapter);
    new EmployerDb(ScrollApplicationActivity.this, new EmployerDb.OnEmployerModel() {

        @Override
        public void onResult(EmployerModel employerModel) {
            for (DocumentReference job : employerModel.getJobs()) {
                Toast.makeText(getApplicationContext(), job.toString(), Toast.LENGTH_LONG).show();
                new JobDb(ScrollApplicationActivity.this, new JobDb.OnJobModel() {

                    @Override
                    public void onResult(JobModel jobModel) {
                        if (jobModel.getPending() == null) {
                            return;
                        }
                        for (DocumentReference pending : jobModel.getPending()) {
                            Log.d(TAG, "onResult: " + pending.getId());
                            new ApplicationDb(ScrollApplicationActivity.this, new ApplicationDb.OnApplicationModel() {

                                @Override
                                public void onResult(ApplicationModel applicationModel) {
                                    new ApplicantDb(ScrollApplicationActivity.this, new ApplicantDb.OnApplicantModel() {

                                        @Override
                                        public void onResult(ApplicantModel applicantModel) {
                                            Log.d(TAG, "onResult: " + applicantModel);
                                            item.add(applicantModel);
                                            ArrayList<DocumentReference> tracker = new ArrayList<>();
                                            tracker.add(pending);
                                            tracker.add(job);
                                            jobTracker.put(applicantModel, tracker);
                                            arrayAdapter.notifyDataSetChanged();
                                        }
                                    }).getApplicantModel(applicationModel.getApplicant());
                                }
                            }).getApplicationModel(pending);
                        }
                    }
                }).getJobModel(job);
            }
        }
    }).getEmployerModel(LoggedInUser.getInstance().getEmail());
    flingAdapterView.setFlingListener(new SwipeFlingAdapterView.onFlingListener() {

        @Override
        public void removeFirstObjectInAdapter() {
            item.remove(0);
            arrayAdapter.notifyDataSetChanged();
        }

        @Override
        public void onLeftCardExit(Object o) {
            new JobDb(ScrollApplicationActivity.this, new JobDb.OnJobUploadSuccess() {

                @Override
                public void onResult() {
                    new ApplicationDb(ScrollApplicationActivity.this, new ApplicationDb.OnApplicationUploadSuccess() {

                        @Override
                        public void onResult() {
                            Toast.makeText(ScrollApplicationActivity.this, "Rejected", Toast.LENGTH_SHORT).show();
                            Intent intent = new Intent(ScrollApplicationActivity.this, FeedbackActivity.class);
                            intent.putExtra(FeedbackActivity.TAG, jobTracker.get(o).get(0).getId());
                            startActivityForResult(intent, 0);
                        }
                    }).updateApplicationStatus(ApplicationModel.REJECTED, jobTracker.get(o).get(0));
                }
            }).deletePending(jobTracker.get(o).get(0), jobTracker.get(o).get(1));
        }

        @Override
        public void onRightCardExit(Object o) {
            Log.d(TAG, "onRightCardExit: " + o);
            new JobDb(ScrollApplicationActivity.this, new JobDb.OnJobUploadSuccess() {

                @Override
                public void onResult() {
                    new ApplicationDb(ScrollApplicationActivity.this, new ApplicationDb.OnApplicationUploadSuccess() {

                        @Override
                        public void onResult() {
                            Toast.makeText(ScrollApplicationActivity.this, "Accepted", Toast.LENGTH_SHORT).show();
                            Intent intent = new Intent(ScrollApplicationActivity.this, FeedbackActivity.class);
                            intent.putExtra(FeedbackActivity.TAG, jobTracker.get(o).get(0).getId());
                            startActivityForResult(intent, 0);
                        }
                    }).updateApplicationStatus(ApplicationModel.ACCEPTED, jobTracker.get(o).get(0));
                }
            }).deletePending(jobTracker.get(o).get(0), jobTracker.get(o).get(1));
        }

        @Override
        public void onAdapterAboutToEmpty(int i) {
        }

        @Override
        public void onScroll(float v) {
        }
    });
    flingAdapterView.setOnItemClickListener(new SwipeFlingAdapterView.OnItemClickListener() {

        @Override
        public void onItemClicked(int i, Object o) {
            Intent intent = new Intent(ScrollApplicationActivity.this, com.example.nftscmers.applicantactivities.ProfileActivity.class);
            intent.putExtra(com.example.nftscmers.applicantactivities.ProfileActivity.TAG, item.get(i).getDocumentId());
            startActivity(intent);
        }
    });
    Button like, dislike;
    like = findViewById(R.id.like);
    dislike = findViewById(R.id.dislike);
    like.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            flingAdapterView.getTopCardListener().selectRight();
        }
    });
    dislike.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            flingAdapterView.getTopCardListener().selectLeft();
        }
    });
    // Initialize and assign variable
    BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation);
    // Set Home selected
    bottomNavigationView.setSelectedItemId(R.id.home);
    // Perform item selected listener
    bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {

        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            Intent intent;
            switch(item.getItemId()) {
                case R.id.history:
                    intent = new Intent(ScrollApplicationActivity.this, JobHistoryActivity.class);
                    startActivity(intent);
                    overridePendingTransition(0, 0);
                    return true;
                case R.id.home:
                    return true;
                case R.id.create:
                    startActivity(new Intent(getApplicationContext(), EditJobActivity.class));
                    overridePendingTransition(0, 0);
                    return true;
                case R.id.profile:
                    intent = new Intent(ScrollApplicationActivity.this, ProfileActivity.class);
                    intent.putExtra(ProfileActivity.TAG, LoggedInUser.getInstance().getEmail());
                    startActivity(intent);
                    overridePendingTransition(0, 0);
                    return true;
            }
            return false;
        }
    });
}
Also used : ApplicantAdapter(com.example.nftscmers.adapters.ApplicantAdapter) ArrayList(java.util.ArrayList) ApplicationModel(com.example.nftscmers.objectmodels.ApplicationModel) ApplicantDb(com.example.nftscmers.db.ApplicantDb) Button(android.widget.Button) BottomNavigationView(com.google.android.material.bottomnavigation.BottomNavigationView) ApplicationDb(com.example.nftscmers.db.ApplicationDb) JobModel(com.example.nftscmers.objectmodels.JobModel) DocumentReference(com.google.firebase.firestore.DocumentReference) SwipeFlingAdapterView(com.lorentzos.flingswipe.SwipeFlingAdapterView) FirebaseFirestore(com.google.firebase.firestore.FirebaseFirestore) FeedbackActivity(com.example.nftscmers.commonactivities.FeedbackActivity) ApplicantModel(com.example.nftscmers.objectmodels.ApplicantModel) EmployerModel(com.example.nftscmers.objectmodels.EmployerModel) Intent(android.content.Intent) MenuItem(android.view.MenuItem) View(android.view.View) BottomNavigationView(com.google.android.material.bottomnavigation.BottomNavigationView) SwipeFlingAdapterView(com.lorentzos.flingswipe.SwipeFlingAdapterView) EmployerDb(com.example.nftscmers.db.EmployerDb) JobDb(com.example.nftscmers.db.JobDb)

Example 2 with ApplicantModel

use of com.example.nftscmers.objectmodels.ApplicantModel in project HackFest2022-Pretzel by chuanshaof.

the class ApplicationHistoryActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_application_history);
    applicationListView = findViewById(R.id.application_history_list);
    ArrayAdapter arrayAdapter = new ApplicationHistoryAdapter(ApplicationHistoryActivity.this, R.layout.item_application_history, applicationDetailsList, new ApplicationHistoryAdapter.OnItemClickListener() {

        @Override
        public void onResult(int position) {
            Intent intent = new Intent(ApplicationHistoryActivity.this, FeedbackActivity.class);
            intent.putExtra(FeedbackActivity.TAG, applicationsList.get(position).getId());
            startActivityForResult(intent, 0);
        }
    });
    applicationListView.setAdapter(arrayAdapter);
    new ApplicantDb(ApplicationHistoryActivity.this, new ApplicantDb.OnApplicantModel() {

        @Override
        public void onResult(ApplicantModel applicantModel) {
            applicationsList = applicantModel.getApplications();
            for (DocumentReference application : applicationsList) {
                Log.d(TAG, "onResult: " + application.getId());
                new ApplicationDb(ApplicationHistoryActivity.this, new ApplicationDb.OnApplicationModel() {

                    @Override
                    public void onResult(ApplicationModel applicationModel) {
                        HashMap<String, String> applicationDetails = new HashMap<>();
                        applicationDetails.put(ApplicationModel.STATUS, applicationModel.getStatus());
                        new JobDb(ApplicationHistoryActivity.this, new JobDb.OnJobModel() {

                            @Override
                            public void onResult(JobModel jobModel) {
                                applicationDetails.put(ApplicationModel.COMPANY, jobModel.getEmployerName());
                                applicationDetails.put(ApplicationModel.POSITION, jobModel.getPosition());
                                applicationDetailsList.add(applicationDetails);
                                arrayAdapter.notifyDataSetChanged();
                            }
                        }).getJobModel(applicationModel.getJob());
                    }
                }).getApplicationModel(application);
            }
        }
    }).getApplicantModel(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) {
            Intent intent;
            switch(item.getItemId()) {
                case R.id.history:
                    return true;
                case R.id.home:
                    intent = new Intent(ApplicationHistoryActivity.this, ScrollJobActivity.class);
                    startActivity(intent);
                    overridePendingTransition(0, 0);
                    return true;
                case R.id.profile:
                    intent = new Intent(ApplicationHistoryActivity.this, ProfileActivity.class);
                    intent.putExtra(ProfileActivity.TAG, LoggedInUser.getInstance().getEmail());
                    startActivity(intent);
                    overridePendingTransition(0, 0);
                    return true;
            }
            return false;
        }
    });
}
Also used : HashMap(java.util.HashMap) FeedbackActivity(com.example.nftscmers.commonactivities.FeedbackActivity) ApplicantModel(com.example.nftscmers.objectmodels.ApplicantModel) ApplicationModel(com.example.nftscmers.objectmodels.ApplicationModel) Intent(android.content.Intent) MenuItem(android.view.MenuItem) ApplicantDb(com.example.nftscmers.db.ApplicantDb) BottomNavigationView(com.google.android.material.bottomnavigation.BottomNavigationView) ApplicationDb(com.example.nftscmers.db.ApplicationDb) JobModel(com.example.nftscmers.objectmodels.JobModel) ApplicationHistoryAdapter(com.example.nftscmers.adapters.ApplicationHistoryAdapter) JobDb(com.example.nftscmers.db.JobDb) ArrayAdapter(android.widget.ArrayAdapter) DocumentReference(com.google.firebase.firestore.DocumentReference)

Example 3 with ApplicantModel

use of com.example.nftscmers.objectmodels.ApplicantModel 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);
        }
    });
}
Also used : SkillsDialogFragment(com.example.nftscmers.fragments.SkillsDialogFragment) ApplicantModel(com.example.nftscmers.objectmodels.ApplicantModel) SkillsFragment(com.example.nftscmers.fragments.SkillsFragment) CropDialogFragment(com.example.nftscmers.fragments.CropDialogFragment) Intent(android.content.Intent) ApplicantDb(com.example.nftscmers.db.ApplicantDb) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) Uri(android.net.Uri) DocumentReference(com.google.firebase.firestore.DocumentReference)

Example 4 with ApplicantModel

use of com.example.nftscmers.objectmodels.ApplicantModel 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);
    }
}
Also used : LoginActivity(com.example.nftscmers.commonactivities.LoginActivity) ApplicantModel(com.example.nftscmers.objectmodels.ApplicantModel) SkillsFragment(com.example.nftscmers.fragments.SkillsFragment) Intent(android.content.Intent) MenuItem(android.view.MenuItem) ApplicantDb(com.example.nftscmers.db.ApplicantDb) ImageView(android.widget.ImageView) View(android.view.View) BottomNavigationView(com.google.android.material.bottomnavigation.BottomNavigationView) TextView(android.widget.TextView) ListView(android.widget.ListView) BottomNavigationView(com.google.android.material.bottomnavigation.BottomNavigationView) YesNoDialogFragment(com.example.nftscmers.fragments.YesNoDialogFragment) ScrollApplicationActivity(com.example.nftscmers.employeractivities.ScrollApplicationActivity)

Example 5 with ApplicantModel

use of com.example.nftscmers.objectmodels.ApplicantModel in project HackFest2022-Pretzel by chuanshaof.

the class ScrollJobActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scroll_job);
    FirebaseFirestore db = FirebaseFirestore.getInstance();
    flingAdapterView = findViewById(R.id.swipe);
    ArrayList<JobModel> data = new ArrayList<>();
    jobTracker = new HashMap<>();
    arrayAdapter = new JobAdapter(ScrollJobActivity.this, R.layout.item_in_cardview, data);
    flingAdapterView.setAdapter(arrayAdapter);
    db.collection(JobModel.getCollectionId()).get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {

        @Override
        public void onComplete(@NonNull Task<QuerySnapshot> task) {
            if (task.isSuccessful()) {
                for (QueryDocumentSnapshot documentSnapshot : task.getResult()) {
                    Log.d(TAG, "onComplete: " + documentSnapshot);
                    new JobDb(ScrollJobActivity.this, new JobDb.OnJobModel() {

                        @Override
                        public void onResult(JobModel jobModel) {
                            new ApplicantDb(ScrollJobActivity.this, new ApplicantDb.OnApplicantModel() {

                                @Override
                                public void onResult(ApplicantModel applicantModel) {
                                    boolean applied = false;
                                    for (DocumentReference application : applicantModel.getApplications()) {
                                        applied = applied | jobModel.getPending().contains(application);
                                    }
                                    if (applied == false) {
                                        data.add(jobModel);
                                        arrayAdapter.notifyDataSetChanged();
                                        jobTracker.put(jobModel, documentSnapshot.getReference());
                                    }
                                }
                            }).getApplicantModel(LoggedInUser.getInstance().getEmail());
                        }
                    }).getJobModel(documentSnapshot.getReference());
                }
            }
        }
    });
    flingAdapterView.setFlingListener(new SwipeFlingAdapterView.onFlingListener() {

        @Override
        public void removeFirstObjectInAdapter() {
            data.remove(0);
            arrayAdapter.notifyDataSetChanged();
        }

        @Override
        public void onLeftCardExit(Object o) {
            Toast.makeText(ScrollJobActivity.this, "Skipped Job", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onRightCardExit(Object o) {
            new ApplicationDb(ScrollJobActivity.this, new ApplicationDb.OnApplicationUploadSuccess() {

                @Override
                public void onResult() {
                    Toast.makeText(ScrollJobActivity.this, "Applied", Toast.LENGTH_SHORT).show();
                }
            }).newApplication(LoggedInUser.getInstance().getUserDocRef(), jobTracker.get(o));
        }

        @Override
        public void onAdapterAboutToEmpty(int i) {
        }

        @Override
        public void onScroll(float v) {
        }
    });
    flingAdapterView.setOnItemClickListener(new SwipeFlingAdapterView.OnItemClickListener() {

        @Override
        public void onItemClicked(int i, Object o) {
            Intent intent = new Intent(ScrollJobActivity.this, ViewJobActivity.class);
            intent.putExtra(ViewJobActivity.TAG, data.get(i).getDocumentId());
            startActivityForResult(intent, 0);
        }
    });
    Button like, dislike;
    like = findViewById(R.id.like);
    dislike = findViewById(R.id.dislike);
    like.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            flingAdapterView.getTopCardListener().selectRight();
        }
    });
    dislike.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            flingAdapterView.getTopCardListener().selectLeft();
        }
    });
    // Initialize and assign variable
    BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation);
    // Set Home selected
    bottomNavigationView.setSelectedItemId(R.id.home);
    // Perform item selected listener
    bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {

        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            Intent intent;
            switch(item.getItemId()) {
                case R.id.history:
                    intent = new Intent(ScrollJobActivity.this, ApplicationHistoryActivity.class);
                    startActivity(intent);
                    overridePendingTransition(0, 0);
                    return true;
                case R.id.home:
                    return true;
                case R.id.profile:
                    intent = new Intent(ScrollJobActivity.this, ProfileActivity.class);
                    intent.putExtra(ProfileActivity.TAG, LoggedInUser.getInstance().getEmail());
                    startActivity(intent);
                    overridePendingTransition(0, 0);
                    return true;
            }
            return false;
        }
    });
}
Also used : ArrayList(java.util.ArrayList) ApplicantDb(com.example.nftscmers.db.ApplicantDb) JobAdapter(com.example.nftscmers.adapters.JobAdapter) QuerySnapshot(com.google.firebase.firestore.QuerySnapshot) Button(android.widget.Button) BottomNavigationView(com.google.android.material.bottomnavigation.BottomNavigationView) ViewJobActivity(com.example.nftscmers.commonactivities.ViewJobActivity) ApplicationDb(com.example.nftscmers.db.ApplicationDb) JobModel(com.example.nftscmers.objectmodels.JobModel) DocumentReference(com.google.firebase.firestore.DocumentReference) SwipeFlingAdapterView(com.lorentzos.flingswipe.SwipeFlingAdapterView) FirebaseFirestore(com.google.firebase.firestore.FirebaseFirestore) QueryDocumentSnapshot(com.google.firebase.firestore.QueryDocumentSnapshot) ApplicantModel(com.example.nftscmers.objectmodels.ApplicantModel) Intent(android.content.Intent) MenuItem(android.view.MenuItem) View(android.view.View) BottomNavigationView(com.google.android.material.bottomnavigation.BottomNavigationView) SwipeFlingAdapterView(com.lorentzos.flingswipe.SwipeFlingAdapterView) JobDb(com.example.nftscmers.db.JobDb)

Aggregations

ApplicantModel (com.example.nftscmers.objectmodels.ApplicantModel)7 Intent (android.content.Intent)5 View (android.view.View)5 ApplicantDb (com.example.nftscmers.db.ApplicantDb)5 MenuItem (android.view.MenuItem)4 BottomNavigationView (com.google.android.material.bottomnavigation.BottomNavigationView)4 DocumentReference (com.google.firebase.firestore.DocumentReference)4 ImageView (android.widget.ImageView)3 TextView (android.widget.TextView)3 ApplicationDb (com.example.nftscmers.db.ApplicationDb)3 JobDb (com.example.nftscmers.db.JobDb)3 JobModel (com.example.nftscmers.objectmodels.JobModel)3 Button (android.widget.Button)2 ListView (android.widget.ListView)2 FeedbackActivity (com.example.nftscmers.commonactivities.FeedbackActivity)2 SkillsFragment (com.example.nftscmers.fragments.SkillsFragment)2 ApplicationModel (com.example.nftscmers.objectmodels.ApplicationModel)2 FirebaseFirestore (com.google.firebase.firestore.FirebaseFirestore)2 SwipeFlingAdapterView (com.lorentzos.flingswipe.SwipeFlingAdapterView)2 ArrayList (java.util.ArrayList)2