forked from organicmaps/organicmaps
[new downloader][android] fix: String usages.
fix: Whats new tuning.
This commit is contained in:
parent
24509716ec
commit
0dddb78622
16 changed files with 77 additions and 81 deletions
|
@ -16,7 +16,7 @@
|
|||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
tools:text="@string/downloader_maps_to_update"/>
|
||||
tools:text="@string/downloader_status_maps"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn__action"
|
||||
|
@ -24,5 +24,5 @@
|
|||
android:layout_height="@dimen/height_item_oneline"
|
||||
style="@style/MwmWidget.Button"
|
||||
android:textAppearance="@style/MwmTextAppearance.Body3"
|
||||
android:text="@string/downloader_update_all"/>
|
||||
android:text="@string/downloader_update_all_button"/>
|
||||
</LinearLayout>
|
|
@ -25,14 +25,14 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/margin_base"
|
||||
android:gravity="center"
|
||||
android:text="@string/youve_been_asking"
|
||||
android:text="@string/whatsnew_smallmwm_header"
|
||||
android:textAppearance="@style/MwmTextAppearance.Title"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/migrate_and_split_mwms_message"
|
||||
android:text="@string/whatsnew_smallmwm_message"
|
||||
android:textAppearance="@style/MwmTextAppearance.Body3"/>
|
||||
|
||||
<Space
|
||||
|
@ -55,7 +55,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/margin_base"
|
||||
android:text="Preparing…"
|
||||
android:text="@string/migration_prefetch_status"
|
||||
android:textAppearance="@style/MwmTextAppearance.Body3"/>
|
||||
|
||||
<FrameLayout
|
||||
|
@ -64,7 +64,7 @@
|
|||
android:layout_marginBottom="@dimen/margin_base">
|
||||
<Button
|
||||
android:id="@+id/button_primary"
|
||||
android:text="@string/downloader_update_all"
|
||||
android:text="@string/migration_update_all_button"
|
||||
style="@style/MwmWidget.Button.Accent"/>
|
||||
|
||||
<com.mapswithme.maps.widget.WheelProgressView
|
||||
|
@ -82,7 +82,7 @@
|
|||
<Button
|
||||
android:id="@+id/button_secondary"
|
||||
style="@style/MwmWidget.Button"
|
||||
android:text="@string/delete_old_maps"
|
||||
android:text="@string/migration_delete_all_download_current_button"
|
||||
android:textColor="?colorAccent"/>
|
||||
</LinearLayout>
|
||||
</com.mapswithme.maps.widget.HeightLimitedFrameLayout>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<TextView
|
||||
android:id="@+id/update_all"
|
||||
style="@style/MwmWidget.Downloader.ToolbarButton"
|
||||
android:text="@string/downloader_update_all"/>
|
||||
android:text="@string/downloader_update_all_button"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cancel_all"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:hint="@string/search"
|
||||
android:hint="@string/downloader_search_field_hint"
|
||||
android:imeOptions="actionSearch|flagNoExtractUi"
|
||||
android:inputType="text"
|
||||
android:padding="@dimen/margin_quarter"
|
||||
|
|
|
@ -66,22 +66,22 @@
|
|||
</integer-array>
|
||||
|
||||
<string-array name="first_start_titles">
|
||||
<item>First start page 1</item>
|
||||
<item>First start page 2</item>
|
||||
<item>@string/onboarding_offline_navigation_title</item>
|
||||
<item>@string/onboarding_offline_maps_title</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="first_start_subtitles">
|
||||
<item>Some text</item>
|
||||
<item>Some text</item>
|
||||
<item>@string/onboarding_offline_navigation_message</item>
|
||||
<item>@string/onboarding_offline_maps_message</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="first_start_switch_titles">
|
||||
<item>Sample switch title</item>
|
||||
<item/>
|
||||
<item/>
|
||||
</string-array>
|
||||
|
||||
<string-array name="first_start_switch_subtitles">
|
||||
<item>Sample switch subtitle</item>
|
||||
<item/>
|
||||
<item/>
|
||||
</string-array>
|
||||
|
||||
|
@ -93,18 +93,32 @@
|
|||
</integer-array>
|
||||
|
||||
<string-array name="news_titles">
|
||||
<item>@string/whats_new_night_caption</item>
|
||||
<item>@string/whatsnew_smallmwm_header</item>
|
||||
<item>@string/whatsnew_editor_title</item>
|
||||
<item>@string/whatsnew_search_header</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="news_subtitles">
|
||||
<item>@string/whats_new_night_body</item>
|
||||
<string-array name="news_messages_1">
|
||||
<item>@string/whatsnew_smallmwm_message</item>
|
||||
<item>@string/whatsnew_editor_message_1</item>
|
||||
<item>@string/whatsnew_search_message</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="news_messages_2">
|
||||
<item/>
|
||||
<item>@string/whatsnew_editor_message_2</item>
|
||||
<item/>
|
||||
</string-array>
|
||||
|
||||
<string-array name="news_switch_titles">
|
||||
<item/>
|
||||
<item/>
|
||||
<item/>
|
||||
</string-array>
|
||||
|
||||
<string-array name="news_switch_subtitles">
|
||||
<item/>
|
||||
<item/>
|
||||
<item/>
|
||||
</string-array>
|
||||
</resources>
|
||||
</resources>
|
||||
|
|
|
@ -407,7 +407,7 @@ public class DownloadResourcesActivity extends BaseMwmFragmentActivity
|
|||
|
||||
case ERR_DOWNLOAD_ERROR:
|
||||
return (ConnectionState.isConnected() ? R.string.download_has_failed
|
||||
: R.string.no_internet_connection_detected);
|
||||
: R.string.common_check_internet_connection_dialog);
|
||||
default:
|
||||
return R.string.not_enough_memory;
|
||||
}
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
package com.mapswithme.maps.downloader;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.util.ConnectionState;
|
||||
import com.mapswithme.util.Constants;
|
||||
|
||||
public final class DownloadHelper
|
||||
{
|
||||
private DownloadHelper() {}
|
||||
|
||||
public interface OnDownloadListener
|
||||
{
|
||||
void onDownload();
|
||||
}
|
||||
|
||||
private static boolean canDownloadWithoutWarning(long size)
|
||||
{
|
||||
return size < 50 * Constants.MB || ConnectionState.isWifiConnected();
|
||||
}
|
||||
|
||||
public static void downloadWithCellularCheck(Activity activity, long size, String name, final OnDownloadListener listener)
|
||||
{
|
||||
if (canDownloadWithoutWarning(size))
|
||||
{
|
||||
listener.onDownload();
|
||||
return;
|
||||
}
|
||||
|
||||
new AlertDialog.Builder(activity)
|
||||
.setMessage(String.format(activity.getString(R.string.no_wifi_ask_cellular_download), name))
|
||||
.setNegativeButton(activity.getString(R.string.close), null)
|
||||
.setPositiveButton(activity.getString(R.string.ok), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dlg, int which)
|
||||
{
|
||||
listener.onDownload();
|
||||
dlg.dismiss();
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
}
|
|
@ -104,7 +104,7 @@ class DownloaderAdapter extends RecyclerView.Adapter<DownloaderAdapter.ViewHolde
|
|||
|
||||
new AlertDialog.Builder(adapter.mActivity)
|
||||
.setTitle(R.string.downloader_delete_map)
|
||||
.setMessage(R.string.downloader_delete_editor_changes)
|
||||
.setMessage(R.string.downloader_delete_map_dialog)
|
||||
.setNegativeButton(android.R.string.no, null)
|
||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener()
|
||||
{
|
||||
|
@ -519,7 +519,7 @@ class DownloaderAdapter extends RecyclerView.Adapter<DownloaderAdapter.ViewHolde
|
|||
if (ci.category != prev)
|
||||
{
|
||||
headerId = CountryItem.CATEGORY_NEAR_ME;
|
||||
mHeaders.put(headerId, MwmApplication.get().getString(R.string.downloader_near_me));
|
||||
mHeaders.put(headerId, MwmApplication.get().getString(R.string.downloader_near_me_subtitle));
|
||||
prev = ci.category;
|
||||
}
|
||||
break;
|
||||
|
@ -528,7 +528,7 @@ class DownloaderAdapter extends RecyclerView.Adapter<DownloaderAdapter.ViewHolde
|
|||
if (ci.category != prev)
|
||||
{
|
||||
headerId = CountryItem.CATEGORY_DOWNLOADED;
|
||||
mHeaders.put(headerId, MwmApplication.get().getString(R.string.downloader_downloaded));
|
||||
mHeaders.put(headerId, MwmApplication.get().getString(R.string.downloader_downloaded_subtitle));
|
||||
prev = ci.category;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -117,7 +117,7 @@ public class DownloaderFragment extends BaseMwmRecyclerFragment
|
|||
showBottom = (info != null && info.filesCount > 0);
|
||||
|
||||
if (showBottom)
|
||||
mPanelText.setText(getString(R.string.downloader_maps_to_update, info.filesCount, StringUtils.getFileSizeString(info.totalSize)));
|
||||
mPanelText.setText(getString(R.string.downloader_status_maps, String.valueOf(info.filesCount) + " (" + StringUtils.getFileSizeString(info.totalSize) + ")"));
|
||||
}
|
||||
|
||||
UiUtils.showIf(showBottom, mBottomPanel);
|
||||
|
|
|
@ -92,11 +92,11 @@ public final class MapManager
|
|||
switch (errorData.errorCode)
|
||||
{
|
||||
case CountryItem.ERROR_NO_INTERNET:
|
||||
text = R.string.no_internet_connection_detected;
|
||||
text = R.string.common_check_internet_connection_dialog;
|
||||
break;
|
||||
|
||||
case CountryItem.ERROR_OOM:
|
||||
text = R.string.not_enough_disk_space;
|
||||
text = R.string.downloader_no_space_title;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -124,11 +124,11 @@ public class MigrationFragment extends BaseMwmFragment
|
|||
switch (code)
|
||||
{
|
||||
case CountryItem.ERROR_OOM:
|
||||
text = R.string.not_enough_disk_space;
|
||||
text = R.string.downloader_no_space_title;
|
||||
break;
|
||||
|
||||
case CountryItem.ERROR_NO_INTERNET:
|
||||
text = R.string.no_internet_connection_detected;
|
||||
text = R.string.common_check_internet_connection_dialog;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -191,7 +191,7 @@ public class EditorHostFragment extends BaseMwmToolbarFragment
|
|||
else
|
||||
{
|
||||
// TODO(yunikkk) set correct error text.
|
||||
UiUtils.showAlertDialog(getActivity(), R.string.not_enough_disk_space);
|
||||
UiUtils.showAlertDialog(getActivity(), R.string.downloader_no_space_title);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,20 @@ abstract class BaseNewsFragment extends BaseMwmDialogFragment
|
|||
Resources res = MwmApplication.get().getResources();
|
||||
|
||||
mTitles = res.getStringArray(getTitles());
|
||||
mSubtitles = res.getStringArray(getSubtitles());
|
||||
mSubtitles = res.getStringArray(getSubtitles1());
|
||||
|
||||
int subtitles2 = getSubtitles2();
|
||||
if (subtitles2 != 0)
|
||||
{
|
||||
String[] strings = res.getStringArray(subtitles2);
|
||||
for (int i = 0; i < mSubtitles.length; i++)
|
||||
{
|
||||
String s = strings[i];
|
||||
if (!TextUtils.isEmpty(s))
|
||||
mSubtitles[i] += "\n\n" + s;
|
||||
}
|
||||
}
|
||||
|
||||
mSwitchTitles = res.getStringArray(getSwitchTitles());
|
||||
mSwitchSubtitles = res.getStringArray(getSwitchSubtitles());
|
||||
|
||||
|
@ -66,7 +79,8 @@ abstract class BaseNewsFragment extends BaseMwmDialogFragment
|
|||
}
|
||||
|
||||
abstract @ArrayRes int getTitles();
|
||||
abstract @ArrayRes int getSubtitles();
|
||||
abstract @ArrayRes int getSubtitles1();
|
||||
abstract @ArrayRes int getSubtitles2();
|
||||
abstract @ArrayRes int getSwitchTitles();
|
||||
abstract @ArrayRes int getSwitchSubtitles();
|
||||
abstract @ArrayRes int getImages();
|
||||
|
|
|
@ -46,11 +46,17 @@ public class FirstStartFragment extends BaseNewsFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
int getSubtitles()
|
||||
int getSubtitles1()
|
||||
{
|
||||
return R.array.first_start_subtitles;
|
||||
}
|
||||
|
||||
@Override
|
||||
int getSubtitles2()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
int getSwitchTitles()
|
||||
{
|
||||
|
|
|
@ -18,9 +18,15 @@ public class NewsFragment extends BaseNewsFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
int getSubtitles()
|
||||
int getSubtitles1()
|
||||
{
|
||||
return R.array.news_subtitles;
|
||||
return R.array.news_messages_1;
|
||||
}
|
||||
|
||||
@Override
|
||||
int getSubtitles2()
|
||||
{
|
||||
return R.array.news_messages_2;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -64,8 +64,10 @@ class ResultCodesHelper
|
|||
case DIFFERENT_MWM:
|
||||
messages.add(resources.getString(R.string.routing_failed_cross_mwm_building));
|
||||
break;
|
||||
//TODO (@yunitski @marchuk) Add proper dialog for this case.
|
||||
case FILE_TOO_OLD:
|
||||
titleRes = R.string.downloader_update_maps;
|
||||
messages.add(resources.getString(R.string.downloader_mwm_migration_dialog));
|
||||
break;
|
||||
case ROUTE_NOT_FOUND:
|
||||
if (missingCount == 0)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue