From d3fc0feddaa5f29d640cd8be59149bbd1cd83130 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 5 Feb 2015 16:00:46 +0200 Subject: [PATCH] Fixed bug with loading indicator show on favorites after closing search --- .../plus/activities/AvailableGPXFragment.java | 18 ++++++++++++++++++ .../plus/activities/FavoritesTreeFragment.java | 8 +++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java index 759eae8b63..33d404d76d 100644 --- a/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/AvailableGPXFragment.java @@ -13,6 +13,7 @@ import java.util.Map; import java.util.Set; import android.content.pm.ActivityInfo; +import android.os.Handler; import android.support.v4.view.MenuItemCompat; import android.support.v7.app.ActionBarActivity; import android.support.v7.view.ActionMode; @@ -154,6 +155,23 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { return true; } }); + MenuItemCompat.setOnActionExpandListener(mi, new MenuItemCompat.OnActionExpandListener() { + @Override + public boolean onMenuItemActionExpand(MenuItem item) { + return true; + } + + @Override + public boolean onMenuItemActionCollapse(MenuItem item) { + // Needed to hide intermediate progress bar after closing action mode + new Handler().postDelayed(new Runnable() { + public void run() { + hideProgressBar(); + } + }, 100); + return true; + } + }); if (ScreenOrientationHelper.isOrientationPortrait(getActivity())) { menu = ((FavoritesActivity) getActivity()).getClearToolbar(true).getMenu(); diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java index 45d6a08d6b..e7767200a5 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java @@ -1,6 +1,7 @@ package net.osmand.plus.activities; import android.content.pm.ActivityInfo; +import android.os.Handler; import android.support.v4.view.MenuItemCompat; import android.support.v7.view.ActionMode; import android.support.v7.widget.SearchView; @@ -332,7 +333,12 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { favouritesAdapter.setFilterResults(null); favouritesAdapter.synchronizeGroups(); favouritesAdapter.notifyDataSetChanged(); - hideProgressBar(); + // Needed to hide intermediate progress bar after closing action mode + new Handler().postDelayed(new Runnable() { + public void run() { + hideProgressBar(); + } + }, 100); return true; } });