Merge pull request #5812 from goblinr/MAPSME-188-ext-auto-migrate-maps

[android] Added map updater dialog
This commit is contained in:
Aleksandr Zatsepin 2017-04-21 13:33:05 +03:00 committed by GitHub
commit 0b57412c3c
48 changed files with 880 additions and 13 deletions

View file

@ -554,6 +554,10 @@ uber::RideRequestLinks Framework::GetUberLinks(string const & productId, ms::Lat
return uber::Api::GetRideRequestLinks(productId, from, to);
}
int Framework::ToDoAfterUpdate() const
{
return (int) m_work.ToDoAfterUpdate();
}
} // namespace android
@ -751,6 +755,26 @@ Java_com_mapswithme_maps_Framework_nativeGetOutdatedCountriesString(JNIEnv * env
return jni::ToJavaString(env, g_framework->GetOutdatedCountriesString());
}
JNIEXPORT jobjectArray JNICALL
Java_com_mapswithme_maps_Framework_nativeGetOutdatedCountries(JNIEnv * env, jclass)
{
vector<Country const *> countries;
Storage const & storage = g_framework->GetStorage();
storage.GetOutdatedCountries(countries);
vector<string> ids;
for (auto country : countries)
ids.push_back(country->Name());
return jni::ToJavaStringArray(env, ids);
}
JNIEXPORT jint JNICALL
Java_com_mapswithme_maps_Framework_nativeToDoAfterUpdate(JNIEnv * env, jclass)
{
return g_framework->ToDoAfterUpdate();
}
JNIEXPORT jboolean JNICALL
Java_com_mapswithme_maps_Framework_nativeIsDataVersionChanged(JNIEnv * env, jclass)
{

View file

@ -181,6 +181,8 @@ namespace android
ms::LatLon const & to, uber::ProductsCallback const & callback,
uber::ErrorCallback const & errorCallback);
static uber::RideRequestLinks GetUberLinks(string const & productId, ms::LatLon const & from, ms::LatLon const & to);
int ToDoAfterUpdate() const;
};
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

View file

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mapswithme.maps.widget.HeightLimitedFrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_base"
android:layout_gravity="center_horizontal"
android:tag="@string/tag_height_limited"
android:src="@drawable/wn_autoupdate"/>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_base"
android:layout_marginRight="@dimen/margin_base"
android:layout_marginBottom="@dimen/margin_base"
android:textAppearance="@style/MwmTextAppearance.Title"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:fontFamily="@string/robotoMedium"
tools:text="@string/whats_new_auto_update_title"
tools:targetApi="jelly_bean"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_base"
android:layout_marginRight="@dimen/margin_base"
android:layout_marginBottom="@dimen/margin_base"
android:textAppearance="@style/MwmTextAppearance.Body1.Secondary"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="@string/whats_new_auto_update_message"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_base"
android:layout_marginRight="@dimen/margin_base"
android:layout_marginBottom="@dimen/margin_base"
android:layout_gravity="center_horizontal">
<TextView
android:id="@+id/update_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/margin_base"
android:textAppearance="@style/MwmTextAppearance.Body1.Secondary"
android:textColor="?accentButtonTextColor"
android:background="?accentButtonBackground"
android:gravity="center"
android:visibility="gone"
tools:text="@string/whats_new_auto_update_button_size"
tools:visibility="visible"/>
<ProgressBar
android:id="@+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
</FrameLayout>
<TextView
android:id="@+id/cancel_btn"
android:layout_width="match_parent"
android:layout_height="@dimen/height_block_base"
android:layout_marginLeft="@dimen/margin_base"
android:layout_marginRight="@dimen/margin_base"
android:layout_marginBottom="@dimen/margin_base"
android:textAppearance="@style/MwmTextAppearance.Body1.Secondary"
android:textColor="?buttonDialogTextColor"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:background="?clickableBackground"
tools:text="@string/whats_new_auto_update_button_later"/>
</LinearLayout>
</com.mapswithme.maps.widget.HeightLimitedFrameLayout>

View file

