use of net.osmand.plus.osmedit.dialogs.OpeningHoursDaysDialogFragment in project Osmand by osmandapp.
the class BasicEditPoiFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_edit_poi_normal, container, false);
TypedValue typedValue = new TypedValue();
Resources.Theme theme = getActivity().getTheme();
theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true);
int iconColor = typedValue.data;
ImageView streetImageView = (ImageView) view.findViewById(R.id.streetImageView);
streetImageView.setImageDrawable(getPaintedContentIcon(R.drawable.ic_action_street_name, iconColor));
ImageView houseNumberImageView = (ImageView) view.findViewById(R.id.houseNumberImageView);
houseNumberImageView.setImageDrawable(getPaintedContentIcon(R.drawable.ic_action_building_number, iconColor));
ImageView phoneImageView = (ImageView) view.findViewById(R.id.phoneImageView);
phoneImageView.setImageDrawable(getPaintedContentIcon(R.drawable.ic_action_call_dark, iconColor));
ImageView webSiteImageView = (ImageView) view.findViewById(R.id.webSiteImageView);
webSiteImageView.setImageDrawable(getPaintedContentIcon(R.drawable.ic_world_globe_dark, iconColor));
ImageView descriptionImageView = (ImageView) view.findViewById(R.id.descriptionImageView);
descriptionImageView.setImageDrawable(getPaintedContentIcon(R.drawable.ic_action_description, iconColor));
ImageView openingHoursImageView = (ImageView) view.findViewById(R.id.openingHoursImageView);
openingHoursImageView.setImageDrawable(getPaintedContentIcon(R.drawable.ic_action_time, iconColor));
streetEditText = (EditText) view.findViewById(R.id.streetEditText);
houseNumberEditText = (EditText) view.findViewById(R.id.houseNumberEditText);
phoneEditText = (EditText) view.findViewById(R.id.phoneEditText);
webSiteEditText = (EditText) view.findViewById(R.id.webSiteEditText);
descriptionEditText = (EditText) view.findViewById(R.id.descriptionEditText);
addTextWatcher(OSMSettings.OSMTagKey.ADDR_STREET.getValue(), streetEditText);
addTextWatcher(OSMSettings.OSMTagKey.WEBSITE.getValue(), webSiteEditText);
addTextWatcher(OSMSettings.OSMTagKey.PHONE.getValue(), phoneEditText);
addTextWatcher(OSMSettings.OSMTagKey.ADDR_HOUSE_NUMBER.getValue(), houseNumberEditText);
addTextWatcher(OSMSettings.OSMTagKey.DESCRIPTION.getValue(), descriptionEditText);
Button addOpeningHoursButton = (Button) view.findViewById(R.id.addOpeningHoursButton);
addOpeningHoursButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
BasicOpeningHourRule rule = new BasicOpeningHourRule();
rule.setStartTime(9 * 60);
rule.setEndTime(18 * 60);
OpeningHoursDaysDialogFragment fragment = OpeningHoursDaysDialogFragment.createInstance(rule, -1);
fragment.show(getChildFragmentManager(), "OpenTimeDialogFragment");
}
});
LinearLayout openHoursContainer = (LinearLayout) view.findViewById(R.id.openHoursContainer);
Drawable clockDrawable = getPaintedContentIcon(R.drawable.ic_action_time, iconColor);
Drawable deleteDrawable = getPaintedContentIcon(R.drawable.ic_action_remove_dark, iconColor);
if (savedInstanceState != null && savedInstanceState.containsKey(OPENING_HOURS)) {
mOpeningHoursAdapter = new OpeningHoursAdapter((OpeningHoursParser.OpeningHours) savedInstanceState.getSerializable(OPENING_HOURS), openHoursContainer, getData(), clockDrawable, deleteDrawable);
mOpeningHoursAdapter.updateViews();
} else {
mOpeningHoursAdapter = new OpeningHoursAdapter(new OpeningHoursParser.OpeningHours(), openHoursContainer, getData(), clockDrawable, deleteDrawable);
}
onFragmentActivated();
return view;
}
Aggregations