,
This commit is contained in:
@@ -52,7 +52,6 @@ public class TopAppDetectionService extends AccessibilityService {
|
||||
|
||||
intent.putExtra(BLOCKED_APP_NAME, appName);
|
||||
startActivity(intent);
|
||||
Toast.makeText(this, appName + " is blocked by SimpliTend", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +89,7 @@ public class TopAppDetectionService extends AccessibilityService {
|
||||
// Set the event types and package names to monitor
|
||||
AccessibilityServiceInfo info = new AccessibilityServiceInfo();
|
||||
info.eventTypes = AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
|
||||
info.packageNames = sharedPref.getArrayList("APP_LIST").toArray(new String[0]);
|
||||
// info.packageNames = sharedPref.getArrayList("APP_LIST").toArray(new String[0]);
|
||||
info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;
|
||||
|
||||
// Set the flags based on the Android version
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
@@ -176,7 +177,7 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
}
|
||||
|
||||
// initializing dashboard fragment
|
||||
replaceFragment(new CgDashBoardFragment(), "dashboard");
|
||||
replaceFragment(CgDashBoardFragment.getInstance(), "dashboard");
|
||||
}
|
||||
|
||||
private void setLayoutDetails() {
|
||||
@@ -198,7 +199,6 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag("dashboard");
|
||||
if (fragment != null) {
|
||||
if (fragment instanceof CgDashBoardFragment) {
|
||||
|
||||
String first_name = "";
|
||||
if (careGiverData != null && careGiverData.first_name != null) {
|
||||
String[] name = careGiverData.first_name.split(" ");
|
||||
@@ -248,7 +248,7 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
@Override
|
||||
public void onBottomNavItemSelected(MenuItem selectedItem) {
|
||||
if (selectedItem == MenuItem.DASHBOARD) {
|
||||
replaceFragment(new CgDashBoardFragment(), "dashboard");
|
||||
replaceFragment(CgDashBoardFragment.getInstance(), "dashboard");
|
||||
|
||||
// setting up toolbar accordingly
|
||||
binding.toolbar.setVisibility(View.VISIBLE);
|
||||
@@ -268,7 +268,7 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
binding.toolbar.setTitle("Welcome " + first_name);
|
||||
|
||||
} else if (selectedItem == MenuItem.MY_PATIENT) {
|
||||
replaceFragment(new MyPatientFragment(), "my_patient");
|
||||
replaceFragment(MyPatientFragment.getInstance(), "my_patient");
|
||||
|
||||
// setting up toolbar accordingly
|
||||
binding.toolbar.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -84,10 +84,20 @@ public class CgDashBoardFragment extends Fragment implements
|
||||
|
||||
private boolean gotoGeofenceActivity;
|
||||
|
||||
public CgDashBoardFragment(){
|
||||
private static CgDashBoardFragment fragment;
|
||||
|
||||
private CgDashBoardFragment(){
|
||||
// required empty
|
||||
}
|
||||
|
||||
public synchronized static CgDashBoardFragment getInstance(){
|
||||
if (fragment == null){
|
||||
fragment = new CgDashBoardFragment();
|
||||
}
|
||||
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
@@ -47,10 +47,20 @@ public class MyPatientFragment extends Fragment implements CgHomeContracts.GetGe
|
||||
|
||||
private ProgressDialog progressDialog;
|
||||
|
||||
public MyPatientFragment() {
|
||||
private static MyPatientFragment myPatientFragment;
|
||||
|
||||
private MyPatientFragment() {
|
||||
// required empty
|
||||
}
|
||||
|
||||
public static synchronized MyPatientFragment getInstance(){
|
||||
if (myPatientFragment == null){
|
||||
myPatientFragment = new MyPatientFragment();
|
||||
}
|
||||
|
||||
return myPatientFragment;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
@@ -51,6 +51,7 @@ public class DefaultLocationClient implements LocationClient{
|
||||
}
|
||||
|
||||
locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, interval)
|
||||
.setMinUpdateDistanceMeters(100) // receive updates only if user has moved over 100 meters
|
||||
.build();
|
||||
|
||||
locationCallback = new LocationCallback() {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ChooseRoleFragment extends Fragment {
|
||||
|
||||
binding.caregiverRole.setOnClickListener(v -> {
|
||||
makeRoleSelection(CAREGIVER);
|
||||
Navigation.findNavController(v).navigate(R.id.action_chooseRoleFragment_to_cgOnBoardFragment);
|
||||
Navigation.findNavController(binding.getRoot()).navigate(R.id.action_chooseRoleFragment_to_cgOnBoardFragment);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -148,7 +148,11 @@ public class AddContactFragment extends Fragment implements WelcomeContracts.Con
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t, String message, int error_code) {
|
||||
Toast.makeText(requireContext(), "Something went wrong", Toast.LENGTH_SHORT).show();
|
||||
try {
|
||||
Toast.makeText(requireContext(), "Something went wrong", Toast.LENGTH_SHORT).show();
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
binding.progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user