Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-03-24 22:01:38 +01:00
commit d18e28fee1
4 changed files with 97 additions and 86 deletions

View file

@ -647,6 +647,7 @@ public class MapActivityActions implements DialogProvider {
// 2-4. Navigation related (directions, mute, cancel navigation) // 2-4. Navigation related (directions, mute, cancel navigation)
boolean muteVisible = routingHelper.getFinalLocation() != null && routingHelper.isFollowingMode(); boolean muteVisible = routingHelper.getFinalLocation() != null && routingHelper.isFollowingMode();
// TODO delete
if (muteVisible) { if (muteVisible) {
boolean mute = routingHelper.getVoiceRouter().isMute(); boolean mute = routingHelper.getVoiceRouter().isMute();
int t = mute ? R.string.menu_mute_on : R.string.menu_mute_off; int t = mute ? R.string.menu_mute_on : R.string.menu_mute_off;
@ -665,6 +666,7 @@ public class MapActivityActions implements DialogProvider {
} }
}).reg(); }).reg();
} }
// TODO delete
if(!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) { if(!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
optionsMenuHelper.item(R.string.get_directions) optionsMenuHelper.item(R.string.get_directions)
.iconColor(R.drawable.ic_action_gdirections_dark) .iconColor(R.drawable.ic_action_gdirections_dark)
@ -719,17 +721,15 @@ public class MapActivityActions implements DialogProvider {
} }
}).reg(); }).reg();
} }
if (getTargets().getPointToNavigate() != null) { optionsMenuHelper.item(R.string.target_points).iconColor(R.drawable.ic_action_flage_dark)
optionsMenuHelper.item(R.string.target_points).iconColor(R.drawable.ic_action_flage_dark) .listen(new OnContextMenuClick() {
.listen(new OnContextMenuClick() { @Override
@Override public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, showWaypointsInDrawer(false);
boolean isChecked) { return false;
showWaypointsInDrawer(false); }
return false; }).reg();
} // TODO delete
}).reg();
}
if(routingHelper.isRouteCalculated()) { if(routingHelper.isRouteCalculated()) {
optionsMenuHelper.item(R.string.impassable_road) optionsMenuHelper.item(R.string.impassable_road)
.iconColor(R.drawable.ic_action_road_works_dark) .iconColor(R.drawable.ic_action_road_works_dark)
@ -742,7 +742,7 @@ public class MapActivityActions implements DialogProvider {
}).reg(); }).reg();
} }
// 5-9. Default actions (Layers, Configure Map screen, Settings, Search, Favorites) // Default actions (Layers, Configure Map screen, Settings, Search, Favorites)
optionsMenuHelper.item(R.string.search_button) optionsMenuHelper.item(R.string.search_button)
.iconColor(R.drawable.ic_action_search_dark) .iconColor(R.drawable.ic_action_search_dark)
.listen(new OnContextMenuClick() { .listen(new OnContextMenuClick() {
@ -760,8 +760,8 @@ public class MapActivityActions implements DialogProvider {
} }
}).reg(); }).reg();
optionsMenuHelper.item(R.string.shared_string_my_places) optionsMenuHelper.item(R.string.shared_string_my_places).iconColor(R.drawable.ic_action_fav_dark)
.iconColor(R.drawable.ic_action_fav_dark).listen(new OnContextMenuClick() { .listen(new OnContextMenuClick() {
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization() Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
@ -773,15 +773,14 @@ public class MapActivityActions implements DialogProvider {
}).reg(); }).reg();
optionsMenuHelper.item(R.string.show_point_options) optionsMenuHelper.item(R.string.show_point_options).iconColor(R.drawable.ic_action_marker_dark)
.iconColor(R.drawable.ic_action_marker_dark) .listen(new OnContextMenuClick() {
.listen(new OnContextMenuClick() { @Override
@Override public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { contextMenuPoint(mapView.getLatitude(), mapView.getLongitude());
contextMenuPoint(mapView.getLatitude(), mapView.getLongitude()); return true;
return true; }
} }).reg();
}).reg();
optionsMenuHelper.item(R.string.configure_map).iconColor(R.drawable.ic_action_layers_dark) optionsMenuHelper.item(R.string.configure_map).iconColor(R.drawable.ic_action_layers_dark)
.listen(new OnContextMenuClick() { .listen(new OnContextMenuClick() {
@ -793,24 +792,50 @@ public class MapActivityActions implements DialogProvider {
}).reg(); }).reg();
optionsMenuHelper.item(R.string.layer_map_appearance).iconColor(R.drawable.ic_configure_screen_dark) optionsMenuHelper.item(R.string.layer_map_appearance).iconColor(R.drawable.ic_configure_screen_dark)
.listen(new OnContextMenuClick() { .listen(new OnContextMenuClick() {
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
prepareConfigureScreen(); prepareConfigureScreen();
return false; return false;
} }
}).reg(); }).reg();
optionsMenuHelper.item(R.string.index_settings).iconColor(R.drawable.ic_type_archive)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getDownloadActivity());
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(newIntent);
return true;
}
}).reg();
optionsMenuHelper.item(R.string.shared_string_settings) optionsMenuHelper.item(R.string.prefs_plugins).iconColor(R.drawable.ic_extension_dark)
.iconColor(R.drawable.ic_action_settings_enabled_dark) .listen(new OnContextMenuClick() {
.listen(new OnContextMenuClick() { @Override
@Override public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
final Intent settings = new Intent(mapActivity, getMyApplication().getAppCustomization().getSettingsActivity()); .getPluginsActivity());
mapActivity.startActivity(settings); // causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
return true; mapActivity.startActivity(newIntent);
} return true;
}).reg(); }
}).reg();
optionsMenuHelper.item(R.string.shared_string_settings).iconColor(R.drawable.ic_action_settings_enabled_dark)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
final Intent settings = new Intent(mapActivity, getMyApplication().getAppCustomization()
.getSettingsActivity());
mapActivity.startActivity(settings);
return true;
}
}).reg();
//////////// Others //////////// Others
OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper); OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper);

