Small changes

This commit is contained in:
Victor Shcherb 2015-03-24 22:01:04 +01:00
parent c3715723d9
commit ee0147464e
3 changed files with 31 additions and 33 deletions

View file

@ -818,7 +818,7 @@ public class MapActivityActions implements DialogProvider {
@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()
.getDownloadActivity()); .getPluginsActivity());
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); // causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(newIntent); mapActivity.startActivity(newIntent);
return true; return true;

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);
@ -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());
} }