Fixed bug with updates not showing
This commit is contained in:
parent
af81ddfaa6
commit
9c42312d0f
3 changed files with 24 additions and 5 deletions
|
@ -83,7 +83,7 @@ public class FavouritesActivity extends SherlockFragmentActivity {
|
|||
OsmandSettings settings = ((OsmandApplication) getApplication()).getSettings();
|
||||
Integer tab = settings.FAVORITES_TAB.get();
|
||||
ViewPager mViewPager = (ViewPager) findViewById(R.id.pager);
|
||||
mTabsAdapter = new TabsAdapter(this, tabHost, mViewPager, settings);
|
||||
mTabsAdapter = new TabsAdapter(this, tabHost, mViewPager, settings, true);
|
||||
mTabsAdapter.addTab(tabHost.newTabSpec(FAVOURITES_INFO).setIndicator(getString(R.string.my_favorites)),
|
||||
FavouritesTreeFragment.class, null);
|
||||
mTabsAdapter.addTab(tabHost.newTabSpec(TRACKS).setIndicator(getString(R.string.my_tracks)),
|
||||
|
@ -170,6 +170,7 @@ public class FavouritesActivity extends SherlockFragmentActivity {
|
|||
private final ViewPager mViewPager;
|
||||
private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>();
|
||||
private OsmandSettings osmSettings;
|
||||
private boolean favorites;
|
||||
|
||||
static final class TabInfo {
|
||||
private final String tag;
|
||||
|
@ -199,8 +200,9 @@ public class FavouritesActivity extends SherlockFragmentActivity {
|
|||
}
|
||||
}
|
||||
|
||||
public TabsAdapter(FragmentActivity activity, TabHost tabHost,ViewPager pager, OsmandSettings settings) {
|
||||
public TabsAdapter(FragmentActivity activity, TabHost tabHost,ViewPager pager, OsmandSettings settings, boolean favorites) {
|
||||
super(activity.getSupportFragmentManager());
|
||||
this.favorites = favorites;
|
||||
mContext = activity;
|
||||
mTabHost = tabHost;
|
||||
mViewPager = pager;
|
||||
|
@ -236,7 +238,9 @@ public class FavouritesActivity extends SherlockFragmentActivity {
|
|||
@Override
|
||||
public void onTabChanged(String tabId) {
|
||||
int position = mTabHost.getCurrentTab();
|
||||
osmSettings.FAVORITES_TAB.set(position);
|
||||
if (favorites){
|
||||
osmSettings.FAVORITES_TAB.set(position);
|
||||
}
|
||||
mViewPager.setCurrentItem(position);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.osmand.IndexConstants;
|
|||
import net.osmand.access.AccessibleAlertBuilder;
|
||||
import net.osmand.plus.*;
|
||||
import net.osmand.plus.activities.FavouritesActivity;
|
||||
import net.osmand.plus.activities.LocalIndexInfo;
|
||||
import net.osmand.plus.activities.SettingsGeneralActivity;
|
||||
import net.osmand.plus.base.BasicProgressAsyncTask;
|
||||
import net.osmand.plus.base.SuggestExternalDirectoryDialog;
|
||||
|
@ -51,6 +52,7 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
|||
private TextView progressPercent;
|
||||
private ImageView cancel;
|
||||
private UpdatesIndexFragment updatesIndexFragment;
|
||||
private List<LocalIndexInfo> localIndexInfos = new ArrayList<LocalIndexInfo>();
|
||||
|
||||
|
||||
public static final String FILTER_KEY = "filter";
|
||||
|
@ -69,7 +71,7 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
|||
tabHost = (TabHost) findViewById(android.R.id.tabhost);
|
||||
tabHost.setup();
|
||||
ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
|
||||
mTabsAdapter = new FavouritesActivity.TabsAdapter(this, tabHost, viewPager, settings);
|
||||
mTabsAdapter = new FavouritesActivity.TabsAdapter(this, tabHost, viewPager, settings, false);
|
||||
mTabsAdapter.addTab(tabHost.newTabSpec("LOCAL_INDEX").setIndicator("Local"),
|
||||
LocalIndexesFragment.class, null);
|
||||
mTabsAdapter.addTab(tabHost.newTabSpec("DOWNLOADS").setIndicator("Downloads"),
|
||||
|
@ -207,6 +209,13 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void setLocalIndexInfos(List<LocalIndexInfo> list){
|
||||
this.localIndexInfos = list;
|
||||
}
|
||||
|
||||
public List<LocalIndexInfo> getLocalIndexInfos(){
|
||||
return localIndexInfos;
|
||||
}
|
||||
|
||||
public DownloadActivityType getType() { return type;}
|
||||
|
||||
|
|
|
@ -268,6 +268,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
protected void onPostExecute(List<LocalIndexInfo> result) {
|
||||
this.result = result;
|
||||
getDownloadActivity().setSupportProgressBarIndeterminateVisibility(false);
|
||||
getDownloadActivity().setLocalIndexInfos(result);
|
||||
}
|
||||
|
||||
public List<LocalIndexInfo> getResult() {
|
||||
|
@ -462,7 +463,12 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
//fixes issue when local files not shown after switching tabs
|
||||
reloadIndexes();
|
||||
if (listAdapter.getGroupCount() == 0 && getDownloadActivity().getLocalIndexInfos().size() > 0){
|
||||
for(LocalIndexInfo info : getDownloadActivity().getLocalIndexInfos()){
|
||||
listAdapter.addLocalIndexInfo(info);
|
||||
}
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
ActionBar actionBar = getDownloadActivity().getSupportActionBar();
|
||||
//hide action bar from downloadindexfragment
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
|
|
Loading…
Reference in a new issue