Search in sources :

Example 1 with ImageFragment

use of com.abewy.android.apps.klyph.fragment.ImageFragment in project Klyph by jonathangerbaud.

the class ImageActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    // requestWindowFeature(Window.FEATURE_NO_TITLE);
    requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    super.onCreate(savedInstanceState);
    // Let the Application class know that the first launch is complete
    // If we come from a notification, then do not show the ads
    // When going back to main activity
    KlyphApplication.getInstance().launchComplete();
    isDestroyed = false;
    getWindow().setBackgroundDrawableResource(R.drawable.image_background);
    getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.ab_background_transparent_gradient));
    setTitle("");
    final ImageFragment image = (ImageFragment) getFragmentManager().findFragmentById(R.id.image_fragment);
    String photoId = getIntent().getStringExtra(KlyphBundleExtras.PHOTO_ID);
    Log.d("ImageActivity", "photo id " + photoId);
    String userId = getIntent().getStringExtra(KlyphBundleExtras.USER_ID);
    if (photoId != null) {
        image.setElementId(photoId);
    // image.load();
    } else if (userId != null) {
        AsyncRequest loadRequest = new AsyncRequest(Query.USER_PROFILE_PHOTO, userId, "", new AsyncRequest.Callback() {

            @Override
            public void onComplete(Response response) {
                if (response.getError() == null) {
                    if (response.getGraphObjectList().size() > 0 && isDestroyed == false) {
                        Photo photo = (Photo) response.getGraphObjectList().get(0);
                        image.setElementId(photo.getObject_id());
                        image.load();
                    }
                }
            }
        });
        loadRequest.execute();
    }
}
Also used : Response(com.abewy.android.apps.klyph.core.request.Response) AsyncRequest(com.abewy.android.apps.klyph.request.AsyncRequest) ImageFragment(com.abewy.android.apps.klyph.fragment.ImageFragment) Photo(com.abewy.android.apps.klyph.core.fql.Photo)

Aggregations

Photo (com.abewy.android.apps.klyph.core.fql.Photo)1 Response (com.abewy.android.apps.klyph.core.request.Response)1 ImageFragment (com.abewy.android.apps.klyph.fragment.ImageFragment)1 AsyncRequest (com.abewy.android.apps.klyph.request.AsyncRequest)1