From c465524d0527e77c3ee711a2dc11c67c07dce706 Mon Sep 17 00:00:00 2001 From: Arsentiy Milchakov Date: Mon, 26 Mar 2018 17:43:11 +0300 Subject: [PATCH] [android] autoupdate layout is updated. --- android/res/layout/fragment_updater.xml | 118 ++++++------------ android/res/values/dimens.xml | 2 +- .../downloader/UpdaterDialogFragment.java | 45 ++++--- .../util/statistics/Statistics.java | 1 + 4 files changed, 62 insertions(+), 104 deletions(-) diff --git a/android/res/layout/fragment_updater.xml b/android/res/layout/fragment_updater.xml index 5646e045a3..15702d62eb 100644 --- a/android/res/layout/fragment_updater.xml +++ b/android/res/layout/fragment_updater.xml @@ -8,7 +8,11 @@ + android:layout_height="match_parent" + android:layout_marginLeft="@dimen/margin_base" + android:layout_marginRight="@dimen/margin_base" + android:layout_marginStart="@dimen/margin_base" + android:layout_marginEnd="@dimen/margin_base"> + + - - - - + - - - - + tools:text="@string/whats_new_auto_update_button_later"/> + diff --git a/android/res/values/dimens.xml b/android/res/values/dimens.xml index 41a88b4893..8540dddd93 100644 --- a/android/res/values/dimens.xml +++ b/android/res/values/dimens.xml @@ -45,7 +45,7 @@ 40dp @dimen/downloader_status_size 32dp - 36dp + 36dp 360dp 240dp diff --git a/android/src/com/mapswithme/maps/downloader/UpdaterDialogFragment.java b/android/src/com/mapswithme/maps/downloader/UpdaterDialogFragment.java index 9df882556d..4385fa3691 100644 --- a/android/src/com/mapswithme/maps/downloader/UpdaterDialogFragment.java +++ b/android/src/com/mapswithme/maps/downloader/UpdaterDialogFragment.java @@ -35,6 +35,7 @@ import java.util.Set; 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_HIDE; import static com.mapswithme.util.statistics.Statistics.EventName.DOWNLOADER_DIALOG_MANUAL_DOWNLOAD; import static com.mapswithme.util.statistics.Statistics.EventName.DOWNLOADER_DIALOG_SHOW; @@ -55,12 +56,9 @@ public class UpdaterDialogFragment extends BaseMwmDialogFragment private TextView mTitle; private TextView mUpdateBtn; private WheelProgressView mProgressBar; - private TextView mLaterBtn; + private TextView mFinishBtn; private View mInfo; private TextView mRelativeStatus; - private TextView mCommonStatus; - private View mFrameBtn; - private TextView mHideBtn; @Nullable private String mTotalSize; @@ -93,9 +91,11 @@ public class UpdaterDialogFragment extends BaseMwmDialogFragment } @NonNull - private final View.OnClickListener mLaterClickListener = (View v) -> + private final View.OnClickListener mFinishClickListener = (View v) -> { - Statistics.INSTANCE.trackDownloaderDialogEvent(DOWNLOADER_DIALOG_LATER, 0); + Statistics.INSTANCE.trackDownloaderDialogEvent(mAutoUpdate ? + DOWNLOADER_DIALOG_HIDE : + DOWNLOADER_DIALOG_LATER, 0); finish(); }; @@ -128,9 +128,6 @@ public class UpdaterDialogFragment extends BaseMwmDialogFragment initViews(); }; - @NonNull - private final View.OnClickListener mHideClickListener = (View v) -> finish(); - @NonNull private final View.OnClickListener mUpdateClickListener = (View v) -> MapManager.warnOn3gUpdate(getActivity(), CountryItem.getRootId(), new Runnable() @@ -139,12 +136,13 @@ public class UpdaterDialogFragment extends BaseMwmDialogFragment public void run() { mAutoUpdate = true; + mFinishBtn.setText(getString(R.string.downloader_hide_screen)); mTitle.setText(getString(R.string.whats_new_auto_update_updating_maps)); setProgress(0, 0, mTotalSizeBytes); setCommonStatus(mProcessedMapId, mCommonStatusResId); MapManager.nativeUpdate(CountryItem.getRootId()); - UiUtils.show(mProgressBar, mInfo, mFrameBtn, mHideBtn); - UiUtils.hide(mUpdateBtn, mLaterBtn); + UiUtils.show(mProgressBar, mInfo); + UiUtils.hide(mUpdateBtn); Statistics.INSTANCE.trackDownloaderDialogEvent(DOWNLOADER_DIALOG_MANUAL_DOWNLOAD, mTotalSizeBytes / Constants.MB); @@ -250,12 +248,9 @@ public class UpdaterDialogFragment extends BaseMwmDialogFragment mTitle = content.findViewById(R.id.title); mUpdateBtn = content.findViewById(R.id.update_btn); mProgressBar = content.findViewById(R.id.progress); - mLaterBtn = content.findViewById(R.id.later_btn); + mFinishBtn = content.findViewById(R.id.later_btn); mInfo = content.findViewById(R.id.info); mRelativeStatus = content.findViewById(R.id.relative_status); - mCommonStatus = content.findViewById(R.id.common_status); - mFrameBtn = content.findViewById(R.id.frame_btn); - mHideBtn = content.findViewById(R.id.hide_btn); initViews(); @@ -340,24 +335,26 @@ public class UpdaterDialogFragment extends BaseMwmDialogFragment private void initViews() { - UiUtils.showIf(mAutoUpdate, mProgressBar, mInfo, mFrameBtn, mHideBtn); - UiUtils.showIf(!mAutoUpdate, mUpdateBtn, mLaterBtn); - - mTitle.setText(mAutoUpdate ? getString(R.string.whats_new_auto_update_updating_maps) - : getString(R.string.whats_new_auto_update_title)); + UiUtils.showIf(mAutoUpdate, mProgressBar, mInfo); + UiUtils.showIf(!mAutoUpdate, mUpdateBtn); mUpdateBtn.setText(getString(R.string.whats_new_auto_update_button_size, mTotalSize)); mUpdateBtn.setOnClickListener(mUpdateClickListener); - mLaterBtn.setText(R.string.whats_new_auto_update_button_later); - mLaterBtn.setOnClickListener(mLaterClickListener); + mFinishBtn.setText(mAutoUpdate ? + getString(R.string.downloader_hide_screen) : + getString(R.string.whats_new_auto_update_button_later)); + mFinishBtn.setOnClickListener(mFinishClickListener); mProgressBar.setOnClickListener(mCancelClickListener); - mHideBtn.setOnClickListener(mHideClickListener); if (mAutoUpdate) { int progress = MapManager.nativeGetOverallProgress(mOutdatedMaps); setProgress(progress, mTotalSizeBytes * progress / 100, mTotalSizeBytes); setCommonStatus(mProcessedMapId, mCommonStatusResId); } + else + { + mTitle.setText(getString(R.string.whats_new_auto_update_title)); + } } private boolean isAllUpdated() @@ -388,7 +385,7 @@ public class UpdaterDialogFragment extends BaseMwmDialogFragment mCommonStatusResId = mwmStatusResId; String status = getString(mwmStatusResId, MapManager.nativeGetName(mwmId)); - mCommonStatus.setText(status); + mTitle.setText(status); } private static class DetachableStorageCallback implements MapManager.StorageCallback { diff --git a/android/src/com/mapswithme/util/statistics/Statistics.java b/android/src/com/mapswithme/util/statistics/Statistics.java index b737a55b02..f27ad5e1d1 100644 --- a/android/src/com/mapswithme/util/statistics/Statistics.java +++ b/android/src/com/mapswithme/util/statistics/Statistics.java @@ -139,6 +139,7 @@ public enum Statistics 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_HIDE = "Downloader_OnStartScreen_select_hide"; public static final String DOWNLOADER_DIALOG_CANCEL = "Downloader_OnStartScreen_cancel_download"; static final String DOWNLOADER_DIALOG_ERROR = "Downloader_OnStartScreen_error";