Search in sources :

Example 1 with Painting

use of com.alexvasilkov.gestures.sample.ex.utils.Painting in project GestureViews by alexvasilkov.

the class ImageCrossAnimationActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.image_cross_animation_from_screen);
    getSupportActionBarNotNull().setDisplayHomeAsUpEnabled(true);
    image = findViewById(R.id.single_image_from);
    // Loading image
    Painting painting = Painting.list(getResources())[PAINTING_ID];
    GlideHelper.loadThumb(image, painting.thumbId);
    // Setting image click listener
    image.setOnClickListener(this::showFullImage);
    // Image position may change (e.g. when screen orientation is changed), so we should update
    // fullscreen image to ensure exit animation will return image into correct position.
    image.getViewTreeObserver().addOnGlobalLayoutListener(this::onLayoutChanges);
}
Also used : Painting(com.alexvasilkov.gestures.sample.ex.utils.Painting)

Example 2 with Painting

use of com.alexvasilkov.gestures.sample.ex.utils.Painting in project GestureViews by alexvasilkov.

the class ImageCropActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.image_crop_screen);
    getSupportActionBarNotNull().setDisplayHomeAsUpEnabled(true);
    imageView = findViewById(R.id.image_crop_viewer);
    cropView = findViewById(R.id.image_crop_area);
    cropView.setImageView(imageView);
    cropView.setRulesCount(gridRulesCount, gridRulesCount);
    resultView = findViewById(R.id.image_crop_result);
    initCropOptions();
    final Painting painting = Painting.list(getResources())[PAINTING_ID];
    GlideHelper.loadFull(imageView, painting.imageId, painting.thumbId);
}
Also used : Painting(com.alexvasilkov.gestures.sample.ex.utils.Painting)

Example 3 with Painting

use of com.alexvasilkov.gestures.sample.ex.utils.Painting in project GestureViews by alexvasilkov.

the class LayoutViewerActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_viewer_screen);
    layout = findViewById(R.id.frame_layout);
    // Initializing custom example settings
    setDefaultSettings(layout.getController().getSettings());
    // Loading sample image
    final ImageView imageView = findViewById(R.id.frame_layout_image);
    final Painting painting = Painting.list(getResources())[PAINTING_ID];
    GlideHelper.loadFull(imageView, painting.imageId, painting.thumbId);
    // Handling button click
    findViewById(R.id.frame_layout_button).setOnClickListener(view -> Toast.makeText(this, "Button clicked", Toast.LENGTH_SHORT).show());
}
Also used : ImageView(android.widget.ImageView) Painting(com.alexvasilkov.gestures.sample.ex.utils.Painting)

Example 4 with Painting

use of com.alexvasilkov.gestures.sample.ex.utils.Painting in project GestureViews by alexvasilkov.

the class ListAdapter method onBindImages.

private void onBindImages(ImagesViewHolder holder, ListItem item, int pos) {
    // Computing number of hidden images, starting with no visible images
    int hidden = item.paintings == null ? 0 : item.paintings.size();
    // Going through all available image views
    for (int i = 0, size = holder.images.length; i < size; i++) {
        // Getting painting for current position (if there is one)
        final Painting painting = item.paintings != null && i < item.paintings.size() ? item.paintings.get(i) : null;
        if (painting == null) {
            // No more paintings, hiding current image
            holder.images[i].setVisibility(View.GONE);
        } else {
            // Showing painting's image for current position
            holder.images[i].setVisibility(View.VISIBLE);
            GlideHelper.loadThumb(holder.images[i], painting.thumbId);
            hidden--;
        }
    }
    // Displaying number of hidden paintings, if any
    final String countText = "+" + hidden;
    holder.count.setText(countText);
    holder.count.setVisibility(hidden > 0 ? View.VISIBLE : View.GONE);
    holder.row.setTag(R.id.tag_item, pos);
}
Also used : Painting(com.alexvasilkov.gestures.sample.ex.utils.Painting)

Example 5 with Painting

use of com.alexvasilkov.gestures.sample.ex.utils.Painting in project GestureViews by alexvasilkov.

the class ListAdapter method onBindHolder.

private void onBindHolder(ViewHolder holder, int position) {
    final Painting painting = paintings[position];
    // Storing item position for click handler
    holder.itemView.setTag(R.id.tag_item, position);
    GlideHelper.loadThumb(holder.image, painting.thumbId);
    CharSequence text = new SpannableBuilder(holder.title.getContext()).createStyle().setFont(Typeface.DEFAULT_BOLD).apply().append(painting.author).append("\n").clearStyle().append(painting.title).build();
    holder.title.setText(text);
}
Also used : SpannableBuilder(com.alexvasilkov.android.commons.texts.SpannableBuilder) Painting(com.alexvasilkov.gestures.sample.ex.utils.Painting)

Aggregations

Painting (com.alexvasilkov.gestures.sample.ex.utils.Painting)16 SpannableBuilder (com.alexvasilkov.android.commons.texts.SpannableBuilder)3 RecyclePagerAdapter (com.alexvasilkov.gestures.commons.RecyclePagerAdapter)2 SimpleTracker (com.alexvasilkov.gestures.transition.tracker.SimpleTracker)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1