forked from organicmaps/organicmaps
Reformatting, constants, renames.
This commit is contained in:
parent
15498808fa
commit
11a1344571
6 changed files with 270 additions and 233 deletions
|
@ -1,200 +1,217 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
<manifest
|
||||
package="com.mapswithme.maps"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:installLocation="auto"
|
||||
android:sharedUserId="com.mapswithme"
|
||||
android:sharedUserLabel="@string/shared_user_label" >
|
||||
android:sharedUserLabel="@string/shared_user_label">
|
||||
|
||||
<uses-sdk tools:node="replace" android:minSdkVersion="7" />
|
||||
<uses-sdk
|
||||
android:minSdkVersion="7"
|
||||
tools:node="replace"/>
|
||||
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00020000"
|
||||
android:required="true" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
android:required="true" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.wifi"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.location"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.location.network"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.location.gps"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00020000"
|
||||
android:required="true"/>
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
android:required="true"/>
|
||||
<uses-feature
|
||||
android:name="android.hardware.wifi"
|
||||
android:required="false"/>
|
||||
<uses-feature
|
||||
android:name="android.hardware.location"
|
||||
android:required="false"/>
|
||||
<uses-feature
|
||||
android:name="android.hardware.location.network"
|
||||
android:required="false"/>
|
||||
<uses-feature
|
||||
android:name="android.hardware.location.gps"
|
||||
android:required="false"/>
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
|
||||
<supports-screens
|
||||
android:largeScreens="true"
|
||||
android:xlargeScreens="true" />
|
||||
<supports-screens
|
||||
android:largeScreens="true"
|
||||
android:xlargeScreens="true"/>
|
||||
|
||||
<application
|
||||
android:name="com.mapswithme.maps.MWMApplication"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
<application
|
||||
android:name="com.mapswithme.maps.MWMApplication"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/MWMMain">
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.version"
|
||||
android:value="@integer/google_play_services_version"/>
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.DownloadResourcesActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/MWMMain" >
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/MWMMain.NoBar">
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.version"
|
||||
android:value="@integer/google_play_services_version" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.DownloadResourcesActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/MWMMain.NoBar" >
|
||||
<!-- standard "geo" scheme -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
|
||||
<!-- standard "geo" scheme -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="geo" />
|
||||
</intent-filter>
|
||||
<data android:scheme="geo"/>
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="ge0" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:host="ge0.me" android:scheme="http" />
|
||||
</intent-filter>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:host="maps.google.com" android:scheme="https" />
|
||||
<data android:host="maps.google.com" android:scheme="http" />
|
||||
</intent-filter>
|
||||
<data android:scheme="ge0"/>
|
||||
</intent-filter>
|
||||
|
||||
<!-- API CALL -->
|
||||
<intent-filter>
|
||||
<action android:name="com.mapswithme.maps.api.request" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.MWMActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/MWMMain.NoBar" >
|
||||
</activity>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.country.DownloadActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/download_maps"
|
||||
android:screenOrientation="behind" >
|
||||
</activity>
|
||||
<data
|
||||
android:host="ge0.me"
|
||||
android:scheme="http"/>
|
||||
</intent-filter>
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.SearchActivity"
|
||||
android:theme="@style/MwmSearch"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:windowSoftInputMode="stateVisible|adjustResize"
|
||||
android:label="@string/search_map"
|
||||
android:screenOrientation="behind" >
|
||||
</activity>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.settings.SettingsActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/settings"
|
||||
android:screenOrientation="behind" >
|
||||
</activity>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.settings.StoragePathActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/maps_storage"
|
||||
android:screenOrientation="behind" >
|
||||
</activity>
|
||||
<data
|
||||
android:host="maps.google.com"
|
||||
android:scheme="https"/>
|
||||
<data
|
||||
android:host="maps.google.com"
|
||||
android:scheme="http"/>
|
||||
</intent-filter>
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.bookmarks.ChooseBookmarkCategoryActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/bookmark_sets"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/MWMTheme.Dialog.Light"
|
||||
android:windowSoftInputMode="stateUnspecified|adjustResize" >
|
||||
</activity>
|
||||
<!-- API CALL -->
|
||||
<intent-filter>
|
||||
<action android:name="com.mapswithme.maps.api.request"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.bookmarks.BookmarkCategoriesActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/bookmarks"
|
||||
android:screenOrientation="behind" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.MWMActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/MWMMain.NoBar">
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.bookmarks.BookmarkListActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/bookmarks"
|
||||
android:screenOrientation="behind" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.mapswithme.country.DownloadActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/download_maps"
|
||||
android:screenOrientation="behind">
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.bookmarks.BookmarkActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/bookmarks"
|
||||
android:screenOrientation="behind" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.SearchActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/search_map"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/MwmSearch"
|
||||
android:windowSoftInputMode="stateVisible|adjustResize">
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.MoreAppsActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/more_apps_title"
|
||||
android:screenOrientation="behind" />
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.settings.SettingsActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/settings"
|
||||
android:screenOrientation="behind">
|
||||
</activity>
|
||||
|
||||
<receiver
|
||||
android:name="com.mapswithme.maps.background.ConnectivityChangedReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true" >
|
||||
<intent-filter>
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.settings.StoragePathActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/maps_storage"
|
||||
android:screenOrientation="behind">
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name="com.mapswithme.maps.background.WorkerService"
|
||||
android:exported="false" >
|
||||
</service>
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.bookmarks.ChooseBookmarkCategoryActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/bookmark_sets"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/MWMTheme.Dialog.Light"
|
||||
android:windowSoftInputMode="stateUnspecified|adjustResize">
|
||||
</activity>
|
||||
|
||||
<!-- Mobile Apps Tracking -->
|
||||
<receiver
|
||||
android:name="com.mobileapptracker.Tracker"
|
||||
android:exported="true" >
|
||||
<intent-filter>
|
||||
<action android:name="com.android.vending.INSTALL_REFERRER" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.bookmarks.BookmarkCategoriesActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/bookmarks"
|
||||
android:screenOrientation="behind">
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.bookmarks.BookmarkListActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/bookmarks"
|
||||
android:screenOrientation="behind">
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.bookmarks.BookmarkActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/bookmarks"
|
||||
android:screenOrientation="behind">
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.mapswithme.maps.MoreAppsActivity"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:label="@string/more_apps_title"
|
||||
android:screenOrientation="behind"/>
|
||||
|
||||
<receiver
|
||||
android:name="com.mapswithme.maps.background.ConnectivityChangedReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name="com.mapswithme.maps.background.WorkerService"
|
||||
android:exported="false">
|
||||
</service>
|
||||
|
||||
<!-- Mobile Apps Tracking -->
|
||||
<receiver
|
||||
android:name="com.mobileapptracker.Tracker"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="com.android.vending.INSTALL_REFERRER"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
|
|
@ -38,12 +38,11 @@ import java.util.regex.Pattern;
|
|||
|
||||
@SuppressLint("StringFormatMatches")
|
||||
public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
||||
implements LocationService.LocationListener, MapStorage.Listener
|
||||
implements LocationService.LocationListener, MapStorage.Listener
|
||||
{
|
||||
private static final String TAG = "DownloadResourcesActivity";
|
||||
private static final String TAG = DownloadResourcesActivity.class.getName();
|
||||
|
||||
// Error codes, should match the same codes in JNI
|
||||
|
||||
private static final int ERR_DOWNLOAD_SUCCESS = 0;
|
||||
private static final int ERR_NOT_ENOUGH_MEMORY = -1;
|
||||
private static final int ERR_NOT_ENOUGH_FREE_SPACE = -2;
|
||||
|
@ -65,6 +64,16 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
|
||||
private MapTask mMapTaskToForward;
|
||||
|
||||
private static final int DOWNLOAD = 0;
|
||||
private static final int PAUSE = 1;
|
||||
private static final int RESUME = 2;
|
||||
private static final int TRY_AGAIN = 3;
|
||||
private static final int PROCEED_TO_MAP = 4;
|
||||
private static final int BTN_COUNT = 5;
|
||||
|
||||
private View.OnClickListener mBtnListeners[] = null;
|
||||
private String mBtnNames[] = null;
|
||||
|
||||
private final IntentProcessor[] mIntentProcessors = {
|
||||
new GeoIntentProcessor(),
|
||||
new HttpGe0IntentProcessor(),
|
||||
|
@ -74,18 +83,20 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
new OpenCountryTaskProcessor(),
|
||||
};
|
||||
|
||||
public static String EXTRA_COUNTRY_INDEX = ".extra.index";
|
||||
|
||||
private void setDownloadMessage(int bytesToDownload)
|
||||
{
|
||||
Log.d(TAG, "prepareFilesDownload, bytesToDownload:" + bytesToDownload);
|
||||
|
||||
if (bytesToDownload < 1024 * 1024)
|
||||
mMsgView.setText(String.format(getString(R.string.download_resources),
|
||||
(float)bytesToDownload / 1024,
|
||||
getString(R.string.kb)));
|
||||
(float) bytesToDownload / 1024,
|
||||
getString(R.string.kb)));
|
||||
else
|
||||
mMsgView.setText(String.format(getString(R.string.download_resources,
|
||||
(float)bytesToDownload / 1024 / 1024,
|
||||
getString(R.string.mb))));
|
||||
(float) bytesToDownload / 1024 / 1024,
|
||||
getString(R.string.mb))));
|
||||
|
||||
}
|
||||
|
||||
|
@ -119,66 +130,56 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
return true;
|
||||
}
|
||||
|
||||
private static final int DOWNLOAD = 0;
|
||||
private static final int PAUSE = 1;
|
||||
private static final int RESUME = 2;
|
||||
private static final int TRY_AGAIN = 3;
|
||||
private static final int PROCEED_TO_MAP = 4;
|
||||
private static final int BTN_COUNT = 5;
|
||||
|
||||
private View.OnClickListener m_btnListeners[] = null;
|
||||
private String m_btnNames[] = null;
|
||||
|
||||
private void initDownloading()
|
||||
{
|
||||
// Get GUI elements and subscribe to map storage (for country downloading).
|
||||
mMapStorage = mApplication.getMapStorage();
|
||||
mSlotId = mMapStorage.subscribe(this);
|
||||
|
||||
mMsgView = (TextView)findViewById(R.id.download_resources_message);
|
||||
mProgress = (ProgressBar)findViewById(R.id.download_resources_progress);
|
||||
mButton = (Button)findViewById(R.id.download_resources_button);
|
||||
mDownloadCountryCheckBox = (CheckBox)findViewById(R.id.download_country_checkbox);
|
||||
mLocationMsgView = (TextView)findViewById(R.id.download_resources_location_message);
|
||||
mMsgView = (TextView) findViewById(R.id.download_resources_message);
|
||||
mProgress = (ProgressBar) findViewById(R.id.download_resources_progress);
|
||||
mButton = (Button) findViewById(R.id.download_resources_button);
|
||||
mDownloadCountryCheckBox = (CheckBox) findViewById(R.id.download_country_checkbox);
|
||||
mLocationMsgView = (TextView) findViewById(R.id.download_resources_location_message);
|
||||
|
||||
// Initialize button states.
|
||||
m_btnListeners = new View.OnClickListener[BTN_COUNT];
|
||||
m_btnNames = new String[BTN_COUNT];
|
||||
mBtnListeners = new View.OnClickListener[BTN_COUNT];
|
||||
mBtnNames = new String[BTN_COUNT];
|
||||
|
||||
m_btnListeners[DOWNLOAD] = new View.OnClickListener()
|
||||
mBtnListeners[DOWNLOAD] = new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v) { onDownloadClicked(v); }
|
||||
};
|
||||
m_btnNames[DOWNLOAD] = getString(R.string.download);
|
||||
mBtnNames[DOWNLOAD] = getString(R.string.download);
|
||||
|
||||
m_btnListeners[PAUSE] = new View.OnClickListener()
|
||||
mBtnListeners[PAUSE] = new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v) { onPauseClicked(v); }
|
||||
};
|
||||
m_btnNames[PAUSE] = getString(R.string.pause);
|
||||
mBtnNames[PAUSE] = getString(R.string.pause);
|
||||
|
||||
m_btnListeners[RESUME] = new View.OnClickListener()
|
||||
mBtnListeners[RESUME] = new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v) { onResumeClicked(v); }
|
||||
};
|
||||
m_btnNames[RESUME] = getString(R.string.continue_download);
|
||||
mBtnNames[RESUME] = getString(R.string.continue_download);
|
||||
|
||||
m_btnListeners[TRY_AGAIN] = new View.OnClickListener()
|
||||
mBtnListeners[TRY_AGAIN] = new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v) { onTryAgainClicked(v); }
|
||||
};
|
||||
m_btnNames[TRY_AGAIN] = getString(R.string.try_again);
|
||||
mBtnNames[TRY_AGAIN] = getString(R.string.try_again);
|
||||
|
||||
m_btnListeners[PROCEED_TO_MAP] = new View.OnClickListener()
|
||||
mBtnListeners[PROCEED_TO_MAP] = new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v) { onProceedToMapClicked(v); }
|
||||
};
|
||||
m_btnNames[PROCEED_TO_MAP] = getString(R.string.download_resources_continue);
|
||||
mBtnNames[PROCEED_TO_MAP] = getString(R.string.download_resources_continue);
|
||||
|
||||
// Start listening the location.
|
||||
mLocationService = mApplication.getLocationService();
|
||||
|
@ -187,8 +188,8 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
|
||||
private void setAction(int action)
|
||||
{
|
||||
mButton.setOnClickListener(m_btnListeners[action]);
|
||||
mButton.setText(m_btnNames[action]);
|
||||
mButton.setOnClickListener(mBtnListeners[action]);
|
||||
mButton.setText(mBtnNames[action]);
|
||||
}
|
||||
|
||||
private void doDownload()
|
||||
|
@ -235,8 +236,12 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
int id;
|
||||
switch (res)
|
||||
{
|
||||
case ERR_NOT_ENOUGH_FREE_SPACE: id = R.string.not_enough_free_space_on_sdcard; break;
|
||||
case ERR_STORAGE_DISCONNECTED: id = R.string.disconnect_usb_cable; break;
|
||||
case ERR_NOT_ENOUGH_FREE_SPACE:
|
||||
id = R.string.not_enough_free_space_on_sdcard;
|
||||
break;
|
||||
case ERR_STORAGE_DISCONNECTED:
|
||||
id = R.string.disconnect_usb_cable;
|
||||
break;
|
||||
|
||||
case ERR_DOWNLOAD_ERROR:
|
||||
if (ConnectionState.isConnected(this))
|
||||
|
@ -245,7 +250,8 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
id = R.string.no_internet_connection_detected;
|
||||
break;
|
||||
|
||||
default: id = R.string.not_enough_memory;
|
||||
default:
|
||||
id = R.string.not_enough_memory;
|
||||
}
|
||||
|
||||
return getString(id);
|
||||
|
@ -281,9 +287,9 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
mDownloadCountryCheckBox.setVisibility(View.GONE);
|
||||
mLocationMsgView.setVisibility(View.GONE);
|
||||
mMsgView.setText(String.format(getString(R.string.downloading_country_can_proceed),
|
||||
mMapStorage.countryName(mCountryIndex)));
|
||||
mMapStorage.countryName(mCountryIndex)));
|
||||
|
||||
mProgress.setMax((int)mMapStorage.countryRemoteSizeInBytes(mCountryIndex));
|
||||
mProgress.setMax((int) mMapStorage.countryRemoteSizeInBytes(mCountryIndex));
|
||||
mProgress.setProgress(0);
|
||||
|
||||
mMapStorage.downloadCountry(mCountryIndex);
|
||||
|
@ -317,7 +323,7 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
// Important check - activity can be destroyed
|
||||
// but notifications from downloading thread are coming.
|
||||
if (mProgress != null)
|
||||
mProgress.setProgress((int)current);
|
||||
mProgress.setProgress((int) current);
|
||||
}
|
||||
|
||||
private Intent getPackageIntent(String s)
|
||||
|
@ -331,7 +337,7 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
{
|
||||
if (!isPro)
|
||||
{
|
||||
final Intent intent = getPackageIntent("com.mapswithme.maps.pro");
|
||||
final Intent intent = getPackageIntent(Constants.Package.MWM_PRO_PACKAGE);
|
||||
if (intent != null)
|
||||
{
|
||||
Log.i(TAG, "Trying to launch pro version");
|
||||
|
@ -343,15 +349,14 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!mApplication.isYota() &&
|
||||
(getPackageIntent("com.mapswithme.maps") != null ||
|
||||
getPackageIntent("com.mapswithme.maps.samsung") != null))
|
||||
if (!MWMApplication.get().isYota() &&
|
||||
(getPackageIntent(Constants.Package.MWM_LITE_PACKAGE) != null ||
|
||||
getPackageIntent(Constants.Package.MWM_SAMSUNG_PACKAGE) != null))
|
||||
{
|
||||
Toast.makeText(this, R.string.suggest_uninstall_lite, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (final ActivityNotFoundException ex)
|
||||
} catch (final ActivityNotFoundException ex)
|
||||
{
|
||||
Log.d(TAG, "Intent not found", ex);
|
||||
}
|
||||
|
@ -367,7 +372,7 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mApplication = (MWMApplication)getApplication();
|
||||
mApplication = (MWMApplication) getApplication();
|
||||
|
||||
final boolean isPro = mApplication.isProVersion();
|
||||
if (checkLiteProPackages(isPro))
|
||||
|
@ -412,7 +417,7 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
if (i == -1)
|
||||
return null;
|
||||
|
||||
mime = mime.substring(i+1);
|
||||
mime = mime.substring(i + 1);
|
||||
if (mime.equalsIgnoreCase("kmz"))
|
||||
return ".kmz";
|
||||
else if (mime.equalsIgnoreCase("kml+xml"))
|
||||
|
@ -458,12 +463,10 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
|
||||
path = filePath;
|
||||
}
|
||||
}
|
||||
catch (final Exception ex)
|
||||
} catch (final Exception ex)
|
||||
{
|
||||
Log.w(TAG, "Attachment not found or io error: " + ex);
|
||||
}
|
||||
finally
|
||||
} finally
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -471,8 +474,7 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
input.close();
|
||||
if (output != null)
|
||||
output.close();
|
||||
}
|
||||
catch (final IOException ex)
|
||||
} catch (final IOException ex)
|
||||
{
|
||||
Log.w(TAG, "Close stream error: " + ex);
|
||||
}
|
||||
|
@ -570,7 +572,7 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
mLocationMsgView.setText(String.format(getString(R.string.download_location_map_up_to_date), name));
|
||||
else
|
||||
{
|
||||
final CheckBox checkBox = (CheckBox)findViewById(R.id.download_country_checkbox);
|
||||
final CheckBox checkBox = (CheckBox) findViewById(R.id.download_country_checkbox);
|
||||
checkBox.setVisibility(View.VISIBLE);
|
||||
|
||||
String msgViewText;
|
||||
|
@ -763,7 +765,6 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
}
|
||||
}
|
||||
|
||||
public static String EXTRA_COUNTRY_INDEX = ".extra.index";
|
||||
private class OpenCountryTaskProcessor implements IntentProcessor
|
||||
{
|
||||
@Override
|
||||
|
@ -782,8 +783,12 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
}
|
||||
|
||||
private native int getBytesToDownload();
|
||||
|
||||
private native int startNextFileDownload(Object observer);
|
||||
|
||||
private native Index findIndexByPos(double lat, double lon);
|
||||
|
||||
private native void cancelCurrentFile();
|
||||
|
||||
private native boolean loadKMZFile(String path);
|
||||
}
|
||||
|
|
|
@ -88,6 +88,7 @@ public class Framework
|
|||
public native static String nativeGetNameAndAddress4Point(double lat, double lon);
|
||||
|
||||
public native static MapObject nativeGetMapObjectForPoint(double lat, double lon);
|
||||
|
||||
public native static void nativeActivateUserMark(double lat, double lon);
|
||||
|
||||
public native static void nativeConnectBalloonListeners(OnBalloonListener listener);
|
||||
|
@ -128,4 +129,12 @@ public class Framework
|
|||
public native static void nativeSetRouteStart(double lat, double lon);
|
||||
|
||||
public native static void nativeSetRouteEnd(double lat, double lon);
|
||||
|
||||
//
|
||||
|
||||
public static native String nativeGetCountryNameIfAbsent(double lat, double lon);
|
||||
|
||||
public static native Index nativeGetIndex(double lat, double lon);
|
||||
|
||||
public static native String nativeGetViewportCountryNameIfAbsent();
|
||||
}
|
||||
|
|
|
@ -459,7 +459,7 @@ public class MWMActivity extends NvEventQueueActivity
|
|||
try
|
||||
{
|
||||
// Exception is thrown if we don't have installed Facebook application.
|
||||
getPackageManager().getPackageInfo(Constants.FB_PACKAGE, 0);
|
||||
getPackageManager().getPackageInfo(Constants.Package.FB_PACKAGE, 0);
|
||||
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.Url.FB_MAPSME_COMMUNITY_NATIVE)));
|
||||
} catch (final Exception e)
|
||||
|
|
|
@ -160,7 +160,7 @@ public class SearchActivity extends MapsWithMeBaseListActivity implements Locati
|
|||
// First try to show warning if no country downloaded for viewport.
|
||||
if (mContext.mSearchMode != AROUND_POSITION)
|
||||
{
|
||||
final String name = mContext.getViewportCountryNameIfAbsent();
|
||||
final String name = Framework.nativeGetViewportCountryNameIfAbsent();
|
||||
if (name != null)
|
||||
return String.format(mContext.getString(R.string.download_viewport_country_to_search), name);
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ public class SearchActivity extends MapsWithMeBaseListActivity implements Locati
|
|||
}
|
||||
else
|
||||
{
|
||||
final String name = mContext.getCountryNameIfAbsent(loc.getLatitude(), loc.getLongitude());
|
||||
final String name = Framework.nativeGetCountryNameIfAbsent(loc.getLatitude(), loc.getLongitude());
|
||||
if (name != null)
|
||||
return String.format(mContext.getString(R.string.download_location_country), name);
|
||||
}
|
||||
|
@ -891,10 +891,6 @@ public class SearchActivity extends MapsWithMeBaseListActivity implements Locati
|
|||
double lat, double lon, int flags,
|
||||
int searchMode, int queryID);
|
||||
|
||||
private native String getCountryNameIfAbsent(double lat, double lon);
|
||||
|
||||
private native String getViewportCountryNameIfAbsent();
|
||||
|
||||
private native String getLastQuery();
|
||||
|
||||
private native void clearLastQuery();
|
||||
|
|
|
@ -22,7 +22,17 @@ public class Constants
|
|||
private Url() {}
|
||||
}
|
||||
|
||||
public static final String FB_PACKAGE = "com.facebook.katana";
|
||||
public static class Package
|
||||
{
|
||||
public static final String FB_PACKAGE = "com.facebook.katana";
|
||||
public static final String MWM_PRO_PACKAGE = "com.mapswithme.maps.pro";
|
||||
public static final String MWM_LITE_PACKAGE = "com.mapswithme.maps";
|
||||
public static final String MWM_SAMSUNG_PACKAGE = "com.mapswithme.maps.samsung";
|
||||
|
||||
private Package() {}
|
||||
}
|
||||
|
||||
|
||||
public static final String MWM_DIR_POSTFIX = "/MapsWithMe/";
|
||||
public static final String DEVICE_YOTAPHONE = "yotaphone";
|
||||
public static final String CACHE_DIR = "cache";
|
||||
|
|
Loading…
Add table
Reference in a new issue