Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

AbstractCommandsFragment.java 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package com.rthoni.camotion.ui.fragments;
  2. import com.luticate.utils.business.LuPromise;
  3. import com.luticate.utils.dbo.LuMultipleDbo;
  4. import com.rthoni.camotion.business.CommandsBusiness;
  5. import com.rthoni.camotion.dbo.CommandDbo;
  6. import com.rthoni.camotion.ui.views.CommandView;
  7. /**
  8. *
  9. * Created by robin on 11/29/15.
  10. */
  11. public abstract class AbstractCommandsFragment extends CamotionFragment<CommandDbo, CommandView> {
  12. @Override
  13. protected LuPromise<LuMultipleDbo<CommandDbo>> getLoadPagePromise(int page, int perPage, String query) {
  14. return CommandsBusiness.getAll(_currentLocation.getConfig(_fullLoginDbo.getLoginDbo()), page, perPage)
  15. .map(new LuPromise.LuConverter<CommandDbo.MultipleCommandDbo, LuMultipleDbo<CommandDbo>>() {
  16. @Override
  17. public LuMultipleDbo<CommandDbo> convert(CommandDbo.MultipleCommandDbo data) {
  18. return data;
  19. }
  20. });
  21. }
  22. @Override
  23. protected CommandView getDboView(final CommandDbo command) {
  24. CommandView commandView = new CommandView(getActivity());
  25. commandView.setCamotionDbo(_fullLoginDbo, _currentLocation);
  26. commandView.setCommand(command);
  27. commandView.setOnClickedListener(new LuPromise.LuConsumer<CommandDbo>() {
  28. @Override
  29. public void execute(CommandDbo command) {
  30. onCommandClicked(command);
  31. }
  32. });
  33. return commandView;
  34. }
  35. protected abstract void onCommandClicked(CommandDbo command);
  36. }