diff --git a/.idea/caches/deviceStreaming.xml b/.idea/caches/deviceStreaming.xml
index 71a1c2c..cf29a49 100644
--- a/.idea/caches/deviceStreaming.xml
+++ b/.idea/caches/deviceStreaming.xml
@@ -282,19 +282,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.idea/other.xml b/.idea/other.xml
new file mode 100644
index 0000000..25d338a
--- /dev/null
+++ b/.idea/other.xml
@@ -0,0 +1,417 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index e376828..c77b91d 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -13,8 +13,8 @@ android {
defaultConfig {
applicationId "kz.istt.locust"
minSdkVersion 15
- versionCode 105
- versionName "3.0.2"
+ versionCode 106
+ versionName "3.0.3"
targetSdkVersion 34
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
diff --git a/app/src/main/java/kz/istt/locust/MainService.java b/app/src/main/java/kz/istt/locust/MainService.java
index 3c13f0e..b93d579 100644
--- a/app/src/main/java/kz/istt/locust/MainService.java
+++ b/app/src/main/java/kz/istt/locust/MainService.java
@@ -94,18 +94,11 @@ public class MainService extends Service
String act=intent.getStringExtra(MainService.PARAM_ACTION);
if(act!=null)
{
- if(act.equals("1"))
- {
- timerTic(true);
- }else
- if(act.equals("2")) //Присвоили слушателя прогресс бара
- {
- m_pi = intent.getParcelableExtra(SetupActivity.PARAM_PINTENT);
- }else
- if(act.equals("3")) //Очистить слушателя прогрес бара
- {
- m_pi = null;
- }
+ switch (act) {
+ case "1" -> timerTic(true);
+ case "2" -> m_pi = intent.getParcelableExtra(SetupActivity.PARAM_PINTENT); //Assigned the listener to the progress bar.
+ case "3" -> m_pi = null; //Clear the progress bar listener.
+ }
}
}
return super.onStartCommand(intent, flags, startId);
diff --git a/app/src/main/java/kz/istt/locust/ScanActivity.java b/app/src/main/java/kz/istt/locust/ScanActivity.java
index 8beba89..fda214a 100644
--- a/app/src/main/java/kz/istt/locust/ScanActivity.java
+++ b/app/src/main/java/kz/istt/locust/ScanActivity.java
@@ -119,20 +119,24 @@ public class ScanActivity extends Activity {
tvCountry = (TextView) findViewById(R.id.tvCountry);
tvOrganization = (TextView) findViewById(R.id.tvOrganization);
+ String serial = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
+
DbOpenHelper dboh = new DbOpenHelper(this);
SQLiteDatabase rdb = null;
Cursor cursor = null;
try {
rdb = dboh.getReadableDatabase();
- cursor = rdb.rawQuery("select " +
- " cr.name as country_name," +
- " cp.name as company_name," +
- " t.name " +
- "from " +
- " terminals t " +
- " left join countries cr on cr.id=t.country_id " +
- " left join companies cp on cp.id=t.company_id " +
- "where t.del=0 and t.serial='"+Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID)+"';", null);
+ String sql = """
+ select
+ cr.name as country_name,
+ cp.name as company_name,
+ t.name
+ from
+ terminals t
+ left join countries cr on cr.id=t.country_id
+ left join companies cp on cp.id=t.company_id
+ where t.del=0 and t.serial=?""";
+ cursor = rdb.rawQuery(sql, new String[]{serial});
if(cursor.moveToFirst())
{
tvCountry.setText(cursor.getString(cursor.getColumnIndex("country_name")));
@@ -242,7 +246,7 @@ public class ScanActivity extends Activity {
public void setJSONObject(JSONObject json)
{
try {
- if(json.getInt("errorCode")==0) {
+ if(json.getInt("error_code")==0) {
tvName.setText(json.getString("name"));
tvCountry.setText(json.getString("country_name"));
tvOrganization.setText(json.getString("company_name"));
@@ -499,7 +503,6 @@ public class ScanActivity extends Activity {
if (mResult != null)
ScanActivity.this.setJSONObject(mResult);
-
if (mErrmsg != null && !mErrmsg.equals("")) {
AlertDialog alertDialog = new AlertDialog.Builder(ScanActivity.this).create();
alertDialog.setTitle("Error");