Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
9d4c494009
4 changed files with 20 additions and 8 deletions
|
@ -5,6 +5,7 @@ import java.io.File;
|
||||||
import java.io.FilenameFilter;
|
import java.io.FilenameFilter;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -251,7 +252,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
getMyApplication().setDownloadActivity(null);
|
getMyApplication().setDownloadActivity(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showDialogToDownloadMaps(List<String> maps) {
|
public void showDialogToDownloadMaps(Collection<String> maps) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int sz = 0;
|
int sz = 0;
|
||||||
String s = "";
|
String s = "";
|
||||||
|
@ -273,7 +274,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
||||||
}
|
}
|
||||||
if(count > 0){
|
if(count > 0){
|
||||||
Builder builder = new AlertDialog.Builder(this);
|
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() {
|
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
@ -149,7 +150,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
ArrayList<TourInformation> tourPresent = new ArrayList<TourInformation>();
|
ArrayList<TourInformation> tourPresent = new ArrayList<TourInformation>();
|
||||||
List<String> warns = new ArrayList<String>();
|
List<String> warns = new ArrayList<String>();
|
||||||
selectedTour = null;
|
selectedTour = null;
|
||||||
final List<String> suggestToDownloadMap = new ArrayList<String>();
|
final HashSet<String> suggestToDownloadMap = new HashSet<String>();
|
||||||
if(toursFolder.exists()) {
|
if(toursFolder.exists()) {
|
||||||
File[] availableTours = toursFolder.listFiles();
|
File[] availableTours = toursFolder.listFiles();
|
||||||
if(availableTours != null) {
|
if(availableTours != null) {
|
||||||
|
@ -197,7 +198,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
da.showDialogToDownloadMaps(suggestToDownloadMap);
|
da.showDialogToDownloadMaps(suggestToDownloadMap);
|
||||||
|
|
||||||
}
|
}
|
||||||
}, 2000);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return warns;
|
return warns;
|
||||||
|
@ -360,6 +361,6 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean showDownloadExtraActions() {
|
public boolean showDownloadExtraActions() {
|
||||||
return super.showDownloadExtraActions();
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,12 @@ public class SherpafySelectToursFragment extends SherlockListFragment {
|
||||||
super.onAttach(activity);
|
super.onAttach(activity);
|
||||||
app = (OsmandApplication) getSherlockActivity().getApplication();
|
app = (OsmandApplication) getSherlockActivity().getApplication();
|
||||||
custom = (SherpafyCustomization) app.getAppCustomization();
|
custom = (SherpafyCustomization) app.getAppCustomization();
|
||||||
TourAdapter tourAdapter = new TourAdapter(custom.getTourInformations());
|
|
||||||
setListAdapter(tourAdapter);
|
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
refreshAdapter();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refreshAdapter() {
|
||||||
|
setListAdapter(new TourAdapter(custom.getTourInformations()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ import android.content.DialogInterface.OnClickListener;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Point;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.ActionBarDrawerToggle;
|
import android.support.v4.app.ActionBarDrawerToggle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
@ -65,6 +64,7 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
private ListView mDrawerList;
|
private ListView mDrawerList;
|
||||||
private ArrayAdapter<Object> drawerAdapter;
|
private ArrayAdapter<Object> drawerAdapter;
|
||||||
private WeakHashMap<Object, Fragment> fragments = new WeakHashMap<Object, Fragment>();
|
private WeakHashMap<Object, Fragment> fragments = new WeakHashMap<Object, Fragment>();
|
||||||
|
private boolean refreshListAfterDownload;
|
||||||
private static Object selectedItem;
|
private static Object selectedItem;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -219,6 +219,10 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.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,
|
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) {
|
if (fragment == null) {
|
||||||
fragment = new SherpafySelectToursFragment();
|
fragment = new SherpafySelectToursFragment();
|
||||||
fragments.put(item, fragment);
|
fragments.put(item, fragment);
|
||||||
|
} else {
|
||||||
|
((SherpafySelectToursFragment) fragment).refreshAdapter();
|
||||||
}
|
}
|
||||||
state = STATE_SELECT_TOUR;
|
state = STATE_SELECT_TOUR;
|
||||||
setDrawerIndicatorVisible(true);
|
setDrawerIndicatorVisible(true);
|
||||||
|
@ -372,6 +378,7 @@ public class TourViewActivity extends SherlockFragmentActivity {
|
||||||
public void startDownloadActivity() {
|
public void startDownloadActivity() {
|
||||||
final Intent download = new Intent(this, DownloadIndexActivity.class);
|
final Intent download = new Intent(this, DownloadIndexActivity.class);
|
||||||
download.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
download.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
refreshListAfterDownload = true;
|
||||||
startActivity(download);
|
startActivity(download);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue