Search in sources :

Example 41 with GraphObject

use of com.abewy.android.apps.klyph.core.graph.GraphObject in project Klyph by jonathangerbaud.

the class UserAbout method onGridItemClick.

@Override
public void onGridItemClick(KlyphGridView l, View v, int position, long id) {
    GraphObject data = (GraphObject) l.getItemAtPosition(position);
    Intent intent = Klyph.getIntentForGraphObject(getActivity(), data);
    if (intent != null) {
        startActivity(intent);
    }
}
Also used : Intent(android.content.Intent) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject)

Example 42 with GraphObject

use of com.abewy.android.apps.klyph.core.graph.GraphObject in project Klyph by jonathangerbaud.

the class UserListDialog method onItemClick.

@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
    GraphObject object = (GraphObject) arg0.getItemAtPosition(position);
    if (object instanceof Tag) {
        Tag tag = (Tag) object;
        startActivity(Klyph.getIntentForGraphObject(getActivity(), tag));
    } else if (object instanceof Friend) {
        Friend friend = (Friend) object;
        startActivity(Klyph.getIntentForGraphObject(getActivity(), friend));
    }
}
Also used : Friend(com.abewy.android.apps.klyph.core.fql.Friend) Tag(com.abewy.android.apps.klyph.core.fql.Tag) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject)

Example 43 with GraphObject

use of com.abewy.android.apps.klyph.core.graph.GraphObject in project Klyph by jonathangerbaud.

the class KlyphDialogFragment method startLoading.

protected void startLoading() {
    loading = true;
    if (isError == true && getAdapter().getCount() > 0) {
        GraphObject lastObject = getAdapter().getLastItem();
        if (lastObject instanceof TextButtonItem) {
            getAdapter().remove(lastObject);
        }
    }
    isError = false;
    if (!firstLoad) {
        if (!loadingObjectAsFirstItem)
            getAdapter().add(loadingObject);
        else
            getAdapter().insert(loadingObject, 0);
        getAdapter().notifyDataSetChanged();
    }
}
Also used : TextButtonItem(com.abewy.klyph.items.TextButtonItem) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject)

Example 44 with GraphObject

use of com.abewy.android.apps.klyph.core.graph.GraphObject in project Klyph by jonathangerbaud.

the class GroupActivity method getCachedDataFromInstanceState.

@Override
protected List<GraphObject> getCachedDataFromInstanceState(Bundle savedInstanceState) {
    Group group = savedInstanceState.getParcelable("group");
    List<GraphObject> data = new ArrayList<GraphObject>();
    data.add(group);
    return data;
}
Also used : Group(com.abewy.android.apps.klyph.core.fql.Group) ArrayList(java.util.ArrayList) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject)

Example 45 with GraphObject

use of com.abewy.android.apps.klyph.core.graph.GraphObject in project Klyph by jonathangerbaud.

the class AlbumActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    super.onCreate(savedInstanceState);
    getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.ab_background_transparent_gradient));
    getWindow().setBackgroundDrawableResource(R.drawable.image_background);
    setTitle("");
    setLoadingView(findViewById(R.id.progress_bar));
    ArrayList<Photo> photos = getIntent().getParcelableArrayListExtra(KlyphBundleExtras.ALBUM_PHOTOS);
    List<String> imageIds = getIntent().getStringArrayListExtra(KlyphBundleExtras.PHOTO_LIST_ID);
    if (photos != null) {
        List<GraphObject> list = new ArrayList<GraphObject>();
        for (Photo photo : photos) {
            list.add(photo);
        }
        ((TabsAdapter) getPagerAdapter()).setPhotos(list);
        int startPosition = getIntent().getIntExtra(KlyphBundleExtras.START_POSITION, 0);
        getViewPager().setCurrentItem(startPosition);
        showViewPager();
        ((TabsAdapter) getPagerAdapter()).show();
        setLoadingViewVisible(false);
    } else if (imageIds != null) {
        String id = "";
        int n = imageIds.size();
        for (int i = 0; i < n; i++) {
            if (i < n - 1) {
                id += "\"" + imageIds.get(i) + "\", ";
            } else {
                id += "\"" + imageIds.get(i) + "\"";
            }
        }
        new AsyncRequest(Query.PHOTO_LIST, id, "", new AsyncRequest.Callback() {

            @Override
            public void onComplete(final Response response) {
                runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        if (response.getError() == null) {
                            onPhotoListRequestSuccess(response.getGraphObjectList());
                        } else {
                            onPhotoListRequestError(response.getError());
                        }
                    }
                });
            }
        }).execute();
    } else {
        Log.d("AlbumActivity", "else");
        String id = getIntent().getStringExtra(KlyphBundleExtras.ALBUM_ID);
        // String name =
        // getIntent().getStringExtra(CkoobafeBundleExtras.ALBUM_NAME);
        // showPageIndicator();
        showViewPager();
        // ((TabsAdapter) getPagerAdapter()).show();
        new AsyncRequest(Query.ALBUM_PHOTOS, id, "", new AsyncRequest.Callback() {

            @Override
            public void onComplete(final Response response) {
                runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        if (response.getError() == null) {
                            onAlbumPhotosRequestSuccess(response.getGraphObjectList());
                        } else {
                            onAlbumPhotosRequestError(response.getError());
                        }
                    }
                });
            }
        }).execute();
    }
}
Also used : AsyncRequest(com.abewy.android.apps.klyph.request.AsyncRequest) ArrayList(java.util.ArrayList) Photo(com.abewy.android.apps.klyph.core.fql.Photo) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject) Response(com.abewy.android.apps.klyph.core.request.Response)

Aggregations

GraphObject (com.abewy.android.apps.klyph.core.graph.GraphObject)101 ArrayList (java.util.ArrayList)71 JSONArray (org.json.JSONArray)41 JSONObject (org.json.JSONObject)16 FriendDeserializer (com.abewy.android.apps.klyph.core.fql.serializer.FriendDeserializer)11 PhotoDeserializer (com.abewy.android.apps.klyph.core.fql.serializer.PhotoDeserializer)9 MultiObjectAdapter (com.abewy.android.apps.klyph.adapter.MultiObjectAdapter)7 Stream (com.abewy.android.apps.klyph.core.fql.Stream)7 View (android.view.View)6 KlyphNotification (com.abewy.android.apps.klyph.KlyphNotification)6 Notification (com.abewy.android.apps.klyph.core.fql.Notification)6 Photo (com.abewy.android.apps.klyph.core.fql.Photo)6 JSONException (org.json.JSONException)6 StreamDeserializer (com.abewy.android.apps.klyph.core.fql.serializer.StreamDeserializer)5 Intent (android.content.Intent)4 ListView (android.widget.ListView)4 Event (com.abewy.android.apps.klyph.core.fql.Event)4 AsyncRequest (com.abewy.android.apps.klyph.request.AsyncRequest)4 TextButtonItem (com.abewy.klyph.items.TextButtonItem)4 AbsListView (android.widget.AbsListView)3