Fix context menu for map regions
This commit is contained in:
parent
0405631a16
commit
08703058eb
3 changed files with 22 additions and 2 deletions
|
@ -787,6 +787,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
progressTitle.setText(titleProgressController.caption);
|
progressTitle.setText(titleProgressController.caption);
|
||||||
progressBar.setIndeterminate(titleProgressController.indeterminate);
|
progressBar.setIndeterminate(titleProgressController.indeterminate);
|
||||||
progressBar.setProgress(titleProgressController.progress);
|
progressBar.setProgress(titleProgressController.progress);
|
||||||
|
progressBar.setVisibility(titleProgressController.progressVisible ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
final ImageView progressButton = (ImageView) view.findViewById(R.id.progressButton);
|
final ImageView progressButton = (ImageView) view.findViewById(R.id.progressButton);
|
||||||
progressButton.setVisibility(titleProgressController.buttonVisible ? View.VISIBLE : View.GONE);
|
progressButton.setVisibility(titleProgressController.buttonVisible ? View.VISIBLE : View.GONE);
|
||||||
|
|
|
@ -440,7 +440,9 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
leftDownloadButtonController.visible = !downloaded;
|
leftDownloadButtonController.visible = !downloaded;
|
||||||
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
|
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
|
||||||
|
|
||||||
boolean downloadIndexes = getMapActivity().getMyApplication().getSettings().isInternetConnectionAvailable()
|
boolean internetConnectionAvailable =
|
||||||
|
getMapActivity().getMyApplication().getSettings().isInternetConnectionAvailable();
|
||||||
|
boolean downloadIndexes = internetConnectionAvailable
|
||||||
&& !downloadThread.getIndexes().isDownloadedFromInternet
|
&& !downloadThread.getIndexes().isDownloadedFromInternet
|
||||||
&& !downloadThread.getIndexes().downloadFromInternetFailed;
|
&& !downloadThread.getIndexes().downloadFromInternetFailed;
|
||||||
|
|
||||||
|
@ -470,6 +472,9 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
} else if (downloadIndexes) {
|
} else if (downloadIndexes) {
|
||||||
titleProgressController.setIndexesDownloadMode();
|
titleProgressController.setIndexesDownloadMode();
|
||||||
titleProgressController.visible = true;
|
titleProgressController.visible = true;
|
||||||
|
} else if (!internetConnectionAvailable) {
|
||||||
|
titleProgressController.setNoInternetConnectionMode();
|
||||||
|
titleProgressController.visible = true;
|
||||||
} else {
|
} else {
|
||||||
titleProgressController.visible = false;
|
titleProgressController.visible = false;
|
||||||
}
|
}
|
||||||
|
@ -507,16 +512,25 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
public int progress = 0;
|
public int progress = 0;
|
||||||
public boolean indeterminate;
|
public boolean indeterminate;
|
||||||
public boolean visible;
|
public boolean visible;
|
||||||
|
public boolean progressVisible;
|
||||||
public boolean buttonVisible;
|
public boolean buttonVisible;
|
||||||
|
|
||||||
public void setIndexesDownloadMode() {
|
public void setIndexesDownloadMode() {
|
||||||
caption = getMapActivity().getString(R.string.downloading_list_indexes);
|
caption = getMapActivity().getString(R.string.downloading_list_indexes);
|
||||||
indeterminate = true;
|
indeterminate = true;
|
||||||
|
progressVisible = true;
|
||||||
|
buttonVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoInternetConnectionMode() {
|
||||||
|
caption = getMapActivity().getString(R.string.no_index_file_to_download);
|
||||||
|
progressVisible = false;
|
||||||
buttonVisible = false;
|
buttonVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMapDownloadMode() {
|
public void setMapDownloadMode() {
|
||||||
indeterminate = false;
|
indeterminate = false;
|
||||||
|
progressVisible = true;
|
||||||
buttonVisible = true;
|
buttonVisible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -353,7 +353,9 @@ public class MapDataMenuController extends MenuController {
|
||||||
topRightTitleButtonController.visible = (otherIndexItems != null && otherIndexItems.size() > 0)
|
topRightTitleButtonController.visible = (otherIndexItems != null && otherIndexItems.size() > 0)
|
||||||
|| (otherLocalIndexInfos != null && otherLocalIndexInfos.size() > 0);
|
|| (otherLocalIndexInfos != null && otherLocalIndexInfos.size() > 0);
|
||||||
|
|
||||||
boolean downloadIndexes = getMapActivity().getMyApplication().getSettings().isInternetConnectionAvailable()
|
boolean internetConnectionAvailable =
|
||||||
|
getMapActivity().getMyApplication().getSettings().isInternetConnectionAvailable();
|
||||||
|
boolean downloadIndexes = internetConnectionAvailable
|
||||||
&& !downloadThread.getIndexes().isDownloadedFromInternet
|
&& !downloadThread.getIndexes().isDownloadedFromInternet
|
||||||
&& !downloadThread.getIndexes().downloadFromInternetFailed;
|
&& !downloadThread.getIndexes().downloadFromInternetFailed;
|
||||||
|
|
||||||
|
@ -383,6 +385,9 @@ public class MapDataMenuController extends MenuController {
|
||||||
} else if (downloadIndexes) {
|
} else if (downloadIndexes) {
|
||||||
titleProgressController.setIndexesDownloadMode();
|
titleProgressController.setIndexesDownloadMode();
|
||||||
titleProgressController.visible = true;
|
titleProgressController.visible = true;
|
||||||
|
} else if (!internetConnectionAvailable) {
|
||||||
|
titleProgressController.setNoInternetConnectionMode();
|
||||||
|
titleProgressController.visible = true;
|
||||||
} else {
|
} else {
|
||||||
titleProgressController.visible = false;
|
titleProgressController.visible = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue