Poi creation: poi has to have at least poi type. Dashboard now always shows if critical message appears.

This commit is contained in:
GaidamakUA 2015-09-02 14:38:08 +03:00
parent b564b84546
commit 29adf705d2
4 changed files with 15 additions and 3 deletions

View file

@ -2255,4 +2255,5 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
<string name="add_opening_hours">Add opening hours</string> <string name="add_opening_hours">Add opening hours</string>
<string name="poi_dialog_poi_type">POI Type</string> <string name="poi_dialog_poi_type">POI Type</string>
<string name="number_of_rows_in_dash">Number of rows in dash %1$s</string> <string name="number_of_rows_in_dash">Number of rows in dash %1$s</string>
<string name="please_specify_poi_type">Please specify POI type.</string>
</resources> </resources>

View file

@ -389,7 +389,7 @@ public class MapActivity extends AccessibleActivity {
if (!dashboardOnMap.isVisible()) { if (!dashboardOnMap.isVisible()) {
final OsmandSettings.CommonPreference<Boolean> shouldShowDashboardOnStart = final OsmandSettings.CommonPreference<Boolean> shouldShowDashboardOnStart =
settings.registerBooleanPreference(MapActivity.SHOULD_SHOW_DASHBOARD_ON_START, true); settings.registerBooleanPreference(MapActivity.SHOULD_SHOW_DASHBOARD_ON_START, true);
if (shouldShowDashboardOnStart.get()) if (shouldShowDashboardOnStart.get() || dashboardOnMap.hasCriticalMessages())
dashboardOnMap.setDashboardVisibility(true, DashboardOnMap.staticVisibleType); dashboardOnMap.setDashboardVisibility(true, DashboardOnMap.staticVisibleType);
} }
} }

View file

@ -910,6 +910,13 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
transaction.show(frag).commit(); transaction.show(frag).commit();
} }
public boolean hasCriticalMessages() {
final OsmandSettings settings = getMyApplication().getSettings();
return rateUsShouldShow.shouldShow(settings, mapActivity, DashRateUsFragment.TAG)
|| errorShouldShow.shouldShow(settings, mapActivity, DashErrorFragment.TAG);
}
View getParentView() { View getParentView() {
return dashboardView; return dashboardView;
} }

View file

@ -19,6 +19,7 @@ import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.Editable; import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -196,7 +197,7 @@ public class EditPoiFragment extends Fragment {
((MapActivity) getActivity()).getMyApplication().getIconsCache() ((MapActivity) getActivity()).getMyApplication().getIconsCache()
.getPaintedContentIcon(R.drawable.ic_action_help, .getPaintedContentIcon(R.drawable.ic_action_help,
getResources().getColor(R.color.inactive_item_orange))); getResources().getColor(R.color.inactive_item_orange)));
ImageButton poiTypeButton = (ImageButton) view.findViewById(R.id.poiTypeButton); final ImageButton poiTypeButton = (ImageButton) view.findViewById(R.id.poiTypeButton);
poiTypeButton.setOnClickListener(new View.OnClickListener() { poiTypeButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -265,7 +266,10 @@ public class EditPoiFragment extends Fragment {
saveButton.setOnClickListener(new View.OnClickListener() { saveButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
// TODO implement saving if (TextUtils.isEmpty(poiTypeEditText.getText())) {
poiTypeEditText.setError(getResources().getString(R.string.please_specify_poi_type));
return;
}
OsmPoint.Action action = node.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY; OsmPoint.Action action = node.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY;
String description = ""; String description = "";
for (Tag tag : editPoiData.tags) { for (Tag tag : editPoiData.tags) {