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)
boolean muteVisible = routingHelper.getFinalLocation() != null && routingHelper.isFollowingMode();
// TODO delete
if (muteVisible) {
boolean mute = routingHelper.getVoiceRouter().isMute();
int t = mute ? R.string.menu_mute_on : R.string.menu_mute_off;
@ -665,6 +666,7 @@ public class MapActivityActions implements DialogProvider {
}
}).reg();
}
// TODO delete
if(!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
optionsMenuHelper.item(R.string.get_directions)
.iconColor(R.drawable.ic_action_gdirections_dark)
@ -719,17 +721,15 @@ public class MapActivityActions implements DialogProvider {
}
}).reg();
}
if (getTargets().getPointToNavigate() != null) {
optionsMenuHelper.item(R.string.target_points).iconColor(R.drawable.ic_action_flage_dark)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos,
boolean isChecked) {
showWaypointsInDrawer(false);
return false;
}
}).reg();
}
optionsMenuHelper.item(R.string.target_points).iconColor(R.drawable.ic_action_flage_dark)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
showWaypointsInDrawer(false);
return false;
}
}).reg();
// TODO delete
if(routingHelper.isRouteCalculated()) {
optionsMenuHelper.item(R.string.impassable_road)
.iconColor(R.drawable.ic_action_road_works_dark)
@ -742,7 +742,7 @@ public class MapActivityActions implements DialogProvider {
}).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)
.iconColor(R.drawable.ic_action_search_dark)
.listen(new OnContextMenuClick() {
@ -760,8 +760,8 @@ public class MapActivityActions implements DialogProvider {
}
}).reg();
optionsMenuHelper.item(R.string.shared_string_my_places)
.iconColor(R.drawable.ic_action_fav_dark).listen(new OnContextMenuClick() {
optionsMenuHelper.item(R.string.shared_string_my_places).iconColor(R.drawable.ic_action_fav_dark)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
@ -773,15 +773,14 @@ public class MapActivityActions implements DialogProvider {
}).reg();
optionsMenuHelper.item(R.string.show_point_options)
.iconColor(R.drawable.ic_action_marker_dark)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
contextMenuPoint(mapView.getLatitude(), mapView.getLongitude());
return true;
}
}).reg();
optionsMenuHelper.item(R.string.show_point_options).iconColor(R.drawable.ic_action_marker_dark)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
contextMenuPoint(mapView.getLatitude(), mapView.getLongitude());
return true;
}
}).reg();
optionsMenuHelper.item(R.string.configure_map).iconColor(R.drawable.ic_action_layers_dark)
.listen(new OnContextMenuClick() {
@ -793,24 +792,50 @@ public class MapActivityActions implements DialogProvider {
}).reg();
optionsMenuHelper.item(R.string.layer_map_appearance).iconColor(R.drawable.ic_configure_screen_dark)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
prepareConfigureScreen();
return false;
}
}).reg();
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
prepareConfigureScreen();
return false;
}
}).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)
.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();
optionsMenuHelper.item(R.string.prefs_plugins).iconColor(R.drawable.ic_extension_dark)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getPluginsActivity());
// 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).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
OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper);

View file

@ -110,19 +110,7 @@ public class SettingsActivity extends SettingsBaseActivity {
@Override
public boolean onPreferenceClick(Preference preference) {
if (preference == localIndexes) {
boolean empty = getMyApplication().getResourceManager().getIndexFileNames().isEmpty();
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()));
}
startActivity(new Intent(this, getMyApplication().getAppCustomization().getDownloadIndexActivity()));
return true;
} else if (preference == general) {
startActivity(new Intent(this, SettingsGeneralActivity.class));

View file

@ -1,5 +1,28 @@
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.content.Context;
import android.content.Intent;
@ -7,7 +30,6 @@ import android.os.Build;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.Toolbar;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.View;
@ -30,32 +52,6 @@ import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCal
import com.github.ksoichiro.android.observablescrollview.ScrollState;
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
* on 03.03.15.
@ -115,7 +111,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
updateTopButton(sy);
}
});
if (listView instanceof ObservableListView) {
if (ScreenOrientationHelper.isOrientationPortrait(mapActivity)) {
((ObservableListView) listView).setScrollViewCallbacks(this);
mFlexibleSpaceImageHeight = mapActivity.getResources().getDimensionPixelSize(
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,
R.color.icon_color_light));
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
} else {
scrollView.setVisibility(View.GONE);
listViewLayout.setVisibility(View.VISIBLE);
switchButton.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_dashboard_dark,
R.color.icon_color_light));
}
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
switchButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -440,11 +436,13 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
if(!cond) {
fragmentTransaction.remove(manager.findFragmentByTag(tag));
} else if(frag instanceof DashBaseFragment){
((DashBaseFragment) frag).onOpenDash();
if(((DashBaseFragment) frag).getView() != null) {
((DashBaseFragment) frag).onOpenDash();
}
}
}
} catch (Exception e) {
getMyApplication().showToastMessage("Error showing dashboard");
getMyApplication().showToastMessage("Error showing dashboard " + tag);
e.printStackTrace();
}
}

View file

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