@ -257,9 +257,9 @@
<!-- Share my position using EMail, %1$@ is ge0:// and %2$@ is http://ge0.me link WITHOUT NAME -->
<string name="my_position_share_email">Chào,\n\nTôi hiện đang ở đây: %1$s. Hãy nhấn vào liên kết này %2$s hoặc liên kết này %3$s để xem địa điểm trên bản đồ.\n\nCám ơn.</string>
<!-- Android share by Message/SMS button text (including SMS) -->
<string name="share_by_message">Chia sẻ bằng tin nhắn</string>
<string name="share_by_message">Partajare ca mesaj</string>
<!-- Share button text which opens menu with more buttons, like Message, EMail, Facebook etc. -->
<string name="share">Chia sẻ</string>
<string name="share">Partajare</string>
<!-- iOS share by Message button text (including SMS) -->
<string name="message">Tin nhắn</string>
<!-- Share by email button text, also used in editor. -->

View file

@ -1083,4 +1083,9 @@
<string name="reviews_on_bookingcom">Больше отзывов на Booking.com</string>
<string name="offline_place_page_more_information">Подключитесь к интернету, чтобы получить больше информации о месте.</string>
<string name="failed_load_information">Не удалось загрузить информацию.</string>
<string name="whats_new_auto_update_updating_maps">Обновляем карты</string>
<string name="whats_new_auto_update_title">Обновите ваши загруженные карты</string>
<string name="whats_new_auto_update_message">Обновление карт поддерживает информацию об объектах в актуальном состоянии</string>
<string name="whats_new_auto_update_button_size">Обновить (%s)</string>
<string name="whats_new_auto_update_button_later">Обновить вручную позже</string>
</resources>

View file

@ -1093,4 +1093,9 @@
<string name="offline_place_page_more_information">Connect to the internet to get more information about the place.</string>
<string name="failed_load_information">Failed to load information.</string>
<string name="booking_search">Booking.com</string>
<string name="whats_new_auto_update_updating_maps">Updating maps</string>
<string name="whats_new_auto_update_title">Update your downloaded maps</string>
<string name="whats_new_auto_update_message">Update maps supports information about objects in the current state</string>
<string name="whats_new_auto_update_button_size">Update (%s)</string>
<string name="whats_new_auto_update_button_later">Manually update later</string>
</resources>

View file

