,
This commit is contained in:
@@ -42,7 +42,6 @@
|
||||
<activity
|
||||
android:name=".apputils.BottomNotificationActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/BottomNotification" />
|
||||
<activity
|
||||
android:name=".patient_dashboard.NotificationsActivity"
|
||||
|
||||
@@ -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 -> {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -1,140 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="@drawable/top_round_corner"
|
||||
android:padding="15dp"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal"
|
||||
android:scrollbars="none"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/black"
|
||||
android:layout_marginHorizontal="100dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="@dimen/_120sdp"
|
||||
android:layout_height="@dimen/_120sdp"
|
||||
android:contentDescription="@string/illustration"
|
||||
android:layout_marginVertical="25dp"
|
||||
android:scaleType="fitXY"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
tools:text="Raj Shinde has gone out of the geofence"
|
||||
android:fontFamily="@font/nunito_semibold"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_16ssp"
|
||||
android:textAlignment="center"
|
||||
|
||||
android:maxLines="3"
|
||||
|
||||
/>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardBackgroundColor="#F4F9FF"
|
||||
app:strokeColor="#C9E0FB"
|
||||
app:strokeWidth="1dp"
|
||||
app:cardCornerRadius="5dp"
|
||||
android:layout_marginTop="15dp"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:layout_margin="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
tools:text="His current location"
|
||||
android:fontFamily="@font/nunito_medium"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_14ssp"
|
||||
android:textAlignment="center"
|
||||
|
||||
android:maxLines="3"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
tools:text="Continental Divide, Estes Park"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_12ssp"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginTop="5dp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:weightSum="2"
|
||||
android:orientation="horizontal">
|
||||
android:padding="15dp"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
||||
tools:text="Call senior"
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
android:textColor="@color/white"
|
||||
android:textAllCaps="false"
|
||||
|
||||
android:paddingVertical="10dp"
|
||||
app:cornerRadius="5dp"
|
||||
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/black"
|
||||
android:layout_marginHorizontal="100dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="@dimen/_120sdp"
|
||||
android:layout_height="@dimen/_120sdp"
|
||||
android:contentDescription="@string/illustration"
|
||||
android:layout_marginVertical="25dp"
|
||||
android:scaleType="fitXY"
|
||||
/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/close"
|
||||
android:layout_width="0dp"
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
||||
android:text="@string/close_"
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
tools:text="Raj Shinde has gone out of the geofence"
|
||||
android:fontFamily="@font/nunito_semibold"
|
||||
android:textColor="@color/black"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="@dimen/_16ssp"
|
||||
android:textAlignment="center"
|
||||
|
||||
android:paddingVertical="10dp"
|
||||
app:cornerRadius="5dp"
|
||||
|
||||
app:backgroundTint="@color/white"
|
||||
|
||||
android:layout_marginStart="15dp"
|
||||
app:strokeColor="@color/color_accent"
|
||||
app:strokeWidth="1dp"
|
||||
android:maxLines="3"
|
||||
|
||||
/>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardBackgroundColor="#F4F9FF"
|
||||
app:strokeColor="#C9E0FB"
|
||||
app:strokeWidth="1dp"
|
||||
app:cardCornerRadius="5dp"
|
||||
android:layout_marginTop="15dp"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:layout_margin="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
tools:text="His current location"
|
||||
android:fontFamily="@font/nunito_medium"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_14ssp"
|
||||
android:textAlignment="center"
|
||||
|
||||
android:maxLines="3"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
tools:text="Continental Divide, Estes Park"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_12ssp"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginTop="5dp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:weightSum="2"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
||||
tools:text="Call senior"
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
android:textColor="@color/white"
|
||||
android:textAllCaps="false"
|
||||
|
||||
android:paddingVertical="10dp"
|
||||
app:cornerRadius="5dp"
|
||||
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
|
||||
/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/close"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
||||
android:text="@string/close_"
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
android:textColor="@color/black"
|
||||
android:textAllCaps="false"
|
||||
|
||||
android:paddingVertical="10dp"
|
||||
app:cornerRadius="5dp"
|
||||
|
||||
app:backgroundTint="@color/white"
|
||||
|
||||
android:layout_marginStart="15dp"
|
||||
app:strokeColor="@color/color_accent"
|
||||
app:strokeWidth="1dp"
|
||||
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
Reference in New Issue
Block a user