private void openForm(String itemId) {
   itemFormFragment = new ItemFormFragment();
   addItemButton = (FloatingActionButton) activity.findViewById(R.id.add_item_button);
   addItemButton.setVisibility(View.GONE);
   itemFormFragment.setResource(addItemButton);
   bundle = new Bundle();
   bundle.putString("itemId", itemId);
   bundle.putString("eventName", eventName);
   itemFormFragment.setArguments(bundle);
   activity
       .getFragmentManager()
       .beginTransaction()
       .setCustomAnimations(
           R.animator.card_flip_right_in, R.animator.card_flip_right_out,
           R.animator.card_flip_left_in, R.animator.card_flip_left_out)
       .replace(R.id.container, itemFormFragment)
       .addToBackStack(null)
       .commit();
 }
Esempio n. 2
0
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_button, container, false);

    Button bt_flat = (Button) v.findViewById(R.id.button_bt_flat);
    Button bt_flat_color = (Button) v.findViewById(R.id.button_bt_flat_color);
    Button bt_flat_wave = (Button) v.findViewById(R.id.button_bt_flat_wave);
    Button bt_flat_wave_color = (Button) v.findViewById(R.id.button_bt_flat_wave_color);
    Button bt_raise = (Button) v.findViewById(R.id.button_bt_raise);
    Button bt_raise_color = (Button) v.findViewById(R.id.button_bt_raise_color);
    Button bt_raise_wave = (Button) v.findViewById(R.id.button_bt_raise_wave);
    Button bt_raise_wave_color = (Button) v.findViewById(R.id.button_bt_raise_wave_color);
    FloatingActionButton bt_float = (FloatingActionButton) v.findViewById(R.id.button_bt_float);
    FloatingActionButton bt_float_color =
        (FloatingActionButton) v.findViewById(R.id.button_bt_float_color);
    FloatingActionButton bt_float_wave =
        (FloatingActionButton) v.findViewById(R.id.button_bt_float_wave);
    FloatingActionButton bt_float_wave_color =
        (FloatingActionButton) v.findViewById(R.id.button_bt_float_wave_color);

    View.OnClickListener listener =
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            Toast.makeText(
                    getActivity(),
                    "Button Clicked!\nEvent's fired when in anim end.",
                    Toast.LENGTH_SHORT)
                .show();
            if (v instanceof FloatingActionButton) {
              FloatingActionButton bt = (FloatingActionButton) v;
              bt.setLineMorphingState((bt.getLineMorphingState() + 1) % 2, true);
            }
          }
        };

    View.OnClickListener listener_delay =
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            Toast.makeText(
                    getActivity(),
                    "Button Clicked!\nEvent's fired when out anim end.",
                    Toast.LENGTH_SHORT)
                .show();
            if (v instanceof FloatingActionButton) {
              FloatingActionButton bt = (FloatingActionButton) v;
              bt.setLineMorphingState((bt.getLineMorphingState() + 1) % 2, true);
            }
          }
        };

    bt_flat.setOnClickListener(listener);
    bt_flat_wave.setOnClickListener(listener);
    bt_raise.setOnClickListener(listener);
    bt_raise_wave.setOnClickListener(listener);
    bt_float.setOnClickListener(listener);
    bt_float_wave.setOnClickListener(listener);

    bt_flat_color.setOnClickListener(listener_delay);
    bt_flat_wave_color.setOnClickListener(listener_delay);
    bt_raise_color.setOnClickListener(listener_delay);
    bt_raise_wave_color.setOnClickListener(listener_delay);
    bt_float_color.setOnClickListener(listener_delay);
    bt_float_wave_color.setOnClickListener(listener_delay);

    //        bt_flat.setOnClickListener(new View.OnClickListener(){
    //            @Override
    //            public void onClick(View v) {
    //                RecurringPickerDialog.Builder builder = new
    // RecurringPickerDialog.Builder(R.style.Material_App_Dialog_Light){
    //                    @Override
    //                    public void onPositiveActionClicked(DialogFragment fragment) {
    //                        RecurringPickerDialog dialog =
    // (RecurringPickerDialog)fragment.getDialog();
    //                        Toast.makeText(fragment.getActivity(),
    // dialog.getRecurring().toString(), Toast.LENGTH_LONG).show();
    //                        fragment.dismiss();
    //                    }
    //
    //                    @Override
    //                    public void onNegativeActionClicked(DialogFragment fragment) {
    //                        Toast.makeText(fragment.getActivity(), "Cancelled",
    // Toast.LENGTH_SHORT).show();
    //                        fragment.dismiss();
    //                    }
    //                };
    //                Recurring recurring = new Recurring();
    //                recurring.setStartTime(System.currentTimeMillis());
    //                recurring.setRepeatMode(Recurring.REPEAT_WEEKLY);
    //                recurring.setEnabledWeekday(Calendar.SUNDAY, true);
    //                recurring.setEnabledWeekday(Calendar.TUESDAY, true);
    //                builder.recurring(recurring)
    //                        .datePickerLayoutStyle(R.style.Material_App_Dialog_DatePicker_Light)
    //                        .positiveAction("OK")
    //                        .negativeAction("CANCEL");
    //
    //                DialogFragment fragment = DialogFragment.newInstance(builder);
    //                fragment.show(getFragmentManager(), null);
    //            }
    //        });

    return v;
  }