@ -44,6 +44,16 @@ public class Framework
public static final int ROUTER_TYPE_BICYCLE = 2;
public static final int ROUTER_TYPE_TAXI = 3;
@Retention(RetentionPolicy.SOURCE)
@IntDef({DO_AFTER_UPDATE_NOTHING, DO_AFTER_UPDATE_AUTO_UPDATE, DO_AFTER_UPDATE_ASK_FOR_UPDATE,
DO_AFTER_UPDATE_MIGRATE})
public @interface DoAfterUpdate {}
public static final int DO_AFTER_UPDATE_NOTHING = 0;
public static final int DO_AFTER_UPDATE_AUTO_UPDATE = 1;
public static final int DO_AFTER_UPDATE_ASK_FOR_UPDATE = 2;
public static final int DO_AFTER_UPDATE_MIGRATE = 3;
@SuppressWarnings("unused")
public interface MapObjectListener
{
@ -139,6 +149,14 @@ public class Framework
@UiThread
public static native String nativeGetOutdatedCountriesString();
@UiThread
@NonNull
public static native String[] nativeGetOutdatedCountries();
@UiThread
@DoAfterUpdate
public static native int nativeToDoAfterUpdate();
public static native boolean nativeIsDataVersionChanged();
public static native void nativeUpdateSavedDataVersion();

View file

@ -17,6 +17,7 @@ import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
@ -38,7 +39,6 @@ import com.mapswithme.maps.api.RoutePoint;
import com.mapswithme.maps.base.BaseMwmFragmentActivity;
import com.mapswithme.maps.base.OnBackPressListener;
import com.mapswithme.maps.bookmarks.BookmarkCategoriesActivity;
import com.mapswithme.maps.ads.Banner;
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
import com.mapswithme.maps.bookmarks.data.MapObject;
import com.mapswithme.maps.downloader.DownloaderActivity;
@ -137,6 +137,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
private final Stack<MapTask> mTasks = new Stack<>();
private final StoragePathManager mPathManager = new StoragePathManager();
@Nullable
private MapFragment mMapFragment;
private PlacePageView mPlacePage;
@ -618,6 +619,27 @@ public class MwmActivity extends BaseMwmFragmentActivity
mRootView = (ViewGroup) container.getParent();
}
public void detachMap(@NonNull FragmentTransaction transaction)
{
if (mMapFragment == null)
return;
transaction.remove(mMapFragment);
mMapFragment = null;
}
public void attachMap()
{
if (mMapFragment != null)
return;
mMapFragment = (MapFragment) MapFragment.instantiate(this, MapFragment.class.getName(), null);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.map_fragment_container, mMapFragment, MapFragment.class.getName())
.commit();
}
private void initNavigationButtons()
{
View frame = findViewById(R.id.navigation_buttons);
@ -1013,7 +1035,8 @@ public class MwmActivity extends BaseMwmFragmentActivity
public void recreate()
{
// Explicitly destroy context before activity recreation.
mMapFragment.destroyContext();
if (mMapFragment != null)
mMapFragment.destroyContext();
super.recreate();
}
@ -1349,7 +1372,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
public boolean onTouch(View view, MotionEvent event)
{
return mPlacePage.hideOnTouch() ||
mMapFragment.onTouch(view, event);
(mMapFragment != null && mMapFragment.onTouch(view, event));
}
@Override

View file

@ -0,0 +1,339 @@
package com.mapswithme.maps.downloader;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.view.Window;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.MwmActivity;
import com.mapswithme.maps.R;
import com.mapswithme.maps.base.BaseMwmDialogFragment;
import com.mapswithme.util.Constants;
import com.mapswithme.util.StringUtils;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.Utils;
import com.mapswithme.util.statistics.Statistics;
import java.util.List;
import java.util.Locale;
import static com.mapswithme.util.statistics.Statistics.EventName.DOWNLOADER_DIALOG_CANCEL;
import static com.mapswithme.util.statistics.Statistics.EventName.DOWNLOADER_DIALOG_DOWNLOAD;
import static com.mapswithme.util.statistics.Statistics.EventName.DOWNLOADER_DIALOG_LATER;
import static com.mapswithme.util.statistics.Statistics.EventName.DOWNLOADER_DIALOG_MANUAL_DOWNLOAD;
import static com.mapswithme.util.statistics.Statistics.EventName.DOWNLOADER_DIALOG_SHOW;
public class UpdaterDialogFragment extends BaseMwmDialogFragment
{
private static final String ARG_UPDATE_IMMEDIATELY = "arg_update_immediately";
private static final String ARG_TOTAL_SIZE = "arg_total_size";
private static final String ARG_TOTAL_SIZE_MB = "arg_total_size_mb";
private static final String ARG_OUTDATED_MAPS = "arg_outdated_maps";
private TextView mTitle;
private TextView mUpdateBtn;
private ProgressBar mProgressBar;
private TextView mCancelBtn;
private int mListenerSlot = 0;
@Nullable
private String mTotalSize;
private long mTotalSizeMb;
private boolean mAutoUpdate;
@Nullable
private String[] mOutdatedMaps;
private boolean mFromInstanceState;
@NonNull
private final MapManager.StorageCallback mStorageCallback = new MapManager.StorageCallback()
{
@Override
public void onStatusChanged(List<MapManager.StorageCallbackData> data)
{
if (mOutdatedMaps == null)
return;
for (MapManager.StorageCallbackData item : data)
{
if (item.isLeafNode && item.newStatus == CountryItem.STATUS_FAILED)
{
String text;
switch (item.errorCode)
{
case CountryItem.ERROR_NO_INTERNET:
text = getString(R.string.common_check_internet_connection_dialog);
break;
case CountryItem.ERROR_OOM:
text = getString(R.string.downloader_no_space_title);
break;
default:
text = String.valueOf(item.errorCode);
}
Statistics.INSTANCE.trackDownloaderDialogError(mTotalSizeMb, text);
MapManager.showError(getActivity(), item, new Utils.Proc<Boolean>()
{
@Override
public void invoke(@NonNull Boolean result)
{
if (result)
{
MapManager.nativeUpdate(CountryItem.getRootId());
}
else
{
// TODO remove attachMap() when dialog migrated to SplashActivity
attachMap();
dismiss();
}
}
});
return;
}
}
if (!isAllUpdated())
return;
// TODO remove attachMap() when dialog migrated to SplashActivity
attachMap();
dismiss();
}
@Override
public void onProgress(String countryId, long localSize, long remoteSize)
{
if (mOutdatedMaps == null)
return;
int progress = MapManager.nativeGetOverallProgress(mOutdatedMaps);
mTitle.setText(String.format(Locale.getDefault(), "%s %d%%",
getString(R.string.whats_new_auto_update_updating_maps), progress));
}
};
@NonNull
private final View.OnClickListener mCancelClickListener = new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Statistics.INSTANCE.trackDownloaderDialogEvent(MapManager.nativeIsDownloading()
? DOWNLOADER_DIALOG_LATER
: DOWNLOADER_DIALOG_CANCEL,
mTotalSizeMb);
if (MapManager.nativeIsDownloading())
MapManager.nativeCancel(CountryItem.getRootId());
// TODO remove attachMap() when dialog migrated to SplashActivity
attachMap();
dismiss();
}
};
@NonNull
private final View.OnClickListener mUpdateClickListener = new View.OnClickListener()
{
@Override
public void onClick(View v)
{
MapManager.nativeUpdate(CountryItem.getRootId());
UiUtils.show(mProgressBar);
UiUtils.hide(mUpdateBtn);
mTitle.setText(String.format(Locale.getDefault(), "%s %d%%",
getString(R.string.whats_new_auto_update_updating_maps), 0));
mCancelBtn.setText(R.string.cancel);
Statistics.INSTANCE.trackDownloaderDialogEvent(DOWNLOADER_DIALOG_MANUAL_DOWNLOAD,
mTotalSizeMb);
}
};
public static boolean showOn(@NonNull FragmentActivity activity)
{
final FragmentManager fm = activity.getSupportFragmentManager();
if (fm.isDestroyed())
return false;
Fragment f = fm.findFragmentByTag(UpdaterDialogFragment.class.getName());
if (f != null)
return false;
@Framework.DoAfterUpdate
final int result = Framework.nativeToDoAfterUpdate();
if (result == Framework.DO_AFTER_UPDATE_MIGRATE || result == Framework.DO_AFTER_UPDATE_NOTHING)
return false;
final UpdateInfo info = MapManager.nativeGetUpdateInfo(null);
if (info == null)
return false;
final Bundle args = new Bundle();
final long size = info.totalSize / Constants.MB;
args.putBoolean(ARG_UPDATE_IMMEDIATELY, result == Framework.DO_AFTER_UPDATE_AUTO_UPDATE);
args.putString(ARG_TOTAL_SIZE, StringUtils.getFileSizeString(info.totalSize));
args.putLong(ARG_TOTAL_SIZE_MB, size);
args.putStringArray(ARG_OUTDATED_MAPS, Framework.nativeGetOutdatedCountries());
final UpdaterDialogFragment fragment = new UpdaterDialogFragment();
fragment.setArguments(args);
FragmentTransaction transaction = fm.beginTransaction()
.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out);
// TODO remove detachMap() when dialog migrated to SplashActivity
if (activity instanceof MwmActivity)
((MwmActivity) activity).detachMap(transaction);
fragment.show(transaction, UpdaterDialogFragment.class.getName());
Statistics.INSTANCE.trackDownloaderDialogEvent(DOWNLOADER_DIALOG_SHOW, size);
return true;
}
@Override
protected int getCustomTheme()
{
return super.getFullscreenTheme();
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
mFromInstanceState = savedInstanceState != null;
readArguments();
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
Dialog res = super.onCreateDialog(savedInstanceState);
res.requestWindowFeature(Window.FEATURE_NO_TITLE);
View content = View.inflate(getActivity(), R.layout.fragment_updater, null);
res.setContentView(content);
mTitle = (TextView) content.findViewById(R.id.title);
mUpdateBtn = (TextView) content.findViewById(R.id.update_btn);
mProgressBar = (ProgressBar) content.findViewById(R.id.progress);
mCancelBtn = (TextView) content.findViewById(R.id.cancel_btn);
initViews();
return res;
}
@Override
public void onResume()
{
super.onResume();
if (isAllUpdated())
{
// TODO remove attachMap() when dialog migrated to SplashActivity
attachMap();
dismiss();
return;
}
// TODO remove detachMap() when dialog migrated to SplashActivity
if (getActivity() instanceof MwmActivity && mFromInstanceState)
{
FragmentTransaction transaction = getActivity().getSupportFragmentManager()
.beginTransaction();
((MwmActivity) getActivity()).detachMap(transaction);
transaction.commit();
}
mListenerSlot = MapManager.nativeSubscribe(mStorageCallback);
if (mAutoUpdate && !MapManager.nativeIsDownloading())
{
MapManager.nativeUpdate(CountryItem.getRootId());
Statistics.INSTANCE.trackDownloaderDialogEvent(DOWNLOADER_DIALOG_DOWNLOAD,
mTotalSizeMb);
}
}
@Override
public void onPause()
{
if (mListenerSlot != 0)
{
MapManager.nativeUnsubscribe(mListenerSlot);
mListenerSlot = 0;
}
super.onPause();
}
@Override
public void onCancel(DialogInterface dialog)
{
if (MapManager.nativeIsDownloading())
MapManager.nativeCancel(CountryItem.getRootId());
// TODO remove attachMap() when dialog migrated to SplashActivity
attachMap();
super.onCancel(dialog);
}
//TODO remove attachMap() when dialog migrated to SplashActivity
private void attachMap()
{
if (!(getActivity() instanceof MwmActivity))
return;
((MwmActivity)getActivity()).attachMap();
}
private void readArguments()
{
Bundle args = getArguments();
if (args == null)
return;
mAutoUpdate = args.getBoolean(ARG_UPDATE_IMMEDIATELY);
if (!mAutoUpdate && MapManager.nativeIsDownloading())
mAutoUpdate = true;
mTotalSize = args.getString(ARG_TOTAL_SIZE);
mTotalSizeMb = args.getLong(ARG_TOTAL_SIZE_MB, 0L);
mOutdatedMaps = args.getStringArray(ARG_OUTDATED_MAPS);
}
private void initViews()
{
UiUtils.showIf(mAutoUpdate, mProgressBar);
UiUtils.showIf(!mAutoUpdate, mUpdateBtn);
mUpdateBtn.setText(getString(R.string.whats_new_auto_update_button_size, mTotalSize));
mUpdateBtn.setOnClickListener(mUpdateClickListener);
mCancelBtn.setText(mAutoUpdate ? R.string.cancel : R.string.whats_new_auto_update_button_later);
mCancelBtn.setOnClickListener(mCancelClickListener);
mTitle.setText(mAutoUpdate ? String.format(Locale.getDefault(), "%s %d%%",
getString(R.string.whats_new_auto_update_updating_maps),
MapManager.nativeGetOverallProgress(mOutdatedMaps))
: getString(R.string.whats_new_auto_update_title));
}
private boolean isAllUpdated()
{
return MapManager.nativeGetOverallProgress(mOutdatedMaps) >= 100;
}
}

