Правка даты в списке анкет обследования саранчи
This commit is contained in:
@ -13,8 +13,8 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "kz.istt.locust"
|
applicationId "kz.istt.locust"
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
versionCode 101
|
versionCode 102
|
||||||
versionName "3.0.0"
|
versionName "3.0.1"
|
||||||
targetSdkVersion 34
|
targetSdkVersion 34
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -702,7 +702,6 @@ public class LocustHealthListActivity extends AppCompatActivity
|
|||||||
btn = new MyButton(this);
|
btn = new MyButton(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
btn.setOnClickListener(oclBtn);
|
btn.setOnClickListener(oclBtn);
|
||||||
|
|
||||||
btn.uid1 = cursor.getString(cursor.getColumnIndex("frmlocustdel_uid"));
|
btn.uid1 = cursor.getString(cursor.getColumnIndex("frmlocustdel_uid"));
|
||||||
|
|||||||
@ -29,6 +29,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -57,7 +58,7 @@ public class LocustListActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public void alert(String text)
|
/*public void alert(String text)
|
||||||
{
|
{
|
||||||
AlertDialog.Builder adb = new AlertDialog.Builder(this,R.style.AlertDialogTheme);
|
AlertDialog.Builder adb = new AlertDialog.Builder(this,R.style.AlertDialogTheme);
|
||||||
adb.setTitle(getString(R.string.Warning));
|
adb.setTitle(getString(R.string.Warning));
|
||||||
@ -70,7 +71,7 @@ public class LocustListActivity extends AppCompatActivity
|
|||||||
});
|
});
|
||||||
AlertDialog ad = adb.show();
|
AlertDialog ad = adb.show();
|
||||||
ad.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.BLACK);
|
ad.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.BLACK);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState)
|
protected void onCreate(Bundle savedInstanceState)
|
||||||
@ -623,9 +624,23 @@ public class LocustListActivity extends AppCompatActivity
|
|||||||
|
|
||||||
btn.uid1 = cursor.getString(cursor.getColumnIndex("uid"));
|
btn.uid1 = cursor.getString(cursor.getColumnIndex("uid"));
|
||||||
|
|
||||||
long dv = cursor.getLong(cursor.getColumnIndex("date")) * (long) 1000; // its need to be in milisecond
|
// Преобразует с учётом временой зоны (пример long dv = 946684800L * 1000L; //2000 ный по гринвичу дало 6 утра)
|
||||||
|
String vv = "";
|
||||||
|
String val = cursor.getString(cursor.getColumnIndex("date"));
|
||||||
|
try {
|
||||||
|
long dv = Long.parseLong(val) * (long) 1000;// its need to be in milisecond
|
||||||
Date df = new java.util.Date(dv);
|
Date df = new java.util.Date(dv);
|
||||||
String vv = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(df);
|
vv = new SimpleDateFormat("dd.MM.yyyy").format(df);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
|
if(vv.isEmpty()) {
|
||||||
|
try {
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
Date df = format.parse(val);
|
||||||
|
vv = new SimpleDateFormat("dd.MM.yyyy").format(df);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
btn.setText(cursor.getString(cursor.getColumnIndex("terrain")) + " (" + vv + ")");
|
btn.setText(cursor.getString(cursor.getColumnIndex("terrain")) + " (" + vv + ")");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user