forked from organicmaps/organicmaps
Show error message when download fails due to internet connection
Signed-off-by: DevarshVasani <vasanidevarsh@gmail.com>
This commit is contained in:
parent
10e7749f2f
commit
9d7984299b
2 changed files with 25 additions and 0 deletions
|
@ -31,6 +31,7 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
|
|||
private final TextView mParent;
|
||||
private final TextView mTitle;
|
||||
private final TextView mSize;
|
||||
private final TextView mError;
|
||||
private final WheelProgressView mProgress;
|
||||
private final Button mButton;
|
||||
|
||||
|
@ -52,6 +53,9 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
|
|||
if (!item.isLeafNode)
|
||||
continue;
|
||||
|
||||
if (mError.getVisibility() == View.VISIBLE)
|
||||
mError.setVisibility(View.GONE);
|
||||
|
||||
if (item.newStatus == CountryItem.STATUS_FAILED)
|
||||
MapManager.showError(mActivity, item, null);
|
||||
|
||||
|
@ -172,6 +176,13 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
|
|||
}
|
||||
}
|
||||
|
||||
if (!ConnectionState.INSTANCE.isConnected() &&
|
||||
failed)
|
||||
{
|
||||
if (!(mError.getVisibility() == View.VISIBLE))
|
||||
mError.setVisibility(View.VISIBLE);
|
||||
mError.setText("Downloading failed, please check your internet connection");
|
||||
}
|
||||
mButton.setText(failed ? R.string.downloader_retry
|
||||
: R.string.download);
|
||||
}
|
||||
|
@ -191,6 +202,7 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
|
|||
mParent = mFrame.findViewById(R.id.downloader_parent);
|
||||
mTitle = mFrame.findViewById(R.id.downloader_title);
|
||||
mSize = mFrame.findViewById(R.id.downloader_size);
|
||||
mError = mFrame.findViewById(R.id.downloader_error);
|
||||
|
||||
View controls = mFrame.findViewById(R.id.downloader_controls_frame);
|
||||
mProgress = controls.findViewById(R.id.wheel_downloader_progress);
|
||||
|
@ -208,6 +220,9 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
|
|||
if (mCurrentCountry == null)
|
||||
return;
|
||||
|
||||
if (mError.getVisibility() == View.VISIBLE)
|
||||
mError.setVisibility(View.GONE);
|
||||
|
||||
boolean retry = (mCurrentCountry.status == CountryItem.STATUS_FAILED);
|
||||
if (retry)
|
||||
{
|
||||
|
|
|
@ -46,6 +46,16 @@
|
|||
android:textAppearance="@style/MwmTextAppearance.Body2"
|
||||
android:gravity="center_horizontal"
|
||||
tools:text="1000 MB"/>
|
||||
<TextView
|
||||
android:id="@+id/downloader_error"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/margin_eighth"
|
||||
android:textAppearance="@style/MwmTextAppearance.Body4"
|
||||
android:gravity="center_horizontal"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/base_red"
|
||||
tools:text="some error very loooooooooong error"/>
|
||||
<FrameLayout
|
||||
android:id="@+id/downloader_controls_frame"
|
||||
android:layout_width="180dp"
|
||||
|
|
Loading…
Add table
Reference in a new issue