View file

@ -29,7 +29,7 @@ import com.mapswithme.maps.base.BaseMwmDialogFragment;
import com.mapswithme.util.ThemeUtils;
import com.mapswithme.util.UiUtils;
abstract class BaseNewsFragment extends BaseMwmDialogFragment
public abstract class BaseNewsFragment extends BaseMwmDialogFragment
{
private ViewPager mPager;
private View mPrevButton;
@ -291,12 +291,16 @@ abstract class BaseNewsFragment extends BaseMwmDialogFragment
}
@SuppressWarnings("TryWithIdenticalCatches")
static void create(FragmentActivity activity, Class<? extends BaseNewsFragment> clazz)
static void create(@NonNull FragmentActivity activity,
@NonNull Class<? extends BaseNewsFragment> clazz)
{
try
{
final BaseNewsFragment fragment = clazz.newInstance();
fragment.show(activity.getSupportFragmentManager(), clazz.getName());
activity.getSupportFragmentManager()
.beginTransaction()
.add(fragment, clazz.getName())
.commitAllowingStateLoss();
} catch (java.lang.InstantiationException ignored)
{}
catch (IllegalAccessException ignored)

View file

@ -73,7 +73,7 @@ public class FirstStartFragment extends BaseNewsFragment
LocationHelper.INSTANCE.onExitFromFirstRun();
}
public static boolean showOn(FragmentActivity activity)
public static boolean showOn(@NonNull FragmentActivity activity)
{
if (Config.getFirstInstallVersion() < BuildConfig.VERSION_CODE)
return false;

View file

@ -1,14 +1,31 @@
package com.mapswithme.maps.news;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import com.mapswithme.maps.BuildConfig;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.maps.R;
import com.mapswithme.maps.downloader.UpdaterDialogFragment;
import com.mapswithme.util.Config;
import com.mapswithme.util.concurrency.UiThread;
public class NewsFragment extends BaseNewsFragment
{
private static final long DONE_DELAY = MwmApplication.get().getResources()
.getInteger(android.R.integer.config_longAnimTime);
@NonNull
private final Runnable mDoneTask = new Runnable()
{
@Override
public void run()
{
NewsFragment.super.onDoneClick();
}
};
private class Adapter extends BaseNewsFragment.Adapter
{
@Override
@ -54,11 +71,27 @@ public class NewsFragment extends BaseNewsFragment
return new Adapter();
}
@Override
protected void onDoneClick()
{
if (!UpdaterDialogFragment.showOn(getActivity()))
super.onDoneClick();
else
UiThread.runLater(mDoneTask, DONE_DELAY);
}
@Override
public void onDestroy()
{
UiThread.cancelDelayedTasks(mDoneTask);
super.onDestroy();
}
/**
* Displays "What's new" dialog on given {@code activity}. Or not.
* @return whether "What's new" dialog should be shown.
*/
public static boolean showOn(FragmentActivity activity)
public static boolean showOn(@NonNull FragmentActivity activity)
{
if (Config.getFirstInstallVersion() >= BuildConfig.VERSION_CODE)
return false;

View file

@ -20,7 +20,6 @@ import com.mapswithme.maps.PrivateVariables;
import com.mapswithme.maps.ads.MwmNativeAd;
import com.mapswithme.maps.ads.NativeAdError;
import com.mapswithme.maps.api.ParsedMwmRequest;
import com.mapswithme.maps.ads.Banner;
import com.mapswithme.maps.bookmarks.data.MapObject;
import com.mapswithme.maps.downloader.MapManager;
import com.mapswithme.maps.editor.Editor;
@ -35,6 +34,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.mapswithme.util.statistics.Statistics.EventName.DOWNLOADER_DIALOG_ERROR;
import static com.mapswithme.util.statistics.Statistics.EventName.PP_BANNER_BLANK;
import static com.mapswithme.util.statistics.Statistics.EventName.PP_BANNER_ERROR;
import static com.mapswithme.util.statistics.Statistics.EventName.PP_SPONSORED_BOOK;
@ -45,10 +45,12 @@ import static com.mapswithme.util.statistics.Statistics.EventParam.ERROR_MESSAGE
import static com.mapswithme.util.statistics.Statistics.EventParam.HOTEL;
import static com.mapswithme.util.statistics.Statistics.EventParam.HOTEL_LAT;
import static com.mapswithme.util.statistics.Statistics.EventParam.HOTEL_LON;
import static com.mapswithme.util.statistics.Statistics.EventParam.MAP_DATA_SIZE;
import static com.mapswithme.util.statistics.Statistics.EventParam.PROVIDER;
import static com.mapswithme.util.statistics.Statistics.EventParam.RESTAURANT;
import static com.mapswithme.util.statistics.Statistics.EventParam.RESTAURANT_LAT;
import static com.mapswithme.util.statistics.Statistics.EventParam.RESTAURANT_LON;
import static com.mapswithme.util.statistics.Statistics.EventParam.TYPE;
import static com.mapswithme.util.statistics.Statistics.ParamValue.BOOKING_COM;
import static com.mapswithme.util.statistics.Statistics.ParamValue.OPENTABLE;
import static com.mapswithme.util.statistics.Statistics.EventName.PP_HOTEL_REVIEWS_LAND;
@ -72,6 +74,12 @@ public enum Statistics
public static final String DOWNLOADER_ERROR = "Downloader_Map_error";
public static final String DOWNLOADER_ACTION = "Downloader_Map_action";
public static final String DOWNLOADER_CANCEL = "Downloader_Cancel_downloading";
public static final String DOWNLOADER_DIALOG_SHOW = "Downloader_OnStartScreen_show";
public static final String DOWNLOADER_DIALOG_MANUAL_DOWNLOAD = "Downloader_OnStartScreen_manual_download";
public static final String DOWNLOADER_DIALOG_DOWNLOAD = "Downloader_OnStartScreen_auto_download";
public static final String DOWNLOADER_DIALOG_LATER = "Downloader_OnStartScreen_select_later";
public static final String DOWNLOADER_DIALOG_CANCEL = "Downloader_OnStartScreen_cancel_download";
static final String DOWNLOADER_DIALOG_ERROR = "Downloader_OnStartScreen_error";
// bookmarks
public static final String BMK_DESCRIPTION_CHANGED = "Bookmark. Description changed";
@ -260,6 +268,7 @@ public enum Statistics
static final String BANNER_STATE = "state";
static final String ERROR_CODE = "error_code";
static final String ERROR_MESSAGE = "error_message";
static final String MAP_DATA_SIZE = "map_data_size:";
private EventParam() {}
}
@ -556,6 +565,19 @@ public enum Statistics
.get());
}
public void trackDownloaderDialogEvent(@NonNull String eventName, long size)
{
trackEvent(eventName, Statistics.params()
.add(MAP_DATA_SIZE, size));
}
public void trackDownloaderDialogError(long size, @NonNull String error)
{
trackEvent(DOWNLOADER_DIALOG_ERROR, Statistics.params()
.add(MAP_DATA_SIZE, size)
.add(TYPE, error));
}
public static ParameterBuilder params()
{
return new ParameterBuilder();

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "فشل تحميل المعلومات.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Nepodařilo se načíst informace.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Kunne ikke indlæse oplysningerne.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Informationen konnten nicht geladen werden.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Η φόρτωση πληροφοριών απέτυχε.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Failed to load information.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Failed to load information.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "No se ha podido cargar la información.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Tietojen lataaminen epäonnistui.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Impossible de charger les informations.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Nem sikerült betölteni az adatokat.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Gagal memuat informasi.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Impossibile caricare le informazioni.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "情報の読み込みに失敗しました。";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "정보를 로드하지 못했습니다.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Kunne ikke laste inn informasjon.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Informatie laden mislukt.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Nie można załadować informacji.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Falha ao carregar informações.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -410,10 +410,10 @@
"my_position_share_email" = "Chào,\n\nTôi hiện đang ở đây: %1$@. Hãy nhấn vào liên kết này %2$@ hoặc liên kết này %3$@ để xem địa điểm trên bản đồ.\n\nCám ơn.";
/* Android share by Message/SMS button text (including SMS) */
"share_by_message" = "Chia sẻ bằng tin nhắn";
"share_by_message" = "Partajare ca mesaj";
/* Share button text which opens menu with more buttons, like Message, EMail, Facebook etc. */
"share" = "Chia sẻ";
"share" = "Partajare";
/* iOS share by Message button text (including SMS) */
"message" = "Tin nhắn";
@ -1846,3 +1846,13 @@
"failed_load_information" = "Încărcarea informațiilor a eșuat.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Не удалось загрузить информацию.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Обновляем карты";
"whats_new_auto_update_title" = "Обновите ваши загруженные карты";
"whats_new_auto_update_message" = "Обновление карт поддерживает информацию об объектах в актуальном состоянии";
"whats_new_auto_update_button_size" = "Обновить (%s)";
"whats_new_auto_update_button_later" = "Обновить вручную позже";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Nepodarilo sa načítať informácie.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Det gick inte att ladda informationen.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "ไม่สามารถโหลดข้อมูลได้";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Bilgiler yüklenemedi.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Не вдалося завантажити інформацію.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "Không thể tải thông tin.";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "无法加载信息。";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -1846,3 +1846,13 @@
"failed_load_information" = "無法載入資訊。";
"booking_search" = "Booking.com";
"whats_new_auto_update_updating_maps" = "Updating maps";
"whats_new_auto_update_title" = "Update your downloaded maps";
"whats_new_auto_update_message" = "Update maps supports information about objects in the current state";
"whats_new_auto_update_button_size" = "Update (%s)";
"whats_new_auto_update_button_later" = "Manually update later";

View file

@ -23148,3 +23148,23 @@
[booking_search]
en = Booking.com
[whats_new_auto_update_updating_maps]
en = Updating maps
ru = Обновляем карты
[whats_new_auto_update_title]
en = Update your downloaded maps
ru = Обновите ваши загруженные карты
[whats_new_auto_update_message]
en = Update maps supports information about objects in the current state
ru = Обновление карт поддерживает информацию об объектах в актуальном состоянии
[whats_new_auto_update_button_size]
en = Update (%s)
ru = Обновить (%s)
[whats_new_auto_update_button_later]
en = Manually update later
ru = Обновить вручную позже