forked from organicmaps/organicmaps
Refactored BottomPanel update
Reduced the complexity of update() from 22 to 18. getAdapter is a function that returns a NonNull adapter. This means that the `!= null` check is not needed. Also, one duplicate line was removed outside the if-else. The state does not seem to be affected by any other lines and thus could be reduced to one single assignment.
This commit is contained in:
parent
420aabcecb
commit
891fe9a814
1 changed files with 6 additions and 6 deletions
|
@ -112,18 +112,19 @@ class BottomPanel
|
|||
|
||||
public void update()
|
||||
{
|
||||
// DownloaderAdapter getAdapter is nonNull.
|
||||
DownloaderAdapter adapter = mFragment.getAdapter();
|
||||
boolean search = adapter != null && adapter.isSearchResultsMode();
|
||||
boolean search = adapter.isSearchResultsMode();
|
||||
|
||||
boolean show = !search;
|
||||
UiUtils.showIf(show && adapter != null && adapter.isMyMapsMode(), mFab);
|
||||
UiUtils.showIf(show && adapter.isMyMapsMode(), mFab);
|
||||
|
||||
if (show)
|
||||
{
|
||||
String root = adapter != null ? adapter.getCurrentRootId() : "";
|
||||
if (adapter != null && adapter.isMyMapsMode())
|
||||
String root = adapter.getCurrentRootId();
|
||||
int status = MapManager.nativeGetStatus(root);
|
||||
if (adapter.isMyMapsMode())
|
||||
{
|
||||
int status = MapManager.nativeGetStatus(root);
|
||||
switch (status)
|
||||
{
|
||||
case CountryItem.STATUS_UPDATABLE:
|
||||
|
@ -156,7 +157,6 @@ class BottomPanel
|
|||
show = !CountryItem.isRoot(root);
|
||||
if (show)
|
||||
{
|
||||
int status = MapManager.nativeGetStatus(root);
|
||||
switch (status)
|
||||
{
|
||||
case CountryItem.STATUS_UPDATABLE:
|
||||
|
|
Loading…
Add table
Reference in a new issue