Последняя миля
This commit is contained in:
2
.idea/compiler.xml
generated
2
.idea/compiler.xml
generated
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="21" />
|
||||
<bytecodeTargetLevel target="17" />
|
||||
</component>
|
||||
</project>
|
||||
4
.idea/deploymentTargetSelector.xml
generated
4
.idea/deploymentTargetSelector.xml
generated
@ -4,10 +4,10 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2024-08-12T08:19:00.432171100Z">
|
||||
<DropdownSelection timestamp="2024-08-18T18:04:19.981174300Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=8293a1b0" />
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=0123456789ABCDEF" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
|
||||
2
.idea/gradle.xml
generated
2
.idea/gradle.xml
generated
@ -5,7 +5,7 @@
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="21" />
|
||||
<option name="gradleJvm" value="jbr-17" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
|
||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -77,7 +77,7 @@
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
@ -86,11 +86,7 @@ public class DateTimeTM extends com.google.android.material.textfield.TextInputE
|
||||
|
||||
public static final Creator<SavedStateTDTM> CREATOR = new Creator<SavedStateTDTM>()
|
||||
{
|
||||
public SavedStateTDTM createFromParcel(Parcel in)
|
||||
{
|
||||
return new SavedStateTDTM(in);
|
||||
}
|
||||
|
||||
public SavedStateTDTM createFromParcel(Parcel in) { return new SavedStateTDTM(in); }
|
||||
public SavedStateTDTM[] newArray(int size)
|
||||
{
|
||||
return new SavedStateTDTM[size];
|
||||
|
||||
@ -6,6 +6,7 @@ import android.os.Parcelable;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.EditText;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@ -28,15 +29,31 @@ public class DateTimeText extends EditText implements fieldDB
|
||||
|
||||
public void setValue(String val)
|
||||
{
|
||||
m_Value = val;
|
||||
m_Value = null; //Присваиваю ниже так как нужно только проверянное значение даты
|
||||
if(val!=null && !val.equals(""))
|
||||
{
|
||||
Date date = new Date(Long.parseLong(m_Value)*1000);
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
|
||||
|
||||
Date date=null;
|
||||
try {
|
||||
date = new Date(Long.parseLong(val)*1000);
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //Теперь для простого преобразования в тип даты PostgreSQL дату храню в виде текста в формате "yyyy-MM-dd HH:mm:ss"
|
||||
m_Value=format.format(date);
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
if(date==null){
|
||||
try {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
date = format.parse(val);
|
||||
m_Value = val;
|
||||
} catch (ParseException e) {
|
||||
}
|
||||
}
|
||||
if(date!=null) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy HH:mm"); //Убрал секунды так всё равно то что отображается не соответствует тому что храниться
|
||||
String str = format.format(date);
|
||||
setText(str);
|
||||
}else{
|
||||
setText("");
|
||||
}
|
||||
}else
|
||||
{
|
||||
setText("");
|
||||
@ -66,7 +83,6 @@ public class DateTimeText extends EditText implements fieldDB
|
||||
{
|
||||
return new SavedStateDTT(in);
|
||||
}
|
||||
|
||||
public SavedStateDTT[] newArray(int size)
|
||||
{
|
||||
return new SavedStateDTT[size];
|
||||
|
||||
@ -62,9 +62,10 @@ public class DBGUITable
|
||||
//Считываем поля и их типы из таблицы
|
||||
DbOpenHelper dboh = new DbOpenHelper(m_context);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("PRAGMA table_info('" + m_table + "');", null);
|
||||
cursor = rdb.rawQuery("PRAGMA table_info('" + m_table + "');", null);
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
if (Tools.getStringFromCursor(cursor, "name").equals(name.toLowerCase())) {
|
||||
@ -73,10 +74,10 @@ public class DBGUITable
|
||||
}
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb != null) { rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -94,9 +95,10 @@ public class DBGUITable
|
||||
boolean result = true;
|
||||
DbOpenHelper dboh = new DbOpenHelper(m_context);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("PRAGMA table_info('"+m_table+"');",null);
|
||||
cursor = rdb.rawQuery("PRAGMA table_info('"+m_table+"');",null);
|
||||
if(cursor.moveToFirst())
|
||||
{
|
||||
do{
|
||||
@ -121,10 +123,10 @@ public class DBGUITable
|
||||
Log.e("CCALM", "Validate field = " + name + " find in CV value = "+value);
|
||||
}while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if (rdb != null) { rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -213,20 +215,21 @@ public class DBGUITable
|
||||
//Проверка нужно ли вставить либо обновить по id записи
|
||||
boolean b=false;
|
||||
DbOpenHelper dboh = new DbOpenHelper(m_context);
|
||||
Cursor cursor;
|
||||
|
||||
if(cv.getAsString("uid")!=null)
|
||||
{
|
||||
uid=cv.getAsString("uid");
|
||||
String sql="select 1 from "+m_table+" where uid = '" + uid +"'";
|
||||
SQLiteDatabase rdb=null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(sql,null);
|
||||
b=cursor.moveToFirst();
|
||||
cursor.close();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null) rdb.close();
|
||||
}
|
||||
}
|
||||
@ -285,10 +288,10 @@ public class DBGUITable
|
||||
DbOpenHelper dboh = new DbOpenHelper(m_context);
|
||||
|
||||
String sql = "";
|
||||
Cursor cursor = null;
|
||||
sql = "select * from "+m_table+" where uid='" + uid + "'";
|
||||
|
||||
SQLiteDatabase rdb=null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(sql, null);
|
||||
@ -300,9 +303,9 @@ public class DBGUITable
|
||||
Object obj=findComponent(cursor.getColumnName(i));
|
||||
if(obj!=null)
|
||||
{
|
||||
if(cursor.getColumnName(i).equals("date")) {
|
||||
Log.e("CCALM", "1 field " + cursor.getColumnName(i) + " = " + cursor.getString(i) + " type= " + cursor.getType(i));
|
||||
}
|
||||
//if(cursor.getColumnName(i).equals("date")) {
|
||||
// Log.e("CCALM", "1 field " + cursor.getColumnName(i) + " = " + cursor.getString(i) + " type= " + cursor.getType(i));
|
||||
//}
|
||||
|
||||
if(cursor.getType(i)==Cursor.FIELD_TYPE_FLOAT){ //Because cutting double
|
||||
setValue(obj, ""+cursor.getDouble(i));
|
||||
@ -311,14 +314,14 @@ public class DBGUITable
|
||||
}
|
||||
|
||||
//для проверки обратное действие
|
||||
Log.e("CCALM", "read field = " + cursor.getColumnName(i) + " val1 = " + cursor.getString(i) + " val2 = " + getValue(findComponent(cursor.getColumnName(i))));
|
||||
//Log.e("CCALM", "read field = " + cursor.getColumnName(i) + " val1 = " + cursor.getString(i) + " val2 = " + getValue(findComponent(cursor.getColumnName(i))));
|
||||
}
|
||||
}
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb != null) { rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
|
||||
@ -1581,26 +1581,16 @@ public class DbOpenHelper extends SQLiteOpenHelper
|
||||
public List<String> GetColumns(String tableName)
|
||||
{
|
||||
List<String> ar = null;
|
||||
Cursor c = null;
|
||||
SQLiteDatabase rdb=null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = getReadableDatabase();
|
||||
try {
|
||||
c = rdb.rawQuery("select * from " + tableName + " limit 1", null);
|
||||
if (c != null) {
|
||||
ar = new ArrayList<String>(Arrays.asList(c.getColumnNames()));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.v(tableName, e.toString(), e);
|
||||
//e.printStackTrace();
|
||||
} finally
|
||||
{
|
||||
if (c != null)
|
||||
c.close();
|
||||
}
|
||||
cursor = rdb.rawQuery("select * from " + tableName + " limit 1", null);
|
||||
ar = new ArrayList<String>(Arrays.asList(cursor.getColumnNames()));
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb != null) { rdb.close(); }
|
||||
}
|
||||
return ar;
|
||||
@ -1611,11 +1601,9 @@ public class DbOpenHelper extends SQLiteOpenHelper
|
||||
{
|
||||
if(tbl==null) return false;
|
||||
|
||||
Cursor cursor;
|
||||
//if(tbl.name.equals("countries"))
|
||||
// Log.i("CCALM", "tbl0=" + tbl.name);
|
||||
//if(tbl.name.equals("countriesregions"))
|
||||
// Log.i("CCALM", "tbl0=" + tbl.name);
|
||||
if(tbl.name.equals("frmlocustdel_locations")){
|
||||
Log.i("CCALM", "tbl.name = "+tbl.name);
|
||||
}
|
||||
|
||||
//Проверка на существование полей
|
||||
Boolean[] fb=new Boolean[tbl.fields.size()]; //Для проверки существования полей в локальной таблице
|
||||
@ -1636,7 +1624,7 @@ public class DbOpenHelper extends SQLiteOpenHelper
|
||||
while(tbl.ReadNextRecord())
|
||||
{
|
||||
if(tbl.name.equals("frmlocustdel_locations")){
|
||||
Log.i("CCALM","tbl.name="+tbl.name);
|
||||
Log.i("CCALM","tbl.name="+tbl.name); //Дата не загрузилась и центр участка не загрузился
|
||||
}
|
||||
String sql=null;
|
||||
String[] par=null;
|
||||
@ -1652,22 +1640,24 @@ public class DbOpenHelper extends SQLiteOpenHelper
|
||||
|
||||
boolean exists=false;
|
||||
SQLiteDatabase rdb=null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = getReadableDatabase();
|
||||
cursor = rdb.rawQuery(sql, par);
|
||||
exists=cursor.moveToFirst();
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb != null) { rdb.close(); }
|
||||
}
|
||||
|
||||
ContentValues cv = new ContentValues();
|
||||
for(int i=0;i<tbl.fields.size();i++)
|
||||
{
|
||||
//if(b && tbl.fields.get(i).name.equals("id")) continue; //Если существует не записываем
|
||||
//Log.i("CCALM","fld="+tbl.fields.get(i).name+" val="+tbl.fields.get(i).getStrVal()+" type="+tbl.fields.get(i).type); //Для дебага
|
||||
if(tbl.name.equals("frmlocustdel_locations")){
|
||||
Log.i("CCALM","fld="+tbl.fields.get(i).name+" val="+tbl.fields.get(i).getStrVal()+" type="+tbl.fields.get(i).type); //Для дебага
|
||||
}
|
||||
|
||||
if(fb[i]) //Присваиваем только поля существующие в локальной базе
|
||||
{
|
||||
@ -1678,7 +1668,7 @@ public class DbOpenHelper extends SQLiteOpenHelper
|
||||
}
|
||||
}
|
||||
|
||||
if(!exists)
|
||||
if(!exists) //Если существует запись то вставляем, иначе обновляем.
|
||||
{
|
||||
SQLiteDatabase wdb = null;
|
||||
try {
|
||||
@ -1808,15 +1798,16 @@ public class DbOpenHelper extends SQLiteOpenHelper
|
||||
//так как пользователь может быть только 1 то удаляем всех остальных
|
||||
boolean b=false;
|
||||
SQLiteDatabase rdb=null;
|
||||
Cursor cursor=null;
|
||||
try {
|
||||
rdb=getReadableDatabase();
|
||||
rdb.execSQL("update _user set del=1;");
|
||||
Cursor cursor = rdb.rawQuery("select 1 from _user where id = ?", new String[]{String.valueOf(id)});
|
||||
cursor = rdb.rawQuery("select 1 from _user where id = ?", new String[]{String.valueOf(id)});
|
||||
b = cursor.moveToFirst();
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null) rdb.close();
|
||||
}
|
||||
|
||||
@ -2247,10 +2238,11 @@ public class DbOpenHelper extends SQLiteOpenHelper
|
||||
{
|
||||
int result[]={0,0};
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = this.getReadableDatabase();
|
||||
|
||||
Cursor cursor = rdb.rawQuery("select id,country_id,lon_max,name from CountriesRegions where del=0 and " + lon + ">lon_min and " + lon + "<lon_max and " + lat + ">lat_min and " + lat + "<lat_max order by area", null);
|
||||
cursor = rdb.rawQuery("select id,country_id,lon_max,name from CountriesRegions where del=0 and " + lon + ">lon_min and " + lon + "<lon_max and " + lat + ">lat_min and " + lat + "<lat_max order by area", null);
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
result[0] = cursor.getInt(cursor.getColumnIndex("country_id"));
|
||||
@ -2310,8 +2302,9 @@ public class DbOpenHelper extends SQLiteOpenHelper
|
||||
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb != null) { rdb.close(); }
|
||||
}
|
||||
return result;
|
||||
|
||||
@ -253,6 +253,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
// Выбираем страны и заполняем поля
|
||||
dboh = new DbOpenHelper(this);
|
||||
SQLiteDatabase rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select c.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = c.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),c.name) name from countries c where c.del=0 order by c.name", null);
|
||||
@ -261,10 +262,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB) spiCountry).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -295,18 +296,19 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
String sql = "select id, name, lon_min from countriesregions where del=0 and country_id=" + ((selectDB)spiCountry).getValue() + " order by name";
|
||||
DbOpenHelper dboh = new DbOpenHelper(LocustActivity.this);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery(sql, null);
|
||||
cursor = rdb.rawQuery(sql, null);
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
((selectDB)spiRegion).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -440,6 +442,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
// Выбираем страны и заполняем поля
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select b.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = b.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),b.name) name from list_biotope b where b.del=0 order by b.name", null);
|
||||
@ -448,10 +451,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiBioBiotope).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -463,6 +466,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
sql = "select g.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = g.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),g.name) name from list_greenery g where g.del=0 order by g.sort";
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(sql, null);
|
||||
@ -471,10 +475,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiBioGreenery).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -485,6 +489,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
// Выбираем страны и заполняем поля
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select c.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = c.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),c.name) name from list_cover c where c.del=0 order by c.sort,c.name", null);
|
||||
@ -493,10 +498,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiBioGreeneryCover).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -522,6 +527,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
// Выбираем страны и заполняем поля
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select lt.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = lt.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),lt.name) name from LocustsTypes lt where lt.del=0 order by lt.sort,lt.name", null);
|
||||
@ -530,10 +536,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiLocustType).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -560,6 +566,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
// Выбираем отрождение и заполняем поля
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select b.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = b.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),b.name) name from list_enemies b where b.del=0 order by b.sort", null);
|
||||
@ -568,10 +575,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiEggsEnemies).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -583,6 +590,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
// Выбираем отрождение и заполняем поля
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select b.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = b.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),b.name) name from Borns b where b.del=0 order by b.sort", null);
|
||||
@ -591,10 +599,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiLarvaBorn).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -605,6 +613,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
// Выбираем отрождение и заполняем поля
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select a.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = a.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),a.name) name from list_age a where a.del=0 order by a.sort", null);
|
||||
@ -613,10 +622,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiLarvaAge).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -627,6 +636,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
// Выбираем отрождение и заполняем поля
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select a.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = a.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),a.name) name from list_paintings a where a.del=0 order by a.sort", null);
|
||||
@ -635,10 +645,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiLarvaPainting).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -650,6 +660,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
// Выбираем отрождение и заполняем поля
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select a.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = a.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),a.name) name from list_behaviors a where a.del=0 order by a.sort", null);
|
||||
@ -658,10 +669,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiLarvaBehavior).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -687,6 +698,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiKuliguliAction).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select a.id,COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = a.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),a.name) name from list_actions a where a.del=0 order by a.sort", null);
|
||||
@ -695,10 +707,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiKuliguliAction).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -709,6 +721,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
// Выбираем отрождение и заполняем поля
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select a.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = a.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),a.name) name from list_age a where a.del=0 order by a.sort", null);
|
||||
@ -717,10 +730,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiKuliguliAge).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -731,6 +744,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiImagoWing).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select f.id,COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = f.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),f.name) name from Fledgling f where f.del=0 order by f.sort", null);
|
||||
@ -739,10 +753,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiImagoWing).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -758,6 +772,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiImagoPhase).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select d.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = d.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),d.name) name from list_phase d where d.del=0 order by d.sort,d.name", null);
|
||||
@ -766,10 +781,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiImagoPhase).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -780,6 +795,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiImagoAction).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select f.id,COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = f.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),f.name) name from list_breeding f where f.del=0 order by f.sort", null);
|
||||
@ -788,10 +804,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiImagoAction).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -844,6 +860,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiSwarmDensity).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select d.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = d.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),d.name) name from list_density d where d.del=0 order by d.percent,d.name", null);
|
||||
@ -852,10 +869,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiSwarmDensity).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -871,6 +888,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiSwarmFlying).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select d.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = d.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),d.name) name, d.degree from list_directions d where d.del=0 order by d.degree", null);
|
||||
@ -879,10 +897,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiSwarmFlying).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -892,6 +910,7 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiSwarmHeight).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select d.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = d.name AND l.short_name='" + Tools.getLang() + "' LIMIT 1),d.name) name from list_height d where d.del=0 order by d.sort,d.name", null);
|
||||
@ -900,10 +919,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
((selectDB)spiSwarmHeight).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -1955,9 +1974,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
list.clear();
|
||||
DbOpenHelper dboh = new DbOpenHelper(this);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("select uid,lat,lon from frmlocust_locations where del=false and frmlocust_uid='" + uid + "' order by pos", null);
|
||||
cursor = rdb.rawQuery("select uid,lat,lon from frmlocust_locations where del=0 and frmlocust_uid='" + uid + "' order by pos", null);
|
||||
if (cursor.moveToFirst())
|
||||
{
|
||||
do
|
||||
@ -1965,10 +1985,10 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
list.add(new LatLon(cursor.getString(0), cursor.getDouble(1), cursor.getDouble(2)));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -2701,10 +2721,11 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
super.onStart();
|
||||
DbOpenHelper dboh = new DbOpenHelper(this);
|
||||
String sql="select * from terminals where del=0 and serial='"+ Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID)+"';";
|
||||
try(
|
||||
SQLiteDatabase rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery(sql, null);
|
||||
) {
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try{
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(sql, null);
|
||||
if(!cursor.moveToFirst())
|
||||
{
|
||||
Toast toast = Toast.makeText(getApplicationContext(),
|
||||
@ -2713,6 +2734,9 @@ public class LocustActivity extends FragmentActivity implements LocationListener
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("CCALM", "Database error occurred", e);
|
||||
}finally{
|
||||
if(cursor != null) { cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
}
|
||||
|
||||
@ -299,6 +299,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
// Выбираем страны и заполняем поля
|
||||
dboh = new DbOpenHelper(this);
|
||||
SQLiteDatabase rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select id, name from countries where del=0 order by name", null);
|
||||
@ -309,10 +310,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiCountry).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -330,9 +331,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
{
|
||||
DbOpenHelper dboh = new DbOpenHelper(LocustDelActivity.this);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("select id, name from countriesregions where del=0 and country_id=" + ((selectDB)spiCountry).getValue() + " order by name", null);
|
||||
cursor = rdb.rawQuery("select id, name from countriesregions where del=0 and country_id=" + ((selectDB)spiCountry).getValue() + " order by name", null);
|
||||
if (cursor.moveToFirst())
|
||||
{
|
||||
do
|
||||
@ -341,10 +343,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -403,6 +405,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiVegType).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select d.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = d.name AND l.short_name='"
|
||||
@ -414,10 +417,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiVegType).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -430,6 +433,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiVegCover).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -442,10 +446,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiVegCover).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -459,6 +463,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
// Выбираем страны и заполняем поля
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -471,10 +476,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiVegDamage).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -495,6 +500,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiInsFormulation).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor=null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -507,10 +513,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiInsFormulation).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -522,6 +528,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiInsDiluted).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -534,10 +541,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiInsDiluted).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -577,6 +584,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiWindDirectionStart).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -589,10 +597,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiWindDirectionStart).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -602,6 +610,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiWindDirectionEnd).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select d.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = d.name AND l.short_name='"
|
||||
@ -613,10 +622,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiWindDirectionEnd).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -626,6 +635,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiSprayDirectionStart).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -639,10 +649,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiSprayDirectionStart).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -652,6 +662,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiSprayDirectionEnd).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -665,10 +676,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiSprayDirectionEnd).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -679,6 +690,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiLocSpecies).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -691,10 +703,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiLocSpecies).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -704,6 +716,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiLocHoppers).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select lt.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = lt.name AND l.short_name='"
|
||||
@ -715,10 +728,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiLocHoppers).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -761,6 +774,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiMainPurpose).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select lt.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = lt.name AND l.short_name='"
|
||||
@ -772,10 +786,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiMainPurpose).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -786,6 +800,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiLocustPhaseId).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -798,10 +813,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiLocustPhaseId).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -811,6 +826,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiSprPlatform).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select d.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = d.name AND l.short_name='"
|
||||
@ -822,10 +838,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiSprPlatform).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -835,6 +851,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiSprPlatformA).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -848,10 +865,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiSprPlatformA).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -861,6 +878,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiSprPlatformG).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -874,10 +892,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiSprPlatformG).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -887,6 +905,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiSprPlatformH).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -900,10 +919,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiSprPlatformH).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -949,6 +968,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiSprMarking).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -961,10 +981,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiSprMarking).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -1011,6 +1031,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiTypeImpact).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select d.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = d.name AND l.short_name='"
|
||||
@ -1022,10 +1043,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiTypeImpact).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -1042,6 +1063,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiEffMethod).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -1054,10 +1076,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
((selectDB)spiEffMethod).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -1235,6 +1257,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
//spiSafEmptyСontainers.addField(this, "", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -1261,10 +1284,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -1886,7 +1909,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
SQLiteDatabase rdb = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
rdb.execSQL("update frmlocustdel_locations set del=true where frmlocustdel_uid=\'" + uid+"\'");
|
||||
rdb.execSQL("update frmlocustdel_locations set del=1 where frmlocustdel_uid=\'" + uid+"\'");
|
||||
ArrayList<LatLon> list = ((LatLonAdapter)latlonList.getAdapter()).latlonList;
|
||||
for(int i=0;i<list.size();i++)
|
||||
{
|
||||
@ -1903,7 +1926,7 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if(exists){
|
||||
stmt = wdb.compileStatement("update frmlocustdel_locations set del=false,frmlocustdel_uid=?,pos=?,lat=?,lon=? where uid=?");
|
||||
stmt = wdb.compileStatement("update frmlocustdel_locations set del=0,frmlocustdel_uid=?,pos=?,lat=?,lon=? where uid=?");
|
||||
stmt.bindString(1, uid);
|
||||
stmt.bindLong(2, i);
|
||||
stmt.bindDouble(3, list.get(i).lat);
|
||||
@ -1998,9 +2021,11 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
list.clear();
|
||||
DbOpenHelper dboh = new DbOpenHelper(this);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("select uid,lat,lon from frmlocustdel_locations where del=false and frmlocustdel_uid='" + uid + "' order by pos", null);
|
||||
String sql="select uid,lat,lon from frmlocustdel_locations where del=0 and frmlocustdel_uid='" + uid + "' order by pos";
|
||||
cursor = rdb.rawQuery(sql, null);
|
||||
if (cursor.moveToFirst())
|
||||
{
|
||||
do
|
||||
@ -2008,10 +2033,10 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
list.add(new LatLon(cursor.getString(0), cursor.getDouble(1), cursor.getDouble(2)));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -2528,19 +2553,20 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe
|
||||
super.onStart();
|
||||
DbOpenHelper dboh = new DbOpenHelper(this);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("select * from terminals where del=0 and serial='"+ Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID)+"';", null);
|
||||
cursor = rdb.rawQuery("select * from terminals where del=0 and serial='"+ Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID)+"';", null);
|
||||
if(!cursor.moveToFirst())
|
||||
{
|
||||
Toast toast = Toast.makeText(getApplicationContext(),
|
||||
getResources().getString(R.string.Please_authorize_the_tablet), Toast.LENGTH_LONG);
|
||||
toast.show();
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
|
||||
@ -608,9 +608,9 @@ public class LocustDelListActivity extends AppCompatActivity
|
||||
|
||||
DbOpenHelper dboh = new DbOpenHelper(LocustDelListActivity.this);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor =null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = null;
|
||||
switch (spiList.getSelectedItemPosition())
|
||||
{
|
||||
case 0:
|
||||
@ -686,10 +686,10 @@ public class LocustDelListActivity extends AppCompatActivity
|
||||
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -705,19 +705,20 @@ public class LocustDelListActivity extends AppCompatActivity
|
||||
|
||||
DbOpenHelper dboh = new DbOpenHelper(this);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("select * from terminals where del=0 and serial='"+ Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID)+"';", null);
|
||||
cursor = rdb.rawQuery("select * from terminals where del=0 and serial='"+ Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID)+"';", null);
|
||||
if(!cursor.moveToFirst())
|
||||
{
|
||||
Toast toast = Toast.makeText(getApplicationContext(),
|
||||
getResources().getString(R.string.Please_authorize_the_tablet), Toast.LENGTH_LONG);
|
||||
toast.show();
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
|
||||
@ -394,6 +394,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
// Выбираем страны и заполняем поля
|
||||
dboh = new DbOpenHelper(this);
|
||||
SQLiteDatabase rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select id, uid, name from countries where del=0 order by name", null);
|
||||
@ -404,10 +405,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiCountry).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -424,6 +425,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiRegion).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select id, name from countriesregions where del=0 order by name", null);
|
||||
@ -435,10 +437,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -519,6 +521,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiVegType).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -531,10 +534,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiVegType).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -549,6 +552,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiVegCover).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -561,10 +565,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiVegCover).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -602,6 +606,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
// Выбираем страны и заполняем поля
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -614,10 +619,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiInsFormulation).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -632,6 +637,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiInsDiluted).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor =null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select d.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = d.name AND l.short_name='"
|
||||
@ -643,10 +649,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiInsDiluted).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -665,6 +671,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiInsContainerState).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -677,10 +684,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiInsContainerState).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -713,6 +720,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiWindDirectionStart).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -725,10 +733,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiWindDirectionStart).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -739,6 +747,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiWindDirectionEnd).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -751,10 +760,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiWindDirectionEnd).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -765,6 +774,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiSprayDirectionStart).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -778,10 +788,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiSprayDirectionStart).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -792,6 +802,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiSprayDirectionEnd).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -805,10 +816,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiSprayDirectionEnd).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -820,6 +831,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiLocSpecies).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -832,10 +844,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiLocSpecies).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -845,6 +857,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiLocHoppers).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -857,10 +870,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiLocHoppers).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -874,6 +887,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiMainPurpose).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -886,10 +900,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiMainPurpose).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -901,6 +915,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiSprPlatform).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -913,10 +928,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiSprPlatform).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -927,6 +942,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiSprPlatformA).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -940,10 +956,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiSprPlatformA).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -954,6 +970,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiSprPlatformG).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select d.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = d.name AND l.short_name='"
|
||||
@ -966,10 +983,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiSprPlatformG).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -980,6 +997,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiSprPlatformH).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -993,10 +1011,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiSprPlatformH).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -1085,6 +1103,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiSprMarking).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -1097,10 +1116,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiSprMarking).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -1259,6 +1278,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiEffTypeImpact).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -1271,10 +1291,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiEffTypeImpact).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -1293,6 +1313,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiEffMethod).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -1305,8 +1326,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiEffMethod).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -1358,6 +1379,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiEffTypeImpact2).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -1370,8 +1392,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiEffTypeImpact2).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -1388,6 +1410,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiEffMethod2).addField("", "");
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -1400,8 +1423,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((selectDB)spiEffMethod2).addField(cursor.getString(cursor.getColumnIndex("name")), cursor.getString(cursor.getColumnIndex("id")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -1516,6 +1539,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
// Пустые контейнеры (выборка локализованных названий)
|
||||
dboh = new DbOpenHelper(this);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getWritableDatabase();
|
||||
cursor = rdb.rawQuery(
|
||||
@ -1539,8 +1563,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
((CheckBox) findViewById(R.id.cbBurned)).setText(cursor.getString(cursor.getColumnIndex("name")));
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -2877,9 +2901,10 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
list.clear();
|
||||
DbOpenHelper dboh = new DbOpenHelper(this);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getWritableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("select uid,lat,lon from frmlocustdel_locations where frmlocustdel_uid='" + uid + "' order by pos", null);
|
||||
cursor = rdb.rawQuery("select uid,lat,lon from frmlocustdel_locations where frmlocustdel_uid='" + uid + "' order by pos", null);
|
||||
if (cursor.moveToFirst())
|
||||
{
|
||||
do
|
||||
@ -2889,6 +2914,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
}
|
||||
cursor.close();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -3190,17 +3216,18 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi
|
||||
|
||||
DbOpenHelper dboh = new DbOpenHelper(this);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getWritableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("select * from terminals where del=0 and serial='"+ Secure.getString(getContentResolver(), Secure.ANDROID_ID)+"';", null);
|
||||
cursor = rdb.rawQuery("select * from terminals where del=0 and serial='"+ Secure.getString(getContentResolver(), Secure.ANDROID_ID)+"';", null);
|
||||
if(!cursor.moveToFirst())
|
||||
{
|
||||
Toast toast = Toast.makeText(getApplicationContext(),
|
||||
getResources().getString(R.string.Please_authorize_the_tablet), Toast.LENGTH_LONG);
|
||||
toast.show();
|
||||
}
|
||||
cursor.close();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
|
||||
@ -605,10 +605,10 @@ public class LocustHealthListActivity extends AppCompatActivity
|
||||
|
||||
DbOpenHelper dboh = new DbOpenHelper(LocustHealthListActivity.this);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
|
||||
Cursor cursor = null;
|
||||
switch (spiList.getSelectedItemPosition())
|
||||
{
|
||||
case 0:
|
||||
@ -618,7 +618,7 @@ public class LocustHealthListActivity extends AppCompatActivity
|
||||
lh.uid as frmlocusthealth_uid,
|
||||
coalesce(ld.district,'') || ' ' || coalesce(ld.terrain,'') terrain,
|
||||
lh.date,
|
||||
EXISTS(select true from frmlocusthealth where frmlocustdel_uid=ld.uid) as health
|
||||
EXISTS(select 1 from frmlocusthealth where frmlocustdel_uid=ld.uid) as health
|
||||
from
|
||||
frmlocusthealth lh
|
||||
left join frmlocustdel ld on lh.frmlocustdel_uid=ld.uid
|
||||
@ -634,7 +634,7 @@ public class LocustHealthListActivity extends AppCompatActivity
|
||||
lh.uid as frmlocusthealth_uid,
|
||||
coalesce(ld.district,'') || ' ' || coalesce(ld.terrain,'') terrain,
|
||||
lh.date,
|
||||
EXISTS(select true from frmlocusthealth where frmlocustdel_uid=ld.uid) as health
|
||||
EXISTS(select 1 from frmlocusthealth where frmlocustdel_uid=ld.uid) as health
|
||||
from
|
||||
frmlocusthealth lh
|
||||
left join frmlocustdel ld on lh.frmlocustdel_uid=ld.uid
|
||||
@ -651,7 +651,7 @@ public class LocustHealthListActivity extends AppCompatActivity
|
||||
lh.uid as frmlocusthealth_uid,
|
||||
coalesce(ld.district,'') || ' ' || coalesce(ld.terrain,'') terrain,
|
||||
lh.date,
|
||||
EXISTS(select true from frmlocusthealth where frmlocustdel_uid=ld.uid) as health
|
||||
EXISTS(select 1 from frmlocusthealth where frmlocustdel_uid=ld.uid) as health
|
||||
from
|
||||
frmlocusthealth lh
|
||||
left join frmlocustdel ld on lh.frmlocustdel_uid=ld.uid
|
||||
@ -667,11 +667,11 @@ public class LocustHealthListActivity extends AppCompatActivity
|
||||
lh.uid as frmlocusthealth_uid,
|
||||
coalesce(ld.district,'') || ' ' || coalesce(ld.terrain,'') terrain,
|
||||
coalesce(lh.date,ld.date) as date,
|
||||
EXISTS(select true from frmlocusthealth where frmlocustdel_uid=ld.uid) as health
|
||||
EXISTS(select 1 from frmlocusthealth where frmlocustdel_uid=ld.uid) as health
|
||||
from
|
||||
frmlocustdel ld
|
||||
left join frmlocusthealth lh on lh.frmlocustdel_uid=ld.uid
|
||||
where ld.del=0 and ld.filled=true
|
||||
where ld.del=0 and ld.filled=1
|
||||
""", null); //Все
|
||||
break;
|
||||
}
|
||||
@ -701,6 +701,9 @@ public class LocustHealthListActivity extends AppCompatActivity
|
||||
int buttonPinkStyle = R.style.ButtonPinkTheme;
|
||||
ContextThemeWrapper newContext = new ContextThemeWrapper(this, R.style.ButtonPinkTheme);
|
||||
btn = new MyButton(newContext, null, 0, buttonPinkStyle);
|
||||
}else{
|
||||
btn = new MyButton(this);
|
||||
btn.setBackgroundResource(R.drawable.button_pink); // Задаете фон кнопки через drawable
|
||||
}
|
||||
}
|
||||
if(btn==null) {
|
||||
@ -747,10 +750,10 @@ public class LocustHealthListActivity extends AppCompatActivity
|
||||
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -766,19 +769,20 @@ public class LocustHealthListActivity extends AppCompatActivity
|
||||
|
||||
DbOpenHelper dboh = new DbOpenHelper(this);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("select * from terminals where del=0 and serial='"+ Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID)+"';", null);
|
||||
cursor = rdb.rawQuery("select * from terminals where del=0 and serial='"+ Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID)+"';", null);
|
||||
if(!cursor.moveToFirst())
|
||||
{
|
||||
Toast toast = Toast.makeText(getApplicationContext(),
|
||||
getResources().getString(R.string.Please_authorize_the_tablet), Toast.LENGTH_LONG);
|
||||
toast.show();
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
|
||||
@ -582,10 +582,10 @@ public class LocustListActivity extends AppCompatActivity
|
||||
|
||||
DbOpenHelper dboh = new DbOpenHelper(LocustListActivity.this);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
String sql;
|
||||
Cursor cursor = null;
|
||||
switch (spiList.getSelectedItemPosition())
|
||||
{
|
||||
case 0:
|
||||
@ -650,11 +650,10 @@ public class LocustListActivity extends AppCompatActivity
|
||||
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -668,19 +667,20 @@ public class LocustListActivity extends AppCompatActivity
|
||||
|
||||
DbOpenHelper dboh = new DbOpenHelper(this);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("select * from terminals where del=0 and serial='"+ Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID)+"';", null);
|
||||
cursor = rdb.rawQuery("select * from terminals where del=0 and serial='"+ Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID)+"';", null);
|
||||
if(!cursor.moveToFirst())
|
||||
{
|
||||
Toast toast = Toast.makeText(getApplicationContext(),
|
||||
getResources().getString(R.string.Please_authorize_the_tablet), Toast.LENGTH_LONG);
|
||||
toast.show();
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
|
||||
@ -102,18 +102,30 @@ public class MainActivity extends Activity {
|
||||
boolean exest = false;
|
||||
String sql;
|
||||
|
||||
Cursor cursor;
|
||||
Cursor cursor=null;
|
||||
try {
|
||||
sql = "select 1 from frmlocust where image_name1='" + fileName + "' or image_name2='" + fileName + "' or image_name3='" + fileName + "';";
|
||||
cursor = rdb.rawQuery(sql, null);
|
||||
if (cursor.moveToFirst())
|
||||
exest = exest | true;
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();;
|
||||
}finally{
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
cursor=null;
|
||||
try {
|
||||
sql = "select 1 from frmlocustdel where image_name1='" + fileName + "' or image_name2='" + fileName + "' or image_name3='" + fileName + "';";
|
||||
cursor = rdb.rawQuery(sql, null);
|
||||
if (cursor.moveToFirst())
|
||||
exest = exest | true;
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();;
|
||||
}finally{
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
|
||||
if (!exest) //Если в базе нет удаляем
|
||||
{
|
||||
@ -202,10 +214,9 @@ public class MainActivity extends Activity {
|
||||
{
|
||||
//Если в справочнике нет ни одной записи то перезапускаем синхронизацию (иначе отображаем главное меню)
|
||||
boolean exists=false;
|
||||
DbOpenHelper dboh;
|
||||
Cursor cursor;
|
||||
dboh = new DbOpenHelper(MainActivity.this);
|
||||
DbOpenHelper dboh = new DbOpenHelper(MainActivity.this);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor=null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
cursor = rdb.rawQuery("select c.id from borns c limit 1;", null);
|
||||
@ -216,10 +227,10 @@ public class MainActivity extends Activity {
|
||||
exists=true;
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){cursor.close();}
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
|
||||
@ -135,8 +135,11 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
|
||||
DbOpenHelper dboh = new DbOpenHelper(this);
|
||||
SQLiteDatabase rdb = null;
|
||||
try {
|
||||
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("select frmlocust_uid,lat,lon from frmlocust_locations where frmlocust_uid!='"+uid+"' order by frmlocust_uid,pos;", null);
|
||||
Cursor cursor=null;
|
||||
try {
|
||||
cursor = rdb.rawQuery("select frmlocust_uid,lat,lon from frmlocust_locations where frmlocust_uid!='" + uid + "' order by frmlocust_uid,pos;", null);
|
||||
if (cursor.moveToFirst()) {
|
||||
String uid = "";
|
||||
PolygonOptions pOptions2 = new PolygonOptions();
|
||||
@ -158,8 +161,15 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
|
||||
polygon.setFillColor(0x7F0000FF);
|
||||
}
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
}
|
||||
|
||||
//Геозоны противосаначовой обработки
|
||||
cursor=null;
|
||||
try {
|
||||
cursor = rdb.rawQuery("select frmlocustdel_uid,lat,lon from frmlocustdel_locations where frmlocustdel_uid!='" + uid + "' order by frmlocustdel_uid,pos;", null);
|
||||
if (cursor.moveToFirst()) {
|
||||
String uid = "";
|
||||
@ -182,7 +192,12 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
|
||||
polygon.setFillColor(0x7FFF0000);
|
||||
}
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package kz.istt.locust;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
@ -241,7 +242,9 @@ public class MySynchronizationOld
|
||||
}
|
||||
|
||||
String geom="";
|
||||
Cursor cursor2 = rdb.rawQuery("select lat,lon from frmlocust_locations where frmlocust_uid=? order by pos", new String[] { String.valueOf(uid) });
|
||||
Cursor cursor2 = null;
|
||||
try {
|
||||
cursor2 = rdb.rawQuery("select lat,lon from frmlocust_locations where frmlocust_uid=? order by pos", new String[]{String.valueOf(uid)});
|
||||
if (cursor2.moveToFirst()) {
|
||||
String first = "[" + cursor2.getDouble(1) + "," + cursor2.getDouble(0) + "]";
|
||||
do {
|
||||
@ -251,17 +254,21 @@ public class MySynchronizationOld
|
||||
geom = "{\"type\":\"Polygon\",\"coordinates\":[[" + geom + "]]}";
|
||||
}
|
||||
xml += " <geom><![CDATA[" + geom + "]]></geom>";
|
||||
cursor2.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor2!=null){ cursor2.close(); }
|
||||
}
|
||||
xml+="</metadata>";
|
||||
|
||||
myThread.addRequest("sendFrmLocust","xml",MySynchronizationOld.URL+"/get/", xml, null,null,null);
|
||||
|
||||
}while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -316,7 +323,9 @@ public class MySynchronizationOld
|
||||
xml+=" <"+cursor.getColumnName(i)+"><![CDATA["+val+"]]></"+cursor.getColumnName(i)+">\n";
|
||||
}
|
||||
String geom="";
|
||||
Cursor cursor2 = rdb.rawQuery("select lat,lon from frmlocustdel_locations where frmlocustdel_uid=? order by pos", new String[] { String.valueOf(uid) });
|
||||
Cursor cursor2 = null;
|
||||
try {
|
||||
cursor2 = rdb.rawQuery("select lat,lon from frmlocustdel_locations where frmlocustdel_uid=? order by pos", new String[]{String.valueOf(uid)});
|
||||
if (cursor2.moveToFirst()) {
|
||||
String first = "[" + cursor2.getDouble(1) + "," + cursor2.getDouble(0) + "]";
|
||||
do {
|
||||
@ -326,7 +335,11 @@ public class MySynchronizationOld
|
||||
geom = "{\"type\":\"Polygon\",\"coordinates\":[[" + geom + "]]}";
|
||||
}
|
||||
xml += " <geom><![CDATA[" + geom + "]]></geom>";
|
||||
cursor2.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor2!=null){ cursor2.close(); }
|
||||
}
|
||||
xml+="</metadata>";
|
||||
|
||||
myThread.addRequest("sendFrmLocust","xml",MySynchronizationOld.URL+"/get/", xml, null,null,null);
|
||||
@ -348,7 +361,9 @@ public class MySynchronizationOld
|
||||
tbl.addField(new TCField("lat",TCField.BD_FLOAT8));
|
||||
tbl.getHeader(outStream);
|
||||
//Переписываю значения из базы данных в outStream
|
||||
Cursor cursor3 = rdb.rawQuery("select uid,del,seq,frmlocustdel_uid,pos,lon,lat from frmlocustdel_locations where frmlocustdel_uid=? order by pos", new String[] { String.valueOf(uid) });
|
||||
Cursor cursor3 = null;
|
||||
try {
|
||||
cursor3 = rdb.rawQuery("select uid,del,seq,frmlocustdel_uid,pos,lon,lat from frmlocustdel_locations where frmlocustdel_uid=? order by pos", new String[]{String.valueOf(uid)});
|
||||
if (cursor3.moveToFirst()) {
|
||||
do {
|
||||
tbl.fields.get(0).setValue(cursor3.getString(0));
|
||||
@ -361,16 +376,20 @@ public class MySynchronizationOld
|
||||
tbl.getCol(outStream);
|
||||
} while (cursor3.moveToNext());
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
cursor3.close();
|
||||
}
|
||||
//Отправляю пакет данных на сервер для вставки либо обновления
|
||||
myThread.addRequest(tbl.name,"",MySynchronizationOld.URL+"/asdc/tctable/", null,null, null, outStream.toByteArray());
|
||||
|
||||
}while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -434,32 +453,33 @@ public class MySynchronizationOld
|
||||
|
||||
}while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
}
|
||||
|
||||
//Для обновления справочников и загрузки старых анкет уничножения саранчи
|
||||
int makeRequest(String tableName,String days,String country_id)
|
||||
boolean makeRequest(String tableName,String days,String country_id)
|
||||
{
|
||||
String seq="";
|
||||
DbOpenHelper dboh = new DbOpenHelper(_context);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("select max(seq) as seq from " + tableName + ";", null);
|
||||
cursor = rdb.rawQuery("select max(seq) as seq from " + tableName + ";", null);
|
||||
if (cursor.moveToFirst()) {
|
||||
seq = cursor.getString(cursor.getColumnIndex("seq"));
|
||||
}
|
||||
if (seq == null) seq = "0";
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -487,19 +507,20 @@ public class MySynchronizationOld
|
||||
//Последовательно отправляю изменёные пользователям записи (send=0 и они заполнены)
|
||||
DbOpenHelper dboh = new DbOpenHelper(_context);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("select uid from frmlocust where send=0 and filled=1 and device_id=?", new String[]{ android_id });
|
||||
cursor = rdb.rawQuery("select uid from frmlocust where send=0 and filled=1 and device_id=?", new String[]{ android_id });
|
||||
if(cursor.moveToFirst())
|
||||
{
|
||||
do{
|
||||
sendFrmLocust(cursor.getString(cursor.getColumnIndex("uid")));
|
||||
}while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -507,19 +528,20 @@ public class MySynchronizationOld
|
||||
//Последовательно отправляю изменёные пользователям записи (send=0 и они заполнены)
|
||||
dboh = new DbOpenHelper(_context);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("select uid from frmlocustdel where send=0 and filled=1 and device_id=?", new String[]{ android_id });
|
||||
cursor = rdb.rawQuery("select uid from frmlocustdel where send=0 and filled=1 and device_id=?", new String[]{ android_id });
|
||||
if(cursor.moveToFirst())
|
||||
{
|
||||
do{
|
||||
sendFrmLocustDel(cursor.getString(cursor.getColumnIndex("uid")));
|
||||
}while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -527,19 +549,20 @@ public class MySynchronizationOld
|
||||
//Последовательно отправляю изменёные пользователям записи (send=0 и они заполнены)
|
||||
dboh = new DbOpenHelper(_context);
|
||||
rdb = null;
|
||||
cursor =null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("select uid from frmlocusthealth where send=0 and filled=1 and device_id=?", new String[]{ android_id });
|
||||
cursor = rdb.rawQuery("select uid from frmlocusthealth where send=0 and filled=1 and device_id=?", new String[]{ android_id });
|
||||
if(cursor.moveToFirst())
|
||||
{
|
||||
do{
|
||||
sendFrmLocustHealth(cursor.getString(0));
|
||||
}while (cursor.moveToNext());
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -585,19 +608,20 @@ public class MySynchronizationOld
|
||||
//Загружаю формы саранчовых обработок за последние X дней для страны Y
|
||||
dboh = new DbOpenHelper(_context);
|
||||
rdb = null;
|
||||
cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("select t.country_id from terminals t where t.del=0 and t.serial='"+ android_id +"';", null);
|
||||
cursor = rdb.rawQuery("select t.country_id from terminals t where t.del=0 and t.serial='"+ android_id +"';", null);
|
||||
if(cursor.moveToFirst())
|
||||
{
|
||||
String country_id = cursor.getString(0);
|
||||
makeRequest("frmlocustdel",String.valueOf(MySynchronizationOld.SyncDays),country_id);
|
||||
makeRequest("frmlocustdel_locations",String.valueOf(MySynchronizationOld.SyncDays),country_id);
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -627,9 +651,10 @@ public class MySynchronizationOld
|
||||
if(filePath==null || filePath.equals("")) return false;
|
||||
File file=new File(filePath);
|
||||
if(!file.exists()) return false;
|
||||
FileInputStream is=null;
|
||||
try
|
||||
{
|
||||
FileInputStream is=new FileInputStream(file);
|
||||
is=new FileInputStream(file);
|
||||
|
||||
DbOpenHelper dbOpenHelper = new DbOpenHelper(_context);
|
||||
|
||||
@ -650,8 +675,6 @@ public class MySynchronizationOld
|
||||
try {
|
||||
doc = builder.parse(is);
|
||||
} catch (Exception e) {
|
||||
is.close();
|
||||
file.delete();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -673,10 +696,10 @@ public class MySynchronizationOld
|
||||
String uid = XMLTools.getCDATAValue(XMLTools.findFirstNode(root, "uid"));
|
||||
if (uid.isBlank() || uid == "null") uid = null;
|
||||
|
||||
Cursor cursor;
|
||||
DbOpenHelper dboh = new DbOpenHelper(_context);
|
||||
SQLiteDatabase rdb = null;
|
||||
SQLiteDatabase wdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
wdb = dboh.getWritableDatabase();
|
||||
@ -704,6 +727,7 @@ public class MySynchronizationOld
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
if(wdb!=null){ wdb.close(); }
|
||||
}
|
||||
@ -714,10 +738,10 @@ public class MySynchronizationOld
|
||||
String uid = XMLTools.getCDATAValue(XMLTools.findFirstNode(root, "uid"));
|
||||
if (uid.isBlank() || uid == "null") uid = null;
|
||||
|
||||
Cursor cursor;
|
||||
DbOpenHelper dboh = new DbOpenHelper(_context);
|
||||
SQLiteDatabase rdb = null;
|
||||
SQLiteDatabase wdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
wdb = dboh.getWritableDatabase();
|
||||
@ -746,6 +770,7 @@ public class MySynchronizationOld
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
if(wdb!=null){ wdb.close(); }
|
||||
}
|
||||
@ -781,10 +806,11 @@ public class MySynchronizationOld
|
||||
String uid = jsonObject.getString("uid");
|
||||
if (uid.isBlank() || uid == "null") uid = null;
|
||||
|
||||
Cursor cursor;
|
||||
|
||||
DbOpenHelper dboh = new DbOpenHelper(_context);
|
||||
SQLiteDatabase rdb = null;
|
||||
SQLiteDatabase wdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
wdb = dboh.getWritableDatabase();
|
||||
@ -815,6 +841,7 @@ public class MySynchronizationOld
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
if(wdb!=null){ wdb.close(); }
|
||||
}
|
||||
@ -831,11 +858,13 @@ public class MySynchronizationOld
|
||||
Log.e("CCALM", "Unknown data type");
|
||||
}
|
||||
|
||||
is.close();
|
||||
file.delete();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
result = false;
|
||||
}finally{
|
||||
if(is!=null) { try { is.close(); } catch (IOException e) { } }
|
||||
file.delete();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -845,10 +874,12 @@ public class MySynchronizationOld
|
||||
/* Поток заданий на отправку данных на сервер */
|
||||
class MyThread extends Thread
|
||||
{
|
||||
private int rid = 0; //Инкреминтальный номер ответа для сохранения уникальных файлов
|
||||
|
||||
class Tsk //Задание отправки данных
|
||||
{
|
||||
private static int mId=0; //Переменная для создания инкриментального идентификатора запроса
|
||||
|
||||
int id = 0; //Инкриментальный идентификатор запроса
|
||||
|
||||
String name = ""; //Название запроса для дебага
|
||||
String type = ""; //Тип ожидаемого результата, такие сейчас: "xml", "json", "tbl"
|
||||
|
||||
@ -858,57 +889,35 @@ class MyThread extends Thread
|
||||
String json = ""; //Отправляемая JSON строка
|
||||
String file = ""; //Отправляемый файл
|
||||
byte[] data = null; //Отправляемые данные
|
||||
Boolean s = false; //Integer s = 0; // false - не отправлялось true - в процессе отправки (если ошибка то ставиться статус не отправлено иначе удаляется из списка заданий)
|
||||
int id = 0; //Инкриментальный идентификатор запроса
|
||||
Boolean send = false; //Integer s = 0; // false - не отправлялось true - в процессе отправки (TODO поменять на int 0=не отправлялось, 1=в процессе отправки 2=отправленно, если ошибка то прибавляется 100 к статусу)
|
||||
|
||||
int wait = 10; //Милисекунд ждать перед отправкой текущего задания
|
||||
int t=0; //Количество совершенных попыток отправки
|
||||
|
||||
Tsk(){
|
||||
mId++;
|
||||
this.id=mId;
|
||||
}
|
||||
}
|
||||
|
||||
private int mId=0; //Инкриментальный идентификатор запроса
|
||||
private Semaphore mSemaphore = null; //Семафор для доступа к списку заданий
|
||||
private ArrayList<Tsk> mTList = new ArrayList<Tsk>(); //Защищёный список
|
||||
private MySynchronizationOld mListener = null; //Для отправки ответов в основной поток
|
||||
private String mAppPath = "";
|
||||
|
||||
//@SuppressLint("HandlerLeak") //Подавить предупреждения о неоптимальности
|
||||
private Handler myHandle = new Handler() //Для ловли сообщений из другого потока
|
||||
@SuppressLint("HandlerLeak")
|
||||
private final Handler myHandle = new Handler() //Для ловли сообщений из другого потока
|
||||
{
|
||||
@Override
|
||||
public void handleMessage(Message msg) //Слушатель ответа после отправки данных на сервер
|
||||
{
|
||||
String type = msg.getData().getString("type");
|
||||
Boolean b = mListener.incomingData(type, msg.getData().getString("file")); //Слушатель должен вернуть true иниче запрос останется в очереди
|
||||
|
||||
try
|
||||
{
|
||||
mSemaphore.acquire();
|
||||
for(int i=0; i<mTList.size();i++)
|
||||
{
|
||||
if(mTList.get(i).id==rid)
|
||||
{
|
||||
if(b) //Удаляем обработанное заданин по id
|
||||
{ mTList.remove(i);
|
||||
break;
|
||||
}else //Не обработаное пытаемся отправить заново (но увеличив ожидание перед повтором прохода заданий на 5 минут но не больше чем раз в 30 минут)
|
||||
{
|
||||
mTList.get(i).wait += 1000 * 60 * 5; //Увеличиваем ожидание перед новой отправкой на 5 минут
|
||||
if(mTList.get(i).wait > 1000 * 60 * 30 ) mTList.get(i).wait = 1000 * 60 * 30; //Ограничение 30 минут
|
||||
mTList.get(i).s = false; //Отмечаем как не отправленное
|
||||
mTList.get(i).t++; //Увиличиваем счётчик количество попыток отправки
|
||||
if(mTList.get(i).t>10) mTList.remove(i); //Удаляем задание после 10 попыток отправки
|
||||
break;
|
||||
boolean done = mListener.incomingData(type, msg.getData().getString("file")); //Слушатель должен вернуть true иниче запрос останется в очереди
|
||||
if(!done){
|
||||
Log.e("CCALM", "Failed to process data");
|
||||
//TODO вывести в лог приложения и наверно отправить накопившиеся на сайт
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (InterruptedException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
} finally
|
||||
{ mSemaphore.release();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
public MyThread(MySynchronizationOld listener, String appPath)
|
||||
@ -922,9 +931,9 @@ class MyThread extends Thread
|
||||
|
||||
// Добавление в задание на отправку до того как не получен ответ от предедущего запроса следующий не отсылается те. последовательно это делает (обработка результатов не в потоке загрузки а в основном потоке)
|
||||
//return id запроса
|
||||
public int addRequest(String name, String type,String url, String xml, String json, String file,byte[] data)
|
||||
public boolean addRequest(String name, String type,String url, String xml, String json, String file,byte[] data)
|
||||
{
|
||||
mId++; //Инкрементируем идентификатор запроса
|
||||
boolean result=false;
|
||||
try
|
||||
{
|
||||
mSemaphore.acquire();
|
||||
@ -936,15 +945,16 @@ class MyThread extends Thread
|
||||
t.json = json;
|
||||
t.file = file;
|
||||
t.data = data;
|
||||
t.s = false;
|
||||
t.id = mId;
|
||||
t.send = false;
|
||||
mTList.add(t);
|
||||
|
||||
result=true;
|
||||
} catch (InterruptedException ex)
|
||||
{
|
||||
} finally
|
||||
{ mSemaphore.release();
|
||||
}
|
||||
return mId;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -975,15 +985,30 @@ class MyThread extends Thread
|
||||
//Считываем первое задание из защищёного семафором списка
|
||||
tsk = null;
|
||||
try {
|
||||
|
||||
mSemaphore.acquire();
|
||||
for(int i=0;i<mTList.size();i++)
|
||||
{
|
||||
if(! mTList.get(i).s)
|
||||
if(! mTList.get(i).send)
|
||||
{ tsk = mTList.get(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//Для дебага:
|
||||
// String names="";
|
||||
// int cnt1=0, cnt2=0;
|
||||
// for(int i=0;i<mTList.size();i++)
|
||||
// {
|
||||
// cnt1++;
|
||||
// if(! mTList.get(i).send)
|
||||
// {
|
||||
// names+=" "+mTList.get(i).name+" id="+String.valueOf(mTList.get(i).id);
|
||||
// cnt2++;
|
||||
// }else{
|
||||
// names+=" *"+mTList.get(i).name+" id="+String.valueOf(mTList.get(i).id);
|
||||
// }
|
||||
// }
|
||||
// Log.i("CCALM", "download task names = "+names+" cnt1 = "+String.valueOf(cnt1)+" cnt2 = "+String.valueOf(cnt2));
|
||||
|
||||
} catch (InterruptedException ex) {
|
||||
// вот такое может произойти, если поток например прервут thread.interrupt()
|
||||
} finally {
|
||||
@ -994,11 +1019,11 @@ class MyThread extends Thread
|
||||
if(tsk != null)
|
||||
{
|
||||
Log.i("CCALM", "download task = "+tsk.name);
|
||||
//if(tsk.name.equals("frmlocustdel_locations")){
|
||||
// Log.i("CCALM", "download task = "+tsk.name);
|
||||
//}
|
||||
if(tsk.name.equals("frmlocustdel_locations")){
|
||||
Log.i("CCALM", "download task = "+tsk.name);
|
||||
}
|
||||
boolean bError=false;
|
||||
tsk.s = true; //Признак отправляемости запроса на сервер
|
||||
tsk.send = true; //Признак отправляемости запроса на сервер
|
||||
|
||||
try {
|
||||
sleep(tsk.wait); //Если в задании задано сколько подождать перед запуском
|
||||
@ -1010,6 +1035,7 @@ class MyThread extends Thread
|
||||
{
|
||||
URL url = new URL(tsk.url);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setDoOutput(true);
|
||||
conn.setReadTimeout(60000); //60000 = 60 секунд
|
||||
conn.setConnectTimeout(15000);
|
||||
conn.setRequestMethod("POST");
|
||||
@ -1099,8 +1125,8 @@ class MyThread extends Thread
|
||||
|
||||
int responseCode=conn.getResponseCode();
|
||||
if (responseCode == HttpsURLConnection.HTTP_OK) {
|
||||
rid++;
|
||||
String filePath = mAppPath+"/"+"data_"+ String.valueOf(rid)+".txt";
|
||||
|
||||
String filePath = mAppPath+"/"+"data_"+ String.valueOf(tsk.id)+".txt";
|
||||
|
||||
//Так как файл может быть большим и он может не поместиться в памяти то сохраняем его на диск (допустим таблица с языками очень большая)
|
||||
try {
|
||||
@ -1111,106 +1137,45 @@ class MyThread extends Thread
|
||||
bos.write(inByte);
|
||||
bis.close();
|
||||
bos.close();
|
||||
}catch(Exception ex)
|
||||
{}
|
||||
}catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
Log.e("CCALM", "Error: ", e);
|
||||
}
|
||||
|
||||
//Информирую слушателя о приёме данных
|
||||
Message msg = myHandle.obtainMessage();
|
||||
Bundle b = new Bundle();
|
||||
b.putString("file", filePath);
|
||||
b.putString("type", tsk.type);
|
||||
msg.setData(b);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("file", filePath); //Путь к файлу
|
||||
bundle.putString("type", tsk.type); //Тип файла
|
||||
msg.setData(bundle);
|
||||
myHandle.sendMessage(msg);
|
||||
}else{
|
||||
Log.e("CCALM", "ERROR URL = "+tsk.url+" responseCode"+String.valueOf(responseCode));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
bError = true;
|
||||
Log.i("CCALM", "URL = "+tsk.url,ex);
|
||||
}
|
||||
/*
|
||||
HttpClient httpClient = new DefaultHttpClient();
|
||||
httpClient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
|
||||
HttpPost httpPost = new HttpPost(tsk.url);
|
||||
if(tsk.file!=null) //Отправляем файл на сервер
|
||||
{
|
||||
File file = new File(tsk.file);
|
||||
if(file.exists())
|
||||
{
|
||||
MultipartEntity mpEntity = new MultipartEntity();
|
||||
ContentBody cbFile = new FileBody(file, "image/jpeg");
|
||||
mpEntity.addPart("file", cbFile);
|
||||
httpPost.setEntity(mpEntity);
|
||||
}
|
||||
}else //Отправляем XML строку
|
||||
{
|
||||
httpPost.addHeader("Content-Type", "application/xml");
|
||||
|
||||
StringEntity entity = new StringEntity(tsk.str, "UTF-8");
|
||||
entity.setContentType("application/xml");
|
||||
httpPost.setEntity(entity);
|
||||
}
|
||||
|
||||
HttpResponse response = httpClient.execute(httpPost);
|
||||
if(response != null)
|
||||
//TODO при старте можно проверять совершен ли полный цикл загрузки без ошибок
|
||||
//Удаляю задание независемо как оно отработало (пусть на верхнем уровне думают пускать ли задание повторно)
|
||||
try
|
||||
{
|
||||
rid++;
|
||||
String filePath = mAppPath+"/"+"data_"+ String.valueOf(rid)+".txt";
|
||||
|
||||
//Так как файл может быть большим и он может не поместиться в памяти то сохраняем его на диск
|
||||
try {
|
||||
BufferedInputStream bis = new BufferedInputStream(response.getEntity().getContent());
|
||||
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(filePath)));
|
||||
int inByte;
|
||||
while ((inByte = bis.read()) != -1) bos.write(inByte);
|
||||
bis.close();
|
||||
bos.close();
|
||||
}catch(Exception ex)
|
||||
{}
|
||||
|
||||
Message msg = myHandle.obtainMessage();
|
||||
Bundle b = new Bundle();
|
||||
b.putString("file", filePath);
|
||||
b.putInt("id", tsk.id);
|
||||
msg.setData(b);
|
||||
myHandle.sendMessage(msg);
|
||||
}else
|
||||
bError = true; //Если ошибка при принятии ответа
|
||||
|
||||
|
||||
} catch (UnsupportedEncodingException ex)
|
||||
{
|
||||
bError = true;
|
||||
Log.i("CCALM", "Error 5 = " + ex.toString());
|
||||
} catch (ClientProtocolException ex)
|
||||
{
|
||||
bError = true;
|
||||
Log.i("CCALM", "Error 6 = " + ex.toString());
|
||||
} catch (IOException ex)
|
||||
{
|
||||
bError = true;
|
||||
Log.i("CCALM", "Error 7 = " + ex.toString());
|
||||
}
|
||||
*/
|
||||
|
||||
if(bError) //Если произошла ошибка при отправке.
|
||||
{
|
||||
tsk.wait += 1000 * 60 * 1; //Увеличиваем ожидание перед новой отправкой на 1 минуту
|
||||
if(tsk.wait > 1000 * 60 * 10 ) tsk.wait = 1000 * 60 * 10; //Ограничение 10 минут
|
||||
tsk.s = false; //Отмечаем как не отправленное
|
||||
tsk.t++; //Увеличиваем счётчик количество попыток отправки
|
||||
|
||||
if(tsk.t>5) //Удаляем задание после 10 попыток отправки
|
||||
{
|
||||
try {
|
||||
mSemaphore.acquire();
|
||||
mTList.remove(tsk);
|
||||
} catch (InterruptedException ex)
|
||||
for(int i=0; i<mTList.size();i++)
|
||||
{
|
||||
// вот такое может произойти, если поток например прервут thread.interrupt()
|
||||
if(mTList.get(i).id==tsk.id)
|
||||
{
|
||||
mTList.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
} finally
|
||||
{
|
||||
mSemaphore.release(); //Отдаем семафор
|
||||
}
|
||||
}
|
||||
{ mSemaphore.release();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -121,9 +121,10 @@ public class ScanActivity extends Activity {
|
||||
|
||||
DbOpenHelper dboh = new DbOpenHelper(this);
|
||||
SQLiteDatabase rdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
Cursor cursor = rdb.rawQuery("select " +
|
||||
cursor = rdb.rawQuery("select " +
|
||||
" cr.name as country_name," +
|
||||
" cp.name as company_name," +
|
||||
" t.name " +
|
||||
@ -138,10 +139,10 @@ public class ScanActivity extends Activity {
|
||||
tvOrganization.setText(cursor.getString(cursor.getColumnIndex("company_name")));
|
||||
tvName.setText(cursor.getString(cursor.getColumnIndex("name")));
|
||||
}
|
||||
cursor.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
}
|
||||
dboh.close();
|
||||
@ -252,15 +253,16 @@ public class ScanActivity extends Activity {
|
||||
DbOpenHelper dboh = new DbOpenHelper(this);
|
||||
SQLiteDatabase rdb = null;
|
||||
SQLiteDatabase wdb = null;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
rdb = dboh.getReadableDatabase();
|
||||
wdb = dboh.getWritableDatabase();
|
||||
Cursor cursor = rdb.rawQuery(sql, null);
|
||||
cursor = rdb.rawQuery(sql, null);
|
||||
if(cursor.moveToFirst())
|
||||
{
|
||||
exists=true;
|
||||
}
|
||||
cursor.close();
|
||||
|
||||
if(exists){
|
||||
sql="update terminals set country_id=?,company_id=?,name=?,serial=? where id=?";
|
||||
SQLiteStatement stmt = wdb.compileStatement(sql);
|
||||
@ -283,6 +285,7 @@ public class ScanActivity extends Activity {
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(cursor!=null){ cursor.close(); }
|
||||
if(rdb!=null){ rdb.close(); }
|
||||
if(wdb!=null){ wdb.close(); }
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ public class Tools
|
||||
StringBuilder result = new StringBuilder();
|
||||
int length;
|
||||
while ((length = is.read(buffer)) != -1) {
|
||||
result.append(new String(buffer, 0, length, StandardCharsets.UTF_8));
|
||||
result.append(new String(buffer, 0, length, "UTF-8")); // StandardCharsets.UTF_8.name() > JDK 7
|
||||
}
|
||||
return result.toString();
|
||||
} catch (IOException e) {
|
||||
|
||||
18
app/src/main/res/drawable-v21/spinner_background.xml
Normal file
18
app/src/main/res/drawable-v21/spinner_background.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:gravity="bottom">
|
||||
<shape android:shape="line"
|
||||
android:gravity="bottom">
|
||||
<stroke android:width="1dp" android:color="@android:color/darker_gray"/>
|
||||
<size android:height="2dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:right="8dp" android:gravity="end|center_vertical">
|
||||
<bitmap
|
||||
android:src="@drawable/down"
|
||||
android:gravity="end|center_vertical"/>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
@ -1,34 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1" />
|
||||
</vector>
|
||||
@ -1,15 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:gravity="bottom">
|
||||
<shape android:shape="line">
|
||||
<stroke android:width="1dp" android:color="@android:color/darker_gray"/>
|
||||
<size android:height="2dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:right="8dp" android:gravity="end|center_vertical">
|
||||
<bitmap
|
||||
android:src="@drawable/down"
|
||||
android:gravity="center"/>
|
||||
android:gravity="end|center_vertical"/>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
|
||||
@ -279,11 +279,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Country"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiCountry"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -301,11 +304,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Region"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiRegion"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -636,11 +642,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Type_of_biotope"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiBioBiotope"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -658,11 +667,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Vegetation"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiBioGreenery"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -680,11 +692,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Vegetation_cover"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiBioGreeneryCover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -759,11 +774,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Are_locusts_present"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiLocustHave"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -781,11 +799,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Locust_species"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiLocustType"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -975,11 +996,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Natural_enemies"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiEggsEnemies"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@ -1018,11 +1042,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Hatching"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiLarvaBorn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1040,11 +1067,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Hopper_stages"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiLarvaAge"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1057,12 +1087,15 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Appearance"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiLarvaPainting"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1080,11 +1113,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Spatial_distribution"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiLarvaBehavior"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1271,11 +1307,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Action"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiKuliguliAction"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1293,11 +1332,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Hopper_stages"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiKuliguliAge"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@ -1336,11 +1378,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Fledging"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiImagoWing"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1358,11 +1403,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Maturity"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiImagoMaturity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1380,11 +1428,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Phase"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiImagoPhase"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1402,11 +1453,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Spatial_distribution"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiImagoAction"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1470,11 +1524,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Feeding_and_roosting"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiImagoFeeding"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1492,11 +1549,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Copulating"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiImagoCopulation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1514,11 +1574,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Laying"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiImagolaying"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1536,11 +1599,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Flying"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiImagoFlying"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@ -1587,11 +1653,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Maturity"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiSwarmMaturity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1609,11 +1678,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Density_of_swarm"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiSwarmDensity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1668,12 +1740,15 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Flying_direction"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiSwarmFlying"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1686,12 +1761,15 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Flying_height"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiSwarmHeight"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@ -267,13 +267,16 @@
|
||||
android:id="@+id/tvCountry"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/Country"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiCountry"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -289,13 +292,16 @@
|
||||
android:id="@+id/tvRegion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/Region"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiRegion"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -659,11 +665,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Vegetation_type"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiVegType"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -706,11 +715,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Del_Vegetation_cover"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiVegCover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -749,11 +761,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Damage"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiVegDamage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -881,11 +896,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Formulation"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiInsFormulation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -919,11 +937,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Commercial_product_diluted"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"/>
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiInsDiluted"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1044,12 +1065,15 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Time_start"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiWeaTimeStart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
android:layout_weight="1"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -1062,12 +1086,15 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Time_end"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiWeaTimeEnd"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
android:layout_weight="1"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1158,7 +1185,9 @@
|
||||
android:id="@+id/spiWindDirectionStart"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
android:layout_weight="1"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvWindDirectionEnd"
|
||||
@ -1171,7 +1200,9 @@
|
||||
android:id="@+id/spiWindDirectionEnd"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
android:layout_weight="1"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1190,7 +1221,9 @@
|
||||
android:id="@+id/spiSprayDirectionStart"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
android:layout_weight="1"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSprayDirectionEnd"
|
||||
@ -1203,7 +1236,9 @@
|
||||
android:id="@+id/spiSprayDirectionEnd"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
android:layout_weight="1"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1237,11 +1272,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Locust_type"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiLocSpecies"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1259,11 +1297,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Hopper_stages"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiLocHoppers"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!--LinearLayout
|
||||
@ -1288,7 +1329,9 @@
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiImago"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout-->
|
||||
|
||||
<LinearLayout
|
||||
@ -1338,7 +1381,9 @@
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiKuliguli"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout-->
|
||||
|
||||
<!--LinearLayout
|
||||
@ -1363,7 +1408,9 @@
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiSwarm"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout-->
|
||||
|
||||
<!--LinearLayout
|
||||
@ -1388,7 +1435,9 @@
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiSparse"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout-->
|
||||
|
||||
|
||||
@ -1407,11 +1456,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Main_purpose_of_treatment"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiMainPurpose"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1429,7 +1481,9 @@
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiLocustPhaseId"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1462,11 +1516,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Spray_platform"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiSprPlatform"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1484,7 +1541,9 @@
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiSprPlatformA"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1502,7 +1561,9 @@
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiSprPlatformG"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1520,7 +1581,9 @@
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiSprPlatformH"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!--LinearLayout
|
||||
@ -1537,7 +1600,9 @@
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiSprCapacity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout-->
|
||||
|
||||
<LinearLayout
|
||||
@ -1618,11 +1683,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Barriers"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiSprBarrier"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!--LinearLayout
|
||||
@ -1708,12 +1776,15 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Ground_marking"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiSprMarking"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1749,12 +1820,15 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Type_of_assessed_biological_impact"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiTypeImpact"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -1817,12 +1891,15 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Method_of_biological_efficiency_estimation"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiEffMethod"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@ -1961,7 +2038,9 @@
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiOperatorExposedInsecticide"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -2088,7 +2167,9 @@
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiSafEmptyContainers"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout-->
|
||||
|
||||
<LinearLayout
|
||||
@ -2195,11 +2276,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Effect_on_non_target_organism"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiSafNonTarget"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -2252,8 +2336,8 @@
|
||||
android:id="@+id/spiSafIncident"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:minWidth="10dp" />
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
||||
@ -524,7 +524,7 @@
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
<EditText
|
||||
android:id="@+id/edtLatCenter"
|
||||
android:id="@+id/edtLatCenter2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
@ -545,7 +545,7 @@
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
<EditText
|
||||
android:id="@+id/edtLonCenter"
|
||||
android:id="@+id/edtLonCenter2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
@ -554,7 +554,7 @@
|
||||
android:inputType="numberDecimal" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnGetGPSCenter"
|
||||
android:id="@+id/btnGetGPSCenter2"
|
||||
style="@style/Widget.MaterialComponents.Button.Icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -568,7 +568,7 @@
|
||||
app:iconPadding="0dp"
|
||||
app:iconSize="24dp" />
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnDelGPSCenter"
|
||||
android:id="@+id/btnDelGPSCenter2"
|
||||
style="@style/Widget.MaterialComponents.Button.Icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -2175,6 +2175,12 @@
|
||||
android:text="@string/Flow_rate_of_sprayer_verified_during_this_monitoring_visit"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin">
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiCalibrConsumptionCheck"
|
||||
android:layout_width="match_parent"
|
||||
@ -2260,6 +2266,12 @@
|
||||
android:text="@string/Droplet_deposition_verified_during_this_monitoring_visit"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin">
|
||||
<dbfields.SpinnerDB
|
||||
android:id="@+id/spiCalibrPrecipitation"
|
||||
android:layout_width="match_parent"
|
||||
@ -2269,22 +2281,19 @@
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llCalibrWidthCard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin">
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Length_of_transect_set_out_with_oil_water_sensitive_papers_m"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin">
|
||||
<EditText
|
||||
android:id="@+id/edtCalibrWidthCard"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:importantForAutofill="no"
|
||||
@ -2292,7 +2301,9 @@
|
||||
android:ems="10"
|
||||
android:inputType="numberDecimal" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llCalibrWindSpeed"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin">
|
||||
@ -2312,6 +2323,7 @@
|
||||
android:inputType="numberDecimal" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/llCalibrDropletCoating"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin">
|
||||
@ -2331,6 +2343,7 @@
|
||||
android:inputType="numberDecimal" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/llCalibrPassesInterval"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin">
|
||||
@ -2618,7 +2631,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llEffTime2"
|
||||
android:id="@+id/llEffPassedTime2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin">
|
||||
@ -2628,7 +2641,7 @@
|
||||
android:text="@string/Time_after_treatment_hours"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
<EditText
|
||||
android:id="@+id/edtEffTime2"
|
||||
android:id="@+id/edtEffPassedTime2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
@ -3612,6 +3625,290 @@
|
||||
app:iconPadding="0dp"
|
||||
app:iconSize="24dp" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:divider="@drawable/spacer_medium"
|
||||
android:showDividers="middle"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin">
|
||||
<TextView
|
||||
android:id="@+id/tvImage1"
|
||||
android:maxLines="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Photos_of_the_treatment_situation_of_any_incidents"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
<EditText
|
||||
android:id="@+id/edtImage2"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:inputType="text"
|
||||
android:hint=""
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:enabled="false"
|
||||
android:focusable="false"/>
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnImage2"
|
||||
style="@style/Widget.MaterialComponents.Button.Icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:insetLeft="0dp"
|
||||
android:insetTop="0dp"
|
||||
android:insetRight="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:minWidth="40dp"
|
||||
app:icon="@drawable/ic_camera"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="0dp"
|
||||
app:iconSize="24dp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnShowImage2"
|
||||
style="@style/Widget.MaterialComponents.Button.Icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:insetLeft="0dp"
|
||||
android:insetTop="0dp"
|
||||
android:insetRight="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:minWidth="40dp"
|
||||
app:icon="@drawable/ic_photo"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="0dp"
|
||||
app:iconSize="24dp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnDelImage2"
|
||||
style="@style/Widget.MaterialComponents.Button.Icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:insetLeft="0dp"
|
||||
android:insetTop="0dp"
|
||||
android:insetRight="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:minWidth="40dp"
|
||||
app:icon="@drawable/ic_delete"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="0dp"
|
||||
app:iconSize="24dp" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:divider="@drawable/spacer_medium"
|
||||
android:showDividers="middle"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin">
|
||||
<TextView
|
||||
android:id="@+id/tvImage3"
|
||||
android:maxLines="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Photos_of_the_treatment_situation_of_any_incidents"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
<EditText
|
||||
android:id="@+id/edtImage3"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:inputType="text"
|
||||
android:hint=""
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:enabled="false"
|
||||
android:focusable="false"/>
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnImage3"
|
||||
style="@style/Widget.MaterialComponents.Button.Icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:insetLeft="0dp"
|
||||
android:insetTop="0dp"
|
||||
android:insetRight="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:minWidth="40dp"
|
||||
app:icon="@drawable/ic_camera"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="0dp"
|
||||
app:iconSize="24dp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnShowImage3"
|
||||
style="@style/Widget.MaterialComponents.Button.Icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:insetLeft="0dp"
|
||||
android:insetTop="0dp"
|
||||
android:insetRight="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:minWidth="40dp"
|
||||
app:icon="@drawable/ic_photo"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="0dp"
|
||||
app:iconSize="24dp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnDelImage3"
|
||||
style="@style/Widget.MaterialComponents.Button.Icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:insetLeft="0dp"
|
||||
android:insetTop="0dp"
|
||||
android:insetRight="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:minWidth="40dp"
|
||||
app:icon="@drawable/ic_delete"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="0dp"
|
||||
app:iconSize="24dp" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:divider="@drawable/spacer_medium"
|
||||
android:showDividers="middle"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin">
|
||||
<TextView
|
||||
android:id="@+id/tvImage4"
|
||||
android:maxLines="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Photos_of_the_treatment_situation_of_any_incidents"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
<EditText
|
||||
android:id="@+id/edtImage4"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:inputType="text"
|
||||
android:hint=""
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:enabled="false"
|
||||
android:focusable="false"/>
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnImage4"
|
||||
style="@style/Widget.MaterialComponents.Button.Icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:insetLeft="0dp"
|
||||
android:insetTop="0dp"
|
||||
android:insetRight="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:minWidth="40dp"
|
||||
app:icon="@drawable/ic_camera"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="0dp"
|
||||
app:iconSize="24dp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnShowImage4"
|
||||
style="@style/Widget.MaterialComponents.Button.Icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:insetLeft="0dp"
|
||||
android:insetTop="0dp"
|
||||
android:insetRight="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:minWidth="40dp"
|
||||
app:icon="@drawable/ic_photo"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="0dp"
|
||||
app:iconSize="24dp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnDelImage4"
|
||||
style="@style/Widget.MaterialComponents.Button.Icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:insetLeft="0dp"
|
||||
android:insetTop="0dp"
|
||||
android:insetRight="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:minWidth="40dp"
|
||||
app:icon="@drawable/ic_delete"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="0dp"
|
||||
app:iconSize="24dp" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:divider="@drawable/spacer_medium"
|
||||
android:showDividers="middle"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin">
|
||||
<TextView
|
||||
android:id="@+id/tvImage5"
|
||||
android:maxLines="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Photos_of_the_treatment_situation_of_any_incidents"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
<EditText
|
||||
android:id="@+id/edtImage5"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:inputType="text"
|
||||
android:hint=""
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:enabled="false"
|
||||
android:focusable="false"/>
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnImage5"
|
||||
style="@style/Widget.MaterialComponents.Button.Icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:insetLeft="0dp"
|
||||
android:insetTop="0dp"
|
||||
android:insetRight="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:minWidth="40dp"
|
||||
app:icon="@drawable/ic_camera"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="0dp"
|
||||
app:iconSize="24dp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnShowImage5"
|
||||
style="@style/Widget.MaterialComponents.Button.Icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:insetLeft="0dp"
|
||||
android:insetTop="0dp"
|
||||
android:insetRight="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:minWidth="40dp"
|
||||
app:icon="@drawable/ic_photo"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="0dp"
|
||||
app:iconSize="24dp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnDelImage5"
|
||||
style="@style/Widget.MaterialComponents.Button.Icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:insetLeft="0dp"
|
||||
android:insetTop="0dp"
|
||||
android:insetRight="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:minWidth="40dp"
|
||||
app:icon="@drawable/ic_delete"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="0dp"
|
||||
app:iconSize="24dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@ -20,7 +20,9 @@
|
||||
<Spinner
|
||||
android:id="@+id/spiList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView1"
|
||||
|
||||
@ -20,7 +20,9 @@
|
||||
<Spinner
|
||||
android:id="@+id/spiList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView1"
|
||||
|
||||
@ -19,7 +19,9 @@
|
||||
<Spinner
|
||||
android:id="@+id/spiList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SpinnerStyle"
|
||||
android:minHeight="@dimen/minHeight"/>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView1"
|
||||
|
||||
@ -407,7 +407,7 @@
|
||||
<string name="If_yes_describe_follow_up_actions">Если Да, опишите последующее действие(я)</string>
|
||||
<string name="Map_and_photos">Карта и фотографии</string>
|
||||
<string name="Was_a_situation_map_made_of_the_treatment">Была ли составлена ситуационная карта обработки?</string>
|
||||
<string name="Photos_of_the_treatment_situation_of_any_incidents">Фото ситуации, возникшей при обработке, любых инцидентов и т. д.</string>
|
||||
<string name="Photos_of_the_treatment_situation_of_any_incidents">Фото любых инцидентов</string>
|
||||
<string name="Risk_assessments">Оценки риска</string>
|
||||
<string name="Any_dwellings_or_housing_nearby_the_treatment">Имеются ли в непосредственной близости от обработок жилые дома или жилье (в радиусе 2 км вокруг обрабатываемого участка)</string>
|
||||
<string name="Distance_from_the_closest_edge_of_the_treated_area_m_to_the_nearest_housing">Расстояние от ближайшего края обрабатываемого участка (м) до ближайшего жилья:</string>
|
||||
|
||||
Reference in New Issue
Block a user