Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-10-01 09:55:50 +02:00
commit 704a2312f9
3 changed files with 17 additions and 43 deletions

View file

@ -743,7 +743,7 @@ public class OpeningHoursParser {
* @param format the string to parse
* @return the OpeningHours object
*/
private static OpeningHoursParser.OpeningHours parseOpenedHoursHandleErrors(String format){
public static OpeningHoursParser.OpeningHours parseOpenedHoursHandleErrors(String format){
if(format == null) {
return null;
}

View file

@ -151,7 +151,6 @@ public class AdvancedDataFragment extends Fragment
public class TagAdapterLinearLayoutHack {
private final LinearLayout linearLayout;
private final EditPoiData editPoiData;
private final MapPoiTypes mapPoiTypes;
private final Map<String, AbstractPoiType> allTypes;
private final HashSet<String> tagKeys;
private final HashSet<String> valueKeys;
@ -162,7 +161,6 @@ public class AdvancedDataFragment extends Fragment
MapPoiTypes mapPoiTypes) {
this.linearLayout = linearLayout;
this.editPoiData = editPoiData;
this.mapPoiTypes = mapPoiTypes;
this.allTypes = mapPoiTypes.getAllTypesTranslatedNames(new StringMatcher() {
@Override
public boolean matches(String name) {
@ -183,6 +181,9 @@ public class AdvancedDataFragment extends Fragment
linearLayout.removeAllViews();
editPoiData.setIsInEdit(true);
for (Entry<String, String> tag : editPoiData.getTagValues().entrySet()) {
if(tag.getKey().equals(EditPoiData.POI_TYPE_TAG)
|| tag.getKey().equals(OSMSettings.OSMTagKey.NAME.getValue()))
continue;
addTagView(tag.getKey(), tag.getValue());
}
editPoiData.setIsInEdit(false);

View file

@ -36,7 +36,7 @@ import net.osmand.util.OpeningHoursParser.BasicOpeningHourRule;
import org.apache.commons.logging.Log;
public class BasicDataFragment extends Fragment
implements EditPoiFragment.OnFragmentActivatedListener{
implements EditPoiFragment.OnFragmentActivatedListener {
private static final String TAG = "BasicDataFragment";
private static final Log LOG = PlatformUtil.getLog(BasicDataFragment.class);
private static final String OPENING_HOURS = "opening_hours";
@ -126,29 +126,6 @@ public class BasicDataFragment extends Fragment
return (OsmandApplication) getActivity().getApplication();
}
@Override
public void onResume() {
super.onResume();
// FIXME opening hours
// @Override
// public void process( String openingHoursString ) {
// parseOpenedHoursHandleErrors(openingHoursString);
// if (openingHours == null) {
// openingHours = new OpeningHoursParser.OpeningHours();
// }
// LOG.debug("openingHours=" + openingHours);
// adapter.replaceOpeningHours(openingHours);
// adapter.updateViews();
// }
//
// @Override
// public void onUntriggered() {
// adapter.replaceOpeningHours(new OpeningHoursParser.OpeningHours());
// adapter.updateViews();
// }
}
protected void addTextWatcher(final String tag, final EditText e) {
e.addTextChangedListener(new TextWatcher() {
@ -186,7 +163,6 @@ public class BasicDataFragment extends Fragment
}
private EditPoiFragment getEditPoiFragment() {
return (EditPoiFragment) getParentFragment();
}
@ -195,19 +171,6 @@ public class BasicDataFragment extends Fragment
return getEditPoiFragment().getEditPoiData();
}
private static String formatTime(int h, int t) {
StringBuilder b = new StringBuilder();
if (h < 10) {
b.append("0"); //$NON-NLS-1$
}
b.append(h).append(":"); //$NON-NLS-1$
if (t < 10) {
b.append("0"); //$NON-NLS-1$
}
b.append(t);
return b.toString();
}
@Override
public void onFragmentActivated() {
streetEditText.setText(getData().getTagValues()
@ -220,6 +183,16 @@ public class BasicDataFragment extends Fragment
.get(OSMSettings.OSMTagKey.WEBSITE.getValue()));
descriptionEditText.setText(getData().getTagValues()
.get(OSMSettings.OSMTagKey.DESCRIPTION.getValue()));
OpeningHoursParser.OpeningHours openingHours =
OpeningHoursParser.parseOpenedHoursHandleErrors(getData().getTagValues()
.get(OSMSettings.OSMTagKey.OPENING_HOURS.getValue()));
if (openingHours == null) {
openingHours = new OpeningHoursParser.OpeningHours();
}
LOG.debug("openingHours=" + openingHours);
mOpeningHoursAdapter.replaceOpeningHours(openingHours);
mOpeningHoursAdapter.updateViews();
}
private class OpeningHoursAdapter {
@ -282,10 +255,10 @@ public class BasicDataFragment extends Fragment
daysTextView.setText(stringBuilder.toString());
TextView openingTextView = (TextView) view.findViewById(R.id.openingTextView);
openingTextView.setText(Algorithms.formatDuration(rule.getStartTime() * 60));
openingTextView.setText(Algorithms.formatDuration(rule.getStartTime()));
TextView closingTextView = (TextView) view.findViewById(R.id.closingTextView);
closingTextView.setText(Algorithms.formatDuration(rule.getStartTime() * 60));
closingTextView.setText(Algorithms.formatDuration(rule.getEndTime()));
timeContainer.setVisibility(View.VISIBLE);
daysTextView.setOnClickListener(new View.OnClickListener() {