СДЕЛАЛ РЕЛИЗ НА GOOGLE PLAY

This commit is contained in:
Igor I
2024-08-19 13:26:37 +05:00
parent 8da3351cf9
commit 5ad16b6e35
13 changed files with 133 additions and 185 deletions

View File

@ -125,7 +125,7 @@ public class DbOpenHelper extends SQLiteOpenHelper
db.execSQL(sql);
//Список стран
sql = "create table if not exists Countries(" +
sql = "create table if not exists countries(" +
"id integer NOT NULL PRIMARY KEY," +
"uid text, " + //Уникальный идентификатор пока не используется но для распределенной базы будет использоваться
"del boolean NOT NULL DEFAULT 0," +
@ -135,7 +135,7 @@ public class DbOpenHelper extends SQLiteOpenHelper
db.execSQL(sql);
//Список регионов для стран
sql = "create table if not exists CountriesRegions(" +
sql = "create table if not exists countriesregions(" +
"id integer NOT NULL PRIMARY KEY," +
"uid text, " + //Уникальный идентификатор пока не используется но для распределенной базы будет использоваться
"del boolean NOT NULL DEFAULT 0," +
@ -151,7 +151,7 @@ public class DbOpenHelper extends SQLiteOpenHelper
db.execSQL(sql);
//Коордионаты границы для региона
/*sql = "create table if not exists CountriesRegionsPoints(" +
/*sql = "create table if not exists countriesregionspoints(" +
"id integer NOT NULL PRIMARY KEY AUTOINCREMENT," +
"uid text, " + //Уникальный идентификатор пока не используется но для распределенной базы будет использоваться
"del boolean NOT NULL DEFAULT 0," +
@ -164,7 +164,7 @@ public class DbOpenHelper extends SQLiteOpenHelper
db.execSQL(sql);*/
//Виды саранчи
sql = "create table if not exists LocustsTypes(" +
sql = "create table if not exists locuststypes(" +
"id integer NOT NULL PRIMARY KEY," +
"uid text, " + //Уникальный идентификатор пока не используется но для распределенной базы будет использоваться
"del boolean NOT NULL DEFAULT 0," +
@ -175,7 +175,7 @@ public class DbOpenHelper extends SQLiteOpenHelper
db.execSQL(sql);
//Справочник отрождения "Начало", "Массовое".
sql = "create table if not exists Borns(" +
sql = "create table if not exists borns(" +
"id integer NOT NULL PRIMARY KEY," +
"uid text, " + //Уникальный идентификатор пока не используется но для распределенной базы будет использоваться
"del boolean NOT NULL DEFAULT 0," +
@ -186,7 +186,7 @@ public class DbOpenHelper extends SQLiteOpenHelper
db.execSQL(sql);
//Справочник окрыление.
sql = "create table if not exists Fledgling(" +
sql = "create table if not exists fledgling(" +
"id integer NOT NULL PRIMARY KEY," +
"uid text, " + //Уникальный идентификатор пока не используется но для распределенной базы будет использоваться
"del boolean NOT NULL DEFAULT 0," +
@ -219,7 +219,7 @@ public class DbOpenHelper extends SQLiteOpenHelper
db.execSQL(sql);
//Опрыскиватели: "Трактор", "Самолёт" итд.
sql = "create table if not exists Sprayers(" +
sql = "create table if not exists sprayers(" +
"id integer NOT NULL PRIMARY KEY," +
"uid text, " + //Уникальный идентификатор пока не используется но для распределенной базы будет использоваться
"del boolean NOT NULL DEFAULT 0," +
@ -628,7 +628,7 @@ public class DbOpenHelper extends SQLiteOpenHelper
"insecticide_formulation_id integer," + //формуляция(1 - УМО, 2 - КЭ, 3 - др.)
"insecticide_dose float," + //норма расхода(л/га)
"insecticide_diluted_id integer," +
"insecticide_Proportion float," +
"insecticide_proportion float," +
"insecticide_rate float," + //расход рабочей жидкости(л/га)
"insecticide_used_volume float," + //Общий объем использованной рабочей жидкости (л)
"insecticide_number_spores float," + //Концентрация спор (/мл) (--------- В 2024 ссказали удалить поэтому не используется ---------)

View File

