mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Merge pull request #2924 from Laserlicht/datetime_android
Datetime android
This commit is contained in:
@@ -17,6 +17,9 @@ import org.libsdl.app.SDLActivity;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
import eu.vcmi.vcmi.util.Log;
|
import eu.vcmi.vcmi.util.Log;
|
||||||
|
|
||||||
@@ -153,6 +156,14 @@ public class NativeMethods
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings(Const.JNI_METHOD_SUPPRESS)
|
||||||
|
public static String getFormattedDateTime()
|
||||||
|
{
|
||||||
|
String currentDate = new SimpleDateFormat((new SimpleDateFormat()).toLocalizedPattern(), Locale.getDefault()).format(new Date());
|
||||||
|
|
||||||
|
return currentDate;
|
||||||
|
}
|
||||||
|
|
||||||
private static void internalProgressDisplay(final boolean show)
|
private static void internalProgressDisplay(final boolean show)
|
||||||
{
|
{
|
||||||
final Context ctx = SDL.getContext();
|
final Context ctx = SDL.getContext();
|
||||||
|
@@ -1,6 +1,10 @@
|
|||||||
#include "StdInc.h"
|
#include "StdInc.h"
|
||||||
#include <vstd/DateUtils.h>
|
#include <vstd/DateUtils.h>
|
||||||
|
|
||||||
|
#if defined(VCMI_ANDROID)
|
||||||
|
#include "../CAndroidVMHelper.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
namespace vstd
|
namespace vstd
|
||||||
@@ -8,6 +12,11 @@ namespace vstd
|
|||||||
|
|
||||||
DLL_LINKAGE std::string getFormattedDateTime(std::time_t dt)
|
DLL_LINKAGE std::string getFormattedDateTime(std::time_t dt)
|
||||||
{
|
{
|
||||||
|
#if defined(VCMI_ANDROID)
|
||||||
|
CAndroidVMHelper vmHelper;
|
||||||
|
return vmHelper.callStaticStringMethod(CAndroidVMHelper::NATIVE_METHODS_DEFAULT_CLASS, "getFormattedDateTime");
|
||||||
|
#endif
|
||||||
|
|
||||||
std::tm tm = *std::localtime(&dt);
|
std::tm tm = *std::localtime(&dt);
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
try
|
try
|
||||||
|
Reference in New Issue
Block a user