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).
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="local_index_unselect_gpx_file">Unselect</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="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="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_map">Offline maps (vector)</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.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
@ -30,7 +32,7 @@ public class GpxSelectionHelper {
// new BooleanPreference("show_current_gpx_track", false).makeGlobal().cache();
private List<SelectedGpxFile> selectedGPXFiles = new java.util.concurrent.CopyOnWriteArrayList<SelectedGpxFile>();
private SavingTrackHelper savingTrackHelper;
private Runnable uiListener;
private Map<Class<?>, Runnable> uiListeners = new LinkedHashMap<Class<?>, Runnable>();
public GpxSelectionHelper(OsmandApplication osmandApplication) {
this.app = osmandApplication;
@ -353,15 +355,20 @@ public class GpxSelectionHelper {
saveCurrentSelections();
}
public void setUiListener(Runnable r) {
this.uiListener = r;
public void setUiListener(Class<?> key, Runnable listener) {
if(listener == null) {
uiListeners.remove(key);
} else {
uiListeners.put(key, listener);
}
}
public Runnable getUiListener() {
return uiListener;
public void runUiListeners() {
for(Runnable r : uiListeners.values()) {
r.run();
}
}
public static class SelectedGpxFile {
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) {
getMyApplication().getSelectedGpxHelper().selectGpxFile(info.gpx, resId == R.string.local_index_select_gpx_file, true);
listAdapter.notifyDataSetChanged();
Runnable r = selectedGpxHelper.getUiListener();
if(r != null) {
r.run();
}
selectedGpxHelper.runUiListeners();
} else if (resId == R.string.local_index_mi_delete) {
Builder confirm = new AlertDialog.Builder(getActivity());
confirm.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
@ -498,6 +495,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
@Override
protected void onPreExecute() {
getSherlockActivity().setSupportProgressBarIndeterminateVisibility(true);
listAdapter.clear();
}
@Override
@ -917,10 +915,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
@Override
protected void onPostExecute(String result) {
Runnable r = selectedGpxHelper.getUiListener();
if(r != null) {
r.run();
}
selectedGpxHelper.runUiListeners();
getSherlockActivity().setProgressBarIndeterminateVisibility(false);
if(showOnMap && toShow != null) {
getMyApplication().getSettings().setMapLocationToShow(toShow.lat, toShow.lon,

View file

@ -6,6 +6,7 @@ package net.osmand.plus.activities;
import java.io.File;
import java.util.ArrayList;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
@ -20,7 +21,9 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
import android.widget.TabWidget;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Window;
@ -34,6 +37,8 @@ public class FavouritesActivity extends SherlockFragmentActivity {
private static final String TRACKS = "TRACKS";
private static final String SELECTED_TRACK = "SELECTED_TRACK";
private TabsAdapter mTabsAdapter;
private TabSpec selectedTrack;
private TabHost tabHost;
@Override
@ -67,7 +72,7 @@ public class FavouritesActivity extends SherlockFragmentActivity {
getSupportFragmentManager().beginTransaction().add(R.id.layout, new FavouritesTreeFragment()).commit();
} else {
setContentView(R.layout.tab_content);
TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
tabHost = (TabHost) findViewById(android.R.id.tabhost);
tabHost.setup();
OsmandSettings settings = ((OsmandApplication) getApplication()).getSettings();
@ -78,12 +83,45 @@ public class FavouritesActivity extends SherlockFragmentActivity {
FavouritesTreeFragment.class, null);
mTabsAdapter.addTab(tabHost.newTabSpec(TRACKS).setIndicator(getString(R.string.my_tracks)),
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);
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);
}
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));
String tag = tabSpec.getTag();
@ -165,6 +203,7 @@ public class FavouritesActivity extends SherlockFragmentActivity {
mTabs.add(info);
mTabHost.addTab(tabSpec);
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);
}
adapter.setDisplayGroups(selectedGpxHelper.getDisplayGroups());
selectedGpxHelper.setUiListener(new Runnable() {
selectedGpxHelper.setUiListener(SelectedGPXFragment.class,
new Runnable() {
@Override
public void run() {
@ -95,7 +96,7 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
@Override
public void onPause() {
super.onPause();
selectedGpxHelper.setUiListener(null);
selectedGpxHelper.setUiListener(SelectedGPXFragment.class, null);
}
@Override
@ -274,8 +275,8 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
public void onClick(DialogInterface dialog, int which) {
if(!vis.isChecked()) {
getMyApplication().getSelectedGpxHelper().selectGpxFile(model.getGpx(), false, false);
SelectedGPXFragment.this.adapter.setDisplayGroups(selectedGpxHelper.getDisplayGroups());
getMyApplication().getSelectedGpxHelper().runUiListeners();
} else {
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;
if (items != null && !items.isEmpty()) {
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 {
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) {
this.app = app;
liveMonitoringHelper = new LiveMonitoringHelper(app);
ApplicationMode.regWidget("monitoring", (ApplicationMode[])null);
ApplicationMode.regWidget("monitoring", ApplicationMode.DEFAULT);
}
@Override