Update interface openinghours

an update to the new interface, no features changed
This commit is contained in:
sanderd17 2012-08-08 14:30:37 +03:00
parent 28ed74045d
commit f447a59e88

View file

@ -17,6 +17,7 @@ import net.osmand.osm.Node;
import net.osmand.osm.OSMSettings.OSMTagKey; import net.osmand.osm.OSMSettings.OSMTagKey;
import net.osmand.osm.OpeningHoursParser; import net.osmand.osm.OpeningHoursParser;
import net.osmand.osm.OpeningHoursParser.BasicDayOpeningHourRule; import net.osmand.osm.OpeningHoursParser.BasicDayOpeningHourRule;
import net.osmand.osm.OpeningHoursParser.OpeningHours;
import net.osmand.osm.OpeningHoursParser.OpeningHoursRule; import net.osmand.osm.OpeningHoursParser.OpeningHoursRule;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
@ -323,7 +324,7 @@ public class EditingPOIActivity implements DialogProvider {
private Dialog createOpenHoursDlg(){ private Dialog createOpenHoursDlg(){
List<OpeningHoursRule> time = OpeningHoursParser.parseOpenedHours(openingHours.getText().toString()); OpeningHours time = OpeningHoursParser.parseOpenedHours(openingHours.getText().toString());
if(time == null){ if(time == null){
AccessibleToast.makeText(ctx, ctx.getString(R.string.opening_hours_not_supported), Toast.LENGTH_LONG).show(); AccessibleToast.makeText(ctx, ctx.getString(R.string.opening_hours_not_supported), Toast.LENGTH_LONG).show();
return null; return null;
@ -332,7 +333,7 @@ public class EditingPOIActivity implements DialogProvider {
List<BasicDayOpeningHourRule> simple = null; List<BasicDayOpeningHourRule> simple = null;
if(time != null){ if(time != null){
simple = new ArrayList<BasicDayOpeningHourRule>(); simple = new ArrayList<BasicDayOpeningHourRule>();
for(OpeningHoursRule r : time){ for(OpeningHoursRule r : time.getRules()){
if(r instanceof BasicDayOpeningHourRule){ if(r instanceof BasicDayOpeningHourRule){
simple.add((BasicDayOpeningHourRule) r); simple.add((BasicDayOpeningHourRule) r);
} else { } else {
@ -348,7 +349,8 @@ public class EditingPOIActivity implements DialogProvider {
builder.setPositiveButton(ctx.getString(R.string.default_buttons_apply), new DialogInterface.OnClickListener(){ builder.setPositiveButton(ctx.getString(R.string.default_buttons_apply), new DialogInterface.OnClickListener(){
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
openingHours.setText(OpeningHoursParser.toStringOpenedHours(v.getTime())); OpeningHours oh = new OpeningHours((ArrayList<OpeningHoursRule>) v.getTime());
openingHours.setText(oh.toString());
ctx.removeDialog(DIALOG_OPENING_HOURS); ctx.removeDialog(DIALOG_OPENING_HOURS);
} }
}); });