100 lines
3.1 KiB
Java
100 lines
3.1 KiB
Java
package com.ssb.simplitend.patientprofile;
|
|
|
|
import android.animation.Animator;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.fragment.app.Fragment;
|
|
|
|
import com.daimajia.androidanimations.library.Techniques;
|
|
import com.daimajia.androidanimations.library.YoYo;
|
|
import com.ssb.simplitend.R;
|
|
import com.ssb.simplitend.apputils.AppUtil;
|
|
import com.ssb.simplitend.databinding.RegisterationDoneFragmentBinding;
|
|
import com.ssb.simplitend.patient_dashboard.DashBoardActivity;
|
|
|
|
public class RegisterCompleteFragment extends Fragment {
|
|
|
|
public RegisterationDoneFragmentBinding binding;
|
|
|
|
public static final String PROFILE_PROGRESS = "profile_progress";
|
|
public static final String IS_CONNECTED_TO_CG = "is_connect_to_cg";
|
|
|
|
int profile_progress, is_connect_to_caregiver;
|
|
|
|
public RegisterCompleteFragment(){
|
|
// required
|
|
}
|
|
|
|
@Nullable
|
|
@Override
|
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
binding = RegisterationDoneFragmentBinding.inflate(inflater, container, false);
|
|
|
|
if (getArguments() != null){
|
|
profile_progress = getArguments().getInt(PROFILE_PROGRESS, 20);
|
|
is_connect_to_caregiver = getArguments().getInt(IS_CONNECTED_TO_CG, 0);
|
|
}
|
|
|
|
binding.animIv.setAnimation(R.raw.done_anim_2);
|
|
binding.animIv.playAnimation();
|
|
|
|
binding.animIv.addAnimatorListener(new Animator.AnimatorListener() {
|
|
@Override
|
|
public void onAnimationStart(@NonNull Animator animator) {
|
|
|
|
}
|
|
|
|
@Override
|
|
public void onAnimationEnd(@NonNull Animator animator) {
|
|
|
|
String title = "Your profile is " + (profile_progress * 20) + "% complete!";
|
|
|
|
binding.title.setText(title);
|
|
YoYo.with(Techniques.FadeIn)
|
|
.duration(100)
|
|
.playOn(binding.title);
|
|
}
|
|
|
|
@Override
|
|
public void onAnimationCancel(@NonNull Animator animator) {
|
|
|
|
}
|
|
|
|
@Override
|
|
public void onAnimationRepeat(@NonNull Animator animator) {
|
|
|
|
}
|
|
});
|
|
|
|
binding.proceed.setOnClickListener(v -> {
|
|
|
|
if (is_connect_to_caregiver == 1){
|
|
gotoPatientDashBoard();
|
|
}else {
|
|
AppUtil.showAlert(requireContext(),
|
|
"Ask Caregiver to register",
|
|
"Kindly ask CareGiver to complete registeration.",
|
|
"OK",
|
|
((dialogInterface, i) -> {
|
|
|
|
}), null, null);
|
|
}
|
|
});
|
|
|
|
return binding.getRoot();
|
|
}
|
|
|
|
private void gotoPatientDashBoard() {
|
|
Intent intent = new Intent(requireActivity(), DashBoardActivity.class);
|
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
startActivity(intent);
|
|
requireActivity().finish();
|
|
}
|
|
}
|