Files
SimpliTend/app/src/main/java/com/ssb/simplitend/patientprofile/RegisterCompleteFragment.java

123 lines
4.0 KiB
Java
Raw Normal View History

2023-07-31 20:36:26 +05:30
package com.ssb.simplitend.patientprofile;
import android.animation.Animator;
2023-08-10 21:00:59 +05:30
import android.content.Intent;
2023-07-31 20:36:26 +05:30
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;
2023-08-11 21:14:23 +05:30
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.load.resource.gif.GifDrawable;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
2023-07-31 20:36:26 +05:30
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;
2023-08-10 21:00:59 +05:30
import com.ssb.simplitend.patient_dashboard.DashBoardActivity;
2023-07-31 20:36:26 +05:30
public class RegisterCompleteFragment extends Fragment {
public RegisterationDoneFragmentBinding binding;
2023-08-03 21:23:47 +05:30
public static final String PROFILE_PROGRESS = "profile_progress";
2023-08-10 21:00:59 +05:30
public static final String IS_CONNECTED_TO_CG = "is_connect_to_cg";
2023-08-03 21:23:47 +05:30
2023-08-10 21:00:59 +05:30
int profile_progress, is_connect_to_caregiver;
2023-08-03 21:23:47 +05:30
2023-08-11 21:14:23 +05:30
public RegisterCompleteFragment() {
2023-07-31 20:36:26 +05:30
// required
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
binding = RegisterationDoneFragmentBinding.inflate(inflater, container, false);
2023-08-11 21:14:23 +05:30
if (getArguments() != null) {
2023-08-03 21:23:47 +05:30
profile_progress = getArguments().getInt(PROFILE_PROGRESS, 20);
2023-08-10 21:00:59 +05:30
is_connect_to_caregiver = getArguments().getInt(IS_CONNECTED_TO_CG, 0);
2023-08-03 21:23:47 +05:30
}
2023-08-11 21:14:23 +05:30
Glide.with(requireContext())
.asGif()
.load(R.raw.filling_anim)
.listener(new RequestListener<GifDrawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<GifDrawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(GifDrawable resource, Object model, Target<GifDrawable> target, DataSource dataSource, boolean isFirstResource) {
resource.setLoopCount(1);
return false;
}
})
.into(binding.animIv);
2023-07-31 20:36:26 +05:30
binding.proceed.setOnClickListener(v -> {
2023-08-11 21:14:23 +05:30
if (is_connect_to_caregiver == 1) {
2023-08-10 21:00:59 +05:30
gotoPatientDashBoard();
2023-08-11 21:14:23 +05:30
} else {
2023-08-10 21:00:59 +05:30
AppUtil.showAlert(requireContext(),
"Ask Caregiver to register",
"Kindly ask CareGiver to complete registeration.",
"OK",
((dialogInterface, i) -> {
}), null, null);
}
2023-07-31 20:36:26 +05:30
});
return binding.getRoot();
}
2023-08-10 21:00:59 +05:30
private void gotoPatientDashBoard() {
Intent intent = new Intent(requireActivity(), DashBoardActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
requireActivity().finish();
}
2023-07-31 20:36:26 +05:30
}
2023-08-11 21:14:23 +05:30
//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) {
//
// }
// });