[core, android] Settings for <long long>. Android binding.

This commit is contained in:
Dmitry Kunin 2013-06-24 12:34:52 +03:00 committed by Alex Zolotarev
parent 6302a98d6e
commit 7254f8646d
3 changed files with 49 additions and 0 deletions

View file

@ -114,4 +114,21 @@ extern "C"
(void)Settings::Set(jni::ToNativeString(env, name), value);
}
JNIEXPORT jlong JNICALL
Java_com_mapswithme_maps_MWMApplication_nativeGetLong(JNIEnv * env, jobject thiz, jstring name, jlong defaultValue)
{
jlong value;
if (Settings::Get(jni::ToNativeString(env, name), value))
return value;
return defaultValue;
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_MWMApplication_nativeSetLong(JNIEnv * env, jobject thiz, jstring name, jlong value)
{
(void)Settings::Set(jni::ToNativeString(env, name), value);
}
}

View file

@ -25,6 +25,9 @@ public class MWMApplication extends android.app.Application implements MapStorag
{
private final static String TAG = "MWMApplication";
private static MWMApplication mSelf;
private LocationService m_location = null;
private LocationState m_locationState = null;
private MapStorage m_storage = null;
@ -38,6 +41,23 @@ public class MWMApplication extends android.app.Application implements MapStorag
private final static String m_defaultProURL = "http://play.google.com/store/apps/details?id=com.mapswithme.maps.pro";
private String m_proVersionURL = m_defaultProURL;
public MWMApplication()
{
super();
mSelf = this;
}
/**
* Just for convenience.
*
* @return global MWMApp
*/
public static MWMApplication get()
{
return mSelf;
}
private void showDownloadToast(int resID, Index idx)
{
final String msg = String.format(getString(resID), m_storage.countryName(idx));
@ -243,4 +263,6 @@ public class MWMApplication extends android.app.Application implements MapStorag
public native void nativeSetBoolean(String name, boolean value);
public native int nativeGetInt(String name, int defaultValue);
public native void nativeSetInt(String name, int value);
public native long nativeGetLong(String name, long defaultValue);
public native void nativeSetLong(String name, long value);
}

View file

@ -225,6 +225,16 @@ namespace Settings
return impl::FromStringScalar<int>(str, v);
}
template <> string ToString<long long>(long long const & v)
{
return impl::ToStringScalar<long long>(v);
}
template <> bool FromString<long long>(string const & str, long long & v)
{
return impl::FromStringScalar<long long>(str, v);
}
template <> string ToString<unsigned>(unsigned const & v)
{
return impl::ToStringScalar<unsigned>(v);