Fixed bug with loading indicator show on favorites after closing search

This commit is contained in:
Denis 2015-02-05 16:00:46 +02:00
parent 0a5f376aea
commit d3fc0fedda
2 changed files with 25 additions and 1 deletions

View file

@ -13,6 +13,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.os.Handler;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.support.v7.view.ActionMode; import android.support.v7.view.ActionMode;
@ -154,6 +155,23 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
return true; 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())) { if (ScreenOrientationHelper.isOrientationPortrait(getActivity())) {
menu = ((FavoritesActivity) getActivity()).getClearToolbar(true).getMenu(); menu = ((FavoritesActivity) getActivity()).getClearToolbar(true).getMenu();

View file

@ -1,6 +1,7 @@
package net.osmand.plus.activities; package net.osmand.plus.activities;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.os.Handler;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
import android.support.v7.view.ActionMode; import android.support.v7.view.ActionMode;
import android.support.v7.widget.SearchView; import android.support.v7.widget.SearchView;
@ -332,7 +333,12 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
favouritesAdapter.setFilterResults(null); favouritesAdapter.setFilterResults(null);
favouritesAdapter.synchronizeGroups(); favouritesAdapter.synchronizeGroups();
favouritesAdapter.notifyDataSetChanged(); 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; return true;
} }
}); });