Правка даты в списке анкет обследования саранчи
This commit is contained in:
@ -702,7 +702,6 @@ public class LocustHealthListActivity extends AppCompatActivity
|
||||
btn = new MyButton(this);
|
||||
}
|
||||
|
||||
|
||||
btn.setOnClickListener(oclBtn);
|
||||
|
||||
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 java.io.File;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
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);
|
||||
adb.setTitle(getString(R.string.Warning));
|
||||
@ -70,7 +71,7 @@ public class LocustListActivity extends AppCompatActivity
|
||||
});
|
||||
AlertDialog ad = adb.show();
|
||||
ad.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.BLACK);
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
@ -623,9 +624,23 @@ public class LocustListActivity extends AppCompatActivity
|
||||
|
||||
btn.uid1 = cursor.getString(cursor.getColumnIndex("uid"));
|
||||
|
||||
long dv = cursor.getLong(cursor.getColumnIndex("date")) * (long) 1000; // its need to be in milisecond
|
||||
Date df = new java.util.Date(dv);
|
||||
String vv = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(df);
|
||||
// Преобразует с учётом временой зоны (пример 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);
|
||||
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 + ")");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user