示例#1
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    fContext = getActivity().getApplicationContext();
    mActivity = (MainActivity) getActivity();
    //        bottomPanel = (LinearLayout) rootView.findViewById(R.id.bottomPanelPhoto);
    progress = (DonutProgress) rootView.findViewById(R.id.donut_progress);
    progress.setVisibility(View.GONE);
    btnSave = (ActionButton) rootView.findViewById(R.id.aBtnSave);

    btnSave.setImageResource(R.drawable.ic_check);
    btnSave.setButtonColor(Color.TRANSPARENT);
    btnSave.setStrokeColor(Color.GREEN);
    btnSave.setStrokeWidth(3.0f);
    btnSave.setButtonColorPressed(Color.LTGRAY);
    btnSave.removeShadow();
    btnSave.setType(ActionButton.Type.BIG);
    btnSave.setShowAnimation(ActionButton.Animations.FADE_IN);
    btnSave.setHideAnimation(ActionButton.Animations.FADE_OUT);
    btnSave.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            new SendFilesTask().execute();
          }
        });
    btnCancel = (ActionButton) rootView.findViewById(R.id.aBtnBack);
    btnCancel.setImageResource(R.drawable.ic_cancel);
    btnCancel.setButtonColor(Color.TRANSPARENT);
    btnCancel.setStrokeColor(Color.RED);
    btnCancel.setStrokeWidth(3.0f);
    btnCancel.setButtonColorPressed(Color.LTGRAY);
    btnCancel.removeShadow();
    btnCancel.setType(ActionButton.Type.BIG);
    btnCancel.setShowAnimation(ActionButton.Animations.FADE_IN);
    btnCancel.setHideAnimation(ActionButton.Animations.FADE_OUT);
    btnCancel.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            btnCancel.playHideAnimation();
            btnSave.playHideAnimation();
            mActivity.onBackPressed();
          }
        });
    imgView = (ImageView) rootView.findViewById(R.id.imgView);
    try {
      ImageLoader.getInstance().displayImage("file:///mnt/" + bmp, imgView);
    } catch (Exception e) {

    }
    mActivity.setIsFAB(false);
    mActivity.updateFAB();
    if (savedInstanceState == null) {
      startAnimation();
    }
  }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    // INIT UI ELEMENTS
    appSpinner = (Spinner) view.findViewById(R.id.appMainEditSpinnerType);
    etDescr = (MaterialEditText) view.findViewById(R.id.appMainEditDescription);
    fabAppMainEdit = (ActionButton) getActivity().findViewById(R.id.fabMain);

    // FAB ANIMATION
    fabAppMainEdit = (ActionButton) getActivity().findViewById(R.id.fabMain);

    fabAppMainEdit.setImageResource(R.mipmap.ic_checked_white);
    fabAppMainEdit.setButtonColor(getResources().getColor(R.color.colorAccent));
    fabAppMainEdit.setButtonColorRipple(android.R.color.white);

    fabAppMainEdit.setShowAnimation(ActionButton.Animations.ROLL_FROM_RIGHT);
    fabAppMainEdit.setHideAnimation(ActionButton.Animations.ROLL_TO_RIGHT);

    fabAppMainEdit.hide();
    fabAppMainEdit.playShowAnimation();
    fabAppMainEdit.show();

    // LOAD DATA
    loadSpinnerData();
    loadDataFromSQLite();

    // LISTENERS
    fabAppMainEdit.setOnClickListener(this);
  }