View file

@ -110,19 +110,7 @@ public class SettingsActivity extends SettingsBaseActivity {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
if (preference == localIndexes) { if (preference == localIndexes) {
boolean empty = getMyApplication().getResourceManager().getIndexFileNames().isEmpty(); startActivity(new Intent(this, getMyApplication().getAppCustomization().getDownloadIndexActivity()));
if (empty) {
File folder = getMyApplication().getAppPath(IndexConstants.BACKUP_INDEX_DIR);
if (folder.exists() && folder.isDirectory()) {
String[] l = folder.list();
empty = l == null || l.length == 0;
}
}
if (empty) {
startActivity(new Intent(this, getMyApplication().getAppCustomization().getDownloadIndexActivity()));
} else {
startActivity(new Intent(this, getMyApplication().getAppCustomization().getDownloadActivity()));
}
return true; return true;
} else if (preference == general) { } else if (preference == general) {
startActivity(new Intent(this, SettingsGeneralActivity.class)); startActivity(new Intent(this, SettingsGeneralActivity.class));

View file

@ -1,5 +1,28 @@
package net.osmand.plus.dashboard; package net.osmand.plus.dashboard;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import net.osmand.data.LatLon;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings.CommonPreference;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.audionotes.DashAudioVideoNotesFragment;
import net.osmand.plus.development.DashSimulateFragment;
import net.osmand.plus.development.OsmandDevelopmentPlugin;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.helpers.ScreenOrientationHelper;
import net.osmand.plus.monitoring.DashTrackFragment;
import net.osmand.plus.osmedit.DashOsmEditsFragment;
import net.osmand.plus.osmo.DashOsMoFragment;
import net.osmand.plus.parkingpoint.DashParkingFragment;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.DownloadedRegionsLayer;
import net.osmand.plus.views.OsmandMapTileView;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@ -7,7 +30,6 @@ import android.os.Build;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.Toolbar;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
@ -30,32 +52,6 @@ import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCal
import com.github.ksoichiro.android.observablescrollview.ScrollState; import com.github.ksoichiro.android.observablescrollview.ScrollState;
import com.software.shell.fab.ActionButton; import com.software.shell.fab.ActionButton;
import net.osmand.data.LatLon;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings.CommonPreference;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.audionotes.DashAudioVideoNotesFragment;
import net.osmand.plus.development.DashSimulateFragment;
import net.osmand.plus.development.OsmandDevelopmentPlugin;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.helpers.ScreenOrientationHelper;
import net.osmand.plus.monitoring.DashTrackFragment;
import net.osmand.plus.osmedit.DashOsmEditsFragment;
import net.osmand.plus.osmo.DashOsMoFragment;
import net.osmand.plus.parkingpoint.DashParkingFragment;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.DownloadedRegionsLayer;
import net.osmand.plus.views.OsmandMapTileView;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import gnu.trove.map.hash.TIntObjectHashMap;
/** /**
* Created by Denis * Created by Denis
* on 03.03.15. * on 03.03.15.
@ -115,7 +111,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
updateTopButton(sy); updateTopButton(sy);
} }
}); });
if (listView instanceof ObservableListView) { if (ScreenOrientationHelper.isOrientationPortrait(mapActivity)) {
((ObservableListView) listView).setScrollViewCallbacks(this); ((ObservableListView) listView).setScrollViewCallbacks(this);
mFlexibleSpaceImageHeight = mapActivity.getResources().getDimensionPixelSize( mFlexibleSpaceImageHeight = mapActivity.getResources().getDimensionPixelSize(
R.dimen.dashboard_map_top_padding); R.dimen.dashboard_map_top_padding);
@ -266,13 +262,13 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
switchButton.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_navigation_drawer, switchButton.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_navigation_drawer,
R.color.icon_color_light)); R.color.icon_color_light));
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
} else { } else {
scrollView.setVisibility(View.GONE); scrollView.setVisibility(View.GONE);
listViewLayout.setVisibility(View.VISIBLE); listViewLayout.setVisibility(View.VISIBLE);
switchButton.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_dashboard_dark, switchButton.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_dashboard_dark,
R.color.icon_color_light)); R.color.icon_color_light));
} }
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
switchButton.setOnClickListener(new View.OnClickListener() { switchButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -440,11 +436,13 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
if(!cond) { if(!cond) {
fragmentTransaction.remove(manager.findFragmentByTag(tag)); fragmentTransaction.remove(manager.findFragmentByTag(tag));
} else if(frag instanceof DashBaseFragment){ } else if(frag instanceof DashBaseFragment){
((DashBaseFragment) frag).onOpenDash(); if(((DashBaseFragment) frag).getView() != null) {
((DashBaseFragment) frag).onOpenDash();
}
} }
} }
} catch (Exception e) { } catch (Exception e) {
getMyApplication().showToastMessage("Error showing dashboard"); getMyApplication().showToastMessage("Error showing dashboard " + tag);
e.printStackTrace(); e.printStackTrace();
} }
} }

View file

@ -103,7 +103,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
this.plugin = plugin; this.plugin = plugin;
poiTypes = uiContext.getMyApplication().getPoiTypes(); poiTypes = uiContext.getMyApplication().getPoiTypes();
allTranslatedSubTypes = poiTypes.getAllTranslatedNames(false); allTranslatedSubTypes = poiTypes.getAllTranslatedNames(true);
settings = ((OsmandApplication) uiContext.getApplication()).getSettings(); settings = ((OsmandApplication) uiContext.getApplication()).getSettings();
if (settings.OFFLINE_EDITION.get() || !settings.isInternetConnectionAvailable(true)) { if (settings.OFFLINE_EDITION.get() || !settings.isInternetConnectionAvailable(true)) {
this.openstreetmapUtil = new OpenstreetmapLocalUtil(activity); this.openstreetmapUtil = new OpenstreetmapLocalUtil(activity);
@ -557,7 +557,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
private Map<String, PoiType> getSubCategoriesMap(PoiCategory poiCategory) { private Map<String, PoiType> getSubCategoriesMap(PoiCategory poiCategory) {
Map<String, PoiType> subCategories = new LinkedHashMap<>(poiTypes.getAllTranslatedNames(poiCategory, false)); Map<String, PoiType> subCategories = new LinkedHashMap<>(poiTypes.getAllTranslatedNames(poiCategory, false));
for (Map.Entry<String, PoiType> s : poiTypes.getAllTranslatedNames(false).entrySet()) { for (Map.Entry<String, PoiType> s : poiTypes.getAllTranslatedNames(true).entrySet()) {
if (!subCategories.containsKey(s.getKey())) { if (!subCategories.containsKey(s.getKey())) {
subCategories.put(s.getKey(), s.getValue()); subCategories.put(s.getKey(), s.getValue());
} }