Add 360 images mapillary filter.
This commit is contained in:
parent
65be31c340
commit
b54b6a0cf2
5 changed files with 91 additions and 15 deletions
|
@ -376,6 +376,53 @@
|
|||
android:background="?attr/dashboard_divider" />
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/pano_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:minHeight="60dp"
|
||||
tools:layout_height="60dp">
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/pano_row_toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:focusable="false" />
|
||||
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
android:id="@+id/pano_row_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
android:text="@string/mapillary_menu_title_pano"
|
||||
android:paddingLeft="52dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:animateLayoutChanges="true"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="52dp"
|
||||
android:paddingStart="52dp">
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -373,7 +373,8 @@
|
|||
<string name="mapillary_menu_edit_text_hint">Type username</string>
|
||||
<string name="mapillary_menu_descr_username">View only images added by</string>
|
||||
<string name="mapillary_menu_title_username">Username</string>
|
||||
<string name="mapillary_menu_filter_description">Filter images by submitter or by date. Only active in closeup zoom.</string>
|
||||
<string name="mapillary_menu_filter_description">Filter images by submitter, by date or by type. Only active in closeup zoom.</string>
|
||||
<string name="mapillary_menu_title_pano">Display only 360° images</string>
|
||||
<string name="map_widget_ruler_control">Radius ruler</string>
|
||||
<string name="shared_string_permissions">Permissions</string>
|
||||
<string name="import_gpx_failed_descr">OsmAnd cannot import the file. Please check if OsmAnd has permission to read file from its location.</string>
|
||||
|
|
|
@ -823,6 +823,7 @@ public class OsmandSettings {
|
|||
public final CommonPreference<String> MAPILLARY_FILTER_USERNAME = new StringPreference("mapillary_filter_username", "").makeGlobal();
|
||||
public final CommonPreference<Long> MAPILLARY_FILTER_FROM_DATE = new LongPreference("mapillary_filter_from_date", 0).makeGlobal();
|
||||
public final CommonPreference<Long> MAPILLARY_FILTER_TO_DATE = new LongPreference("mapillary_filter_to_date", 0).makeGlobal();
|
||||
public final CommonPreference<Boolean> MAPILLARY_FILTER_PANO = new BooleanPreference("mapillary_filter_pano", false).makeGlobal();
|
||||
|
||||
public final CommonPreference<Boolean> USE_FAST_RECALCULATION = new BooleanPreference("use_fast_recalculation", true).makeGlobal().cache();
|
||||
public final CommonPreference<Boolean> FORCE_PRIVATE_ACCESS_ROUTING_ASKED = new BooleanPreference("force_private_access_routing", false).makeProfile().cache();
|
||||
|
|
|
@ -115,7 +115,6 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
|
|||
((AppCompatImageView) view.findViewById(R.id.mapillary_filters_date_icon)).setImageDrawable(getIcon(R.drawable.ic_action_data, colorRes));
|
||||
((AppCompatImageView) view.findViewById(R.id.mapillary_filters_tile_cache_icon)).setImageDrawable(getIcon(R.drawable.ic_layer_top_dark, colorRes));
|
||||
|
||||
|
||||
final DelayAutoCompleteTextView textView = (DelayAutoCompleteTextView) view.findViewById(R.id.auto_complete_text_view);
|
||||
textView.setAdapter(new MapillaryAutoCompleteAdapter(getContext(), R.layout.auto_complete_suggestion, getMyApplication()));
|
||||
String selectedUsername = settings.MAPILLARY_FILTER_USERNAME.get();
|
||||
|
@ -150,13 +149,7 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
|
|||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
view.findViewById(R.id.warning_linear_layout).setVisibility(View.GONE);
|
||||
if (!settings.MAPILLARY_FILTER_USERNAME.get().equals("") ||
|
||||
settings.MAPILLARY_FILTER_TO_DATE.get() != 0 ||
|
||||
settings.MAPILLARY_FILTER_FROM_DATE.get() != 0) {
|
||||
changeButtonState((Button) view.findViewById(R.id.button_apply), 1, true);
|
||||
} else {
|
||||
changeButtonState((Button) view.findViewById(R.id.button_apply), .5f, false);
|
||||
}
|
||||
enableButtonApply(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -179,7 +172,7 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
|
|||
from.set(Calendar.DAY_OF_MONTH, dayOfMonth);
|
||||
dateFromEt.setText(dateFormat.format(from.getTime()));
|
||||
settings.MAPILLARY_FILTER_FROM_DATE.set(from.getTimeInMillis());
|
||||
changeButtonState((Button) view.findViewById(R.id.button_apply), 1, true);
|
||||
enableButtonApply(view);
|
||||
mapActivity.getDashboard().refreshContent(true);
|
||||
}
|
||||
};
|
||||
|
@ -206,7 +199,7 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
|
|||
to.set(Calendar.DAY_OF_MONTH, dayOfMonth);
|
||||
dateToEt.setText(dateFormat.format(to.getTime()));
|
||||
settings.MAPILLARY_FILTER_TO_DATE.set(to.getTimeInMillis());
|
||||
changeButtonState((Button) view.findViewById(R.id.button_apply), 1, true);
|
||||
enableButtonApply(view);
|
||||
mapActivity.getDashboard().refreshContent(true);
|
||||
}
|
||||
};
|
||||
|
@ -233,9 +226,28 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
}
|
||||
|
||||
final View rowPano = view.findViewById(R.id.pano_row);
|
||||
final CompoundButton pano = (CompoundButton) rowPano.findViewById(R.id.pano_row_toggle);
|
||||
pano.setOnCheckedChangeListener(null);
|
||||
pano.setChecked(settings.MAPILLARY_FILTER_PANO.get());
|
||||
pano.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||
settings.MAPILLARY_FILTER_PANO.set(!settings.MAPILLARY_FILTER_PANO.get());
|
||||
enableButtonApply(view);
|
||||
mapActivity.getDashboard().refreshContent(true);
|
||||
}
|
||||
});
|
||||
rowPano.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
pano.setChecked(!pano.isChecked());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
final Button apply = (Button) view.findViewById(R.id.button_apply);
|
||||
changeButtonState(apply, .5f, false);
|
||||
disableButtonApply(view);
|
||||
apply.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -243,7 +255,7 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
|
|||
String dateFrom = dateFromEt.getText().toString();
|
||||
String dateTo = dateToEt.getText().toString();
|
||||
|
||||
if (!settings.MAPILLARY_FILTER_USERNAME.get().equals("") || !dateFrom.equals("") || !dateTo.equals("")) {
|
||||
if (!settings.MAPILLARY_FILTER_USERNAME.get().equals("") || !dateFrom.equals("") || !dateTo.equals("") || settings.MAPILLARY_FILTER_PANO.get()) {
|
||||
settings.USE_MAPILLARY_FILTER.set(true);
|
||||
}
|
||||
if (dateFrom.equals("")) {
|
||||
|
@ -272,12 +284,14 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
|
|||
textView.setText("");
|
||||
dateFromEt.setText("");
|
||||
dateToEt.setText("");
|
||||
pano.setChecked(false);
|
||||
|
||||
settings.USE_MAPILLARY_FILTER.set(false);
|
||||
settings.MAPILLARY_FILTER_USER_KEY.set("");
|
||||
settings.MAPILLARY_FILTER_USERNAME.set("");
|
||||
settings.MAPILLARY_FILTER_FROM_DATE.set(0L);
|
||||
settings.MAPILLARY_FILTER_TO_DATE.set(0L);
|
||||
settings.MAPILLARY_FILTER_PANO.set(false);
|
||||
|
||||
plugin.updateLayers(mapActivity.getMapView(), mapActivity);
|
||||
hideKeyboard();
|
||||
|
@ -295,6 +309,14 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void enableButtonApply(View view) {
|
||||
changeButtonState((Button) view.findViewById(R.id.button_apply), 1, true);
|
||||
}
|
||||
|
||||
private void disableButtonApply(View view) {
|
||||
changeButtonState((Button) view.findViewById(R.id.button_apply), .5f, false);
|
||||
}
|
||||
|
||||
private void changeButtonState(Button button, float alpha, boolean enabled) {
|
||||
button.setAlpha(alpha);
|
||||
button.setEnabled(enabled);
|
||||
|
|
|
@ -202,6 +202,7 @@ class MapillaryVectorLayer extends MapTileLayer implements MapillaryLayer, ICont
|
|||
long capturedAt = ((Number) userData.get("captured_at")).longValue();
|
||||
long from = settings.MAPILLARY_FILTER_FROM_DATE.get();
|
||||
long to = settings.MAPILLARY_FILTER_TO_DATE.get();
|
||||
boolean pano = settings.MAPILLARY_FILTER_PANO.get();
|
||||
|
||||
if (!userKey.equals("")) {
|
||||
String key = (String) userData.get("userkey");
|
||||
|
@ -216,6 +217,10 @@ class MapillaryVectorLayer extends MapTileLayer implements MapillaryLayer, ICont
|
|||
} else if ((from != 0 && capturedAt < from) || (to != 0 && capturedAt > to)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pano) {
|
||||
return (long) userData.get("pano") == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue