support
This commit is contained in:
12
.idea/deploymentTargetDropDown.xml
generated
12
.idea/deploymentTargetDropDown.xml
generated
@@ -1,18 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<targetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="$USER_HOME$/.android/avd/Pixel_7_Pro_API_33.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2023-12-15T09:11:22.247476Z" />
|
||||
<targetsSelectedWithDialog>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
|
||||
@@ -14,13 +14,18 @@
|
||||
android:name="android.permission.PACKAGE_USAGE_STATS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||
<uses-permission
|
||||
android:name="android.permission.QUERY_ALL_PACKAGES"
|
||||
tools:ignore="QueryAllPackagesPermission" />
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_SECURE_SETTINGS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
|
||||
<!-- for retrieving all the apps having launcher screen-->
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent>
|
||||
</queries>
|
||||
|
||||
<application
|
||||
android:name=".apputils.SimpliTendApp"
|
||||
android:allowBackup="false"
|
||||
|
||||
@@ -68,29 +68,6 @@ public abstract class AppUtil {
|
||||
|
||||
private static final String TAG = "AppUtil";
|
||||
|
||||
public static final String NOTIFICATION_ACTION = "com.simplitend.NOTIFICATION_ACTION";
|
||||
|
||||
// fields
|
||||
public static final String PATIENT_DETAILS = "user_details";
|
||||
public static final String CAREGIVER_DETAILS = "caregiver_details";
|
||||
|
||||
public static final String PATIENT_TOKEN = "user_token";
|
||||
public static final String CAREGIVER_TOKEN = "caregiver_token";
|
||||
|
||||
public static final String CG_APP_SECURITY = "cg_app_security";
|
||||
|
||||
public static final int NOT_ASKED_CG_SECURITY = 2;
|
||||
public static final int CG_NO_SECURITY_NEEDED = 3;
|
||||
public static final int CG_SECURITY_NEEDED = 4;
|
||||
|
||||
public static final String CG_REGISTRATION_COMPLETE = "cg_registration_complete";
|
||||
|
||||
public static final String PATIENT_UID = "patient_uid";
|
||||
|
||||
public static final String IS_PATIENT_LOGGED_IN = "patient_logged_in";
|
||||
|
||||
public static final String WHITE_LISTED_CONTACTS = "white_listed_contacts";
|
||||
|
||||
// util functions
|
||||
|
||||
// closes keyboard
|
||||
@@ -381,6 +358,31 @@ public abstract class AppUtil {
|
||||
|
||||
// ********************* USER DATA UTILS ******************************************
|
||||
|
||||
public static final String NOTIFICATION_ACTION = "com.simplitend.NOTIFICATION_ACTION";
|
||||
|
||||
// fields
|
||||
public static final String PATIENT_DETAILS = "user_details";
|
||||
public static final String CAREGIVER_DETAILS = "caregiver_details";
|
||||
|
||||
public static final String PATIENT_TOKEN = "user_token";
|
||||
public static final String CAREGIVER_TOKEN = "caregiver_token";
|
||||
|
||||
public static final String CG_APP_SECURITY = "cg_app_security";
|
||||
|
||||
public static final int NOT_ASKED_CG_SECURITY = 2;
|
||||
public static final int CG_NO_SECURITY_NEEDED = 3;
|
||||
public static final int CG_SECURITY_NEEDED = 4;
|
||||
|
||||
public static final String CG_REGISTRATION_COMPLETE = "cg_registration_complete";
|
||||
|
||||
public static final String PATIENT_UID = "patient_uid";
|
||||
|
||||
public static final String IS_PATIENT_LOGGED_IN = "patient_logged_in";
|
||||
|
||||
public static final String WHITE_LISTED_CONTACTS = "white_listed_contacts";
|
||||
|
||||
public static final String NO_OF_NOTIFICATIONS = "no_of_notifications_cg";
|
||||
|
||||
public static void savePatientData(String token, int patient_uid, Context context, boolean isLoggedIn) {
|
||||
SharedPreferences sp = context.getSharedPreferences(PATIENT_DETAILS, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
@@ -411,6 +413,8 @@ public abstract class AppUtil {
|
||||
}
|
||||
|
||||
public static void patientSignOut(Context context) {
|
||||
clearAllNotifications(context);
|
||||
|
||||
AppUtil.savePatientData(null, -1, context, false);
|
||||
|
||||
PatientDataCache.setPatientData(null);
|
||||
@@ -508,6 +512,8 @@ public abstract class AppUtil {
|
||||
|
||||
CaregiverDataCache.setCareGiverData(null);
|
||||
|
||||
clearAllNotifications(context);
|
||||
|
||||
// setting up notification prefs default to yes
|
||||
setCgNotificationPref(context, MEDICATIONS_NOTIFICATIONS, true);
|
||||
setCgNotificationPref(context, MEDICATION_REFILL_NOTIFICATIONS, true);
|
||||
@@ -517,6 +523,29 @@ public abstract class AppUtil {
|
||||
setCgNotificationPref(context, GEOFENCE_NOTIFICATIONS, true);
|
||||
}
|
||||
|
||||
public static void incrementNoOfNotification(Context context){
|
||||
SharedPreferences sp = context.getSharedPreferences(CAREGIVER_DETAILS, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
|
||||
editor.putInt(NO_OF_NOTIFICATIONS, sp.getInt(NO_OF_NOTIFICATIONS, 0) + 1);
|
||||
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static void clearAllNotifications(Context context){
|
||||
SharedPreferences sp = context.getSharedPreferences(CAREGIVER_DETAILS, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
|
||||
editor.putInt(NO_OF_NOTIFICATIONS, 0);
|
||||
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static int getNoOfNotificationsCount(Context context){
|
||||
SharedPreferences sp = context.getSharedPreferences(CAREGIVER_DETAILS, Context.MODE_PRIVATE);
|
||||
return sp.getInt(NO_OF_NOTIFICATIONS, 0);
|
||||
}
|
||||
|
||||
// caregiver notification preference
|
||||
public static final String MEDICATIONS_NOTIFICATIONS = "medications_notifications";
|
||||
public static final String MEDICATION_REFILL_NOTIFICATIONS = "MEDICATION_REFILL_notifications";
|
||||
|
||||
@@ -16,8 +16,6 @@ import static com.app.simplitend.apputils.NotificationService.NOTIFICATION_SENIO
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -34,6 +32,7 @@ import com.app.simplitend.patientprofile.medreminder.mvvm.models.ReminderResult;
|
||||
import com.app.simplitend.patientprofile.setuproutine.mvvm.RoutineDetails;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.onesignal.OneSignal;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -50,20 +50,29 @@ public class NotificationService implements INotificationServiceExtension {
|
||||
public void onNotificationReceived(@NonNull INotificationReceivedEvent iNotificationReceivedEvent) {
|
||||
// Log.d("aditya testing", "onNotificationReceived: " + iNotificationReceivedEvent.getNotification());
|
||||
|
||||
// increment notifications count
|
||||
AppUtil.incrementNoOfNotification(iNotificationReceivedEvent.getContext());
|
||||
|
||||
// showing maximum 7 notifications due to the limitations enforced by manufacturers
|
||||
// Thus, removing the oldest notification to show this new notification
|
||||
|
||||
NotificationManager notificationManager = (NotificationManager) iNotificationReceivedEvent.getContext().getSystemService(NOTIFICATION_SERVICE);
|
||||
try {
|
||||
int active_notifications_count = notificationManager.getActiveNotifications().length;
|
||||
if (active_notifications_count >= 7) // already number is incremented when notification is arrived
|
||||
{
|
||||
List<StatusBarNotification> active_notifications = Arrays.asList(notificationManager.getActiveNotifications());
|
||||
active_notifications.sort(Comparator.comparingInt(n -> (int) n.getPostTime()));
|
||||
|
||||
// removing last item
|
||||
StatusBarNotification notification = active_notifications.get(active_notifications.size() - 1);
|
||||
OneSignal.getNotifications().removeNotification(notification.getId());
|
||||
int minPostTime = Integer.MAX_VALUE;
|
||||
StatusBarNotification notification = null;
|
||||
for (StatusBarNotification not: active_notifications){
|
||||
if (not.getPostTime() < minPostTime){
|
||||
notification = not;
|
||||
}
|
||||
}
|
||||
|
||||
if (notification != null) {
|
||||
OneSignal.getNotifications().removeNotification(notification.getId());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// clearing all notifications
|
||||
|
||||
@@ -8,9 +8,7 @@ import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.InputFilter;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.util.Patterns;
|
||||
import android.view.View;
|
||||
@@ -40,10 +38,6 @@ import com.github.dhaval2404.imagepicker.ImagePicker;
|
||||
import com.google.i18n.phonenumbers.NumberParseException;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
import com.google.i18n.phonenumbers.Phonenumber;
|
||||
import com.skydoves.powerspinner.OnSpinnerItemSelectedListener;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
@@ -199,22 +193,8 @@ public class EditProfileInfoActivity extends AppCompatActivity implements
|
||||
binding.street.setText(patientData.address_line1);
|
||||
binding.town.setText(patientData.city);
|
||||
binding.zipCode.setText(patientData.post_code);
|
||||
|
||||
String country = patientData.country;
|
||||
String state = patientData.state;
|
||||
if (!countryList.contains(country)){
|
||||
countryList.add(country);
|
||||
ArrayList<String> states = new ArrayList<>();
|
||||
states.add(state);
|
||||
country_N_states_map.put(country, states);
|
||||
}
|
||||
|
||||
try {
|
||||
binding.countrySpinner.selectItemByIndex(countryList.indexOf(country));
|
||||
binding.stateSpinner.selectItemByIndex(country_N_states_map.get(country).indexOf(state));
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
binding.country.setText(patientData.country);
|
||||
binding.state.setText(patientData.state);
|
||||
}
|
||||
|
||||
|
||||
@@ -222,8 +202,6 @@ public class EditProfileInfoActivity extends AppCompatActivity implements
|
||||
|
||||
private void initViews() {
|
||||
|
||||
loadCountriesAndStates();
|
||||
|
||||
// date picker dialog
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 18);
|
||||
@@ -257,8 +235,6 @@ public class EditProfileInfoActivity extends AppCompatActivity implements
|
||||
|
||||
setFocusManager();
|
||||
|
||||
inputFieldFocusManage();
|
||||
|
||||
imageSelector = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
|
||||
result -> {
|
||||
if (result.getResultCode() == Activity.RESULT_OK && result.getData() != null) {
|
||||
@@ -279,7 +255,7 @@ public class EditProfileInfoActivity extends AppCompatActivity implements
|
||||
binding.email.addTextChangedListener(TextUtils.LEADING_SPACE_WATCHER);
|
||||
binding.street.addTextChangedListener(TextUtils.LEADING_SPACE_WATCHER);
|
||||
|
||||
new EditTextErrorRemover(binding.name, binding.email, binding.contactNumber, binding.street);
|
||||
new EditTextErrorRemover(binding.name, binding.email, binding.contactNumber);
|
||||
|
||||
}
|
||||
|
||||
@@ -328,8 +304,33 @@ public class EditProfileInfoActivity extends AppCompatActivity implements
|
||||
AppUtil.closeKeyboard(this);
|
||||
binding.countryCodes.showOrDismiss();
|
||||
});
|
||||
|
||||
binding.country.setOnClickListener(this::showCannotChangeAddressDialog);
|
||||
binding.street.setOnClickListener(this::showCannotChangeAddressDialog);
|
||||
binding.town.setOnClickListener(this::showCannotChangeAddressDialog);
|
||||
binding.state.setOnClickListener(this::showCannotChangeAddressDialog);
|
||||
binding.zipCode.setOnClickListener(this::showCannotChangeAddressDialog);
|
||||
}
|
||||
|
||||
public void showCannotChangeAddressDialog(View view){
|
||||
if (!isCaregiver){
|
||||
// patient's profile is to be updated
|
||||
if (isFromPatient){
|
||||
// patient app
|
||||
AppUtil.showAlert(this,
|
||||
"Couldn't update address",
|
||||
"You can update the senior's address from the caregiver app's geofence screen.\n\nCaregiver app >> Senior profile >> geofence",
|
||||
getString(R.string.ok), ((dialogInterface, i) -> dialogInterface.dismiss()), null, null);
|
||||
}else{
|
||||
// senior app
|
||||
AppUtil.showAlert(this,
|
||||
"Couldn't update address",
|
||||
"You can update the senior's address from the geofence screen.\n\nSenior profile >> geofence",
|
||||
getString(R.string.ok), ((dialogInterface, i) -> dialogInterface.dismiss()), null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean allCgOkay() {
|
||||
|
||||
binding.name.setError(null);
|
||||
@@ -588,121 +589,6 @@ public class EditProfileInfoActivity extends AppCompatActivity implements
|
||||
return input_date;
|
||||
}
|
||||
|
||||
private void inputFieldFocusManage() {
|
||||
|
||||
binding.town.setOnEditorActionListener((textView, i, keyEvent) -> {
|
||||
AppUtil.closeKeyboard(this);
|
||||
binding.town.clearFocus();
|
||||
binding.stateSpinner.show();
|
||||
return true;
|
||||
});
|
||||
|
||||
binding.zipCode.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
if (editable.toString().length() == 6){
|
||||
binding.zipCode.clearFocus();
|
||||
AppUtil.closeKeyboard(EditProfileInfoActivity.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void loadCountriesAndStates() {
|
||||
|
||||
countryList = new ArrayList<>();
|
||||
|
||||
country_N_states_map = new HashMap<>();
|
||||
|
||||
try {
|
||||
|
||||
String country_n_states_str = readCountryNStates(this);
|
||||
|
||||
JSONArray country_n_states = new JSONObject(country_n_states_str).getJSONArray("countries");
|
||||
|
||||
Log.d(TAG, "loadCountriesAndStates: " + country_n_states);
|
||||
|
||||
for (int i = 0; i < country_n_states.length(); i++) {
|
||||
|
||||
String country = country_n_states.getJSONObject(i).getString("country");
|
||||
countryList.add(country);
|
||||
|
||||
JSONArray states = country_n_states.getJSONObject(i).getJSONArray("states");
|
||||
|
||||
ArrayList<String> stateList = new ArrayList<>();
|
||||
|
||||
for (int j = 0; j < states.length(); j++) {
|
||||
stateList.add(states.getString(j));
|
||||
}
|
||||
|
||||
country_N_states_map.put(country, stateList);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
Log.e(TAG, "load country and states: ", e);
|
||||
}
|
||||
|
||||
Log.d(TAG, "loadCountriesAndStates: " + countryList);
|
||||
|
||||
binding.stateSpinner.setLifecycleOwner(this);
|
||||
binding.countrySpinner.setLifecycleOwner(this);
|
||||
|
||||
binding.countrySpinner.setItems(countryList);
|
||||
|
||||
|
||||
// selecting United States country as by default
|
||||
// if (countryList.contains(UNITED_STATES)){
|
||||
// binding.countrySpinner.selectItemByIndex(countryList.indexOf(UNITED_STATES));
|
||||
//
|
||||
// if (country_N_states_map.containsKey(UNITED_STATES))
|
||||
// {
|
||||
// binding.stateSpinner.setItems(country_N_states_map.get(UNITED_STATES));
|
||||
// }
|
||||
// }
|
||||
|
||||
binding.stateSpinner.setDismissWhenNotifiedItemSelected(true);
|
||||
binding.countrySpinner.setDismissWhenNotifiedItemSelected(true);
|
||||
|
||||
binding.stateSpinner.setIsFocusable(true);
|
||||
binding.countrySpinner.setIsFocusable(true);
|
||||
|
||||
binding.countrySpinner.setOnSpinnerItemSelectedListener((OnSpinnerItemSelectedListener<String>) (i, s, i1, t1) -> {
|
||||
|
||||
binding.countrySpinner.setError(null);
|
||||
|
||||
ArrayList<String> stateList;
|
||||
|
||||
if (country_N_states_map.containsKey(t1) && country_N_states_map.get(t1) != null) {
|
||||
stateList = country_N_states_map.get(t1);
|
||||
} else {
|
||||
stateList = new ArrayList<>();
|
||||
}
|
||||
|
||||
if (stateList != null) {
|
||||
binding.stateSpinner.setItems(stateList);
|
||||
binding.stateSpinner.clearSelectedItem();
|
||||
}
|
||||
});
|
||||
|
||||
binding.stateSpinner.setOnSpinnerItemSelectedListener((OnSpinnerItemSelectedListener<String>) (i, s, i1, t1) -> {
|
||||
binding.stateSpinner.setError(null);
|
||||
binding.zipCode.requestFocus();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public String readCountryNStates(Context context) throws IOException {
|
||||
StringBuilder returnString = new StringBuilder();
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.app.simplitend.chats.mvvm.Author;
|
||||
import com.app.simplitend.chats.mvvm.Message;
|
||||
import com.app.simplitend.chats.mvvm.Receiver;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@@ -109,7 +110,7 @@ public class SocketHelper {
|
||||
try {
|
||||
if (args.length >= 4) {
|
||||
String received_sender_id = (String) args[1];
|
||||
String message_txt = (String) args[2];
|
||||
byte[] message_txt = (byte[]) args[2];
|
||||
// 2023-11-24T12:30:41.652Z
|
||||
String date = (String) args[3]; // mm/dd/yyyy',' HH:mm:ss a
|
||||
|
||||
@@ -129,11 +130,11 @@ public class SocketHelper {
|
||||
|
||||
if (sender_id.equals(received_sender_id)){
|
||||
// Author message
|
||||
message = new Message(new Author(received_sender_id, author_image), message_txt, message_date);
|
||||
message = new Message(new Author(received_sender_id, author_image), new String(message_txt, StandardCharsets.UTF_8), message_date);
|
||||
callback.onMessageSentSuccessfully();
|
||||
}else{
|
||||
// receiver message
|
||||
message = new Message(new Receiver(received_sender_id, receiver_image), message_txt, message_date);
|
||||
message = new Message(new Receiver(received_sender_id, receiver_image), new String(message_txt, StandardCharsets.UTF_8), message_date);
|
||||
}
|
||||
|
||||
callback.onMessageReceived(message);
|
||||
@@ -152,7 +153,7 @@ public class SocketHelper {
|
||||
}
|
||||
|
||||
public void sendMessage(@NonNull String message, @NonNull String sender_id, @NonNull String receiver_id, @NonNull String channel_id, String user_principal_id) {
|
||||
mSocket.emit("chatMessage", sender_id, message, receiver_id, channel_id, user_principal_id);
|
||||
mSocket.emit("chatMessage", sender_id, message.getBytes(StandardCharsets.UTF_8), receiver_id, channel_id, user_principal_id);
|
||||
}
|
||||
|
||||
private static final String LOCATION_EVENT_PREFIX = "patientCurrentLocation";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.app.simplitend.locationupdates;
|
||||
|
||||
import static android.content.Intent.ACTION_BATTERY_CHANGED;
|
||||
import static com.app.simplitend.patientgeofencing.GeoFenceHelper.GEOFENCE_TAG;
|
||||
import static com.app.simplitend.patientgeofencing.PatientLocationUpdatesReceiver.LOCATION_EXTRA_KEY;
|
||||
import static com.app.simplitend.patientgeofencing.PatientLocationUpdatesReceiver.LOCATION_REQUEST_TAG;
|
||||
@@ -7,11 +8,15 @@ import static com.app.simplitend.patientgeofencing.PatientLocationUpdatesReceive
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.location.Location;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -52,6 +57,8 @@ public class LocationService extends Service implements LocationClient.DefaultLo
|
||||
|
||||
private DefaultLocationClient locationClient;
|
||||
|
||||
private BroadcastReceiver batteryChangeReceiver;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
@@ -59,6 +66,26 @@ public class LocationService extends Service implements LocationClient.DefaultLo
|
||||
LocationServices.getFusedLocationProviderClient(this));
|
||||
|
||||
SocketHelper.getInstance().establishConnection(null);
|
||||
|
||||
batteryChangeReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (ACTION_BATTERY_CHANGED.equals(intent.getAction())){
|
||||
int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
|
||||
int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
|
||||
|
||||
float batteryPct = level * 100 / (float)scale;
|
||||
|
||||
Toast.makeText(context, "" + batteryPct, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// try {
|
||||
// registerReceiver(batteryChangeReceiver, new IntentFilter(ACTION_BATTERY_CHANGED));
|
||||
// } catch (Exception e) {
|
||||
// // do nothing
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -117,6 +144,8 @@ public class LocationService extends Service implements LocationClient.DefaultLo
|
||||
stopSelf();
|
||||
removeLocationUpdates();
|
||||
SocketHelper.getInstance().closeConnection();
|
||||
|
||||
// unregisterReceiver(batteryChangeReceiver);
|
||||
}
|
||||
|
||||
public void removeLocationUpdates() {
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.app.simplitend.apputils.RetrofitHelper;
|
||||
import com.app.simplitend.databinding.ActivityNotificationsBinding;
|
||||
import com.app.simplitend.databinding.NotificationViewholderBinding;
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
import com.onesignal.OneSignal;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -82,6 +83,13 @@ public class NotificationsActivity extends AppCompatActivity implements Callback
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
OneSignal.getNotifications().clearAllNotifications();
|
||||
AppUtil.clearAllNotifications(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
final Configuration configuration = new Configuration(newBase.getResources().getConfiguration());
|
||||
|
||||
@@ -52,6 +52,9 @@ import com.app.simplitend.welcome.welcomepatient.fragments.contacts.mvvm.models.
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.onesignal.OneSignal;
|
||||
import com.onesignal.notifications.INotificationLifecycleListener;
|
||||
import com.onesignal.notifications.INotificationWillDisplayEvent;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -60,7 +63,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class PatientDashboardFragment extends Fragment implements ProfileContracts.GetRemindersListCallback, CaregiverMainViewModel.GetNearestResultCallback, ProfileContracts.GetRoutinesCallback, CaregiverMainViewModel.GetNearestActivityCallback {
|
||||
public class PatientDashboardFragment extends Fragment implements ProfileContracts.GetRemindersListCallback, CaregiverMainViewModel.GetNearestResultCallback, ProfileContracts.GetRoutinesCallback, CaregiverMainViewModel.GetNearestActivityCallback, INotificationLifecycleListener {
|
||||
|
||||
// view binding
|
||||
protected PatientDashboardFragmentBinding binding;
|
||||
@@ -186,6 +189,8 @@ public class PatientDashboardFragment extends Fragment implements ProfileContrac
|
||||
}
|
||||
}), false);
|
||||
|
||||
OneSignal.getNotifications().addForegroundLifecycleListener(this);
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@@ -193,6 +198,7 @@ public class PatientDashboardFragment extends Fragment implements ProfileContrac
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
requireContext().unregisterReceiver(notification_receiver);
|
||||
OneSignal.getNotifications().removeForegroundLifecycleListener(this);
|
||||
}
|
||||
|
||||
private void setDetails() {
|
||||
@@ -221,12 +227,23 @@ public class PatientDashboardFragment extends Fragment implements ProfileContrac
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updateTime();
|
||||
updateNotificationsCount();
|
||||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
activity.registerReceiver(timeTickReceiver, new IntentFilter(Intent.ACTION_TIME_TICK));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateNotificationsCount() {
|
||||
int notificationsCount = AppUtil.getNoOfNotificationsCount(requireContext());
|
||||
if (notificationsCount > 0){
|
||||
binding.notificationCount.setText(String.valueOf(notificationsCount));
|
||||
binding.notificationCount.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
binding.notificationCount.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
@@ -621,4 +638,13 @@ public class PatientDashboardFragment extends Fragment implements ProfileContrac
|
||||
|
||||
viewModel.ongoingActivityText = binding.activityMessage.getText().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWillDisplay(@NonNull INotificationWillDisplayEvent iNotificationWillDisplayEvent) {
|
||||
try {
|
||||
requireActivity().runOnUiThread(this::updateNotificationsCount);
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
10
app/src/main/res/drawable/ic_notification_home.xml
Normal file
10
app/src/main/res/drawable/ic_notification_home.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="128dp"
|
||||
android:height="128dp"
|
||||
android:viewportWidth="128"
|
||||
android:viewportHeight="128">
|
||||
<path
|
||||
android:pathData="M59.3,1.5c-3.5,1.5 -5.8,4.5 -6.8,9 -0.5,2.4 -1.8,3.5 -6.5,5.8 -11.3,5.3 -19.9,17.1 -22,29.8 -0.5,3.5 -1,10.7 -1,15.9 0,12.3 -2.1,20.9 -7,29.2 -9.1,15.2 -4,19.6 28.2,24.3 2.4,0.4 3.9,1.2 4.3,2.5 0.3,1 2.3,3.4 4.4,5.3 7.1,6.4 17,5.9 23.5,-1.3 2,-2.2 3.6,-4.4 3.6,-5 0,-0.5 1.7,-1.2 3.8,-1.5 32.2,-4.7 37.3,-9.1 28.2,-24.3 -4.9,-8.3 -7,-16.9 -7,-29.2 0,-5.2 -0.5,-12.4 -1,-15.9 -2.1,-12.7 -10.7,-24.4 -21.9,-29.8 -5.2,-2.5 -6,-3.3 -7.2,-7.3 -1,-3.1 -2.4,-5.2 -4.8,-6.7 -3.9,-2.6 -6.3,-2.8 -10.8,-0.8zM68.4,8.2c0.9,1.2 1.6,2.6 1.6,3 0,0.5 -2.7,0.8 -6,0.8 -3.3,-0 -6,-0.3 -6,-0.8 0,-2.3 3.4,-5.2 6,-5.2 1.8,-0 3.4,0.8 4.4,2.2zM76.7,20.2c7.8,2.9 15.2,10 18.8,18.1 2.6,5.6 2.9,7.7 3.6,22.2 0.8,17.8 2.4,24.8 7.8,33.5 5.3,8.6 3.7,10.7 -10.1,13.6 -15.6,3.3 -50,3.3 -65.6,-0 -13.8,-2.9 -15.4,-5 -10.1,-13.6 5.4,-8.7 7,-15.7 7.8,-33.5 0.7,-14.4 1.1,-16.6 3.5,-22.1 7.6,-16.8 26.8,-24.8 44.3,-18.2zM71.2,119c-2.4,2.3 -4.2,3 -7.2,3 -3,-0 -4.8,-0.7 -7.2,-3l-3.3,-2.9 10.5,-0 10.5,-0 -3.3,2.9z"
|
||||
android:fillColor="#000000"
|
||||
android:strokeColor="#00000000"/>
|
||||
</vector>
|
||||
@@ -320,9 +320,8 @@
|
||||
|
||||
/>
|
||||
|
||||
<com.skydoves.powerspinner.PowerSpinnerView
|
||||
android:id="@+id/country_spinner"
|
||||
android:enabled="false"
|
||||
<TextView
|
||||
android:id="@+id/country"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -362,7 +361,7 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<EditText
|
||||
<TextView
|
||||
android:id="@+id/street"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -375,23 +374,21 @@
|
||||
android:textColor="@color/black"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
|
||||
android:gravity="center_vertical"
|
||||
|
||||
android:paddingVertical="5dp"
|
||||
tools:text="Aditya"
|
||||
android:padding="10dp"
|
||||
|
||||
android:drawableStart="@drawable/ic_home"
|
||||
android:drawablePadding="10dp"
|
||||
|
||||
android:autofillHints="postalAddress"
|
||||
android:inputType="text|textCapSentences"
|
||||
|
||||
android:maxLength="255"
|
||||
/>
|
||||
app:drawableStartCompat="@drawable/ic_home" />
|
||||
|
||||
<EditText
|
||||
<TextView
|
||||
android:id="@+id/town"
|
||||
android:enabled="false"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/edit_text_bg_2"
|
||||
@@ -403,16 +400,15 @@
|
||||
android:textColor="@color/black"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
|
||||
android:gravity="center_vertical"
|
||||
|
||||
android:paddingVertical="5dp"
|
||||
android:padding="10dp"
|
||||
|
||||
android:drawableStart="@drawable/ic_home"
|
||||
android:drawablePadding="10dp"
|
||||
|
||||
android:autofillHints="postalAddress"
|
||||
android:inputType="text|textCapSentences"
|
||||
/>
|
||||
app:drawableStartCompat="@drawable/ic_home" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -436,9 +432,8 @@
|
||||
|
||||
/>
|
||||
|
||||
<com.skydoves.powerspinner.PowerSpinnerView
|
||||
android:id="@+id/state_spinner"
|
||||
android:enabled="false"
|
||||
<TextView
|
||||
android:id="@+id/state"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -449,38 +444,20 @@
|
||||
android:padding="10dp"
|
||||
android:textColor="@color/black"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
|
||||
android:hint="@string/enter_your_state"
|
||||
android:textColorHint="#A1A1A1"
|
||||
|
||||
app:spinner_arrow_drawable="@drawable/ic_down"
|
||||
app:spinner_arrow_show="false"
|
||||
|
||||
app:spinner_popup_max_height="200dp"
|
||||
app:spinner_arrow_animate="true"
|
||||
app:fontFamily="@font/nunito_regular"
|
||||
|
||||
android:layout_marginVertical="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
|
||||
app:spinner_arrow_gravity="end"
|
||||
app:spinner_arrow_padding="8dp"
|
||||
app:spinner_arrow_tint="@color/black"
|
||||
app:spinner_divider_show="true"
|
||||
app:spinner_divider_size="0.4dp"
|
||||
app:spinner_divider_color="@color/black"
|
||||
app:spinner_item_height="46dp"
|
||||
app:spinner_popup_animation="dropdown"
|
||||
app:spinner_popup_background="@drawable/edit_text_bg_2"
|
||||
app:spinner_popup_elevation="14dp"
|
||||
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<EditText
|
||||
<TextView
|
||||
android:id="@+id/zip_code"
|
||||
android:enabled="false"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/edit_text_bg_2"
|
||||
@@ -492,18 +469,17 @@
|
||||
android:textColor="@color/black"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
|
||||
android:gravity="center_vertical"
|
||||
|
||||
android:paddingVertical="5dp"
|
||||
android:padding="10dp"
|
||||
|
||||
android:drawableStart="@drawable/ic_home"
|
||||
android:drawablePadding="10dp"
|
||||
|
||||
android:maxLength="6"
|
||||
|
||||
android:autofillHints="postalAddress"
|
||||
android:inputType="number"
|
||||
/>
|
||||
app:drawableStartCompat="@drawable/ic_home" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_centerVertical="true"
|
||||
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
tools:text="12 : 00 PM"
|
||||
android:textColor="@color/white_bg"
|
||||
@@ -46,13 +48,12 @@
|
||||
|
||||
<de.hdodenhof.circleimageview.CircleImageView
|
||||
android:id="@+id/profile"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
|
||||
android:src="@drawable/senior_img"
|
||||
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
|
||||
app:civ_border_color="@color/white_bg"
|
||||
app:civ_border_width="1dp"
|
||||
@@ -61,17 +62,56 @@
|
||||
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/notifications"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:contentDescription="@string/notification"
|
||||
|
||||
app:srcCompat="@drawable/ic_pat_home_noti"
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
|
||||
android:layout_toStartOf="@id/profile"
|
||||
android:layout_marginHorizontal="15dp" />
|
||||
android:layout_marginHorizontal="15dp"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/notifications"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:contentDescription="@string/notification"
|
||||
app:srcCompat="@drawable/ic_notification_home"
|
||||
app:tint="@color/white"
|
||||
android:layout_alignParentEnd="true"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/notification_count"
|
||||
android:layout_width="@dimen/_15sdp"
|
||||
android:layout_height="@dimen/_15sdp"
|
||||
|
||||
android:background="@drawable/round_corners"
|
||||
android:backgroundTint="@android:color/holo_red_light"
|
||||
|
||||
android:visibility="gone"
|
||||
|
||||
tools:text="99"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="11sp"
|
||||
android:gravity="center"
|
||||
|
||||
android:layout_marginStart="7dp"
|
||||
|
||||
android:maxLength="2"
|
||||
android:singleLine="true"
|
||||
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@
|
||||
<string name="continue_"><u>Continue</u></string>
|
||||
<string name="no_contacts_found">No contacts found.</string>
|
||||
<string name="there_are_no_contacts_added_in_your_contact_directory_please_click_on_the_create_new_contact_button_above">There are no contacts added in your contact directory. Please click on the "Create New Contact" button above.</string>
|
||||
<string name="geofencing">Geofencing</string>
|
||||
<string name="geofencing">Create a geofence</string>
|
||||
<string name="set_specific_geographic_areas_and_receive_instant_alerts_when_your_loved_one_leaves_the_geofenced_zone">Add geofence and receive notification when senior’s smartphone leaves the area of the geofence</string>
|
||||
<string name="destination_0_5m_away">Unknown location</string>
|
||||
<string name="_165_hasley_st_newark_nj_07102">Couldn\'t load address</string>
|
||||
|
||||
@@ -22,11 +22,13 @@ android.nonTransitiveRClass=true
|
||||
android.enableJetifier=true
|
||||
|
||||
# production
|
||||
SIMPLITEND_BASE_URL="https://app.simplitend.com/"
|
||||
SIMPLITEND_SOKCET_HOST="https://app.simplitend.com:3002/"
|
||||
#SIMPLITEND_BASE_URL="https://app.simplitend.com/"
|
||||
#SIMPLITEND_SOKCET_HOST="https://app.simplitend.com:3002/"
|
||||
|
||||
# staging
|
||||
#SIMPLITEND_BASE_URL="https://staging.simplitend.com/"
|
||||
SIMPLITEND_BASE_URL="https://staging.simplitend.com/"
|
||||
SIMPLITEND_SOKCET_HOST="https://staging.simplitend.com:3002/"
|
||||
|
||||
|
||||
# development
|
||||
#SIMPLITEND_BASE_URL="https://simplitend.betadelivery.com/"
|
||||
Reference in New Issue
Block a user