forked from organicmaps/organicmaps
[android] Updated design of download world map screen.
This commit is contained in:
parent
75cdd86180
commit
6595345924
2 changed files with 24 additions and 41 deletions
|
@ -1,31 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/tv_location"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_base"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/getting_position"
|
||||
android:textAppearance="@style/MwmTextAppearance.Body2"
|
||||
android:visibility="gone"/>
|
||||
<CheckBox
|
||||
android:id="@+id/chb_download_country"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_base"
|
||||
android:layout_marginStart="@dimen/margin_base"
|
||||
android:text="@string/download_country_ask"
|
||||
android:textAppearance="@style/MwmTextAppearance.Body2"
|
||||
android:visibility="gone"/>
|
||||
android:textAppearance="?fontBody2"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
<ProgressBar
|
||||
android:id="@+id/progressbar"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/margin_base_plus"
|
||||
android:layout_marginTop="@dimen/margin_base"
|
||||
android:layout_marginEnd="@dimen/margin_base_plus"
|
||||
android:layout_marginBottom="@dimen/margin_base"
|
||||
android:indeterminate="false" />
|
||||
|
|
|
@ -59,7 +59,6 @@ public class DownloadResourcesLegacyActivity extends BaseMwmFragmentActivity imp
|
|||
private static final int ERR_FILE_IN_PROGRESS = -6;
|
||||
|
||||
private TextView mTvMessage;
|
||||
private TextView mTvLocation;
|
||||
private ProgressBar mProgress;
|
||||
private Button mBtnDownload;
|
||||
private CheckBox mChbDownloadCountry;
|
||||
|
@ -129,29 +128,15 @@ public class DownloadResourcesLegacyActivity extends BaseMwmFragmentActivity imp
|
|||
int status = MapManager.nativeGetStatus(mCurrentCountry);
|
||||
String name = MapManager.nativeGetName(mCurrentCountry);
|
||||
|
||||
UiUtils.show(mTvLocation);
|
||||
|
||||
if (status == CountryItem.STATUS_DONE)
|
||||
mTvLocation.setText(String.format(getString(R.string.download_location_map_up_to_date), name));
|
||||
else
|
||||
if (status != CountryItem.STATUS_DONE)
|
||||
{
|
||||
UiUtils.show(mChbDownloadCountry);
|
||||
|
||||
String locationText;
|
||||
String checkBoxText;
|
||||
|
||||
if (status == CountryItem.STATUS_UPDATABLE)
|
||||
{
|
||||
locationText = getString(R.string.download_location_update_map_proposal);
|
||||
checkBoxText = String.format(getString(R.string.update_country_ask), name);
|
||||
}
|
||||
else
|
||||
{
|
||||
locationText = getString(R.string.download_location_map_proposal);
|
||||
checkBoxText = String.format(getString(R.string.download_country_ask), name);
|
||||
}
|
||||
|
||||
mTvLocation.setText(locationText);
|
||||
mChbDownloadCountry.setText(checkBoxText);
|
||||
}
|
||||
|
||||
|
@ -281,7 +266,7 @@ public class DownloadResourcesLegacyActivity extends BaseMwmFragmentActivity imp
|
|||
private void setDownloadMessage(int bytesToDownload)
|
||||
{
|
||||
mTvMessage.setText(getString(R.string.download_resources,
|
||||
StringUtils.getFileSizeString(getApplicationContext(), bytesToDownload)));
|
||||
StringUtils.getFileSizeString(this, bytesToDownload)));
|
||||
}
|
||||
|
||||
private boolean prepareFilesDownload(boolean showMap)
|
||||
|
@ -315,7 +300,7 @@ public class DownloadResourcesLegacyActivity extends BaseMwmFragmentActivity imp
|
|||
mProgress = findViewById(R.id.progressbar);
|
||||
mBtnDownload = findViewById(R.id.btn_download_resources);
|
||||
mChbDownloadCountry = findViewById(R.id.chb_download_country);
|
||||
mTvLocation = findViewById(R.id.tv_location);
|
||||
|
||||
mBtnListeners = new View.OnClickListener[BTN_COUNT];
|
||||
mBtnNames = new String[BTN_COUNT];
|
||||
|
||||
|
@ -398,7 +383,8 @@ public class DownloadResourcesLegacyActivity extends BaseMwmFragmentActivity imp
|
|||
}
|
||||
}
|
||||
|
||||
private static @StringRes int getErrorTitle(int res)
|
||||
@StringRes
|
||||
private static int getErrorTitle(int res)
|
||||
{
|
||||
switch (res)
|
||||
{
|
||||
|
@ -446,7 +432,7 @@ public class DownloadResourcesLegacyActivity extends BaseMwmFragmentActivity imp
|
|||
if (mCurrentCountry != null && mChbDownloadCountry.isChecked())
|
||||
{
|
||||
CountryItem item = CountryItem.fill(mCurrentCountry);
|
||||
UiUtils.hide(mChbDownloadCountry, mTvLocation);
|
||||
UiUtils.hide(mChbDownloadCountry);
|
||||
mTvMessage.setText(getString(R.string.downloading_country_can_proceed, item.name));
|
||||
mProgress.setMax((int)item.totalSize);
|
||||
mProgress.setProgress(0);
|
||||
|
@ -494,14 +480,15 @@ public class DownloadResourcesLegacyActivity extends BaseMwmFragmentActivity imp
|
|||
return null;
|
||||
}
|
||||
|
||||
private void showErrorDialog(int result){
|
||||
AlertDialog dialog = new AlertDialog.Builder()
|
||||
.setTitleId(getErrorTitle(result))
|
||||
.setMessageId(getErrorMessage(result))
|
||||
.setPositiveBtnId(R.string.try_again)
|
||||
.setReqCode(ERROR_LOADING_DIALOG_REQ_CODE)
|
||||
.setFragManagerStrategyType(AlertDialog.FragManagerStrategyType.ACTIVITY_FRAGMENT_MANAGER)
|
||||
.build();
|
||||
private void showErrorDialog(int result)
|
||||
{
|
||||
AlertDialog dialog = new AlertDialog.Builder()
|
||||
.setTitleId(getErrorTitle(result))
|
||||
.setMessageId(getErrorMessage(result))
|
||||
.setPositiveBtnId(R.string.try_again)
|
||||
.setReqCode(ERROR_LOADING_DIALOG_REQ_CODE)
|
||||
.setFragManagerStrategyType(AlertDialog.FragManagerStrategyType.ACTIVITY_FRAGMENT_MANAGER)
|
||||
.build();
|
||||
dialog.show(this, ERROR_LOADING_DIALOG_TAG);
|
||||
}
|
||||
|
||||
|
@ -509,6 +496,7 @@ public class DownloadResourcesLegacyActivity extends BaseMwmFragmentActivity imp
|
|||
public void onAlertDialogPositiveClick(int requestCode, int which)
|
||||
{
|
||||
setAction(TRY_AGAIN);
|
||||
onTryAgainClicked();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue