use of com.squareup.otto.Subscribe in project FluxyAndroidTodo by armueller.
the class TodoListManager method reactToTodoAction.
@Subscribe
public void reactToTodoAction(TodoAction action) {
DataBundle<TodoAction.DataKeys> data = action.getData();
long id = (long) data.get(TodoAction.DataKeys.ID, -1L);
String description = (String) data.get(TodoAction.DataKeys.DESCRIPTION, "");
switch(action.getType()) {
case ADD:
addTodo(description);
break;
case TOGGLE:
toggleTodoComplete(id);
break;
case TOGGLE_ALL:
toggleAllTodosComplete();
break;
case EDIT:
editTodo(id, description);
break;
case DELETE:
deleteTodo(id);
break;
case DELETE_ALL:
deleteAllCompleteTodos();
break;
case UNDO_DELETE_ALL:
undoDeleteCompleteAllTodos();
break;
}
dataBus.post(new RawTodoList(todoItems));
}
use of com.squareup.otto.Subscribe in project caronae-android by caronae.
the class ChatAct method updateMsgsListWithServer.
@Subscribe
public void updateMsgsListWithServer(final String rideId) {
translate = AnimationUtils.loadAnimation(this, R.anim.anim_loading_messages_down);
cardLoadingMessages.startAnimation(translate);
String since = null;
if (chatMsgsList == null) {
chatMsgsList = new ArrayList<>();
}
if (chatMsgsList.size() != 0) {
boolean lastMessageIsMine = true;
int counter = chatMsgsList.size() - 1;
while (lastMessageIsMine && counter >= 0) {
if (!chatMsgsList.get(counter).getSenderId().equals(String.valueOf(App.getUser().getDbId()))) {
since = chatMsgsList.get(counter).getTime();
lastMessageIsMine = false;
}
counter--;
}
}
Intent fetchMessageService = new Intent(getApplicationContext(), FetchReceivedMessagesService.class);
fetchMessageService.putExtra(RIDE_ID_BUNDLE_KEY, rideId);
fetchMessageService.putExtra("since", since);
getApplicationContext().startService(fetchMessageService);
}
use of com.squareup.otto.Subscribe in project caronae-android by caronae.
the class AllRidesListFrag method updateAdapter.
@Subscribe
public void updateAdapter(ArrayList<Object> listFiltered) {
filteredGoingList.clear();
filteredNotGoingList.clear();
for (int rides = 1; rides < listFiltered.size(); rides++) {
RideForJson ride = (RideForJson) listFiltered.get(rides);
if (ride.isGoing()) {
filteredGoingList.add((RideForJson) listFiltered.get(rides));
} else {
filteredNotGoingList.add((RideForJson) listFiltered.get(rides));
}
}
if (pageIdentifier == AllRidesFragmentPagerAdapter.PAGE_GOING) {
if (filteredGoingList.size() == 0) {
filter = null;
adapter.makeList(goingRides);
Util.toast("Nenhuma carona encontrada para esta busca");
} else {
filter = (CharSequence) listFiltered.get(0);
adapter.makeList(filteredGoingList);
}
} else {
if (filteredNotGoingList.size() == 0) {
filter = null;
adapter.makeList(notGoingRides);
Util.toast("Nenhuma carona encontrada para esta busca");
} else {
filter = (CharSequence) listFiltered.get(0);
adapter.makeList(filteredNotGoingList);
}
}
}
use of com.squareup.otto.Subscribe in project android-store by soomla.
the class StorePacksActivity method onCurrencyBalanceChanged.
/**
* Receives the given <code>currencyBalanceChangedEvent</code>, and upon notification, fetches
* the currency balance and places it in the balance label.
*
* @param currencyBalanceChangedEvent event to receive
*/
@Subscribe
public void onCurrencyBalanceChanged(CurrencyBalanceChangedEvent currencyBalanceChangedEvent) {
TextView muffinsBalance = (TextView) findViewById(R.id.balance);
muffinsBalance.setText("" + currencyBalanceChangedEvent.getBalance());
}
use of com.squareup.otto.Subscribe in project android-store by soomla.
the class StoreGoodsActivity method onCurrencyBalanceChanged.
/**
* Receives the given <code>onCurrencyBalanceChanged</code>. Upon notification, fetches the
* currency balance and places it in the balance label.
*
* @param currencyBalanceChangedEvent the event received
*/
@Subscribe
public void onCurrencyBalanceChanged(CurrencyBalanceChangedEvent currencyBalanceChangedEvent) {
TextView muffinsBalance = (TextView) findViewById(R.id.balance);
muffinsBalance.setText("" + currencyBalanceChangedEvent.getBalance());
}
Aggregations