use of com.abewy.android.apps.klyph.request.AsyncRequest in project Klyph by jonathangerbaud.
the class KlyphFragment method refresh.
protected void refresh() {
startLoading();
if (KlyphFlags.LOG_REQUEST_EXEC)
Log.d(TAG, "request = " + requestType + ", id = " + elementId + ", offset = " + offset);
request = new AsyncRequest(requestType, elementId, offset, new AsyncRequest.Callback() {
public void onComplete(Response response) {
// Log.i(TAG, "onCompleted");
onRequestComplete(response);
}
});
request.execute();
}
use of com.abewy.android.apps.klyph.request.AsyncRequest in project Klyph by jonathangerbaud.
the class KlyphFragment2 method refresh.
protected void refresh() {
startLoading();
if (KlyphFlags.LOG_REQUEST_EXEC)
Log.d(TAG, "request = " + requestType + ", id = " + elementId + ", offset = " + offset);
request = new AsyncRequest(requestType, elementId, offset, new AsyncRequest.Callback() {
public void onComplete(Response response) {
Log.i(TAG, "onCompleted");
onRequestComplete(response);
}
});
request.execute();
}
use of com.abewy.android.apps.klyph.request.AsyncRequest in project Klyph by jonathangerbaud.
the class Notifications method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_dismiss) {
List<GraphObject> list = new ArrayList<GraphObject>();
List<List<AsyncRequest>> batchs = new ArrayList<List<AsyncRequest>>();
List<AsyncRequest> requests = new ArrayList<AsyncRequest>();
batchs.add(requests);
for (GraphObject o : getAdapter().getItems()) {
if (o instanceof Notification || o instanceof FriendRequest) {
if (o instanceof Notification) {
Notification n = (Notification) o;
if (requests.size() == 40) {
requests = new ArrayList<AsyncRequest>();
batchs.add(requests);
}
requests.add(new AsyncRequest(Query.POST_READ_NOTIFICATION, n.getNotification_id(), "", null));
n.setIs_unread(false);
}
list.add(o);
}
}
populate(list);
unreadCount = 0;
getActivity().invalidateOptionsMenu();
for (List<AsyncRequest> batch : batchs) {
if (batch.size() > 0)
AsyncRequest.executeBatch(batch);
}
((NotificationsListener) getActivity()).onNewNotifications();
return true;
} else if (item.getItemId() == R.id.menu_refresh) {
onRefreshClicked();
return true;
}
return super.onOptionsItemSelected(item);
}
use of com.abewy.android.apps.klyph.request.AsyncRequest in project Klyph by jonathangerbaud.
the class PageTimeline method doLikeAction.
private void doLikeAction() {
final Page page = (Page) getElement();
if (page.getIs_fan() == false) {
page.setIs_fan(true);
((FragmentActivity) getActivity()).invalidateOptionsMenu();
new AsyncRequest(Query.POST_LIKE, page.getPage_id(), "", new AsyncRequest.Callback() {
@Override
public void onComplete(Response response) {
Log.i("onComplete", "" + response.getError());
onLikeRequestComplete(response);
}
}).execute();
} else {
page.setIs_fan(false);
((FragmentActivity) getActivity()).invalidateOptionsMenu();
new AsyncRequest(Query.POST_UNLIKE, page.getPage_id(), "", new AsyncRequest.Callback() {
@Override
public void onComplete(Response response) {
Log.i("onComplete", "" + response.getError());
onUnlikeRequestComplete(response);
}
}).execute();
}
}
use of com.abewy.android.apps.klyph.request.AsyncRequest in project Klyph by jonathangerbaud.
the class StreamListFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
MultiObjectAdapter adapter = /* KlyphPreferences.areBannerAdsEnabled() ? new NewsfeedAdapter(getListView()) : */
new MultiObjectAdapter(getListView());
if (KlyphPreferences.animateCards()) {
GoogleCardStyleAdapter gcsAdapter = new GoogleCardStyleAdapter(adapter);
gcsAdapter.setAbsListView(getListView());
setListAdapter(gcsAdapter);
} else {
setListAdapter(adapter);
}
defineEmptyText(R.string.empty_list_no_stream);
// getListView().setPadding(0, 8, 0, 0);
// getListView().setDivider(getResources().getDrawable(R.drawable.hdivider_transparent));
// getGridView().setVerticalSpacing(16);
// getListView().setItemsCanFocus(false);
getListView().setDrawSelectorOnTop(true);
getListView().setSelector(AttrUtil.getResourceId(getActivity(), R.attr.streamSelector));
setListVisible(false);
if (KlyphData.getFriendLists() == null) {
new AsyncRequest(Query.FRIEND_LISTS, "", "", new Callback() {
@Override
public void onComplete(Response response) {
onRequestComplete(response);
}
}).execute();
}
super.onViewCreated(view, savedInstanceState);
}
Aggregations