Change button icon color on tap in map data context menu
This commit is contained in:
parent
62607944ee
commit
a69e44a7c1
2 changed files with 15 additions and 5 deletions
|
@ -583,6 +583,16 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearIcon(boolean left) {
|
||||||
|
if (left) {
|
||||||
|
leftIcon = null;
|
||||||
|
leftIconId = 0;
|
||||||
|
} else {
|
||||||
|
rightIcon = null;
|
||||||
|
rightIconId = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void updateStateListDrawableIcon(@DrawableRes int resId, boolean left) {
|
public void updateStateListDrawableIcon(@DrawableRes int resId, boolean left) {
|
||||||
if (left) {
|
if (left) {
|
||||||
leftIcon = enabled ? getStateListDrawable(resId) : null;
|
leftIcon = enabled ? getStateListDrawable(resId) : null;
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class MapDataMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
leftDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_download);
|
leftDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_download);
|
||||||
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
|
leftDownloadButtonController.updateStateListDrawableIcon(R.drawable.ic_action_import, true);
|
||||||
|
|
||||||
rightDownloadButtonController = new TitleButtonController() {
|
rightDownloadButtonController = new TitleButtonController() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -142,7 +142,7 @@ public class MapDataMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
rightDownloadButtonController.caption = getMapActivity().getString(R.string.download_select_map_types);
|
rightDownloadButtonController.caption = getMapActivity().getString(R.string.download_select_map_types);
|
||||||
rightDownloadButtonController.leftIconId = R.drawable.ic_plugin_srtm;
|
rightDownloadButtonController.updateStateListDrawableIcon(R.drawable.ic_plugin_srtm, true);
|
||||||
|
|
||||||
bottomTitleButtonController = new TitleButtonController() {
|
bottomTitleButtonController = new TitleButtonController() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -159,7 +159,7 @@ public class MapDataMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
bottomTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_delete);
|
bottomTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_delete);
|
||||||
bottomTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
bottomTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_delete_dark, true);
|
||||||
|
|
||||||
titleProgressController = new TitleProgressController() {
|
titleProgressController = new TitleProgressController() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -367,7 +367,7 @@ public class MapDataMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
|
|
||||||
leftDownloadButtonController.visible = true;
|
leftDownloadButtonController.visible = true;
|
||||||
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
|
leftDownloadButtonController.updateStateListDrawableIcon(R.drawable.ic_action_import, true);
|
||||||
if (backuped) {
|
if (backuped) {
|
||||||
leftDownloadButtonController.caption = getMapActivity().getString(R.string.local_index_mi_restore);
|
leftDownloadButtonController.caption = getMapActivity().getString(R.string.local_index_mi_restore);
|
||||||
} else if (indexItem != null) {
|
} else if (indexItem != null) {
|
||||||
|
@ -375,7 +375,7 @@ public class MapDataMenuController extends MenuController {
|
||||||
|| indexItem.getType() == DownloadActivityType.HILLSHADE_FILE)
|
|| indexItem.getType() == DownloadActivityType.HILLSHADE_FILE)
|
||||||
&& srtmDisabled) {
|
&& srtmDisabled) {
|
||||||
leftDownloadButtonController.caption = getMapActivity().getString(R.string.get_plugin);
|
leftDownloadButtonController.caption = getMapActivity().getString(R.string.get_plugin);
|
||||||
leftDownloadButtonController.leftIconId = 0;
|
leftDownloadButtonController.clearIcon(true);
|
||||||
} else if (indexItem.isOutdated()) {
|
} else if (indexItem.isOutdated()) {
|
||||||
leftDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_update);
|
leftDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_update);
|
||||||
} else if (!downloaded) {
|
} else if (!downloaded) {
|
||||||
|
|
Loading…
Reference in a new issue