Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-08-13 19:14:08 +02:00
commit 9d4c494009
4 changed files with 20 additions and 8 deletions

View file

@ -5,6 +5,7 @@ import java.io.File;
import java.io.FilenameFilter;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -251,7 +252,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
getMyApplication().setDownloadActivity(null);
}
public void showDialogToDownloadMaps(List<String> maps) {
public void showDialogToDownloadMaps(Collection<String> maps) {
int count = 0;
int sz = 0;
String s = "";
@ -273,7 +274,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
}
if(count > 0){
Builder builder = new AlertDialog.Builder(this);
builder.setMessage(MessageFormat.format(getString(R.string.download_additional_maps), s, sz));
builder.setMessage(getString(R.string.download_additional_maps, s, sz));
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {

View file

@ -5,6 +5,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;
@ -149,7 +150,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
ArrayList<TourInformation> tourPresent = new ArrayList<TourInformation>();
List<String> warns = new ArrayList<String>();
selectedTour = null;
final List<String> suggestToDownloadMap = new ArrayList<String>();
final HashSet<String> suggestToDownloadMap = new HashSet<String>();
if(toursFolder.exists()) {
File[] availableTours = toursFolder.listFiles();
if(availableTours != null) {
@ -197,7 +198,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
da.showDialogToDownloadMaps(suggestToDownloadMap);
}
}, 2000);
});
}
}
return warns;
@ -360,6 +361,6 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
@Override
public boolean showDownloadExtraActions() {
return super.showDownloadExtraActions();
return false;
}
}

View file

@ -46,9 +46,12 @@ public class SherpafySelectToursFragment extends SherlockListFragment {
super.onAttach(activity);
app = (OsmandApplication) getSherlockActivity().getApplication();
custom = (SherpafyCustomization) app.getAppCustomization();
TourAdapter tourAdapter = new TourAdapter(custom.getTourInformations());
setListAdapter(tourAdapter);
setHasOptionsMenu(true);
refreshAdapter();
}
public void refreshAdapter() {
setListAdapter(new TourAdapter(custom.getTourInformations()));
}

View file

@ -21,7 +21,6 @@ import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Point;
import android.os.Bundle;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.app.Fragment;
@ -65,6 +64,7 @@ public class TourViewActivity extends SherlockFragmentActivity {
private ListView mDrawerList;
private ArrayAdapter<Object> drawerAdapter;
private WeakHashMap<Object, Fragment> fragments = new WeakHashMap<Object, Fragment>();
private boolean refreshListAfterDownload;
private static Object selectedItem;
@Override
@ -219,6 +219,10 @@ public class TourViewActivity extends SherlockFragmentActivity {
@Override
protected void onResume() {
super.onResume();
if(refreshListAfterDownload){
refreshListAfterDownload = false;
selectMenu(selectedItem == null ? R.string.sherpafy_tours : selectedItem);
}
}
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconLight, int iconDark, int menuItemType,
@ -257,6 +261,8 @@ public class TourViewActivity extends SherlockFragmentActivity {
if (fragment == null) {
fragment = new SherpafySelectToursFragment();
fragments.put(item, fragment);
} else {
((SherpafySelectToursFragment) fragment).refreshAdapter();
}
state = STATE_SELECT_TOUR;
setDrawerIndicatorVisible(true);
@ -372,6 +378,7 @@ public class TourViewActivity extends SherlockFragmentActivity {
public void startDownloadActivity() {
final Intent download = new Intent(this, DownloadIndexActivity.class);
download.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
refreshListAfterDownload = true;
startActivity(download);
}