[android] [bookmarks] Add needed strings to Framework::StringsBundle.

This commit is contained in:
vng 2013-02-12 22:50:13 +03:00 committed by Alex Zolotarev
parent 51e13fc2e8
commit 4da118bd5e
4 changed files with 44 additions and 42 deletions

View file

@ -104,13 +104,6 @@ extern "C"
g_framework->GetCountryStatusDisplay()->downloadCountry();
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_MWMActivity_nativeSetString(JNIEnv * env, jobject thiz, jstring name, jstring value)
{
g_framework->AddString(jni::ToNativeString(env, name),
jni::ToNativeString(env, value));
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_MWMActivity_nativeStorageConnected(JNIEnv * env, jobject thiz)
{

View file

@ -92,4 +92,11 @@ extern "C"
{
return android::Platform::Instance().HasAvailableSpaceForWriting(size);
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_MWMApplication_nativeSetString(JNIEnv * env, jobject thiz, jstring name, jstring value)
{
g_framework->AddString(jni::ToNativeString(env, name),
jni::ToNativeString(env, value));
}
}

View file

@ -525,13 +525,6 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService
if (mApplication.nativeIsBenchmarking())
getWindow().addFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
nativeSetString("country_status_added_to_queue", getString(R.string.country_status_added_to_queue));
nativeSetString("country_status_downloading", getString(R.string.country_status_downloading));
nativeSetString("country_status_download", getString(R.string.country_status_download));
nativeSetString("country_status_download_failed", getString(R.string.country_status_download_failed));
nativeSetString("try_again", getString(R.string.try_again));
nativeSetString("not_enough_free_space_on_sdcard", getString(R.string.not_enough_free_space_on_sdcard));
nativeConnectDownloadButton();
alignZoomButtons();
@ -542,13 +535,8 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService
@Override
public void onClick(int cat, int bmk)
{
startActivity(
new Intent(MWMActivity.this, BookmarkActivity.class)
.putExtra(
BookmarkActivity.PIN,
new ParcelablePoint(cat, bmk
)
));
startActivity(new Intent(MWMActivity.this, BookmarkActivity.class)
.putExtra(BookmarkActivity.PIN, new ParcelablePoint(cat, bmk)));
}
});
}
@ -898,8 +886,6 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService
}
}
private native void nativeSetString(String name, String value);
private native void nativeStorageConnected();
private native void nativeStorageDisconnected();

View file

@ -71,32 +71,37 @@ public class MWMApplication extends android.app.Application implements MapStorag
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ECLAIR_MR1)
System.setProperty("http.keepAlive", "false");
AssetManager assets = getAssets();
InputStream stream = null;
try
// get url for PRO version
if (!m_isProVersion)
{
stream = assets.open("app_info.txt");
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
AssetManager assets = getAssets();
InputStream stream = null;
try
{
stream = assets.open("app_info.txt");
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
final String s = reader.readLine();
if (s.length() > 0)
m_proVersionURL = s;
final String s = reader.readLine();
if (s.length() > 0)
m_proVersionURL = s;
Log.i(TAG, "Pro version url: " + m_proVersionURL);
Log.i(TAG, "Pro version url: " + m_proVersionURL);
}
catch (IOException ex)
{
// suppress exceptions - pro version doesn't need app_info.txt
}
Utils.closeStream(stream);
}
catch (IOException ex)
{
// suppress exceptions - pro version doesn't need app_info.txt
}
Utils.closeStream(stream);
final String extStoragePath = getDataStoragePath();
final String extTmpPath = getExtAppDirectoryPath("caches");
// Create folders if they don't exist
new File(extStoragePath).mkdirs();
new File(extTmpPath).mkdirs();
// init native framework
nativeInit(getApkPath(),
extStoragePath,
getTmpPath(),
@ -104,11 +109,20 @@ public class MWMApplication extends android.app.Application implements MapStorag
m_isProVersion);
m_slotID = getMapStorage().subscribe(this);
//init bmManager (automatically load bookmarks)
if (isProVersion())
{
// init cross-platform strings bundle
nativeSetString("country_status_added_to_queue", getString(R.string.country_status_added_to_queue));
nativeSetString("country_status_downloading", getString(R.string.country_status_downloading));
nativeSetString("country_status_download", getString(R.string.country_status_download));
nativeSetString("country_status_download_failed", getString(R.string.country_status_download_failed));
nativeSetString("try_again", getString(R.string.try_again));
nativeSetString("not_enough_free_space_on_sdcard", getString(R.string.not_enough_free_space_on_sdcard));
nativeSetString("dropped_pin", getString(R.string.dropped_pin));
nativeSetString("my_places", getString(R.string.my_places));
// init BookmarkManager (automatically loads bookmarks)
if (m_isProVersion)
BookmarkManager.getBookmarkManager(getApplicationContext());
}
}
public LocationService getLocationService()
@ -210,6 +224,8 @@ public class MWMApplication extends android.app.Application implements MapStorag
public native void submitDialogResult(int dlg, int res);
/// @}
private native void nativeSetString(String name, String value);
/// Dealing with Settings
public native boolean nativeGetBoolean(String name, boolean defaultVal);
public native void nativeSetBoolean(String name, boolean val);