This commit is contained in:
14Sandee
2023-11-30 21:07:10 +05:30
parent 3c3d108098
commit d382c7ae2e
8 changed files with 181 additions and 120 deletions

View File

@@ -16,6 +16,8 @@ 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;
@@ -49,6 +51,11 @@ public class BottomNotificationActivity extends AppCompatActivity {
return;
}
// to solve Android Oreo problem where we cannot set activity's orientation to portrait in the manifest
// if (android.os.Build.VERSION.SDK_INT != Build.VERSION_CODES.O) {
// setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
// }
View view = findViewById(R.id.bsa_tint);
if (view != null){
view.setOnClickListener(v -> {

View File

@@ -1,15 +1,18 @@
package com.app.simplitend.apputils;
import static android.content.Context.NOTIFICATION_SERVICE;
import static com.app.simplitend.apputils.AppUtil.NOTIFICATION_ACTION;
import static com.app.simplitend.patientgeofencing.GeoFenceHelper.GEOFENCE_ID;
import static com.app.simplitend.patientgeofencing.GeoFenceHelper.GEOFENCE_TAG;
import android.Manifest;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.service.notification.StatusBarNotification;
import android.util.Log;
import androidx.annotation.NonNull;
@@ -29,6 +32,12 @@ import com.onesignal.notifications.INotificationServiceExtension;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class NotificationService implements INotificationServiceExtension {
public static final String CONTENT_TYPE_KEY = "content_type_key";
@@ -40,6 +49,26 @@ public class NotificationService implements INotificationServiceExtension {
@Override
public void onNotificationReceived(@NonNull INotificationReceivedEvent iNotificationReceivedEvent) {
// 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 == 8) // 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);
notificationManager.cancel(notification.getId());
}
} catch (Exception e) {
// clearing all notifications
notificationManager.cancelAll();
}
JSONObject extras = iNotificationReceivedEvent.getNotification().getAdditionalData();
String content_type = null, senior_current_address = null;
int id = -1;

View File

@@ -456,6 +456,14 @@ public class CgGeoFencingActivity extends AppCompatActivity implements OnMapRead
return;
}
if (geofence_bs_binding.message.getText().toString().trim().isEmpty()){
// message is important
geofence_bs_binding.message.setError("Required");
return;
}else {
geofence_bs_binding.message.setError(null);
}
// convert to meters
if (geofence_bs_binding.unitSpinner.getSelectedIndex() == 1) {
// it is miles

View File

@@ -3,7 +3,6 @@ package com.app.simplitend.welcome.activities;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Bundle;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;

View File

@@ -340,7 +340,7 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
new Handler().postDelayed(() -> {
if (bsd != null) bsd.dismiss();
Toast.makeText(requireActivity(), "Contact updated successFully.", Toast.LENGTH_SHORT).show();
Toast.makeText(requireActivity(), "Contact updated successfully.", Toast.LENGTH_SHORT).show();
try {
Navigation.findNavController(binding.getRoot()).popBackStack(R.id.addContactFragment, false);
} catch (Exception e) {