コード例 #1
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_book_event, container);
    ButterKnife.bind(this, view);
    Bundle args = getArguments();
    selectedRoom = args.getParcelable(Room.TAG);
    startDate = (Date) args.getSerializable(START_DATE);
    endDate = (Date) args.getSerializable(END_DATE);
    client = GoogleCalendarApiClient.getInstance();
    mProgress = new ProgressDialog(getContext());
    mProgress.setMessage(getResources().getString(R.string.loading_message));

    getDialog().setTitle(selectedRoom.name);

    String summary =
        getResources()
            .getString(R.string.room_booking_title, sdf.format(startDate), sdf.format(endDate));
    tvSummary.setText(summary);
    setupButtons();
    setupEditText();
    etSummary.requestFocus();
    getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    return view;
  }
コード例 #2
0
 /** Background task to call Google Calendar API. */
 @Override
 protected Void doInBackground(Room... params) {
   try {
     client.createEventAt(
         params[0], new DateTime(startDate), new DateTime(endDate), summaryText, detailsText);
   } catch (Exception e) {
     mLastError = e;
     cancel(true);
   }
   return null;
 }