.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.ssb.simplitend.patientprofile;
|
||||
|
||||
import static com.ssb.simplitend.patientprofile.RegisterCompleteFragment.IS_CONNECTED_TO_CG;
|
||||
import static com.ssb.simplitend.patientprofile.RegisterCompleteFragment.PROFILE_PROGRESS;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
@@ -32,7 +33,7 @@ public class ProfileProgressFragment extends Fragment implements ProfileContract
|
||||
|
||||
private ProgressDialog progressDialog;
|
||||
|
||||
int profile_progress;
|
||||
int profile_progress, is_connected_to_caregiver;
|
||||
|
||||
public ProfileProgressFragment() {
|
||||
// required empty const.
|
||||
@@ -106,6 +107,7 @@ public class ProfileProgressFragment extends Fragment implements ProfileContract
|
||||
binding.proceed.setOnClickListener(v -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(PROFILE_PROGRESS, profile_progress);
|
||||
bundle.putInt(IS_CONNECTED_TO_CG, is_connected_to_caregiver);
|
||||
|
||||
Navigation.findNavController(v).navigate(R.id.action_profileProgressFragment_to_registerCompleteFragment, bundle);
|
||||
});
|
||||
@@ -116,6 +118,7 @@ public class ProfileProgressFragment extends Fragment implements ProfileContract
|
||||
public void onProfileProgressFetched(@NonNull PatientData patientData) {
|
||||
|
||||
profile_progress = 0;
|
||||
is_connected_to_caregiver = patientData.isCareGiverConnectedWithPatient;
|
||||
|
||||
if (patientData.isCareGiverLink == 1) {
|
||||
// TODO: 25-07-2023 look into this
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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;
|
||||
@@ -15,14 +16,16 @@ 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;
|
||||
int profile_progress, is_connect_to_caregiver;
|
||||
|
||||
public RegisterCompleteFragment(){
|
||||
// required
|
||||
@@ -35,6 +38,7 @@ public class RegisterCompleteFragment extends Fragment {
|
||||
|
||||
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);
|
||||
@@ -69,15 +73,27 @@ public class RegisterCompleteFragment extends Fragment {
|
||||
});
|
||||
|
||||
binding.proceed.setOnClickListener(v -> {
|
||||
AppUtil.showAlert(requireContext(),
|
||||
"Ask Caregiver to register",
|
||||
"Kindly ask CareGiver to complete registeration.",
|
||||
"OK",
|
||||
((dialogInterface, i) -> {
|
||||
|
||||
}), null, null);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ public class AddMedicalInfoFragment extends Fragment implements
|
||||
|
||||
AppUtil.showAnimateDBS(requireContext(),
|
||||
title,
|
||||
R.raw.done_anim_primary, 3000,
|
||||
R.raw.done_anim_primary, 3600,
|
||||
yes -> {
|
||||
Navigation.findNavController(binding.getRoot()).popBackStack(R.id.medicalInfoFragment, false);
|
||||
});
|
||||
|
||||
@@ -700,7 +700,7 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
|
||||
|
||||
AppUtil.showAnimateDBS(requireContext(),
|
||||
getString(R.string.changes_successful), R.raw.done_anim_primary,
|
||||
3000, v3 -> {
|
||||
3600, v3 -> {
|
||||
// here v3 is null
|
||||
Navigation.findNavController(binding.getRoot()).popBackStack(R.id.reminderFragment, false, true);
|
||||
});
|
||||
|
||||
@@ -437,7 +437,7 @@ ReminderAdapter.ReminderCheckClickListener{
|
||||
dialog.dismiss();
|
||||
});
|
||||
}else{
|
||||
Toast.makeText(requireContext(), "Cannot done future routine.", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(requireContext(), "Cannot mark future routine.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
|
||||
@@ -476,7 +476,7 @@ public class AddRoutineFragment extends Fragment implements CompoundButton.OnChe
|
||||
|
||||
AppUtil.showAnimateDBS(requireContext(),
|
||||
getString(R.string.changes_successful), R.raw.done_anim_primary,
|
||||
3000, v3 -> {
|
||||
3600, v3 -> {
|
||||
// here v3 is null
|
||||
Navigation.findNavController(binding.getRoot()).popBackStack(R.id.routineFragment, false, true);
|
||||
});
|
||||
|
||||
@@ -407,7 +407,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
dialog.dismiss();
|
||||
});
|
||||
}else{
|
||||
Toast.makeText(requireContext(), "Cannot done future routine.", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(requireContext(), "Cannot mark future routine.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ssb.simplitend.welcome.welcomecg.fragments;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
@@ -18,6 +19,7 @@ import androidx.navigation.Navigation;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.caregiverdashboard.CaregiverDashActivity;
|
||||
import com.ssb.simplitend.databinding.ConnectCaregiverFragmentBinding;
|
||||
import com.ssb.simplitend.welcome.welcomecg.WelcomeContracts;
|
||||
import com.ssb.simplitend.welcome.welcomecg.mvvm.CgWelcomeViewModel;
|
||||
@@ -143,6 +145,13 @@ public class CgConnectFragment extends Fragment implements WelcomeContracts.Conn
|
||||
progressDialog.dismiss();
|
||||
|
||||
Toast.makeText(requireContext(), "Caregiver connected.", Toast.LENGTH_SHORT).show();
|
||||
|
||||
// go to cg dash board
|
||||
Intent intent = new Intent(requireActivity(), CaregiverDashActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
requireActivity().finish();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -205,6 +205,7 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
|
||||
// todo should be removed afterwards
|
||||
binding.dob.setOnLongClickListener(v -> {
|
||||
binding.dob.setText("12-12-2001");
|
||||
binding.dob.setHint("12-12-2001");
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.NavOptions;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
@@ -111,6 +112,24 @@ public class CgSignInFragment extends Fragment implements WelcomeContracts.CgLog
|
||||
return allOkay;
|
||||
}
|
||||
|
||||
private void gotoCgAuthActivity() {
|
||||
Intent intent = new Intent(requireActivity(), CgAuthActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
|
||||
requireActivity().finish();
|
||||
}
|
||||
|
||||
private void gotoCgConnect() {
|
||||
NavOptions navOptions = new NavOptions.Builder()
|
||||
.setPopUpTo(R.id.welcomeFragment, true)
|
||||
.build();
|
||||
|
||||
// goto cg connect screen
|
||||
Navigation.findNavController(binding.getRoot())
|
||||
.navigate(R.id.action_cgSignInFragment_to_cgConnectFragment, null, navOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoginSuccess(CareGiverData careGiverData, String token) {
|
||||
progressDialog.dismiss();
|
||||
@@ -118,11 +137,12 @@ public class CgSignInFragment extends Fragment implements WelcomeContracts.CgLog
|
||||
|
||||
AppUtil.saveCgData(token, requireContext());
|
||||
|
||||
Intent intent = new Intent(requireActivity(), CgAuthActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
if (careGiverData.isPatientLinkedAndConnected == 1){
|
||||
gotoCgAuthActivity();
|
||||
}else{
|
||||
gotoCgConnect();
|
||||
}
|
||||
|
||||
requireActivity().finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,5 +32,6 @@ public class CareGiverData{
|
||||
public int is_patient;
|
||||
public int is_caregiver;
|
||||
public int is_caregiver_account_updated;
|
||||
public int isPatientLinkedAndConnected;
|
||||
public String is_admin;
|
||||
}
|
||||
|
||||
@@ -161,16 +161,23 @@ public class SignInFragment extends Fragment implements WelcomeContracts.Registe
|
||||
Toast.makeText(requireContext(), "Log in successful.", Toast.LENGTH_SHORT).show();
|
||||
|
||||
if (patientResult.patientData != null){
|
||||
if (patientResult.patientData.isCareGiverLink == 1){
|
||||
if (patientResult.patientData.isCareGiverConnectedWithPatient == 1){
|
||||
// connected to caregiver
|
||||
// thus, sending it to dashboard
|
||||
Intent intent = new Intent(requireActivity(), DashBoardActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
requireActivity().finish();
|
||||
} else if (patientResult.patientData.isCareGiverLink == 1){
|
||||
gotoProfileProgress();
|
||||
return;
|
||||
}else{
|
||||
// no patient data or no caregiver contact yet added thus sending to contact list
|
||||
gotoContactList();
|
||||
}
|
||||
}else{
|
||||
// no patient data or no caregiver contact yet added thus sending to contact list
|
||||
gotoContactList();
|
||||
}
|
||||
|
||||
// no patient data or no caregiver contact yet added thus sending to contactlist
|
||||
gotoContactList();
|
||||
|
||||
// TODO: 09-08-2023 don't do anything further more.
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,19 +55,5 @@ public class SignInSignUpFragment extends Fragment {
|
||||
onBoardPagerAdapter = new OnBoardPagerAdapter(getChildFragmentManager(), getLifecycle());
|
||||
binding.viewPager.setAdapter(onBoardPagerAdapter);
|
||||
binding.circleIndicator.setViewPager(binding.viewPager);
|
||||
|
||||
// margin top to indicator depending upon screen density so that... image in onboard looks non-stretched vertically
|
||||
float dynamic_size = getResources().getDisplayMetrics().ydpi;
|
||||
|
||||
if (dynamic_size >= 420){
|
||||
|
||||
dynamic_size = dynamic_size * 0.4f;
|
||||
|
||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) binding.circleIndicator.getLayoutParams();
|
||||
layoutParams.setMargins(0, (int) dynamic_size, 0, 0);
|
||||
|
||||
binding.circleIndicator.setLayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
Toast.makeText(requireActivity(), "Contact updated successFully.", Toast.LENGTH_SHORT).show();
|
||||
Navigation.findNavController(binding.getRoot()).popBackStack(R.id.addContactFragment, false);
|
||||
|
||||
}, 3000);
|
||||
}, 3600);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.ssb.simplitend.welcome.welcomepatient.fragments.onboardfragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -29,17 +29,29 @@ public class OnBoardOne extends Fragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = OnboardOneFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
float dynamic_size = getResources().getDisplayMetrics().ydpi * 0.3f;
|
||||
// Calculate screen dimensions in pixels
|
||||
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
|
||||
int screenWidth = displayMetrics.widthPixels;
|
||||
int screenHeight = displayMetrics.heightPixels;
|
||||
|
||||
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) binding.image.getLayoutParams();
|
||||
layoutParams.setMargins(10, 0, 10, (int) dynamic_size);
|
||||
// Calculate aspect ratio
|
||||
float aspectRatio = (float) screenHeight / (float) screenWidth;
|
||||
|
||||
binding.image.setLayoutParams(layoutParams);
|
||||
// Toast.makeText(requireContext(), "" + aspectRatio, Toast.LENGTH_SHORT).show();
|
||||
|
||||
LinearLayout.LayoutParams layoutParams3 = (LinearLayout.LayoutParams) binding.title.getLayoutParams();
|
||||
layoutParams.setMargins(10, 0,10, (int) dynamic_size);
|
||||
|
||||
binding.title.setLayoutParams(layoutParams3);
|
||||
if (aspectRatio > 2.1){
|
||||
// screen is taller
|
||||
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.title_tall));
|
||||
binding.subTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.sub_title_tall));
|
||||
}else if (aspectRatio > 2){
|
||||
// screen is normal size
|
||||
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.title_tall_medium));
|
||||
binding.subTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.sub_title_tall_medium));
|
||||
}else {
|
||||
// screen is smaller
|
||||
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.title_small));
|
||||
binding.subTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.sub_title_small));
|
||||
}
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.ssb.simplitend.welcome.welcomepatient.fragments.onboardfragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.ssb.simplitend.databinding.OnboardOneFragmentBinding;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.OnboardThreeFragmentBinding;
|
||||
|
||||
public class OnBoardThree extends Fragment {
|
||||
@@ -28,17 +28,30 @@ public class OnBoardThree extends Fragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = OnboardThreeFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
float dynamic_size = getResources().getDisplayMetrics().ydpi * 0.3f;
|
||||
// Calculate screen dimensions in pixels
|
||||
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
|
||||
int screenWidth = displayMetrics.widthPixels;
|
||||
int screenHeight = displayMetrics.heightPixels;
|
||||
|
||||
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) binding.image.getLayoutParams();
|
||||
layoutParams.setMargins(10, 0, 10, (int) dynamic_size);
|
||||
// Calculate aspect ratio
|
||||
float aspectRatio = (float) screenHeight / (float) screenWidth;
|
||||
|
||||
binding.image.setLayoutParams(layoutParams);
|
||||
// Toast.makeText(requireContext(), "" + aspectRatio, Toast.LENGTH_SHORT).show();
|
||||
|
||||
LinearLayout.LayoutParams layoutParams3 = (LinearLayout.LayoutParams) binding.title.getLayoutParams();
|
||||
layoutParams.setMargins(10, 0,10, (int) dynamic_size);
|
||||
if (aspectRatio > 2.1){
|
||||
// screen is taller
|
||||
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.title_tall));
|
||||
binding.subTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.sub_title_tall));
|
||||
}else if (aspectRatio > 2){
|
||||
// screen is normal size
|
||||
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.title_tall_medium));
|
||||
binding.subTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.sub_title_tall_medium));
|
||||
}else {
|
||||
// screen is smaller
|
||||
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.title_small_2));
|
||||
binding.subTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.sub_title_small));
|
||||
}
|
||||
|
||||
binding.title.setLayoutParams(layoutParams3);
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.ssb.simplitend.welcome.welcomepatient.fragments.onboardfragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.ssb.simplitend.databinding.OnboardOneFragmentBinding;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.OnboardTwoFragmentBinding;
|
||||
|
||||
public class OnBoardTwo extends Fragment {
|
||||
@@ -28,17 +28,30 @@ public class OnBoardTwo extends Fragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = OnboardTwoFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
float dynamic_size = getResources().getDisplayMetrics().ydpi * 0.3f;
|
||||
// Calculate screen dimensions in pixels
|
||||
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
|
||||
int screenWidth = displayMetrics.widthPixels;
|
||||
int screenHeight = displayMetrics.heightPixels;
|
||||
|
||||
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) binding.image.getLayoutParams();
|
||||
layoutParams.setMargins(10, 0, 10, (int) dynamic_size);
|
||||
// Calculate aspect ratio
|
||||
float aspectRatio = (float) screenHeight / (float) screenWidth;
|
||||
|
||||
binding.image.setLayoutParams(layoutParams);
|
||||
// Toast.makeText(requireContext(), "" + aspectRatio, Toast.LENGTH_SHORT).show();
|
||||
|
||||
LinearLayout.LayoutParams layoutParams3 = (LinearLayout.LayoutParams) binding.title.getLayoutParams();
|
||||
layoutParams.setMargins(10, 0,10, (int) dynamic_size);
|
||||
|
||||
binding.title.setLayoutParams(layoutParams3);
|
||||
if (aspectRatio > 2.1){
|
||||
// screen is taller
|
||||
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.title_tall));
|
||||
binding.subTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.sub_title_tall));
|
||||
}else if (aspectRatio > 2){
|
||||
// screen is normal size
|
||||
binding.title.setText(getString(R.string.have_a_worry_nfree_stroll_2));
|
||||
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.title_tall_medium));
|
||||
binding.subTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.sub_title_tall_medium));
|
||||
}else {
|
||||
// screen is smaller
|
||||
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.title_small));
|
||||
binding.subTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.sub_title_small));
|
||||
}
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.ssb.simplitend.welcome.welcomepatient.fragments.register;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -38,16 +36,24 @@ public class SplashFragment extends Fragment implements ProfileContracts.Profile
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = SplashFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
binding.retry.setOnClickListener(v -> {
|
||||
checkIfAhyUser();
|
||||
});
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
checkIfAhyUser();
|
||||
}
|
||||
|
||||
private void checkIfAhyUser() {
|
||||
binding.retry.setVisibility(View.GONE);
|
||||
binding.loadAnim.setVisibility(View.VISIBLE);
|
||||
|
||||
String token = AppUtil.getUserToken(requireContext());
|
||||
if (token != null && !token.isEmpty()){
|
||||
// user is already logged in as PATIENT
|
||||
@@ -103,7 +109,13 @@ public class SplashFragment extends Fragment implements ProfileContracts.Profile
|
||||
|
||||
@Override
|
||||
public void onProfileProgressFetched(PatientData patientData) {
|
||||
if (patientData.isCareGiverLink == 1){
|
||||
binding.retry.setVisibility(View.GONE);
|
||||
binding.loadAnim.setVisibility(View.GONE);
|
||||
|
||||
if (patientData.isCareGiverConnectedWithPatient == 1){
|
||||
// go to dashboard
|
||||
gotoDashBoard();
|
||||
}else if (patientData.isCareGiverLink == 1){
|
||||
// user has already added caregiver as a contact
|
||||
// thus, sending it to dashboard
|
||||
gotoProfileProgress();
|
||||
@@ -119,8 +131,19 @@ public class SplashFragment extends Fragment implements ProfileContracts.Profile
|
||||
}
|
||||
}
|
||||
|
||||
private void gotoDashBoard() {
|
||||
Intent intent = new Intent(requireActivity(), DashBoardActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
requireActivity().finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProfileProgressFetchFailed(Throwable t, String message) {
|
||||
|
||||
Toast.makeText(requireContext(), "Couldn't connect.", Toast.LENGTH_SHORT).show();
|
||||
|
||||
binding.retry.setVisibility(View.VISIBLE);
|
||||
binding.loadAnim.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,8 @@ public class PatientData {
|
||||
public int isCareGiverLink
|
||||
, isPatientReminderData
|
||||
, isPatientRoutineData
|
||||
, isPatientMedicalData;
|
||||
, isPatientMedicalData
|
||||
, isCareGiverConnectedWithPatient;
|
||||
|
||||
public PatientData() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user