0
0

SendSuccessFragment.java 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package com.emato.ich.fragment;
  2. import android.os.Bundle;
  3. import android.view.LayoutInflater;
  4. import android.view.View;
  5. import android.view.ViewGroup;
  6. import androidx.annotation.NonNull;
  7. import androidx.annotation.Nullable;
  8. import androidx.fragment.app.Fragment;
  9. import androidx.navigation.fragment.NavHostFragment;
  10. import com.emato.ich.MainActivity;
  11. import com.emato.ich.R;
  12. import com.emato.ich.databinding.FragmentSendSuccessBinding;
  13. import com.emato.ich.local.LocalStorage;
  14. import org.jetbrains.annotations.NotNull;
  15. public class SendSuccessFragment extends Fragment {
  16. private FragmentSendSuccessBinding binding;
  17. @Nullable
  18. @org.jetbrains.annotations.Nullable
  19. @Override
  20. public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
  21. binding = FragmentSendSuccessBinding.inflate(inflater, container, false);
  22. return binding.getRoot();
  23. }
  24. public void onViewCreated(@NonNull @NotNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
  25. // 继续投递
  26. binding.continueSendBtn.setOnClickListener(view1 -> {
  27. NavHostFragment.findNavController(SendSuccessFragment.this)
  28. .navigate(R.id.action_sendSuccessFragment_to_chooseCabinetFragment);
  29. });
  30. // 退出账号
  31. binding.exitAccountBtn.setOnClickListener(view1 -> {
  32. // 清空Session
  33. LocalStorage.getInstance().cleanSession();
  34. ((MainActivity) getActivity()).getBundleMap().clear();
  35. NavHostFragment.findNavController(SendSuccessFragment.this)
  36. .navigate(R.id.action_sendSuccessFragment_to_mainFragment);
  37. });
  38. }
  39. @Override
  40. public void onDestroy() {
  41. super.onDestroy();
  42. binding = null;
  43. }
  44. }