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