Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
8a8e41e0e2
5 changed files with 57 additions and 32 deletions
|
@ -37,7 +37,7 @@ public class Version {
|
||||||
return ctx.getString(R.string.versionFeatures).contains("+amazon");
|
return ctx.getString(R.string.versionFeatures).contains("+amazon");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isGooglePlayEnabled(OsmandApplication ctx) {
|
public static boolean isGooglePlayEnabled(OsmandApplication ctx) {
|
||||||
return ctx.getString(R.string.versionFeatures).contains("+play_market");
|
return ctx.getString(R.string.versionFeatures).contains("+play_market");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.actions.OsmAndDialogs;
|
import net.osmand.plus.activities.actions.OsmAndDialogs;
|
||||||
import net.osmand.plus.activities.search.SearchActivity;
|
import net.osmand.plus.activities.search.SearchActivity;
|
||||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||||
|
@ -691,6 +692,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
|
|
||||||
|
if (Version.isGooglePlayEnabled(app)) {
|
||||||
optionsMenuHelper.item(R.string.osm_live).iconColor(R.drawable.ic_action_osm_live)
|
optionsMenuHelper.item(R.string.osm_live).iconColor(R.drawable.ic_action_osm_live)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -701,6 +703,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
|
}
|
||||||
|
|
||||||
optionsMenuHelper.item(R.string.prefs_plugins).iconColor(R.drawable.ic_extension_dark)
|
optionsMenuHelper.item(R.string.prefs_plugins).iconColor(R.drawable.ic_extension_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
|
@ -37,6 +37,7 @@ import net.osmand.map.WorldRegion;
|
||||||
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;
|
||||||
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.LocalIndexHelper;
|
import net.osmand.plus.activities.LocalIndexHelper;
|
||||||
import net.osmand.plus.activities.LocalIndexInfo;
|
import net.osmand.plus.activities.LocalIndexInfo;
|
||||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||||
|
@ -130,9 +131,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
||||||
|
|
||||||
progressBar = (ProgressBar) view.findViewById(R.id.progress);
|
progressBar = (ProgressBar) view.findViewById(R.id.progress);
|
||||||
|
|
||||||
//test
|
if (!Version.isDeveloperVersion(getMyApplication())) {
|
||||||
//getSettings().LIVE_UPDATES_PURCHASED.set(true);
|
|
||||||
|
|
||||||
subscriptionHeader = inflater.inflate(R.layout.live_updates_header, listView, false);
|
subscriptionHeader = inflater.inflate(R.layout.live_updates_header, listView, false);
|
||||||
updateSubscriptionHeader();
|
updateSubscriptionHeader();
|
||||||
|
|
||||||
|
@ -147,6 +146,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
loadLocalIndexesTask = new LoadLocalIndexTask(adapter, this).execute();
|
loadLocalIndexesTask = new LoadLocalIndexTask(adapter, this).execute();
|
||||||
return view;
|
return view;
|
||||||
|
@ -232,7 +232,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
if (getSettings().LIVE_UPDATES_PURCHASED.get()) {
|
if (getSettings().LIVE_UPDATES_PURCHASED.get() && !Version.isDeveloperVersion(getMyApplication())) {
|
||||||
ActionBar actionBar = getMyActivity().getSupportActionBar();
|
ActionBar actionBar = getMyActivity().getSupportActionBar();
|
||||||
if (actionBar != null) {
|
if (actionBar != null) {
|
||||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||||
|
|
|
@ -11,6 +11,7 @@ import android.view.MenuItem;
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.download.AbstractDownloadActivity;
|
import net.osmand.plus.download.AbstractDownloadActivity;
|
||||||
import net.osmand.plus.download.DownloadIndexesThread;
|
import net.osmand.plus.download.DownloadIndexesThread;
|
||||||
import net.osmand.plus.inapp.InAppHelper;
|
import net.osmand.plus.inapp.InAppHelper;
|
||||||
|
@ -34,6 +35,9 @@ public class OsmLiveActivity extends AbstractDownloadActivity
|
||||||
setContentView(R.layout.activity_livie_updates);
|
setContentView(R.layout.activity_livie_updates);
|
||||||
|
|
||||||
inAppHelper = new InAppHelper(getMyApplication());
|
inAppHelper = new InAppHelper(getMyApplication());
|
||||||
|
if (Version.isDeveloperVersion(getMyApplication())) {
|
||||||
|
inAppHelper = null;
|
||||||
|
}
|
||||||
|
|
||||||
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
|
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
|
||||||
pagerAdapter = new LiveUpdatesFragmentPagerAdapter(getSupportFragmentManager());
|
pagerAdapter = new LiveUpdatesFragmentPagerAdapter(getSupportFragmentManager());
|
||||||
|
|
|
@ -52,8 +52,10 @@ public class MapMarkersWidgetsFactory {
|
||||||
private ImageButton moreButton;
|
private ImageButton moreButton;
|
||||||
private ImageButton moreButton2nd;
|
private ImageButton moreButton2nd;
|
||||||
|
|
||||||
|
private MapMarker marker;
|
||||||
private int markerColorIndex = -1;
|
private int markerColorIndex = -1;
|
||||||
private String markerDistText;
|
private String markerDistText;
|
||||||
|
private MapMarker marker2nd;
|
||||||
private int markerColorIndex2nd = -1;
|
private int markerColorIndex2nd = -1;
|
||||||
private String markerDistText2nd;
|
private String markerDistText2nd;
|
||||||
|
|
||||||
|
@ -249,13 +251,17 @@ public class MapMarkersWidgetsFactory {
|
||||||
arrowImg.invalidate();
|
arrowImg.invalidate();
|
||||||
|
|
||||||
int dist = (int) mes[0];
|
int dist = (int) mes[0];
|
||||||
String txt;
|
String txt = null;
|
||||||
if (loc != null) {
|
if (loc != null) {
|
||||||
txt = OsmAndFormatter.getFormattedDistance(dist, map.getMyApplication());
|
txt = OsmAndFormatter.getFormattedDistance(dist, map.getMyApplication());
|
||||||
} else {
|
} else {
|
||||||
|
if ((firstLine && marker != this.marker) || (!firstLine && marker != this.marker2nd)) {
|
||||||
txt = "—";
|
txt = "—";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (txt != null) {
|
||||||
distText.setText(txt);
|
distText.setText(txt);
|
||||||
|
}
|
||||||
updateVisibility(okButton, !customLocation && loc != null && dist < MIN_DIST_OK_VISIBLE);
|
updateVisibility(okButton, !customLocation && loc != null && dist < MIN_DIST_OK_VISIBLE);
|
||||||
|
|
||||||
String descr;
|
String descr;
|
||||||
|
@ -272,12 +278,18 @@ public class MapMarkersWidgetsFactory {
|
||||||
addressText.setText(descr);
|
addressText.setText(descr);
|
||||||
|
|
||||||
if (firstLine) {
|
if (firstLine) {
|
||||||
|
this.marker = marker;
|
||||||
markerColorIndex = marker.colorIndex;
|
markerColorIndex = marker.colorIndex;
|
||||||
|
if (txt != null) {
|
||||||
markerDistText = txt;
|
markerDistText = txt;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
this.marker2nd = marker;
|
||||||
markerColorIndex2nd = marker.colorIndex;
|
markerColorIndex2nd = marker.colorIndex;
|
||||||
|
if (txt != null) {
|
||||||
markerDistText2nd = txt;
|
markerDistText2nd = txt;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,6 +306,7 @@ public class MapMarkersWidgetsFactory {
|
||||||
setImageDrawable(map.getMyApplication().getIconsCache()
|
setImageDrawable(map.getMyApplication().getIconsCache()
|
||||||
.getIcon(R.drawable.widget_marker_day,
|
.getIcon(R.drawable.widget_marker_day,
|
||||||
MapMarkerDialogHelper.getMapMarkerColorId(markerColorIndex)));
|
MapMarkerDialogHelper.getMapMarkerColorId(markerColorIndex)));
|
||||||
|
cachedMarkerColorIndex = markerColorIndex;
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
if (!markerDistText.equals(cachedMarkerDistText)) {
|
if (!markerDistText.equals(cachedMarkerDistText)) {
|
||||||
|
@ -303,11 +316,13 @@ public class MapMarkersWidgetsFactory {
|
||||||
} else {
|
} else {
|
||||||
setText(markerDistText.substring(0, ls), markerDistText.substring(ls + 1));
|
setText(markerDistText.substring(0, ls), markerDistText.substring(ls + 1));
|
||||||
}
|
}
|
||||||
|
cachedMarkerDistText = markerDistText;
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
} else if (cachedMarkerDistText != null) {
|
} else if (cachedMarkerDistText != null) {
|
||||||
|
cachedMarkerColorIndex = -1;
|
||||||
cachedMarkerDistText = null;
|
cachedMarkerDistText = null;
|
||||||
setText(null, null);
|
setText(null, null);
|
||||||
return true;
|
return true;
|
||||||
|
@ -338,6 +353,7 @@ public class MapMarkersWidgetsFactory {
|
||||||
setImageDrawable(map.getMyApplication().getIconsCache()
|
setImageDrawable(map.getMyApplication().getIconsCache()
|
||||||
.getIcon(R.drawable.widget_marker_day,
|
.getIcon(R.drawable.widget_marker_day,
|
||||||
MapMarkerDialogHelper.getMapMarkerColorId(markerColorIndex2nd)));
|
MapMarkerDialogHelper.getMapMarkerColorId(markerColorIndex2nd)));
|
||||||
|
cachedMarkerColorIndex = markerColorIndex2nd;
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
if (!markerDistText2nd.equals(cachedMarkerDistText)) {
|
if (!markerDistText2nd.equals(cachedMarkerDistText)) {
|
||||||
|
@ -347,11 +363,13 @@ public class MapMarkersWidgetsFactory {
|
||||||
} else {
|
} else {
|
||||||
setText(markerDistText2nd.substring(0, ls), markerDistText2nd.substring(ls + 1));
|
setText(markerDistText2nd.substring(0, ls), markerDistText2nd.substring(ls + 1));
|
||||||
}
|
}
|
||||||
|
cachedMarkerDistText = markerDistText2nd;
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
} else if (cachedMarkerDistText != null) {
|
} else if (cachedMarkerDistText != null) {
|
||||||
|
cachedMarkerColorIndex = -1;
|
||||||
cachedMarkerDistText = null;
|
cachedMarkerDistText = null;
|
||||||
setText(null, null);
|
setText(null, null);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue