Delete Test_details.java
This commit is contained in:
@@ -1,162 +0,0 @@
|
|||||||
package com.ShanMukhaInnovations.ArrestTB;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.core.app.ActivityCompat;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
|
|
||||||
import android.Manifest;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.Spinner;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
public class Test_details extends Navigation_Top implements AdapterView.OnItemSelectedListener {
|
|
||||||
Button btnTest;
|
|
||||||
EditText NIRTLabd,SPINTubeIDd;
|
|
||||||
String NIRTLabde,SPINTubeIDde,validatyd,sampled;
|
|
||||||
int PERMISSION_ALL = 1;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
LayoutInflater inflater = (LayoutInflater) this
|
|
||||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
View contentView = inflater.inflate(R.layout.activity_test_details, null, false);
|
|
||||||
draw.addView(contentView, 0);
|
|
||||||
Spinner Spinner_sample = findViewById(R.id.spinner_sample);
|
|
||||||
|
|
||||||
// editor.putString(Name, phonenum);
|
|
||||||
|
|
||||||
NIRTLabd=findViewById(R.id.NIRTLab);
|
|
||||||
SPINTubeIDd=findViewById(R.id.SPINTubeID);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
btnTest=findViewById(R.id.startTest);
|
|
||||||
btnTest.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
NIRTLabde = NIRTLabd.getText().toString();
|
|
||||||
SPINTubeIDde = SPINTubeIDd.getText().toString();
|
|
||||||
if (NIRTLabde.equals("") || SPINTubeIDde.equals("") || sampled.equals("")) {
|
|
||||||
Toast.makeText(Test_details.this, "Please fill all fields", Toast.LENGTH_SHORT).show();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if(ContextCompat.checkSelfPermission(Test_details.this, Manifest.permission.WRITE_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED)
|
|
||||||
{
|
|
||||||
|
|
||||||
ActivityCompat.requestPermissions(Test_details.this,new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},23);
|
|
||||||
|
|
||||||
// MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
|
|
||||||
// app-defined int constant
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SharedPreferences preferences = getSharedPreferences("PhoneBook1", MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
|
||||||
|
|
||||||
editor.putString("NIRTLabde", NIRTLabde);
|
|
||||||
editor.putString("SPINTubeIDde", SPINTubeIDde);
|
|
||||||
editor.putString("sample", sampled);
|
|
||||||
editor.putString("validity", validatyd);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
editor.commit();
|
|
||||||
|
|
||||||
if (restorePrefData()) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Intent intent = new Intent(getApplicationContext(), AddImage.class);
|
|
||||||
|
|
||||||
|
|
||||||
startActivity(intent);
|
|
||||||
finish();
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
|
|
||||||
Intent intent = new Intent(getApplicationContext(), Camera_Guide.class);
|
|
||||||
|
|
||||||
startActivity(intent);
|
|
||||||
finish();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
ArrayAdapter<CharSequence> sample_adapter = ArrayAdapter.createFromResource(this,
|
|
||||||
R.array.Type_Of_Sample, android.R.layout.simple_spinner_item);
|
|
||||||
|
|
||||||
sample_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
|
||||||
Spinner_sample.setAdapter(sample_adapter);
|
|
||||||
Spinner_sample.setOnItemSelectedListener(this);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Spinner Spinner_validity = findViewById(R.id.spinner_validity);
|
|
||||||
|
|
||||||
ArrayAdapter<CharSequence> Validity_adapter = ArrayAdapter.createFromResource(this,
|
|
||||||
R.array.Validity, android.R.layout.simple_spinner_item);
|
|
||||||
|
|
||||||
Validity_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
|
||||||
Spinner_validity.setAdapter(Validity_adapter);
|
|
||||||
Spinner_validity.setOnItemSelectedListener(this);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
private boolean restorePrefData() {
|
|
||||||
|
|
||||||
|
|
||||||
SharedPreferences pref = getApplicationContext().getSharedPreferences("myPrefs",MODE_PRIVATE);
|
|
||||||
Boolean isIntroActivityOpnendBefore = pref.getBoolean("isIntroOpnend",false);
|
|
||||||
return isIntroActivityOpnendBefore;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
if(parent.getId() == R.id.spinner_sample)
|
|
||||||
{
|
|
||||||
sampled = parent.getItemAtPosition(position).toString();
|
|
||||||
|
|
||||||
//do this
|
|
||||||
}
|
|
||||||
if(parent.getId() == R.id.spinner_validity)
|
|
||||||
{
|
|
||||||
validatyd = parent.getItemAtPosition(position).toString();
|
|
||||||
|
|
||||||
//do this
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNothingSelected(AdapterView<?> parent) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user