Show map size in controller

This commit is contained in:
PavelRatushny 2017-12-29 12:25:33 +02:00
parent dd2441c024
commit 3faf93db25
4 changed files with 16 additions and 6 deletions

View file

@ -598,7 +598,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
historyStack.add(menuData);
}
if (!(menuController instanceof MapDataMenuController)) {
menuController.buildMapDownloadButton(latLon);
menuController.buildMapDownloadButtonAndSizeInfo(latLon);
}
return true;
} else {

View file

@ -1501,7 +1501,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
if (created) {
menu.updateData();
updateButtonsAndProgress();
runLayoutListener();
refreshTitle();
}
}

View file

@ -4,6 +4,7 @@ import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
@ -433,14 +434,23 @@ public abstract class MenuController extends BaseMenuController {
}
public int getAdditionalInfoColor() {
if (indexItem != null) {
return R.color.icon_color;
}
return 0;
}
public String getAdditionalInfoStr() {
if (indexItem != null) {
return getMapActivity().getString(R.string.file_size_in_mb, indexItem.getArchiveSizeMB());
}
return "";
}
public int getAdditionalInfoIconRes() {
if (indexItem != null) {
return R.drawable.ic_sdcard_16;
}
return 0;
}
@ -646,7 +656,7 @@ public abstract class MenuController extends BaseMenuController {
}
}
public void buildMapDownloadButton(final LatLon latLon) {
public void buildMapDownloadButtonAndSizeInfo(final LatLon latLon) {
new AsyncTask<Void, Void, BinaryMapDataObject>() {
ResourceManager rm;

View file

@ -150,7 +150,7 @@ public class AmenityMenuController extends MenuController {
if (openingHoursInfo != null) {
return openingHoursInfo.isOpened() ? R.color.ctx_menu_amenity_opened_text_color : R.color.ctx_menu_amenity_closed_text_color;
}
return 0;
return super.getAdditionalInfoColor();
}
@Override
@ -158,7 +158,7 @@ public class AmenityMenuController extends MenuController {
if (openingHoursInfo != null) {
return openingHoursInfo.getInfo(getMapActivity());
}
return "";
return super.getAdditionalInfoStr();
}
@Override
@ -166,7 +166,7 @@ public class AmenityMenuController extends MenuController {
if (openingHoursInfo != null) {
return R.drawable.ic_action_opening_hour_16;
}
return 0;
return super.getAdditionalInfoIconRes();
}
public static String getTypeStr(Amenity amenity) {