1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package com.rthoni.camotion.ui.fragments;
-
- import com.luticate.utils.business.LuPromise;
- import com.luticate.utils.dbo.LuMultipleDbo;
- import com.rthoni.camotion.business.CommandsBusiness;
- import com.rthoni.camotion.dbo.CommandDbo;
- import com.rthoni.camotion.ui.views.CommandView;
-
- /**
- *
- * Created by robin on 11/29/15.
- */
- public abstract class AbstractCommandsFragment extends CamotionFragment<CommandDbo, CommandView> {
-
- @Override
- protected LuPromise<LuMultipleDbo<CommandDbo>> getLoadPagePromise(int page, int perPage, String query) {
- return CommandsBusiness.getAll(_currentLocation.getConfig(_fullLoginDbo.getLoginDbo()), page, perPage)
- .map(new LuPromise.LuConverter<CommandDbo.MultipleCommandDbo, LuMultipleDbo<CommandDbo>>() {
- @Override
- public LuMultipleDbo<CommandDbo> convert(CommandDbo.MultipleCommandDbo data) {
- return data;
- }
- });
- }
-
- @Override
- protected CommandView getDboView(final CommandDbo command) {
- CommandView commandView = new CommandView(getActivity());
- commandView.setCamotionDbo(_fullLoginDbo, _currentLocation);
- commandView.setCommand(command);
- commandView.setOnClickedListener(new LuPromise.LuConsumer<CommandDbo>() {
- @Override
- public void execute(CommandDbo command) {
- onCommandClicked(command);
- }
- });
- return commandView;
- }
-
- protected abstract void onCommandClicked(CommandDbo command);
- }
|