This commit is contained in:
14Sandee
2023-11-08 19:45:13 +05:30
parent ccf5ad636d
commit 41c9500d50
5 changed files with 187 additions and 14 deletions

View File

@@ -12,7 +12,7 @@
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-11-07T15:25:15.288893Z" />
<timeTargetWasSelectedWithDropDown value="2023-11-08T14:09:30.889381Z" />
<targetsSelectedWithDialog>
<Target>
<type value="QUICK_BOOT_TARGET" />

View File

@@ -12,12 +12,15 @@ import static com.app.simplitend.patientgeofencing.GeoFenceHelper.GEOFENCE_TAG;
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.InsetDrawable;
import android.location.Address;
import android.location.Geocoder;
import android.net.Uri;
@@ -25,6 +28,7 @@ import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
@@ -35,6 +39,7 @@ import androidx.annotation.RawRes;
import com.app.simplitend.R;
import com.app.simplitend.appblocking.TopAppDetectionService;
import com.app.simplitend.articles.ArticleShowerActivity;
import com.app.simplitend.databinding.AlertDialogBinding;
import com.app.simplitend.databinding.BottomSheetAlertBinding;
import com.app.simplitend.databinding.DecisionBottomsheetBinding;
import com.app.simplitend.databinding.DoneBottomsheetBinding;
@@ -173,19 +178,73 @@ public abstract class AppUtil {
@NonNull String positiveText, @NonNull DialogInterface.OnClickListener positiveClickListener,
String negativeText, DialogInterface.OnClickListener negativeClickListener) {
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context);
AlertDialogBinding binding = AlertDialogBinding.inflate(LayoutInflater.from(context));
Dialog dialog = new Dialog(context);
dialog.setContentView(binding.getRoot());
alertBuilder.setTitle(title);
alertBuilder.setMessage(message);
alertBuilder.setPositiveButton(positiveText, positiveClickListener /* Call back*/);
if (negativeText != null && negativeClickListener != null) {
// Negative button
alertBuilder.setNegativeButton(negativeText, negativeClickListener);
try {
ColorDrawable back = new ColorDrawable(Color.TRANSPARENT);
InsetDrawable inset = new InsetDrawable(back, 30);
dialog.getWindow().setBackgroundDrawable(inset);
} catch (Exception e) {
// do nothing
}
alertBuilder.create().show(); // Showing alert dialog
try {
WindowManager.LayoutParams layoutParams = dialog.getWindow().getAttributes();
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
dialog.getWindow().setAttributes(layoutParams);
}catch (Exception e){
// do nothing
}
final DialogInterface DIALOG_INTERFACE = new DialogInterface() {
@Override
public void cancel() {
dialog.dismiss();
}
@Override
public void dismiss() {
dialog.dismiss();
}
};
binding.title.setText(title);
binding.susbTitle.setText(message);
binding.positiveBtn.setText(positiveText);
binding.positiveBtn.setOnClickListener(v -> {
dialog.dismiss();
positiveClickListener.onClick(DIALOG_INTERFACE, 0);
});
if (negativeText != null){
binding.negativeBtn.setVisibility(View.VISIBLE);
binding.negativeBtn.setText(negativeText);
binding.negativeBtn.setOnClickListener(v -> {
dialog.dismiss();
if (negativeClickListener != null){
negativeClickListener.onClick(DIALOG_INTERFACE, 0);
}
});
}
dialog.show();
// AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context);
//
// alertBuilder.setTitle(title);
// alertBuilder.setMessage(message);
//
// alertBuilder.setPositiveButton(positiveText, positiveClickListener /* Call back*/);
//
// if (negativeText != null && negativeClickListener != null) {
// // Negative button
// alertBuilder.setNegativeButton(negativeText, negativeClickListener);
// }
//
// alertBuilder.create().show(); // Showing alert dialog
}
// fetches the country codes from the JSON file in raw directory

View File

@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/round_corners"
android:backgroundTint="@color/white"
android:orientation="vertical"
android:layout_marginHorizontal="25dp"
android:paddingVertical="0dp">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:layout_gravity="center_horizontal"
android:layout_marginHorizontal="15dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:ellipsize="end"
android:fontFamily="@font/nunito_bold"
android:maxLines="2"
android:textAppearance="@style/TextAppearance.Material3.TitleLarge"
android:textColor="@color/black"
tools:text="Dialog title"
/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/color_accent" />
<TextView
android:id="@+id/susb_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:layout_marginVertical="10dp"
android:fontFamily="@font/nunito_regular"
android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
android:textColor="@color/black"
tools:text="This is message that will be shown as subtitle"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:layout_marginBottom="5dp"
android:gravity="center"
android:layout_gravity="end"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="@+id/negative_btn"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/nunito_regular"
android:textAllCaps="false"
android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
app:backgroundTint="@color/white"
android:textColor="@color/black"
app:strokeColor="@color/color_accent"
app:strokeWidth="0.5dp"
tools:text="No"
android:layout_marginEnd="5dp"
app:cornerRadius="5dp"
android:singleLine="true"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/positive_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/nunito_bold"
android:textAllCaps="false"
android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
android:textColor="@color/white"
tools:text="Go to settings"
android:layout_marginStart="5dp"
app:cornerRadius="5dp"
android:singleLine="true"
/>
</LinearLayout>
</LinearLayout>

View File

@@ -477,8 +477,8 @@
<string name="change">Change</string>
<string name="senior_address">Senior address:</string>
<string name="confirm_your_pin">Confirm your pin</string>
<string name="first_name">First name*</string>
<string name="enter_your_first_name">Enter your first name</string>
<string name="first_name">Name*</string>
<string name="enter_your_first_name">Enter your name</string>
<string name="to_update_the_frequently_used_apps_go_to_nprofile_frequently_used_apps"><![CDATA[To update the frequently used apps, go to profile >> Frequently used apps]]></string>
<string name="don_t_show_this">Don\'t show this</string>
<string name="next_medication_schedule">Next medication schedule:</string>

View File

@@ -23,6 +23,7 @@
<style name="BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog">
<item name="bottomSheetStyle">@style/bottomSheetStyleWrapper</item>
<item name="marginHorizontal">50dp</item>
</style>
<style name="bottomSheetStyleWrapper" parent="Widget.Design.BottomSheet.Modal">