diff --git a/.idea/.name b/.idea/.name
index 348a07e..0c371fd 100644
--- a/.idea/.name
+++ b/.idea/.name
@@ -1 +1 @@
-Spin Tube App
\ No newline at end of file
+arrest_tb
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
index 796b96d..42afabf 100644
--- a/app/.gitignore
+++ b/app/.gitignore
@@ -1 +1 @@
-/build
+/build
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index e23792d..ce94010 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,13 +1,11 @@
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
+apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
+
defaultConfig {
applicationId "in.sminnovations.arrest_tb"
@@ -15,6 +13,7 @@ android {
targetSdkVersion 29
versionCode 1
versionName "1.0"
+ multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@@ -25,6 +24,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
aaptOptions {
noCompress "tflite"
noCompress "lite"
@@ -54,6 +57,7 @@ dependencies {
implementation 'com.google.firebase:firebase-config:20.0.0'
implementation 'com.google.firebase:firebase-auth:20.0.1'
+
implementation 'com.google.firebase:firebase-database:19.5.1'
implementation 'com.google.firebase:firebase-storage:19.2.0'
testImplementation 'junit:junit:4.12'
@@ -61,5 +65,16 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
+ implementation 'com.google.firebase:firebase-crashlytics:17.1.1'
+ implementation 'com.google.firebase:firebase-perf:19.0.11'
+ implementation 'com.android.support:multidex:1.0.3'
+ implementation 'com.karumi:dexter:6.2.2'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.2'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-intents:3.3.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0'
+
+
+
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index e04ff48..9771d44 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -4,21 +4,20 @@
-
-
+
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/in/sminnovations/arrest_tb/AddImage.java b/app/src/main/java/in/sminnovations/arrest_tb/AddImage.java
index 406ca2c..7f01ed5 100644
--- a/app/src/main/java/in/sminnovations/arrest_tb/AddImage.java
+++ b/app/src/main/java/in/sminnovations/arrest_tb/AddImage.java
@@ -40,6 +40,7 @@ import com.theartofdev.edmodo.cropper.CropImageView;
import java.io.File;
import java.io.IOException;
+import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
@@ -332,12 +333,16 @@ public class AddImage extends NavigationTop {
Calendar calendar = Calendar.getInstance();
SimpleDateFormat currentDate = new SimpleDateFormat("MMM dd, yyyy");
- saveCurrentDate = currentDate.format(calendar.getTime());
- SimpleDateFormat currentTime = new SimpleDateFormat("HH:mm:ss a");
+ saveCurrentDate = currentDate.format(calendar.getTime());
+ saveCurrentDate = saveCurrentDate .replaceAll("[^A-Za-z0-9 ]","");
+
+
+ SimpleDateFormat currentTime = new SimpleDateFormat("h:mm a");
saveCurrentTime = currentTime.format(calendar.getTime());
TestRandomKey = saveCurrentDate + saveCurrentTime+number;
+ TestRandomKey = TestRandomKey .replaceAll("[^A-Za-z0-9 ]","");
final StorageReference filePath1 =TestImagesRef.child(ImageUri1.getLastPathSegment() + TestRandomKey + ".jpg");
diff --git a/app/src/main/java/in/sminnovations/arrest_tb/PatientDetail.java b/app/src/main/java/in/sminnovations/arrest_tb/PatientDetail.java
index 05b4a2f..d236b05 100644
--- a/app/src/main/java/in/sminnovations/arrest_tb/PatientDetail.java
+++ b/app/src/main/java/in/sminnovations/arrest_tb/PatientDetail.java
@@ -1,5 +1,6 @@
package in.sminnovations.arrest_tb;
+import android.Manifest;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.content.Context;
@@ -9,7 +10,9 @@ import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
+import android.net.Uri;
import android.os.Bundle;
+import android.provider.Settings;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -24,7 +27,14 @@ import android.widget.Toast;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
+import com.karumi.dexter.Dexter;
+import com.karumi.dexter.MultiplePermissionsReport;
+import com.karumi.dexter.PermissionToken;
+import com.karumi.dexter.listener.PermissionRequest;
+import com.karumi.dexter.listener.multi.MultiplePermissionsListener;
+
import java.util.Calendar;
+import java.util.List;
public class PatientDetail extends NavigationTop implements AdapterView.OnItemSelectedListener {
private Button next_act;
@@ -105,7 +115,55 @@ public class PatientDetail extends NavigationTop implements AdapterView.OnItemSe
if (patientid.equals("") || patientage.equals("") || patientnikshayid.equals("")) {
Toast.makeText(PatientDetail.this, "Please fill all fields", Toast.LENGTH_SHORT).show();
- } else {
+ }
+ else if (patientid.length()!=5 )
+ {
+ Toast.makeText(PatientDetail.this, "Patient Id must be 5 characters", Toast.LENGTH_SHORT).show();
+
+
+
+ }
+ else if (patientid.matches("^[a-zA-Z]*$") || patientid.matches("^[0-9]*$") )
+ {
+ Toast.makeText(PatientDetail.this, "Patient Id must be alphanumeric", Toast.LENGTH_SHORT).show();
+
+
+
+ }
+ /* else if ( patientagedigit>100)
+ {
+ Toast.makeText(PatientDetail.this, "Enter a valid Age", Toast.LENGTH_SHORT).show();
+
+ }*/
+
+
+
+ else if(Integer.parseInt(String.valueOf(Age.getText()))>100 || Integer.parseInt(String.valueOf(Age.getText()))<1) {
+
+
+ Toast.makeText(PatientDetail.this, "Enter a valid Age", Toast.LENGTH_SHORT).show();
+
+
+
+ }
+ else if ( patientnikshayid.length()<8 )
+ {
+ Toast.makeText(PatientDetail.this, "Nikshay Id must be 8 or 9 digit Number ", Toast.LENGTH_SHORT).show();
+
+
+ }
+ else if ( patientnikshayid.length()>9 )
+ {
+ Toast.makeText(PatientDetail.this, "Nikshay Id must be 8 or 9 digit Number ", Toast.LENGTH_SHORT).show();
+
+ }
+
+
+
+ else {
+ locationpermission();
+ getLocation();
+
SharedPreferences preferences = getSharedPreferences("PhoneBook", MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
@@ -196,6 +254,60 @@ public class PatientDetail extends NavigationTop implements AdapterView.OnItemSe
gpsTracker.showSettingsAlert();
}
}
+ private void locationpermission()
+ {
+ /* Dexter.withContext(this).withPermission(Manifest.permission.ACCESS_FINE_LOCATION).withListener(new PermissionListener() {
+ @Override
+ public void onPermissionGranted(PermissionGrantedResponse permissionGrantedResponse) {
+ getLocation();
+ }
+
+ @Override
+ public void onPermissionDenied(PermissionDeniedResponse permissionDeniedResponse) {
+ Intent intent=new Intent();
+ intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
+ Uri uri =Uri.fromParts("package",getPackageName(),"");
+ intent.setData(uri);
+ startActivity(intent);
+
+
+ }
+
+ @Override
+ public void onPermissionRationaleShouldBeShown(PermissionRequest permissionRequest, PermissionToken permissionToken) {
+ permissionToken.continuePermissionRequest();
+
+ }
+ }).check();
+*/
+ Dexter.withContext(this).withPermissions(Manifest.permission.ACCESS_COARSE_LOCATION,Manifest.permission.ACCESS_FINE_LOCATION).withListener(new MultiplePermissionsListener() {
+ @Override
+ public void onPermissionsChecked(MultiplePermissionsReport multiplePermissionsReport) {
+ if(multiplePermissionsReport.areAllPermissionsGranted())
+ {
+ getLocation();
+ }
+ if(multiplePermissionsReport.isAnyPermissionPermanentlyDenied())
+ {
+ Intent intent=new Intent();
+ intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
+ Uri uri =Uri.fromParts("package",getPackageName(),"");
+ intent.setData(uri);
+ startActivity(intent);
+
+ }
+
+ }
+
+ @Override
+ public void onPermissionRationaleShouldBeShown(List list, PermissionToken permissionToken) {
+ permissionToken.continuePermissionRequest();
+
+ }
+ }).check();
+
+ }
+
diff --git a/app/src/main/java/in/sminnovations/arrest_tb/TestResult.java b/app/src/main/java/in/sminnovations/arrest_tb/TestResult.java
index f947130..9edbfa5 100644
--- a/app/src/main/java/in/sminnovations/arrest_tb/TestResult.java
+++ b/app/src/main/java/in/sminnovations/arrest_tb/TestResult.java
@@ -50,7 +50,34 @@ public class TestResult extends NavigationTop implements AdapterView.OnItemSelec
if (NIRTLabde.equals("") || SPINTubeIDde.equals("") || sampled.equals("")) {
Toast.makeText(TestResult.this, "Please fill all fields", Toast.LENGTH_SHORT).show();
- } else {
+ }
+ else if ( NIRTLabde.length()!=7 )
+
+ {
+ Toast.makeText(TestResult.this, "NIRT Lab Number must be 7 characters", Toast.LENGTH_SHORT).show();
+
+
+ }
+ else if (NIRTLabde.matches("^[a-zA-Z]*$") || NIRTLabde.matches("^[0-9]*$") )
+
+ {
+ Toast.makeText(TestResult.this, "NIRT Lab Number must be alphanumeric", Toast.LENGTH_SHORT).show();
+
+
+ }
+ else if (SPINTubeIDde.length()!=6 )
+ {
+ Toast.makeText(TestResult.this, "Spin Tube ID must be 6 characters", Toast.LENGTH_SHORT).show();
+
+
+ }
+ else if (SPINTubeIDde.matches("^[a-zA-Z]*$") || SPINTubeIDde.matches("^[0-9]*$") )
+ {
+ Toast.makeText(TestResult.this, "Spin Tube ID must be alphanumeric", Toast.LENGTH_SHORT).show();
+
+
+ }
+ else {
if(ContextCompat.checkSelfPermission(TestResult.this, Manifest.permission.WRITE_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED)
{
diff --git a/app/src/main/java/in/sminnovations/arrest_tb/crash.java b/app/src/main/java/in/sminnovations/arrest_tb/crash.java
new file mode 100644
index 0000000..b6201da
--- /dev/null
+++ b/app/src/main/java/in/sminnovations/arrest_tb/crash.java
@@ -0,0 +1,23 @@
+package in.sminnovations.arrest_tb;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+
+public class crash extends AppCompatActivity {
+ Button d;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_crash);
+ d.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ throw new RuntimeException("app crashed");
+ }
+ });
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_crash.xml b/app/src/main/res/layout/activity_crash.xml
new file mode 100644
index 0000000..c4106f2
--- /dev/null
+++ b/app/src/main/res/layout/activity_crash.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 54673c7..0a97f18 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,7 +6,10 @@ buildscript {
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
- classpath 'com.google.gms:google-services:4.2.0'
+ classpath 'com.google.gms:google-services:4.3.3'
+ classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
+ classpath "com.android.tools.build:gradle:4.0.1"
+ classpath 'com.google.firebase:perf-plugin:1.3.4' // Performance Monitoring plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files