use of com.abewy.android.apps.klyph.core.graph.GraphObject in project Klyph by jonathangerbaud.
the class GalleryFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
loadingView = (ProgressBar) view.findViewById(android.R.id.progress);
setListVisible(false);
super.onViewCreated(view, savedInstanceState);
imageUris = new ArrayList<String>();
getGridView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
getGridView().setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> gridView, View view, int position, long id) {
GraphObject o = getAdapter().getItem(position);
if (o instanceof CameraObject) {
Intent intent = new Intent(getActivity(), GalleryActivity.class);
intent.putExtra(KlyphBundleExtras.CAMERA_PICTURES, true);
intent.putStringArrayListExtra(KlyphBundleExtras.PHOTO_LIST_URI, (ArrayList<String>) initUris);
startActivityForResult(intent, CAMERA_GALLERY_CODE);
} else {
if (!Android.isMinAPI(11)) {
CheckableGalleryLayout cgl = (CheckableGalleryLayout) view;
cgl.toggle();
Picture image = (Picture) o;
image.setSelected(cgl.isChecked());
}
if (actionMode == null)
actionMode = getActivity().startActionMode(mActionModeCallback);
refreshActionModeTitle();
}
}
});
showCamera = !getActivity().getIntent().getBooleanExtra(KlyphBundleExtras.CAMERA_PICTURES, false);
hasCamera = getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA) || getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT);
defineEmptyText(R.string.empty_list_no_photo);
}
use of com.abewy.android.apps.klyph.core.graph.GraphObject in project Klyph by jonathangerbaud.
the class SearchUserRequest method handleResult.
@Override
public List<GraphObject> handleResult(JSONArray result) {
Log.d("SearchUser", "handleResult");
List<GraphObject> list = new ArrayList<GraphObject>();
int n = result.length();
for (int i = 0; i < n; i++) {
Friend friend = new Friend();
JSONObject json = result.optJSONObject(i);
friend.setUid(json.optString("id"));
friend.setName(json.optString("name"));
JSONObject pic = json.optJSONObject("picture");
JSONObject data = pic.optJSONObject("data");
friend.setPic(data.optString("url"));
list.add(friend);
}
setHasMoreData(false);
return list;
}
use of com.abewy.android.apps.klyph.core.graph.GraphObject in project Klyph by jonathangerbaud.
the class ThreadRequest method handleResult.
@Override
public ArrayList<GraphObject> handleResult(JSONArray[] result) {
JSONArray data = result[0];
JSONArray users = result[1];
JSONArray recipients = result[2];
JSONArray user_pics = result[3];
assocData(recipients, users, "id", "uid", "first_name", "first_name");
assocData(recipients, user_pics, "id", "id", "pic", "url");
assocData(recipients, recipients, "id", "id", "uid", "id");
assocData3(data, recipients, "recipients", "id", "recipients_friends");
MessageThreadDeserializer deserializer = new MessageThreadDeserializer();
ArrayList<GraphObject> mts = (ArrayList<GraphObject>) deserializer.deserializeArray(data);
setHasMoreData(mts.size() >= 15);
return mts;
}
use of com.abewy.android.apps.klyph.core.graph.GraphObject in project Klyph by jonathangerbaud.
the class KlyphFragment method populate.
protected void populate(List<GraphObject> data) {
if (getView() != null) {
MultiObjectAdapter adapter = getAdapter();
for (GraphObject graphObject : data) {
adapter.add(graphObject);
}
// adapter.addAll(data); is only available in api 11
endLoading();
boolean requestHasMoreData = request != null && request.hasMoreData();
if (data.size() == 0 || !requestHasMoreData)
noMoreData = true;
offset = String.valueOf(adapter.getCount());
}
}
use of com.abewy.android.apps.klyph.core.graph.GraphObject in project Klyph by jonathangerbaud.
the class EventFragment method populate.
@Override
protected void populate(List<GraphObject> data) {
Log.d("EventFragment", "populate: " + data.size());
if (data.size() > 0) {
GraphObject o = data.get(0);
if (o instanceof Event) {
event = (Event) o;
data.remove(0);
if (getActivity() != null)
getActivity().setTitle(event.getName());
List<GraphObject> list = new ArrayList<GraphObject>();
list.add(event);
EventData eventData = new EventData(event);
list.add(eventData);
EventResponseItem responseItem = new EventResponseItem(event);
responseItem.setAttendButtonListener(attendButtonListener);
responseItem.setUnsureButtonListener(unsureButtonListener);
responseItem.setDeclineButtonListener(declinedButtonListener);
list.add(responseItem);
EventAttendees attendeesItem = new EventAttendees(event);
attendeesItem.setInvitedListener(invitedGuestListener);
attendeesItem.setGoingListener(goingGuestListener);
attendeesItem.setUnsureListener(unsureGuestListener);
attendeesItem.setDeclinedListener(declinedGuestListener);
list.add(attendeesItem);
list.addAll(data);
data = list;
getActivity().invalidateOptionsMenu();
}
}
super.populate(data);
setNoMoreData(true);
}
Aggregations