Поправил активацию планшетов при помощи QR кодов
This commit is contained in:
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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");
|
||||
|
||||
Reference in New Issue
Block a user