Permission handling Library ,Espresso and Validation Attributes Added
This commit is contained in:
2
.idea/.name
generated
2
.idea/.name
generated
@@ -1 +1 @@
|
||||
Spin Tube App
|
||||
arrest_tb
|
||||
2
app/.gitignore
vendored
2
app/.gitignore
vendored
@@ -1 +1 @@
|
||||
/build
|
||||
/build
|
||||
@@ -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'
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,21 +4,20 @@
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".crash"></activity>
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
@@ -28,66 +27,75 @@
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_path" />
|
||||
</provider>
|
||||
<activity android:name=".NegativeResults" android:screenOrientation="portrait"
|
||||
></activity>
|
||||
<activity android:name=".PositiveResult" android:screenOrientation="portrait"
|
||||
/>
|
||||
<activity android:name=".TestDetails" android:screenOrientation="portrait"
|
||||
/>
|
||||
<activity android:name=".Register" android:screenOrientation="portrait"
|
||||
/>
|
||||
<activity android:name=".ForgetPassword" android:screenOrientation="portrait"
|
||||
/>
|
||||
<activity android:name=".CreatePassword" android:screenOrientation="portrait"
|
||||
/>
|
||||
<activity android:name=".Home" android:screenOrientation="portrait"
|
||||
/>
|
||||
<activity android:name=".VerifyOTP.VerifyOtp" android:screenOrientation="portrait"
|
||||
/>
|
||||
<activity android:name=".ForgetPasswordReset" android:screenOrientation="portrait"
|
||||
/>
|
||||
<activity android:name=".VerifyOTP.VerifyOtpForgetPassword" android:screenOrientation="portrait"
|
||||
/>
|
||||
<activity android:name=".SplashScreen" android:screenOrientation="portrait"
|
||||
> <intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter></activity>
|
||||
<activity android:name=".MainActivity" android:screenOrientation="portrait"
|
||||
/>
|
||||
<activity android:name=".Report" android:screenOrientation="portrait"
|
||||
>
|
||||
|
||||
</activity>
|
||||
<activity android:name=".NavigationTop" android:screenOrientation="portrait"
|
||||
/>
|
||||
<activity android:name=".LoginScreen" android:screenOrientation="portrait"
|
||||
/>
|
||||
|
||||
|
||||
<activity android:name=".AddImage" android:screenOrientation="portrait"
|
||||
></activity>
|
||||
<activity android:name=".CameraGuide" android:screenOrientation="portrait"></activity>
|
||||
<activity android:name=".About" android:screenOrientation="portrait" />
|
||||
<activity android:name=".PatientDetail" android:screenOrientation="portrait"></activity>
|
||||
<activity android:name=".TestResult" android:screenOrientation="portrait" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<activity
|
||||
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
|
||||
android:name=".NegativeResults"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".PositiveResult"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".TestDetails"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Register"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ForgetPassword"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".CreatePassword"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Home"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".VerifyOTP.VerifyOtp"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ForgetPasswordReset"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".VerifyOTP.VerifyOtpForgetPassword"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".SplashScreen"
|
||||
android:screenOrientation="portrait">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Report"
|
||||
android:screenOrientation="portrait"></activity>
|
||||
<activity
|
||||
android:name=".NavigationTop"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".LoginScreen"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".AddImage"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".CameraGuide"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".About"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".PatientDetail"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".TestResult"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
|
||||
android:theme="@style/Base.Theme.AppCompat" />
|
||||
</application>
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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<PermissionRequest> list, PermissionToken permissionToken) {
|
||||
permissionToken.continuePermissionRequest();
|
||||
|
||||
}
|
||||
}).check();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
|
||||
23
app/src/main/java/in/sminnovations/arrest_tb/crash.java
Normal file
23
app/src/main/java/in/sminnovations/arrest_tb/crash.java
Normal file
@@ -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");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
14
app/src/main/res/layout/activity_crash.xml
Normal file
14
app/src/main/res/layout/activity_crash.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?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="match_parent"
|
||||
tools:context=".crash">
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/gg"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user