Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-07-01 02:30:59 +02:00
commit ebf984ae29
7 changed files with 70 additions and 25 deletions

View file

@ -9,6 +9,8 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
--> -->
<string name="no_index_file_to_download">Nothing to download, please check internet connection.</string>
<string name="select_index_file_to_download">Nothing was found. If you can\'t find your region, you can make it yourself (see http://osmand.net).</string>
<string name="none_selected_gpx">No GPX files selected. In order to select press and hold on available track.</string> <string name="none_selected_gpx">No GPX files selected. In order to select press and hold on available track.</string>
<string name="local_index_unselect_gpx_file">Unselect</string> <string name="local_index_unselect_gpx_file">Unselect</string>
<string name="local_index_select_gpx_file">Select to show</string> <string name="local_index_select_gpx_file">Select to show</string>
@ -983,7 +985,6 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
<string name="confirm_interrupt_download">Do you want to interrupt file downloading?</string> <string name="confirm_interrupt_download">Do you want to interrupt file downloading?</string>
<string name="first_time_msg">Thank you for using OsmAnd. For many features of this application you need some regional offline data which you can download via \'Settings\' → \'Manage map files\'. Afterwards you will be able to view maps, locate addresses, look up POIs, and find public transportation.</string> <string name="first_time_msg">Thank you for using OsmAnd. For many features of this application you need some regional offline data which you can download via \'Settings\' → \'Manage map files\'. Afterwards you will be able to view maps, locate addresses, look up POIs, and find public transportation.</string>
<string name="basemap_was_selected_to_download">Basemap is required for proper application functioning and was selected to download.</string> <string name="basemap_was_selected_to_download">Basemap is required for proper application functioning and was selected to download.</string>
<string name="select_index_file_to_download">Nothing was found. If you can\'t find your region, you can make it yourself (see http://osmand.net).</string>
<string name="local_indexes_cat_tile">Online and tile maps</string> <string name="local_indexes_cat_tile">Online and tile maps</string>
<string name="local_indexes_cat_map">Offline maps (vector)</string> <string name="local_indexes_cat_map">Offline maps (vector)</string>
<string name="index_settings_descr">Download and manage offline map files stored on your device</string> <string name="index_settings_descr">Download and manage offline map files stored on your device</string>

View file

@ -2,7 +2,9 @@ package net.osmand.plus;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
@ -30,7 +32,7 @@ public class GpxSelectionHelper {
// new BooleanPreference("show_current_gpx_track", false).makeGlobal().cache(); // new BooleanPreference("show_current_gpx_track", false).makeGlobal().cache();
private List<SelectedGpxFile> selectedGPXFiles = new java.util.concurrent.CopyOnWriteArrayList<SelectedGpxFile>(); private List<SelectedGpxFile> selectedGPXFiles = new java.util.concurrent.CopyOnWriteArrayList<SelectedGpxFile>();
private SavingTrackHelper savingTrackHelper; private SavingTrackHelper savingTrackHelper;
private Runnable uiListener; private Map<Class<?>, Runnable> uiListeners = new LinkedHashMap<Class<?>, Runnable>();
public GpxSelectionHelper(OsmandApplication osmandApplication) { public GpxSelectionHelper(OsmandApplication osmandApplication) {
this.app = osmandApplication; this.app = osmandApplication;
@ -353,15 +355,20 @@ public class GpxSelectionHelper {
saveCurrentSelections(); saveCurrentSelections();
} }
public void setUiListener(Runnable r) { public void setUiListener(Class<?> key, Runnable listener) {
this.uiListener = r; if(listener == null) {
uiListeners.remove(key);
} else {
uiListeners.put(key, listener);
}
} }
public Runnable getUiListener() { public void runUiListeners() {
return uiListener; for(Runnable r : uiListeners.values()) {
r.run();
}
} }
public static class SelectedGpxFile { public static class SelectedGpxFile {
public boolean notShowNavigationDialog = false; public boolean notShowNavigationDialog = false;
@ -545,5 +552,4 @@ public class GpxSelectionHelper {
} }
} }

View file

@ -400,10 +400,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
resId == R.string.local_index_select_gpx_file) { resId == R.string.local_index_select_gpx_file) {
getMyApplication().getSelectedGpxHelper().selectGpxFile(info.gpx, resId == R.string.local_index_select_gpx_file, true); getMyApplication().getSelectedGpxHelper().selectGpxFile(info.gpx, resId == R.string.local_index_select_gpx_file, true);
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
Runnable r = selectedGpxHelper.getUiListener(); selectedGpxHelper.runUiListeners();
if(r != null) {
r.run();
}
} else if (resId == R.string.local_index_mi_delete) { } else if (resId == R.string.local_index_mi_delete) {
Builder confirm = new AlertDialog.Builder(getActivity()); Builder confirm = new AlertDialog.Builder(getActivity());
confirm.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() { confirm.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
@ -498,6 +495,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
@Override @Override
protected void onPreExecute() { protected void onPreExecute() {
getSherlockActivity().setSupportProgressBarIndeterminateVisibility(true); getSherlockActivity().setSupportProgressBarIndeterminateVisibility(true);
listAdapter.clear();
} }
@Override @Override
@ -917,10 +915,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
@Override @Override
protected void onPostExecute(String result) { protected void onPostExecute(String result) {
Runnable r = selectedGpxHelper.getUiListener(); selectedGpxHelper.runUiListeners();
if(r != null) {
r.run();
}
getSherlockActivity().setProgressBarIndeterminateVisibility(false); getSherlockActivity().setProgressBarIndeterminateVisibility(false);
if(showOnMap && toShow != null) { if(showOnMap && toShow != null) {
getMyApplication().getSettings().setMapLocationToShow(toShow.lat, toShow.lon, getMyApplication().getSettings().setMapLocationToShow(toShow.lat, toShow.lon,

View file

@ -6,6 +6,7 @@ package net.osmand.plus.activities;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
@ -20,7 +21,9 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.TabHost; import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
import android.widget.TabWidget; import android.widget.TabWidget;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragmentActivity; import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Window; import com.actionbarsherlock.view.Window;
@ -34,6 +37,8 @@ public class FavouritesActivity extends SherlockFragmentActivity {
private static final String TRACKS = "TRACKS"; private static final String TRACKS = "TRACKS";
private static final String SELECTED_TRACK = "SELECTED_TRACK"; private static final String SELECTED_TRACK = "SELECTED_TRACK";
private TabsAdapter mTabsAdapter; private TabsAdapter mTabsAdapter;
private TabSpec selectedTrack;
private TabHost tabHost;
@Override @Override
@ -67,7 +72,7 @@ public class FavouritesActivity extends SherlockFragmentActivity {
getSupportFragmentManager().beginTransaction().add(R.id.layout, new FavouritesTreeFragment()).commit(); getSupportFragmentManager().beginTransaction().add(R.id.layout, new FavouritesTreeFragment()).commit();
} else { } else {
setContentView(R.layout.tab_content); setContentView(R.layout.tab_content);
TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost); tabHost = (TabHost) findViewById(android.R.id.tabhost);
tabHost.setup(); tabHost.setup();
OsmandSettings settings = ((OsmandApplication) getApplication()).getSettings(); OsmandSettings settings = ((OsmandApplication) getApplication()).getSettings();
@ -78,12 +83,45 @@ public class FavouritesActivity extends SherlockFragmentActivity {
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)),
AvailableGPXFragment.class, null); AvailableGPXFragment.class, null);
mTabsAdapter.addTab(tabHost.newTabSpec(SELECTED_TRACK).setIndicator(getString(R.string.selected_track)), selectedTrack = mTabsAdapter.addTab(tabHost.newTabSpec(SELECTED_TRACK).setIndicator(getString(R.string.selected_track)),
SelectedGPXFragment.class, null); SelectedGPXFragment.class, null);
tabHost.setCurrentTab(tab); tabHost.setCurrentTab(tab);
updateSelectedTracks();
} }
}
@Override
protected void onResume() {
super.onResume();
((OsmandApplication) getApplication()).getSelectedGpxHelper().setUiListener(FavouritesActivity.class,new Runnable() {
@Override
public void run() {
updateSelectedTracks();
}
});
}
@Override
protected void onPause() {
super.onPause();
((OsmandApplication) getApplication()).getSelectedGpxHelper().setUiListener(FavouritesActivity.class, null);
}
public void updateSelectedTracks() {
if (selectedTrack != null) {
GpxSelectionHelper gpx = ((OsmandApplication) getApplication()).getSelectedGpxHelper();
String vl = getString(R.string.selected_track);
if (gpx.isShowingAnyGpxFiles()) {
vl += " (" + gpx.getSelectedGPXFiles().size()
+ ")";
}
try {
((TextView)tabHost.getTabWidget().getChildAt(2).findViewById(android.R.id.title)).setText(vl);
} catch (Exception e) {
}
mTabsAdapter.notifyDataSetChanged();
}
} }
@ -157,7 +195,7 @@ public class FavouritesActivity extends SherlockFragmentActivity {
mViewPager.setOnPageChangeListener(this); mViewPager.setOnPageChangeListener(this);
} }
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { public TabSpec addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) {
tabSpec.setContent(new DummyTabFactory(mContext)); tabSpec.setContent(new DummyTabFactory(mContext));
String tag = tabSpec.getTag(); String tag = tabSpec.getTag();
@ -165,6 +203,7 @@ public class FavouritesActivity extends SherlockFragmentActivity {
mTabs.add(info); mTabs.add(info);
mTabHost.addTab(tabSpec); mTabHost.addTab(tabSpec);
notifyDataSetChanged(); notifyDataSetChanged();
return tabSpec;
} }
@ -210,3 +249,4 @@ public class FavouritesActivity extends SherlockFragmentActivity {
} }
} }