@ -48,6 +48,15 @@ public class LocustDelListActivity extends AppCompatActivity
public String android_id="";
private final Handler handler = new Handler();
private final Runnable runnable = new Runnable() {
@Override
public void run() {
updateList();
handler.postDelayed(this, 1000); // Раз в секунду
}
};
public void alert(String text)
{
AlertDialog.Builder adb = new AlertDialog.Builder(this,R.style.AlertDialogTheme);
@ -115,24 +124,7 @@ public class LocustDelListActivity extends AppCompatActivity
});
//Чтоб список обновлялся раз в минуту в соответствии с текущем фильтром (для наглядности отправки данных)
timer.scheduleAtFixedRate(new TimerTask()
{
@SuppressLint("HandlerLeak")
private Handler myHandle = new Handler() {
@Override
public void handleMessage(Message msg)
{
//onStart();
updateList();
}
};
@Override
public void run() {
myHandle.sendMessage(myHandle.obtainMessage());
}
}, 0, 1000 ); //Раз в секунду
handler.post(runnable); // Начинаем выполнение задачи
}
@Override
@ -623,8 +615,8 @@ public class LocustDelListActivity extends AppCompatActivity
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); //Отправленные
break;
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(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 and device_id='"+android_id+"'", null); //Все
//cursor = rdb.rawQuery("select uid, coalesce(district,'') || ' ' || coalesce(terrain,'') terrain, date from frmlocustdel where del=0", null); //Все
break;
}

View File

@ -46,6 +46,15 @@ public class LocustHealthListActivity extends AppCompatActivity
private Timer timer = new Timer();
public File file = null;
private final Handler handler = new Handler();
private final Runnable runnable = new Runnable() {
@Override
public void run() {
updateList();
handler.postDelayed(this, 1000); // Раз в секунду
}
};
public void alert(String text)
{
AlertDialog.Builder adb = new AlertDialog.Builder(this,R.style.AlertDialogTheme);
@ -112,24 +121,7 @@ public class LocustHealthListActivity extends AppCompatActivity
});*/
//Чтоб список обновлялся раз в минуту в соответствии с текущем фильтром (для наглядности отправки данных)
timer.scheduleAtFixedRate(new TimerTask()
{
@SuppressLint("HandlerLeak")
private Handler myHandle = new Handler() {
@Override
public void handleMessage(Message msg)
{
//onStart();
updateList();
}
};
@Override
public void run() {
myHandle.sendMessage(myHandle.obtainMessage());
}
}, 0, 1000 ); //Раз в секунду
handler.post(runnable); // Начинаем выполнение задачи
}
@Override

View File

@ -48,6 +48,15 @@ public class LocustListActivity extends AppCompatActivity
public File file = null;
//public int g_button=0;
private final Handler handler = new Handler();
private final Runnable runnable = new Runnable() {
@Override
public void run() {
updateList();
handler.postDelayed(this, 1000); // Раз в секунду
}
};
public void alert(String text)
{
AlertDialog.Builder adb = new AlertDialog.Builder(this,R.style.AlertDialogTheme);
@ -110,23 +119,7 @@ public class LocustListActivity extends AppCompatActivity
//Чтоб список обновлялся раз в минуту в соответствии с текущем фильтром (для наглядности отправки данных)
timer.scheduleAtFixedRate(new TimerTask()
{
@SuppressLint("HandlerLeak")
private Handler myHandle = new Handler() {
@Override
public void handleMessage(Message msg)
{
//onStart();
updateList();
}
};
@Override
public void run() {
myHandle.sendMessage(myHandle.obtainMessage());
}
}, 0, 1000 ); //Раз в минуту
handler.post(runnable); // Начинаем выполнение задачи
}
@Override

View File

@ -62,6 +62,47 @@ public class MainActivity extends Activity {
public int g_button=0;
private final Handler handler = new Handler();
private final Runnable runnable = new Runnable() {
@Override
public void run() {
//Если в справочнике нет ни одной записи то перезапускаем синхронизацию (иначе отображаем главное меню)
boolean exists=false;
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);
if (cursor.moveToFirst())
{
do
{
exists=true;
} while (cursor.moveToNext());
}
}catch(Exception e){
e.printStackTrace();
}finally{
if(cursor!=null){cursor.close();}
if(rdb!=null){ rdb.close(); }
}
dboh.close();
if(!exists) {
startService(new Intent(MainActivity.this, MainService.class).putExtra(MainService.PARAM_ACTION, "1"));
}else {
LinearLayout pBar = (LinearLayout)findViewById(R.id.pBar);
pBar.setVisibility(View.GONE);
LinearLayout form = (LinearLayout)findViewById(R.id.form);
form.setVisibility(View.VISIBLE);
}
handler.postDelayed(this, 1000*10); // Раз в 10 секунду
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -203,59 +244,15 @@ public class MainActivity extends Activity {
//e.printStackTrace();
Log.e("CCALM", "Error: ", e);
}
/*
LinearLayout pBar = (LinearLayout)findViewById(R.id.pBar);
pBar.setVisibility(View.GONE);
LinearLayout form = (LinearLayout)findViewById(R.id.form);
form.setVisibility(View.VISIBLE);
*/
//Для синхронизации справочников
timer.scheduleAtFixedRate(new TimerTask()
{
@SuppressLint("HandlerLeak")
private Handler myHandle = new Handler() {
@Override
public void handleMessage(Message msg)
{
//Если в справочнике нет ни одной записи то перезапускаем синхронизацию (иначе отображаем главное меню)
boolean exists=false;
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);
if (cursor.moveToFirst())
{
do
{
exists=true;
} while (cursor.moveToNext());
}
}catch(Exception e){
e.printStackTrace();
}finally{
if(cursor!=null){cursor.close();}
if(rdb!=null){ rdb.close(); }
}
dboh.close();
if(!exists) {
startService(new Intent(MainActivity.this, MainService.class).putExtra(MainService.PARAM_ACTION, "1"));
}else {
LinearLayout pBar = (LinearLayout)findViewById(R.id.pBar);
pBar.setVisibility(View.GONE);
LinearLayout form = (LinearLayout)findViewById(R.id.form);
form.setVisibility(View.VISIBLE);
}
}
};
@Override
public void run() {
myHandle.sendMessage(myHandle.obtainMessage());
}
}, 0, 1000 * 10 * 1 ); //Раз 10 секунд
//Подправлены переводы для грузинского и азербайджанского языка а также изменён размер фотографий на FullHD
handler.post(runnable); // Начинаем выполнение задачи
}
//Запрашиваю разрешения сдесь хотя GPS на другой форме использую

View File

@ -13,6 +13,9 @@ import android.util.Log;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* Служба пытается отправить новые данные каждые 5 мнут на сервере, если нет данных то не отправляет.
@ -25,13 +28,42 @@ public class MainService extends Service
public final static String PARAM_ACTION = "ACTION";
//NotificationManager m_nm; //http://startandroid.ru/ru/uroki/vse-uroki-spiskom/164-urok-99-service-uvedomlenija-notifications
private Timer timer = new Timer();
private Timer timerP = new Timer(); //Прогрес бар уведомлений
//private Timer timer = new Timer();
//private Timer timerP = new Timer(); //Прогрес бар уведомлений
MySynchronizationOld _syn = null;
public PendingIntent m_pi = null; //Слушатель прогрес бара
private final Handler handler = new Handler();
private final Runnable runnable = new Runnable() {
@Override
public void run() {
timerTic(false);
handler.postDelayed(this, 1000 * 60 * 5); // Повторять каждые 5 минут
}
};
private final Handler handlerP = new Handler();
private final Runnable runnableProgress = new Runnable() {
@Override
public void run() {
if (MainService.this.m_pi != null) {
int cnt = _syn.getCount();
Intent intent = new Intent().putExtra(SetupActivity.PARAM_RESULT, cnt);
try {
m_pi.send(MainService.this, SetupActivity.STATUS_FINISH, intent);
} catch (PendingIntent.CanceledException e) {
Log.e("CCALM", "Error: ", e);
}
}
// Повторяем запуск через 500 миллисекунд
handlerP.postDelayed(this, 500);
}
};
@Override
public void onCreate()
{
@ -43,45 +75,9 @@ public class MainService extends Service
_syn = new MySynchronizationOld(this);
timer.scheduleAtFixedRate(new TimerTask()
{
@SuppressLint("HandlerLeak")
private Handler myHandle = new Handler() {
@Override
public void handleMessage(Message msg)
{
timerTic(false);
}
};
handler.post(runnable); // Начинаем выполнение задачи
@Override
public void run() {
myHandle.sendMessage(myHandle.obtainMessage());
}
},0,1000 * 60 * 5 ); //Раз в 5 минут (либо отдельно при сохранении записи)
//Отображаем прогресс бар синхронизации в уведомлениях каждую секунду
timerP.scheduleAtFixedRate(new TimerTask()
{
@Override
public void run()
{
if(MainService.this.m_pi != null)
{
int cnt=_syn.getCount();
Intent intent = new Intent().putExtra(SetupActivity.PARAM_RESULT, cnt);
try
{
m_pi.send(MainService.this, SetupActivity.STATUS_FINISH, intent);
} catch (CanceledException e)
{
//e.printStackTrace();
Log.e("CCALM", "Error: ", e);
}
}
}
},0,500);
handlerP.post(runnableProgress); // Начинаем выполнение задачи
}
@Override