Search in sources :

Example 1 with ParametersHolder

use of com.trovebox.android.common.ui.adapter.PhotosEndlessAdapter.ParametersHolder in project mobile-android by photo.

the class PhotoDetailsFragment method initFromIntent.

public int initFromIntent(Intent intent) {
    int position = -1;
    if (intent.hasExtra(EXTRA_PHOTO)) {
        Photo photo = intent.getParcelableExtra(EXTRA_PHOTO);
        ArrayList<Photo> photos = new ArrayList<Photo>();
        photos.add(photo);
        thumbnailsAdapter = new ThumbnailsAdapter(photos);
        position = 0;
    } else if (intent.hasExtra(EXTRA_PHOTOS)) {
        ArrayList<Photo> photos = intent.getParcelableArrayListExtra(EXTRA_PHOTOS);
        thumbnailsAdapter = new ThumbnailsAdapter(photos);
        position = 0;
    } else if (intent.hasExtra(EXTRA_ADAPTER_PHOTOS)) {
        PhotosEndlessAdapter.ParametersHolder parameters = (ParametersHolder) intent.getParcelableExtra(EXTRA_ADAPTER_PHOTOS);
        position = parameters.getPosition();
        thumbnailsAdapter = new ThumbnailsAdapter(parameters);
    }
    return position;
}
Also used : PhotosEndlessAdapter(com.trovebox.android.common.ui.adapter.PhotosEndlessAdapter) ParametersHolder(com.trovebox.android.common.ui.adapter.PhotosEndlessAdapter.ParametersHolder) ArrayList(java.util.ArrayList) Photo(com.trovebox.android.common.model.Photo) ParametersHolder(com.trovebox.android.common.ui.adapter.PhotosEndlessAdapter.ParametersHolder)

Example 2 with ParametersHolder

use of com.trovebox.android.common.ui.adapter.PhotosEndlessAdapter.ParametersHolder in project mobile-android by photo.

the class PhotoDetailsFragment method onSaveInstanceState.

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelable(EXTRA_ADAPTER_PHOTOS, new ParametersHolder(thumbnailsAdapter, mAdapter.currentPhoto));
}
Also used : ParametersHolder(com.trovebox.android.common.ui.adapter.PhotosEndlessAdapter.ParametersHolder)

Example 3 with ParametersHolder

use of com.trovebox.android.common.ui.adapter.PhotosEndlessAdapter.ParametersHolder in project mobile-android by photo.

the class PhotoDetailsFragment method init.

void init(View v, Bundle savedInstanceState) {
    titleText = (TextView) v.findViewById(R.id.image_title);
    dateText = (TextView) v.findViewById(R.id.image_date);
    privateBtn = (ImageView) v.findViewById(R.id.button_private);
    detailsView = v.findViewById(R.id.image_details);
    int position = 0;
    if (savedInstanceState != null) {
        PhotosEndlessAdapter.ParametersHolder parameters = (ParametersHolder) savedInstanceState.getParcelable(EXTRA_ADAPTER_PHOTOS);
        position = parameters.getPosition();
        thumbnailsAdapter = new ThumbnailsAdapter(parameters);
    } else {
        position = initFromIntent(getActivity().getIntent());
    }
    initImageViewers(v, position);
}
Also used : PhotosEndlessAdapter(com.trovebox.android.common.ui.adapter.PhotosEndlessAdapter) ParametersHolder(com.trovebox.android.common.ui.adapter.PhotosEndlessAdapter.ParametersHolder) ParametersHolder(com.trovebox.android.common.ui.adapter.PhotosEndlessAdapter.ParametersHolder)

Aggregations

ParametersHolder (com.trovebox.android.common.ui.adapter.PhotosEndlessAdapter.ParametersHolder)3 PhotosEndlessAdapter (com.trovebox.android.common.ui.adapter.PhotosEndlessAdapter)2 Photo (com.trovebox.android.common.model.Photo)1 ArrayList (java.util.ArrayList)1