View file

@ -83,7 +83,8 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
setAdapter(adapter); setAdapter(adapter);
} }
adapter.setDisplayGroups(selectedGpxHelper.getDisplayGroups()); adapter.setDisplayGroups(selectedGpxHelper.getDisplayGroups());
selectedGpxHelper.setUiListener(new Runnable() { selectedGpxHelper.setUiListener(SelectedGPXFragment.class,
new Runnable() {
@Override @Override
public void run() { public void run() {
@ -95,7 +96,7 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
@Override @Override
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
selectedGpxHelper.setUiListener(null); selectedGpxHelper.setUiListener(SelectedGPXFragment.class, null);
} }
@Override @Override
@ -274,8 +275,8 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if(!vis.isChecked()) { if(!vis.isChecked()) {
getMyApplication().getSelectedGpxHelper().selectGpxFile(model.getGpx(), false, false); getMyApplication().getSelectedGpxHelper().selectGpxFile(model.getGpx(), false, false);
SelectedGPXFragment.this.adapter.setDisplayGroups(selectedGpxHelper.getDisplayGroups()); SelectedGPXFragment.this.adapter.setDisplayGroups(selectedGpxHelper.getDisplayGroups());
getMyApplication().getSelectedGpxHelper().runUiListeners();
} else { } else {
updateSplit(model, distanceSplit, timeSplit, sp.getSelectedItemPosition() ); updateSplit(model, distanceSplit, timeSplit, sp.getSelectedItemPosition() );
} }

View file

@ -167,6 +167,8 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
Collection<IndexItem> items = (Collection<IndexItem>) results.values; Collection<IndexItem> items = (Collection<IndexItem>) results.values;
if (items != null && !items.isEmpty()) { if (items != null && !items.isEmpty()) {
list.addAll(IndexItemCategory.categorizeIndexItems(downloadActivity.getMyApplication(), items)); list.addAll(IndexItemCategory.categorizeIndexItems(downloadActivity.getMyApplication(), items));
} else if(DownloadIndexAdapter.this.indexFiles.isEmpty()){
list.add(new IndexItemCategory(downloadActivity.getResources().getString(R.string.no_index_file_to_download), 1));
} else { } else {
list.add(new IndexItemCategory(downloadActivity.getResources().getString(R.string.select_index_file_to_download), 1)); list.add(new IndexItemCategory(downloadActivity.getResources().getString(R.string.select_index_file_to_download), 1));
} }

View file

@ -42,7 +42,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
public OsmandMonitoringPlugin(OsmandApplication app) { public OsmandMonitoringPlugin(OsmandApplication app) {
this.app = app; this.app = app;
liveMonitoringHelper = new LiveMonitoringHelper(app); liveMonitoringHelper = new LiveMonitoringHelper(app);
ApplicationMode.regWidget("monitoring", (ApplicationMode[])null); ApplicationMode.regWidget("monitoring", ApplicationMode.DEFAULT);
} }
@Override @Override