Order by distance
This commit is contained in:
75
.idea/caches/deviceStreaming.xml
generated
75
.idea/caches/deviceStreaming.xml
generated
@ -75,6 +75,18 @@
|
|||||||
<option name="screenX" value="1080" />
|
<option name="screenX" value="1080" />
|
||||||
<option name="screenY" value="2160" />
|
<option name="screenY" value="2160" />
|
||||||
</PersistentDeviceSelectionData>
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="34" />
|
||||||
|
<option name="brand" value="samsung" />
|
||||||
|
<option name="codename" value="a14m" />
|
||||||
|
<option name="id" value="a14m" />
|
||||||
|
<option name="labId" value="google" />
|
||||||
|
<option name="manufacturer" value="Samsung" />
|
||||||
|
<option name="name" value="SM-A145R" />
|
||||||
|
<option name="screenDensity" value="450" />
|
||||||
|
<option name="screenX" value="1080" />
|
||||||
|
<option name="screenY" value="2408" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
<PersistentDeviceSelectionData>
|
<PersistentDeviceSelectionData>
|
||||||
<option name="api" value="34" />
|
<option name="api" value="34" />
|
||||||
<option name="brand" value="samsung" />
|
<option name="brand" value="samsung" />
|
||||||
@ -124,19 +136,19 @@
|
|||||||
<option name="screenY" value="2340" />
|
<option name="screenY" value="2340" />
|
||||||
</PersistentDeviceSelectionData>
|
</PersistentDeviceSelectionData>
|
||||||
<PersistentDeviceSelectionData>
|
<PersistentDeviceSelectionData>
|
||||||
<option name="api" value="31" />
|
<option name="api" value="34" />
|
||||||
<option name="brand" value="samsung" />
|
<option name="brand" value="google" />
|
||||||
<option name="codename" value="a51" />
|
<option name="codename" value="akita" />
|
||||||
<option name="id" value="a51" />
|
<option name="id" value="akita" />
|
||||||
<option name="labId" value="google" />
|
<option name="labId" value="google" />
|
||||||
<option name="manufacturer" value="Samsung" />
|
<option name="manufacturer" value="Google" />
|
||||||
<option name="name" value="Galaxy A51" />
|
<option name="name" value="Pixel 8a" />
|
||||||
<option name="screenDensity" value="420" />
|
<option name="screenDensity" value="420" />
|
||||||
<option name="screenX" value="1080" />
|
<option name="screenX" value="1080" />
|
||||||
<option name="screenY" value="2400" />
|
<option name="screenY" value="2400" />
|
||||||
</PersistentDeviceSelectionData>
|
</PersistentDeviceSelectionData>
|
||||||
<PersistentDeviceSelectionData>
|
<PersistentDeviceSelectionData>
|
||||||
<option name="api" value="34" />
|
<option name="api" value="35" />
|
||||||
<option name="brand" value="google" />
|
<option name="brand" value="google" />
|
||||||
<option name="codename" value="akita" />
|
<option name="codename" value="akita" />
|
||||||
<option name="id" value="akita" />
|
<option name="id" value="akita" />
|
||||||
@ -342,6 +354,18 @@
|
|||||||
<option name="screenX" value="384" />
|
<option name="screenX" value="384" />
|
||||||
<option name="screenY" value="384" />
|
<option name="screenY" value="384" />
|
||||||
</PersistentDeviceSelectionData>
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="35" />
|
||||||
|
<option name="brand" value="motorola" />
|
||||||
|
<option name="codename" value="eqe" />
|
||||||
|
<option name="id" value="eqe" />
|
||||||
|
<option name="labId" value="google" />
|
||||||
|
<option name="manufacturer" value="Motorola" />
|
||||||
|
<option name="name" value="edge 50 pro" />
|
||||||
|
<option name="screenDensity" value="450" />
|
||||||
|
<option name="screenX" value="1220" />
|
||||||
|
<option name="screenY" value="2712" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
<PersistentDeviceSelectionData>
|
<PersistentDeviceSelectionData>
|
||||||
<option name="api" value="33" />
|
<option name="api" value="33" />
|
||||||
<option name="brand" value="google" />
|
<option name="brand" value="google" />
|
||||||
@ -548,6 +572,18 @@
|
|||||||
<option name="screenX" value="1008" />
|
<option name="screenX" value="1008" />
|
||||||
<option name="screenY" value="2244" />
|
<option name="screenY" value="2244" />
|
||||||
</PersistentDeviceSelectionData>
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="34" />
|
||||||
|
<option name="brand" value="motorola" />
|
||||||
|
<option name="codename" value="lion" />
|
||||||
|
<option name="id" value="lion" />
|
||||||
|
<option name="labId" value="google" />
|
||||||
|
<option name="manufacturer" value="Motorola" />
|
||||||
|
<option name="name" value="moto g04" />
|
||||||
|
<option name="screenDensity" value="280" />
|
||||||
|
<option name="screenX" value="720" />
|
||||||
|
<option name="screenY" value="1612" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
<PersistentDeviceSelectionData>
|
<PersistentDeviceSelectionData>
|
||||||
<option name="api" value="33" />
|
<option name="api" value="33" />
|
||||||
<option name="brand" value="google" />
|
<option name="brand" value="google" />
|
||||||
@ -560,6 +596,18 @@
|
|||||||
<option name="screenX" value="1080" />
|
<option name="screenX" value="1080" />
|
||||||
<option name="screenY" value="2400" />
|
<option name="screenY" value="2400" />
|
||||||
</PersistentDeviceSelectionData>
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="34" />
|
||||||
|
<option name="brand" value="motorola" />
|
||||||
|
<option name="codename" value="lyriq" />
|
||||||
|
<option name="id" value="lyriq" />
|
||||||
|
<option name="labId" value="google" />
|
||||||
|
<option name="manufacturer" value="Motorola" />
|
||||||
|
<option name="name" value="edge 40" />
|
||||||
|
<option name="screenDensity" value="400" />
|
||||||
|
<option name="screenX" value="1080" />
|
||||||
|
<option name="screenY" value="2400" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
<PersistentDeviceSelectionData>
|
<PersistentDeviceSelectionData>
|
||||||
<option name="api" value="34" />
|
<option name="api" value="34" />
|
||||||
<option name="brand" value="motorola" />
|
<option name="brand" value="motorola" />
|
||||||
@ -769,6 +817,19 @@
|
|||||||
<option name="screenX" value="1080" />
|
<option name="screenX" value="1080" />
|
||||||
<option name="screenY" value="2424" />
|
<option name="screenY" value="2424" />
|
||||||
</PersistentDeviceSelectionData>
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="36" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="tokay" />
|
||||||
|
<option name="default" value="true" />
|
||||||
|
<option name="id" value="tokay" />
|
||||||
|
<option name="labId" value="google" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel 9" />
|
||||||
|
<option name="screenDensity" value="420" />
|
||||||
|
<option name="screenX" value="1080" />
|
||||||
|
<option name="screenY" value="2424" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
<PersistentDeviceSelectionData>
|
<PersistentDeviceSelectionData>
|
||||||
<option name="api" value="34" />
|
<option name="api" value="34" />
|
||||||
<option name="brand" value="samsung" />
|
<option name="brand" value="samsung" />
|
||||||
|
|||||||
@ -606,16 +606,16 @@ public class LocustDelListActivity extends AppCompatActivity
|
|||||||
switch (spiList.getSelectedItemPosition())
|
switch (spiList.getSelectedItemPosition())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
cursor = rdb.rawQuery("select uid, coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocustdel where del=0 and filled!=1 and device_id='" + android_id + "'", null); //Не отправленные
|
cursor = rdb.rawQuery("select uid, coalesce(area,'') || ' ' || coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocustdel where del=0 and filled!=1 and device_id='" + android_id + "'", null); //Не отправленные
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
cursor = rdb.rawQuery("select uid, coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocustdel where del=0 and send=0 and filled=1 and device_id='"+android_id+"'", null); //Не отправленные
|
cursor = rdb.rawQuery("select uid, coalesce(area,'') || ' ' || coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocustdel where del=0 and send=0 and filled=1 and device_id='"+android_id+"'", null); //Не отправленные
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
cursor = rdb.rawQuery("select uid, coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocustdel where del=0 and send=1 and device_id='"+android_id+"'", null); //Отправленные
|
cursor = rdb.rawQuery("select uid, coalesce(area,'') || ' ' || coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocustdel where del=0 and send=1 and device_id='"+android_id+"'", null); //Отправленные
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cursor = rdb.rawQuery("select uid, coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocustdel where del=0 and device_id='"+android_id+"'", null); //Все
|
cursor = rdb.rawQuery("select uid, coalesce(area,'') || ' ' || coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocustdel where del=0 and device_id='"+android_id+"'", null); //Все
|
||||||
//cursor = rdb.rawQuery("select uid, coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocustdel where del=0", null); //Все
|
//cursor = rdb.rawQuery("select uid, coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocustdel where del=0", null); //Все
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,20 @@
|
|||||||
package kz.istt.locust;
|
package kz.istt.locust;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.location.Location;
|
||||||
|
import android.location.LocationListener;
|
||||||
|
import android.location.LocationManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@ -26,6 +34,7 @@ import android.widget.Spinner;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
@ -35,8 +44,14 @@ import java.util.Date;
|
|||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
public class LocustHealthListActivity extends AppCompatActivity
|
import dbfields.selectDB;
|
||||||
|
import tools.LatLonListener;
|
||||||
|
|
||||||
|
public class LocustHealthListActivity extends AppCompatActivity implements LocationListener, LatLonListener
|
||||||
{
|
{
|
||||||
|
private LocationManager _lm;
|
||||||
|
private double _lat = 0; // c GPS приёмника
|
||||||
|
private double _lon = 0; // c GPS приёмника
|
||||||
|
|
||||||
public LinearLayout llList;
|
public LinearLayout llList;
|
||||||
public MyButton btn;
|
public MyButton btn;
|
||||||
@ -122,6 +137,13 @@ public class LocustHealthListActivity extends AppCompatActivity
|
|||||||
|
|
||||||
//Чтоб список обновлялся раз в минуту в соответствии с текущем фильтром (для наглядности отправки данных)
|
//Чтоб список обновлялся раз в минуту в соответствии с текущем фильтром (для наглядности отправки данных)
|
||||||
handler.post(runnable); // Начинаем выполнение задачи
|
handler.post(runnable); // Начинаем выполнение задачи
|
||||||
|
|
||||||
|
// Чтоб слушать GPS (в конце метода чтобы успели присвоиться GUI компоненты локальным переменным)
|
||||||
|
_lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||||
|
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 500, 1, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -601,14 +623,28 @@ public class LocustHealthListActivity extends AppCompatActivity
|
|||||||
try {
|
try {
|
||||||
rdb = dboh.getReadableDatabase();
|
rdb = dboh.getReadableDatabase();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
_lat = location.getLatitude();
|
||||||
|
_lon = location.getLongitude();
|
||||||
|
|
||||||
|
SELECT *,
|
||||||
|
((latitude - ?) * (latitude - ?) + (longitude - ?) * (longitude - ?)) AS distance
|
||||||
|
FROM locations
|
||||||
|
ORDER BY distance ASC;
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
switch (spiList.getSelectedItemPosition())
|
switch (spiList.getSelectedItemPosition())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
cursor = rdb.rawQuery("""
|
cursor = rdb.rawQuery("""
|
||||||
select
|
select
|
||||||
|
ld.seq,
|
||||||
ld.uid as frmlocustdel_uid,
|
ld.uid as frmlocustdel_uid,
|
||||||
lh.uid as frmlocusthealth_uid,
|
lh.uid as frmlocusthealth_uid,
|
||||||
coalesce(ld.district,'') || ' ' || coalesce(ld.terrain,'') terrain,
|
coalesce(ld.area,'') || ' ' || coalesce(ld.district,'') || ' ' || coalesce(ld.terrain,'') terrain,
|
||||||
lh.date,
|
lh.date,
|
||||||
EXISTS(select 1 from frmlocusthealth where frmlocustdel_uid=ld.uid) as health
|
EXISTS(select 1 from frmlocusthealth where frmlocustdel_uid=ld.uid) as health
|
||||||
from
|
from
|
||||||
@ -617,14 +653,16 @@ public class LocustHealthListActivity extends AppCompatActivity
|
|||||||
where
|
where
|
||||||
lh.del=0
|
lh.del=0
|
||||||
and lh.filled!=1
|
and lh.filled!=1
|
||||||
|
order by ld.seq desc
|
||||||
""", null); //Не отправленные
|
""", null); //Не отправленные
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
cursor = rdb.rawQuery("""
|
cursor = rdb.rawQuery("""
|
||||||
select
|
select
|
||||||
|
ld.seq,
|
||||||
ld.uid as frmlocustdel_uid,
|
ld.uid as frmlocustdel_uid,
|
||||||
lh.uid as frmlocusthealth_uid,
|
lh.uid as frmlocusthealth_uid,
|
||||||
coalesce(ld.district,'') || ' ' || coalesce(ld.terrain,'') terrain,
|
coalesce(ld.area,'') || ' ' || coalesce(ld.district,'') || ' ' || coalesce(ld.terrain,'') terrain,
|
||||||
lh.date,
|
lh.date,
|
||||||
EXISTS(select 1 from frmlocusthealth where frmlocustdel_uid=ld.uid) as health
|
EXISTS(select 1 from frmlocusthealth where frmlocustdel_uid=ld.uid) as health
|
||||||
from
|
from
|
||||||
@ -634,14 +672,16 @@ public class LocustHealthListActivity extends AppCompatActivity
|
|||||||
lh.del=0
|
lh.del=0
|
||||||
and lh.send=0
|
and lh.send=0
|
||||||
and lh.filled=1
|
and lh.filled=1
|
||||||
|
order by ld.seq desc
|
||||||
""", null); //Не отправленные
|
""", null); //Не отправленные
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
cursor = rdb.rawQuery("""
|
cursor = rdb.rawQuery("""
|
||||||
select
|
select
|
||||||
|
ld.seq,
|
||||||
ld.uid as frmlocustdel_uid,
|
ld.uid as frmlocustdel_uid,
|
||||||
lh.uid as frmlocusthealth_uid,
|
lh.uid as frmlocusthealth_uid,
|
||||||
coalesce(ld.district,'') || ' ' || coalesce(ld.terrain,'') terrain,
|
coalesce(ld.area,'') || ' ' || coalesce(ld.district,'') || ' ' || coalesce(ld.terrain,'') terrain,
|
||||||
lh.date,
|
lh.date,
|
||||||
EXISTS(select 1 from frmlocusthealth where frmlocustdel_uid=ld.uid) as health
|
EXISTS(select 1 from frmlocusthealth where frmlocustdel_uid=ld.uid) as health
|
||||||
from
|
from
|
||||||
@ -650,21 +690,58 @@ public class LocustHealthListActivity extends AppCompatActivity
|
|||||||
where
|
where
|
||||||
lh.del=0
|
lh.del=0
|
||||||
and lh.send=1
|
and lh.send=1
|
||||||
|
order by ld.seq desc
|
||||||
""", null); //Отправленные
|
""", null); //Отправленные
|
||||||
break;
|
break;
|
||||||
default:
|
default: {
|
||||||
|
|
||||||
|
String prefName = "Distance";
|
||||||
|
SharedPreferences prefs = getSharedPreferences("CommonPrefs", Activity.MODE_PRIVATE);
|
||||||
|
String checked = prefs.getString(prefName, "");
|
||||||
|
if(checked.isEmpty() || checked.equals("1")) {
|
||||||
|
String[] selectionArgs = new String[]{
|
||||||
|
String.valueOf(_lat),
|
||||||
|
String.valueOf(_lat),
|
||||||
|
String.valueOf(_lon),
|
||||||
|
String.valueOf(_lon)
|
||||||
|
};
|
||||||
cursor = rdb.rawQuery("""
|
cursor = rdb.rawQuery("""
|
||||||
|
|
||||||
select
|
select
|
||||||
|
ld.seq,
|
||||||
ld.uid as frmlocustdel_uid,
|
ld.uid as frmlocustdel_uid,
|
||||||
lh.uid as frmlocusthealth_uid,
|
lh.uid as frmlocusthealth_uid,
|
||||||
coalesce(ld.district,'') || ' ' || coalesce(ld.terrain,'') terrain,
|
coalesce(ld.area,'') || ' ' || coalesce(ld.district,'') || ' ' || coalesce(ld.terrain,'') terrain,
|
||||||
|
coalesce(lh.date,ld.date) as date,
|
||||||
|
EXISTS(select 1 from frmlocusthealth where frmlocustdel_uid=ld.uid) as health,
|
||||||
|
((ld.lat_center - ?) * (ld.lat_center - ?) + (ld.lon_center - ?) * (ld.lon_center - ?)) AS distance
|
||||||
|
from
|
||||||
|
frmlocustdel ld
|
||||||
|
left join frmlocusthealth lh on lh.frmlocustdel_uid=ld.uid
|
||||||
|
where
|
||||||
|
ld.del=0
|
||||||
|
and ld.filled=1
|
||||||
|
order by distance, ld.seq desc
|
||||||
|
""", selectionArgs); //Все
|
||||||
|
}else{
|
||||||
|
cursor = rdb.rawQuery("""
|
||||||
|
select
|
||||||
|
ld.seq,
|
||||||
|
ld.uid as frmlocustdel_uid,
|
||||||
|
lh.uid as frmlocusthealth_uid,
|
||||||
|
coalesce(ld.area,'') || ' ' || coalesce(ld.district,'') || ' ' || coalesce(ld.terrain,'') terrain,
|
||||||
coalesce(lh.date,ld.date) as date,
|
coalesce(lh.date,ld.date) as date,
|
||||||
EXISTS(select 1 from frmlocusthealth where frmlocustdel_uid=ld.uid) as health
|
EXISTS(select 1 from frmlocusthealth where frmlocustdel_uid=ld.uid) as health
|
||||||
from
|
from
|
||||||
frmlocustdel ld
|
frmlocustdel ld
|
||||||
left join frmlocusthealth lh on lh.frmlocustdel_uid=ld.uid
|
left join frmlocusthealth lh on lh.frmlocustdel_uid=ld.uid
|
||||||
where ld.del=0 and ld.filled=1
|
where
|
||||||
|
ld.del=0
|
||||||
|
and ld.filled=1
|
||||||
|
order by ld.seq desc
|
||||||
""", null); //Все
|
""", null); //Все
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,4 +856,21 @@ public class LocustHealthListActivity extends AppCompatActivity
|
|||||||
dboh.close();
|
dboh.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLocationChanged(Location location)
|
||||||
|
{
|
||||||
|
_lat = location.getLatitude(); // от устройства
|
||||||
|
_lon = location.getLongitude(); // от устройства
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getLat() {
|
||||||
|
return this._lat;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getLon() {
|
||||||
|
return this._lon;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -583,19 +583,19 @@ public class LocustListActivity extends AppCompatActivity
|
|||||||
switch (spiList.getSelectedItemPosition())
|
switch (spiList.getSelectedItemPosition())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
sql = "select uid, coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocust where del=0 and filled!=1";
|
sql = "select uid, coalesce(area,'') || ' ' || coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocust where del=0 and filled!=1";
|
||||||
cursor = rdb.rawQuery(sql, null); //Не заполненые
|
cursor = rdb.rawQuery(sql, null); //Не заполненые
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
sql = "select uid, coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocust where del=0 and send=0 and filled=1";
|
sql = "select uid, coalesce(area,'') || ' ' || coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocust where del=0 and send=0 and filled=1";
|
||||||
cursor = rdb.rawQuery(sql, null); //Не отправленные
|
cursor = rdb.rawQuery(sql, null); //Не отправленные
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
sql = "select uid, coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocust where del=0 and send=1";
|
sql = "select uid, coalesce(area,'') || ' ' || coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocust where del=0 and send=1";
|
||||||
cursor = rdb.rawQuery(sql, null); //Отправленные
|
cursor = rdb.rawQuery(sql, null); //Отправленные
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sql = "select uid, coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocust where del=0";
|
sql = "select uid, coalesce(area,'') || ' ' || coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocust where del=0";
|
||||||
cursor = rdb.rawQuery(sql, null); //Все
|
cursor = rdb.rawQuery(sql, null); //Все
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,6 +66,8 @@ public class SetupActivity extends Activity {
|
|||||||
public EditText edtURL = null;
|
public EditText edtURL = null;
|
||||||
public EditText edtSyncDays = null;
|
public EditText edtSyncDays = null;
|
||||||
public CheckBox cbIdentifyCountryRegion = null;
|
public CheckBox cbIdentifyCountryRegion = null;
|
||||||
|
public CheckBox cbOrderByDistance = null;
|
||||||
|
|
||||||
public CheckBox cbShowAdvancedSettings = null;
|
public CheckBox cbShowAdvancedSettings = null;
|
||||||
|
|
||||||
public final static int TASK1_CODE = 1;
|
public final static int TASK1_CODE = 1;
|
||||||
@ -292,11 +294,40 @@ public class SetupActivity extends Activity {
|
|||||||
editor.putString(prefName, "1"); //Default value
|
editor.putString(prefName, "1"); //Default value
|
||||||
else
|
else
|
||||||
editor.putString(prefName, "0");
|
editor.putString(prefName, "0");
|
||||||
editor.commit();
|
editor.apply();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
cbIdentifyCountryRegion.setOnClickListener(oclBtnId);
|
cbIdentifyCountryRegion.setOnClickListener(oclBtnId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cbOrderByDistance = (CheckBox) findViewById(R.id.cbOrderByDistance);
|
||||||
|
|
||||||
|
prefName = "Distance";
|
||||||
|
prefs = getSharedPreferences("CommonPrefs", Activity.MODE_PRIVATE);
|
||||||
|
checked = prefs.getString(prefName, "");
|
||||||
|
if(checked.equals("") || checked.equals("1"))
|
||||||
|
cbOrderByDistance.setChecked(true);
|
||||||
|
else
|
||||||
|
cbOrderByDistance.setChecked(false);
|
||||||
|
|
||||||
|
oclBtnId = new OnClickListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onClick(View v)
|
||||||
|
{
|
||||||
|
String prefName = "Distance";
|
||||||
|
SharedPreferences prefs = getSharedPreferences("CommonPrefs", Activity.MODE_PRIVATE);
|
||||||
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
|
if(cbOrderByDistance.isChecked())
|
||||||
|
editor.putString(prefName, "1"); //Default value
|
||||||
|
else
|
||||||
|
editor.putString(prefName, "0");
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
cbOrderByDistance.setOnClickListener(oclBtnId);
|
||||||
|
|
||||||
//Кнопка для сканирования QR кода
|
//Кнопка для сканирования QR кода
|
||||||
btnQR = (Button) findViewById(R.id.btnQR);
|
btnQR = (Button) findViewById(R.id.btnQR);
|
||||||
OnClickListener oclBtnQR = new OnClickListener()
|
OnClickListener oclBtnQR = new OnClickListener()
|
||||||
|
|||||||
@ -201,6 +201,11 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/Identify_country_region" />
|
android:text="@string/Identify_country_region" />
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/cbOrderByDistance"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/Sort_lists_by_distance" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@ -311,6 +311,7 @@
|
|||||||
<string name="Egg_pods_density_m2_to">Küpəciklərin sıxlığı/m² əvvəl</string>
|
<string name="Egg_pods_density_m2_to">Küpəciklərin sıxlığı/m² əvvəl</string>
|
||||||
<string name="Hopper_density_m2_from">Sürfələrin sıxlığı/m² ilə</string>
|
<string name="Hopper_density_m2_from">Sürfələrin sıxlığı/m² ilə</string>
|
||||||
<string name="Hopper_density_m2_to">Sürfələrin sıxlığı/m²</string>
|
<string name="Hopper_density_m2_to">Sürfələrin sıxlığı/m²</string>
|
||||||
|
<string name="Sort_lists_by_distance">Siyahıları məsafəyə görə sıralayın</string>
|
||||||
<string name="Please_activate_GPS">Zəhmət olmasa GPS-i aktivləşdirin</string>
|
<string name="Please_activate_GPS">Zəhmət olmasa GPS-i aktivləşdirin</string>
|
||||||
<string name="Authorize_the_tablet_by_QR_code">Planşetə QR kodu ilə icazə verin</string>
|
<string name="Authorize_the_tablet_by_QR_code">Planşetə QR kodu ilə icazə verin</string>
|
||||||
<string name="Responsible_person_inspector">Planşet üzrə məsul şəxs-müfəttiş</string>
|
<string name="Responsible_person_inspector">Planşet üzrə məsul şəxs-müfəttiş</string>
|
||||||
|
|||||||
@ -322,6 +322,7 @@
|
|||||||
<string name="Egg_pods_density_m2_to">"Ձվապարկեր (խտություն /մ2) նախքան "</string>
|
<string name="Egg_pods_density_m2_to">"Ձվապարկեր (խտություն /մ2) նախքան "</string>
|
||||||
<string name="Hopper_density_m2_from">թրթուրների խտությունը (/մ²) հետ</string>
|
<string name="Hopper_density_m2_from">թրթուրների խտությունը (/մ²) հետ</string>
|
||||||
<string name="Hopper_density_m2_to">թրթուրների խտությունը (/մ²) հետ</string>
|
<string name="Hopper_density_m2_to">թրթուրների խտությունը (/մ²) հետ</string>
|
||||||
|
<string name="Sort_lists_by_distance">Դասավորել ցուցակները հեռավորության համաձայն</string>
|
||||||
<string name="Please_activate_GPS">"Խնդրում ենք ակտիվացնել GPS-ը "</string>
|
<string name="Please_activate_GPS">"Խնդրում ենք ակտիվացնել GPS-ը "</string>
|
||||||
<string name="Authorize_the_tablet_by_QR_code">Լիազորեք պլանշետը QR կոդով</string>
|
<string name="Authorize_the_tablet_by_QR_code">Լիազորեք պլանշետը QR կոդով</string>
|
||||||
<string name="Responsible_person_inspector">Պատասխանատու անձ (պլանշետի համար)</string>
|
<string name="Responsible_person_inspector">Պատասխանատու անձ (պլանշետի համար)</string>
|
||||||
|
|||||||
@ -313,6 +313,7 @@
|
|||||||
<string name="Egg_pods_density_m2_to">"პარკუჭანები (სიმჭიდროვე/მ²) ადრე "</string>
|
<string name="Egg_pods_density_m2_to">"პარკუჭანები (სიმჭიდროვე/მ²) ადრე "</string>
|
||||||
<string name="Hopper_density_m2_from">მატლების სიმჭიდროვე (მ²) თან</string>
|
<string name="Hopper_density_m2_from">მატლების სიმჭიდროვე (მ²) თან</string>
|
||||||
<string name="Hopper_density_m2_to">მატლების სიმჭიდროვე (მ²) ადრე</string>
|
<string name="Hopper_density_m2_to">მატლების სიმჭიდროვე (მ²) ადრე</string>
|
||||||
|
<string name="Sort_lists_by_distance">სიების დახარისხება მანძილის მიხედვით</string>
|
||||||
<string name="Please_activate_GPS">"გთხოვთ გააქტიუროთ GPS "</string>
|
<string name="Please_activate_GPS">"გთხოვთ გააქტიუროთ GPS "</string>
|
||||||
<string name="Authorize_the_tablet_by_QR_code">ტაბლეტის ავტორიზაცია QR კოდით</string>
|
<string name="Authorize_the_tablet_by_QR_code">ტაბლეტის ავტორიზაცია QR კოდით</string>
|
||||||
<string name="Responsible_person_inspector">პასუხისმგებელი პირის ინსპექტორი</string>
|
<string name="Responsible_person_inspector">პასუხისმგებელი პირის ინსპექტორი</string>
|
||||||
|
|||||||
@ -316,6 +316,7 @@
|
|||||||
<string name="Egg_pods_density_m2_to">Кубышкалар жыштыгы (/м²) мурун</string>
|
<string name="Egg_pods_density_m2_to">Кубышкалар жыштыгы (/м²) мурун</string>
|
||||||
<string name="Hopper_density_m2_from">Личинкалардын жыштыгы (/м²) менен</string>
|
<string name="Hopper_density_m2_from">Личинкалардын жыштыгы (/м²) менен</string>
|
||||||
<string name="Hopper_density_m2_to">"Личинкалардын жыштыгы (/м²) мурун "</string>
|
<string name="Hopper_density_m2_to">"Личинкалардын жыштыгы (/м²) мурун "</string>
|
||||||
|
<string name="Sort_lists_by_distance">Тизмелерди аралыктары боюнча иреттөө</string>
|
||||||
<string name="Please_activate_GPS">GPSти иштетиңиз</string>
|
<string name="Please_activate_GPS">GPSти иштетиңиз</string>
|
||||||
<string name="Authorize_the_tablet_by_QR_code">Планшетке QR коду аркылуу уруксат бериңиз</string>
|
<string name="Authorize_the_tablet_by_QR_code">Планшетке QR коду аркылуу уруксат бериңиз</string>
|
||||||
<string name="Responsible_person_inspector">Планшет үчүн жооптуу (инспектор)</string>
|
<string name="Responsible_person_inspector">Планшет үчүн жооптуу (инспектор)</string>
|
||||||
|
|||||||
@ -320,6 +320,7 @@
|
|||||||
<string name="Egg_pods_density_m2_to">Күбіршектер (тығыздығы/м²) бұрын</string>
|
<string name="Egg_pods_density_m2_to">Күбіршектер (тығыздығы/м²) бұрын</string>
|
||||||
<string name="Hopper_density_m2_from">Дернәсілдердің тығыздығы (/м²) бірге</string>
|
<string name="Hopper_density_m2_from">Дернәсілдердің тығыздығы (/м²) бірге</string>
|
||||||
<string name="Hopper_density_m2_to">"Дернәсілдердің тығыздығы (/м²) бұрын "</string>
|
<string name="Hopper_density_m2_to">"Дернәсілдердің тығыздығы (/м²) бұрын "</string>
|
||||||
|
<string name="Sort_lists_by_distance">Тізімдерді қашықтық бойынша сұрыптау</string>
|
||||||
<string name="Please_activate_GPS">GPS-ті іске қосыңыз</string>
|
<string name="Please_activate_GPS">GPS-ті іске қосыңыз</string>
|
||||||
<string name="Authorize_the_tablet_by_QR_code">Планшетке QR коды арқылы рұқсат беріңіз</string>
|
<string name="Authorize_the_tablet_by_QR_code">Планшетке QR коды арқылы рұқсат беріңіз</string>
|
||||||
<string name="Responsible_person_inspector">Планшетке жауапты тұлға (инспектор)</string>
|
<string name="Responsible_person_inspector">Планшетке жауапты тұлға (инспектор)</string>
|
||||||
|
|||||||
@ -291,6 +291,7 @@
|
|||||||
<string name="Egg_pods_density_m2_to">تعداد زه ملخ (نیچه) در متر مربع از</string>
|
<string name="Egg_pods_density_m2_to">تعداد زه ملخ (نیچه) در متر مربع از</string>
|
||||||
<string name="Hopper_density_m2_from">تراکم مچک ( / متر مربع ) سره</string>
|
<string name="Hopper_density_m2_from">تراکم مچک ( / متر مربع ) سره</string>
|
||||||
<string name="Hopper_density_m2_to">"تراکم مچک ( / متر مربع ) مخکې "</string>
|
<string name="Hopper_density_m2_to">"تراکم مچک ( / متر مربع ) مخکې "</string>
|
||||||
|
<string name="Sort_lists_by_distance">لیستونه د واټن له مخې ترتیب کړئ</string>
|
||||||
<string name="Please_activate_GPS">مهرباني وکړئ GPS فعال کړئ</string>
|
<string name="Please_activate_GPS">مهرباني وکړئ GPS فعال کړئ</string>
|
||||||
<string name="Authorize_the_tablet_by_QR_code">تابلیت تان را ذریعه کیوآر کود اختیار نمائید</string>
|
<string name="Authorize_the_tablet_by_QR_code">تابلیت تان را ذریعه کیوآر کود اختیار نمائید</string>
|
||||||
<string name="Responsible_person_inspector">شخص مسئول تفتیش</string>
|
<string name="Responsible_person_inspector">شخص مسئول تفتیش</string>
|
||||||
|
|||||||
@ -333,6 +333,7 @@
|
|||||||
<string name="Egg_pods_density_m2_to">Плотность кубышек (/м²) до</string>
|
<string name="Egg_pods_density_m2_to">Плотность кубышек (/м²) до</string>
|
||||||
<string name="Hopper_density_m2_from">Плотность личинок (/м²) от</string>
|
<string name="Hopper_density_m2_from">Плотность личинок (/м²) от</string>
|
||||||
<string name="Hopper_density_m2_to">Плотность личинок (/м²) до</string>
|
<string name="Hopper_density_m2_to">Плотность личинок (/м²) до</string>
|
||||||
|
<string name="Sort_lists_by_distance">Сортировать списки по расстоянию</string>
|
||||||
<string name="Please_activate_GPS">Пожалуйста активируйте GPS</string>
|
<string name="Please_activate_GPS">Пожалуйста активируйте GPS</string>
|
||||||
<string name="Authorize_the_tablet_by_QR_code">Авторизовать планшет по QR коду</string>
|
<string name="Authorize_the_tablet_by_QR_code">Авторизовать планшет по QR коду</string>
|
||||||
|
|
||||||
|
|||||||
@ -324,6 +324,7 @@
|
|||||||
<string name="Egg_pods_density_m2_to">Кузачаҳо ( зиччи м2) пеш</string>
|
<string name="Egg_pods_density_m2_to">Кузачаҳо ( зиччи м2) пеш</string>
|
||||||
<string name="Hopper_density_m2_from">Зичии кирминаҳо (/м2) бо</string>
|
<string name="Hopper_density_m2_from">Зичии кирминаҳо (/м2) бо</string>
|
||||||
<string name="Hopper_density_m2_to">Зичии кирминаҳо (/м2) пеш</string>
|
<string name="Hopper_density_m2_to">Зичии кирминаҳо (/м2) пеш</string>
|
||||||
|
<string name="Sort_lists_by_distance">Рӯйхатҳоро аз рӯи масофа ҷудо кунед</string>
|
||||||
<string name="Please_activate_GPS">Лутфан GPS-ро фаъол созед</string>
|
<string name="Please_activate_GPS">Лутфан GPS-ро фаъол созед</string>
|
||||||
<string name="Authorize_the_tablet_by_QR_code">Ба планшет тавассути рамзи QR иҷозат диҳед</string>
|
<string name="Authorize_the_tablet_by_QR_code">Ба планшет тавассути рамзи QR иҷозат диҳед</string>
|
||||||
<string name="Responsible_person_inspector">Шахси масъули планшет</string>
|
<string name="Responsible_person_inspector">Шахси масъули планшет</string>
|
||||||
|
|||||||
@ -324,6 +324,7 @@
|
|||||||
<string name="Egg_pods_density_m2_to">Ýumurtgaly küýzejikler ýada kubyşkalar (gürlügi/m²) çenli</string>
|
<string name="Egg_pods_density_m2_to">Ýumurtgaly küýzejikler ýada kubyşkalar (gürlügi/m²) çenli</string>
|
||||||
<string name="Hopper_density_m2_from">Liçinkalaryň gürlügi (/m²) dan</string>
|
<string name="Hopper_density_m2_from">Liçinkalaryň gürlügi (/m²) dan</string>
|
||||||
<string name="Hopper_density_m2_to">Liçinkalaryň gürlügi (/m²) çenli</string>
|
<string name="Hopper_density_m2_to">Liçinkalaryň gürlügi (/m²) çenli</string>
|
||||||
|
<string name="Sort_lists_by_distance">Sanawlary uzaklyk boýunça tertipläň</string>
|
||||||
<string name="Please_activate_GPS">GPS-i işjeňleşdirmegiňizi haýyş edýäris</string>
|
<string name="Please_activate_GPS">GPS-i işjeňleşdirmegiňizi haýyş edýäris</string>
|
||||||
<string name="Authorize_the_tablet_by_QR_code">Planşedi QR kody bilen ygtyýarlandyryň</string>
|
<string name="Authorize_the_tablet_by_QR_code">Planşedi QR kody bilen ygtyýarlandyryň</string>
|
||||||
<string name="Responsible_person_inspector">Planşet boýunça jogapkär adam</string>
|
<string name="Responsible_person_inspector">Planşet boýunça jogapkär adam</string>
|
||||||
|
|||||||
@ -325,6 +325,7 @@
|
|||||||
<string name="Egg_pods_density_m2_to">Ko\'zachalar zichligi (ta/m²) oldin</string>
|
<string name="Egg_pods_density_m2_to">Ko\'zachalar zichligi (ta/m²) oldin</string>
|
||||||
<string name="Hopper_density_m2_from">Lichinkalar zichligi (ta/m²) bilan</string>
|
<string name="Hopper_density_m2_from">Lichinkalar zichligi (ta/m²) bilan</string>
|
||||||
<string name="Hopper_density_m2_to">Lichinkalar zichligi (ta/m²) oldin</string>
|
<string name="Hopper_density_m2_to">Lichinkalar zichligi (ta/m²) oldin</string>
|
||||||
|
<string name="Sort_lists_by_distance">Roʻyxatlarni masofa boʻyicha tartiblang</string>
|
||||||
<string name="Please_activate_GPS">Iltimos, GPSni faollashtiring</string>
|
<string name="Please_activate_GPS">Iltimos, GPSni faollashtiring</string>
|
||||||
<string name="Authorize_the_tablet_by_QR_code">Planshetga QR kod orqali avtorizatsiya qiling</string>
|
<string name="Authorize_the_tablet_by_QR_code">Planshetga QR kod orqali avtorizatsiya qiling</string>
|
||||||
<string name="Responsible_person_inspector">Planshet uchun javobgar shaxs</string>
|
<string name="Responsible_person_inspector">Planshet uchun javobgar shaxs</string>
|
||||||
|
|||||||
@ -332,6 +332,7 @@
|
|||||||
<string name="title_activity_maps">Map</string>
|
<string name="title_activity_maps">Map</string>
|
||||||
<string name="Show_map">Show map</string>
|
<string name="Show_map">Show map</string>
|
||||||
<string name="Identify_country_region">Locate your country and region by GPS</string>
|
<string name="Identify_country_region">Locate your country and region by GPS</string>
|
||||||
|
<string name="Sort_lists_by_distance">Sort lists by distance</string>
|
||||||
<string name="Please_activate_GPS">Please activate GPS</string>
|
<string name="Please_activate_GPS">Please activate GPS</string>
|
||||||
<string name="Authorize_the_tablet_by_QR_code">Authorize the tablet by QR code</string>
|
<string name="Authorize_the_tablet_by_QR_code">Authorize the tablet by QR code</string>
|
||||||
<string name="Responsible_person_inspector">Responsible person for the tablet (inspector)</string>
|
<string name="Responsible_person_inspector">Responsible person for the tablet (inspector)</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user