Fix #5937
This commit is contained in:
parent
3c15a7a2ff
commit
900196975b
2 changed files with 24 additions and 5 deletions
|
@ -1,7 +1,5 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
import static net.osmand.plus.osmedit.EditPoiDialogFragment.AMENITY_TEXT_LENGTH;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
|
@ -10,8 +8,6 @@ import android.support.annotation.Nullable;
|
|||
import android.support.v4.app.Fragment;
|
||||
import android.text.Editable;
|
||||
import android.text.InputFilter;
|
||||
import android.text.InputFilter.LengthFilter;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.TypedValue;
|
||||
|
@ -41,6 +37,8 @@ import java.util.Map;
|
|||
|
||||
import gnu.trove.list.array.TIntArrayList;
|
||||
|
||||
import static net.osmand.plus.osmedit.EditPoiDialogFragment.AMENITY_TEXT_LENGTH;
|
||||
|
||||
public class BasicEditPoiFragment extends BaseOsmAndFragment
|
||||
implements EditPoiDialogFragment.OnFragmentActivatedListener {
|
||||
private static final Log LOG = PlatformUtil.getLog(BasicEditPoiFragment.class);
|
||||
|
@ -167,6 +165,19 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment
|
|||
mOpeningHoursAdapter.setOpeningHoursRule(item, position);
|
||||
}
|
||||
|
||||
public void removeUnsavedOpeningHours() {
|
||||
EditPoiData data = getData();
|
||||
if (data != null) {
|
||||
OpeningHoursParser.OpeningHours openingHours = OpeningHoursParser.parseOpenedHoursHandleErrors(data.getTagValues()
|
||||
.get(OSMSettings.OSMTagKey.OPENING_HOURS.getValue()));
|
||||
if (openingHours == null) {
|
||||
openingHours = new OpeningHoursParser.OpeningHours();
|
||||
}
|
||||
mOpeningHoursAdapter.replaceOpeningHours(openingHours);
|
||||
mOpeningHoursAdapter.updateViews();
|
||||
}
|
||||
}
|
||||
|
||||
private EditPoiData getData() {
|
||||
Fragment parent = getParentFragment();
|
||||
if (parent != null && parent instanceof EditPoiDialogFragment) {
|
||||
|
|
|
@ -83,7 +83,15 @@ public class OpeningHoursHoursDialogFragment extends DialogFragment {
|
|||
}
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
.setNegativeButton(R.string.shared_string_cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
BasicEditPoiFragment editPoiFragment = ((BasicEditPoiFragment) getParentFragment());
|
||||
if (editPoiFragment != null) {
|
||||
editPoiFragment.removeUnsavedOpeningHours();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
int paddingInDp = 18;
|
||||
float density = getActivity().getResources().getDisplayMetrics().density;
|
||||
|
|
Loading…
Reference in a new issue