Search in sources :

Example 1 with JobAdderFragment

use of com.example.flashgig.JobAdderFragment in project FIREBASE_TEST_JAVA by essantos8.

the class MainActivity method onBackPressed.

@Override
public void onBackPressed() {
    Fragment curFragment = getSupportFragmentManager().findFragmentById(R.id.frameLayout);
    if (curFragment instanceof DetailFragment || curFragment instanceof JobAdderFragment || curFragment instanceof ProfileEditFragment) {
        super.onBackPressed();
        return;
    }
    SearchView searchBar = findViewById(R.id.searchviewHome);
    if (searchBar != null) {
        if (!searchBar.isIconified()) {
            searchBar.setIconified(true);
            searchBar.onActionViewCollapsed();
            return;
        }
    }
    this.moveTaskToBack(true);
}
Also used : ProfileEditFragment(com.example.flashgig.fragments.ProfileEditFragment) JobAdderFragment(com.example.flashgig.JobAdderFragment) SearchView(android.widget.SearchView) DetailFragment(com.example.flashgig.fragments.DetailFragment) DetailFragment(com.example.flashgig.fragments.DetailFragment) MessagesFragment(com.example.flashgig.fragments.MessagesFragment) ProfileFragment(com.example.flashgig.fragments.ProfileFragment) HomeFragment(com.example.flashgig.fragments.HomeFragment) MyJobsFragment(com.example.flashgig.fragments.MyJobsFragment) Fragment(androidx.fragment.app.Fragment) ProfileEditFragment(com.example.flashgig.fragments.ProfileEditFragment) JobAdderFragment(com.example.flashgig.JobAdderFragment)

Example 2 with JobAdderFragment

use of com.example.flashgig.JobAdderFragment in project FIREBASE_TEST_JAVA by essantos8.

the class ProfileFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    binding = FragmentProfileBinding.inflate(inflater, container, false);
    progressBar = binding.progressBar;
    textName = binding.textName;
    textEmail = binding.textEmail;
    textPhone = binding.textPhone;
    profilePicture = binding.ProfilePic;
    retrieveInfo(false);
    binding.btnEditProfile.setOnClickListener(view -> {
        // startActivity(new Intent(getContext(), ProfileEditActivity.class));
        replaceFragment(new ProfileEditFragment(), "profileEdit");
    });
    binding.btnProfileAddJob.setOnClickListener(view -> {
        // startActivity(new Intent(getContext(), JobAdderActivity.class));
        replaceFragment(new JobAdderFragment(), "jobAdder");
    });
    binding.btnReviews.setOnClickListener(view -> {
        startActivity(new Intent(getContext(), ReviewsActivity.class));
    });
    binding.btnProfileUpdate.setOnClickListener(view -> {
        retrieveInfo(true);
    });
    binding.btnLogout.setOnClickListener(view -> {
        FirebaseAuth.getInstance().signOut();
        db.clearPersistence();
        Toast.makeText(this.getContext(), "User logged out!", Toast.LENGTH_SHORT).show();
        getActivity().finish();
        startActivity(new Intent(getContext(), SplashActivity.class));
    });
    // Inflate the layout for this fragment
    return binding.getRoot();
}
Also used : JobAdderFragment(com.example.flashgig.JobAdderFragment) SplashActivity(com.example.flashgig.activities.SplashActivity) ReviewsActivity(com.example.flashgig.activities.ReviewsActivity) Intent(android.content.Intent)

Aggregations

JobAdderFragment (com.example.flashgig.JobAdderFragment)2 Intent (android.content.Intent)1 SearchView (android.widget.SearchView)1 Fragment (androidx.fragment.app.Fragment)1 ReviewsActivity (com.example.flashgig.activities.ReviewsActivity)1 SplashActivity (com.example.flashgig.activities.SplashActivity)1 DetailFragment (com.example.flashgig.fragments.DetailFragment)1 HomeFragment (com.example.flashgig.fragments.HomeFragment)1 MessagesFragment (com.example.flashgig.fragments.MessagesFragment)1 MyJobsFragment (com.example.flashgig.fragments.MyJobsFragment)1 ProfileEditFragment (com.example.flashgig.fragments.ProfileEditFragment)1 ProfileFragment (com.example.flashgig.fragments.ProfileFragment)1