creating pattern class and fragment layout.