コード例 #1
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, final ViewGroup container, Bundle savedInstance) {

    View v = inflater.inflate(R.layout.fragment_movement, container, false);
    croutonParent = container;

    fabButton = (FloatingActionButton) getActivity().findViewById(R.id.fabButton);
    fabButton.hide();
    /*if(Utils.getDefaultWalletIdPref(getActivity())==-1)
        fabButton.hide(true);
    else
        fabButton.show(true);*/

    cursorCardAdapter =
        new MovementCursorCardAdapter(
            getActivity(),
            dbHelper.getMovementsOfWallet(
                Utils.getDefaultWalletIdPref(getActivity()), Const.KEY_MOVEMENT_DATE, true),
            false); // dbHelper.getMovementsOfWallet(Utils.getDefaultWalletIdPref(getActivity()),
    // Const.KEY_MOVEMENT_NAME),false, true);

    listViewMovement = (CardListView) v.findViewById(R.id.listViewMovement);
    if (listViewMovement != null) {
      listViewMovement.setAdapter(cursorCardAdapter);
    }
    LayoutAnimationController lac =
        new LayoutAnimationController(
            AnimationUtils.loadAnimation(getActivity(), R.anim.table_row_appear),
            0.5f); // 0.5f == time between appearance of listview items.
    listViewMovement.setLayoutAnimation(lac);
    listViewMovement.setFastScrollEnabled(true);
    listViewMovement.setEmptyView(v.findViewById(R.id.emtyView));

    /*fabButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialogAddMovement();
        }
    });
    fabButton.attachToListView(listViewMovement);*/

    multiple_actions = (FloatingActionsMenu) v.findViewById(R.id.multiple_actions);
    fbNewExit =
        (com.getbase.floatingactionbutton.FloatingActionButton) v.findViewById(R.id.fbNewExit);
    fbNewEntry =
        (com.getbase.floatingactionbutton.FloatingActionButton) v.findViewById(R.id.fbNewEntry);
    fbNewEntry.setOnClickListener(this);
    fbNewExit.setOnClickListener(this);
    if (Utils.getDefaultWalletIdPref(getActivity()) == -1)
      multiple_actions.setVisibility(View.GONE);
    else fabButton.setVisibility(View.VISIBLE);

    return v;
  }
コード例 #2
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (requestCode == 1) {

      Style primaryBlue =
          new Style.Builder()
              .setBackgroundColorValue(getResources().getColor(R.color.primary))
              .build();

      if (resultCode == AddMovementActivity.RESULT_EDIT) {
        Crouton.makeText(getActivity(), getString(R.string.Updated), primaryBlue, croutonParent)
            .show();
      } else if (resultCode == AddMovementActivity.RESULT_ADDED) {
        Crouton.makeText(getActivity(), getString(R.string.Added), primaryBlue, croutonParent)
            .show();
      } else if (resultCode == AddMovementActivity.RESULT_ADDED_WITH_REPEATING) {
        // Crouton.makeText(getActivity(),"Added with repeating",primaryBlue ,croutonParent).show();
      } else if (resultCode == AddMovementActivity.RESULT_CANCELLED) {
        Crouton.makeText(getActivity(), getString(R.string.Cancelled), primaryBlue, croutonParent)
            .show();
      }

      cursorCardAdapter.swapCursor(
          dbHelper.getMovementsOfWallet(
              Utils.getDefaultWalletIdPref(getActivity()), Const.KEY_MOVEMENT_DATE, true));
    }
  }
コード例 #3
0
 @Override
 public void onCreate(Bundle bundle) {
   super.onCreate(bundle);
   dbHelper = new DBHelper(getActivity());
   ((ActionBarActivity) getActivity())
       .getSupportActionBar()
       .setTitle(dbHelper.getWalletNameById(Utils.getDefaultWalletIdPref(getActivity())));
 }