Example usage for android.widget ImageView post

List of usage examples for android.widget ImageView post

Introduction

In this page you can find the example usage for android.widget ImageView post.

Prototype

public boolean post(Runnable action) 

Source Link

Document

Causes the Runnable to be added to the message queue.

Usage

From source file:com.ncode.android.apps.schedo.ui.EventsFragment.java

@Override
public void bindCollectionItemView(Context context, View view, int groupId, int indexInGroup, int dataIndex,
        Object tag) {/*from w  ww.j  a  v a2s . co  m*/
    if (mCursor == null || !mCursor.moveToPosition(dataIndex)) {
        LOGW(TAG, "Can't bind collection view item, dataIndex=" + dataIndex
                + (mCursor == null ? ": cursor is null" : ": bad data index."));
        return;
    }

    final String eventId = mCursor.getString(EventsQuery.EVENT_ID);
    if (eventId == null) {
        return;
    }

    // first, read event info from cursor and put it in convenience variables
    final String eventTitle = mCursor.getString(EventsQuery.TITLE);
    final String speakerNames = mCursor.getString(EventsQuery.SPEAKER_NAMES);
    final String eventAbstract = mCursor.getString(EventsQuery.ABSTRACT);
    final String[] eventDays = mCursor.getString(EventsQuery.EVENT_DAYS).split(",");
    final long eventStart = Long.valueOf(eventDays[0]).longValue();
    final long eventEnd = Long.valueOf(eventDays[eventDays.length / 2]).longValue();
    //final String roomName = mCursor.getString(EventsQuery.ROOM_NAME);
    int eventColor = mCursor.getInt(EventsQuery.COLOR);
    eventColor = eventColor == 0 ? getResources().getColor(R.color.default_event_color) : eventColor;
    int darkEventColor = 0;
    final String snippet = mIsSearchCursor ? mCursor.getString(EventsQuery.SNIPPET) : null;
    final Spannable styledSnippet = mIsSearchCursor ? buildStyledSnippet(snippet) : null;
    final boolean starred = mCursor.getInt(EventsQuery.IN_MY_SCHEDULE) != 0;
    final String[] tags = mCursor.getString(EventsQuery.TAGS).split(",");

    // now let's compute a few pieces of information from the data, which we will use
    // later to decide what to render where
    final boolean hasLivestream = !TextUtils.isEmpty(mCursor.getString(EventsQuery.LIVESTREAM_URL));
    final long now = UIUtils.getCurrentTime(context);
    final boolean happeningNow = now >= eventStart && now <= eventEnd;

    // text that says "LIVE" if event is live, or empty if event is not live
    final String liveNowText = hasLivestream ? " " + UIUtils.getLiveBadgeText(context, eventStart, eventEnd)
            : "";

    // get reference to all the views in the layout we will need
    final TextView titleView = (TextView) view.findViewById(R.id.session_title);
    final TextView subtitleView = (TextView) view.findViewById(R.id.session_subtitle);
    final TextView shortSubtitleView = (TextView) view.findViewById(R.id.session_subtitle_short);
    final TextView snippetView = (TextView) view.findViewById(R.id.session_snippet);
    final TextView abstractView = (TextView) view.findViewById(R.id.session_abstract);
    final TextView categoryView = (TextView) view.findViewById(R.id.session_category);
    final View eventTargetView = view.findViewById(R.id.session_target);

    if (eventColor == 0) {
        // use default
        eventColor = mDefaultEventColor;
    }

    if (mNoTrackBranding) {
        eventColor = getResources().getColor(R.color.no_track_branding_session_color);
    }

    darkEventColor = UIUtils.scaleSessionColorToDefaultBG(eventColor);

    ImageView photoView = (ImageView) view.findViewById(R.id.session_photo_colored);
    if (photoView != null) {
        if (!mPreloader.isDimensSet()) {
            final ImageView finalPhotoView = photoView;
            photoView.post(new Runnable() {
                @Override
                public void run() {
                    mPreloader.setDimens(finalPhotoView.getWidth(), finalPhotoView.getHeight());
                }
            });
        }
        // colored
        photoView
                .setColorFilter(mNoTrackBranding
                        ? new PorterDuffColorFilter(
                                getResources().getColor(R.color.no_track_branding_session_tile_overlay),
                                PorterDuff.Mode.SRC_ATOP)
                        : UIUtils.makeSessionImageScrimColorFilter(darkEventColor));
    } else {
        photoView = (ImageView) view.findViewById(R.id.session_photo);
    }
    ViewCompat.setTransitionName(photoView, "photo_" + eventId);

    // when we load a photo, it will fade in from transparent so the
    // background of the container must be the event color to avoid a white flash
    ViewParent parent = photoView.getParent();
    if (parent != null && parent instanceof View) {
        ((View) parent).setBackgroundColor(darkEventColor);
    } else {
        photoView.setBackgroundColor(darkEventColor);
    }

    String photo = mCursor.getString(EventsQuery.PHOTO_URL);
    if (!TextUtils.isEmpty(photo)) {
        mImageLoader.loadImage(photo, photoView, true /*crop*/);
    } else {
        // cleaning the (potentially) recycled photoView, in case this event has no photo:
        photoView.setImageDrawable(null);
    }

    // render title
    titleView.setText(eventTitle == null ? "?" : eventTitle);

    // render subtitle into either the subtitle view, or the short subtitle view, as available
    if (subtitleView != null) {
        subtitleView.setText(UIUtils.formatEventSubtitle(eventStart, eventEnd, mBuffer, context) + liveNowText);
    } else if (shortSubtitleView != null) {
        shortSubtitleView.setText(
                UIUtils.formatEventSubtitle(eventStart, eventEnd, mBuffer, context, true) + liveNowText);
    }

    // render category
    if (categoryView != null) {
        TagMetadata.Tag groupTag = mTagMetadata.getGroupTag(tags, Config.Tags.EVENT_GROUPING_TAG_CATEGORY);
        if (groupTag != null && !Config.Tags.EVENTS.equals(groupTag.getId())) {
            categoryView.setText(groupTag.getName());
            categoryView.setVisibility(View.VISIBLE);
        } else {
            categoryView.setVisibility(View.GONE);
        }
    }

    // if a snippet view is available, render the event snippet there.
    if (snippetView != null) {
        if (mIsSearchCursor) {
            // render the search snippet into the snippet view
            snippetView.setText(styledSnippet);
        } else {
            // render speaker names and abstracts into the snippet view
            mBuffer.setLength(0);
            if (!TextUtils.isEmpty(speakerNames)) {
                mBuffer.append(speakerNames).append(". ");
            }
            if (!TextUtils.isEmpty(eventAbstract)) {
                mBuffer.append(eventAbstract);
            }
            snippetView.setText(mBuffer.toString());
        }
    }

    if (abstractView != null && !mIsSearchCursor) {
        // render speaker names and abstracts into the abstract view
        mBuffer.setLength(0);
        if (!TextUtils.isEmpty(speakerNames)) {
            mBuffer.append(speakerNames).append("\n\n");
        }
        if (!TextUtils.isEmpty(eventAbstract)) {
            mBuffer.append(eventAbstract);
        }
        abstractView.setText(mBuffer.toString());
    }

    // show or hide the "in my schedule" indicator
    view.findViewById(R.id.indicator_in_schedule).setVisibility(starred ? View.VISIBLE : View.INVISIBLE);

    // if we are in condensed mode and this card is the hero card (big card at the top
    // of the screen), set up the message card if necessary.
    if (!useExpandedMode() && groupId == HERO_GROUP_ID) {
        // this is the hero view, so we might want to show a message card
        final boolean cardShown = setupMessageCard(view);

        // if this is the wide hero layout, show or hide the card or the event abstract
        // view, as appropriate (they are mutually exclusive).
        final View cardContainer = view.findViewById(R.id.message_card_container_wide);
        final View abstractContainer = view.findViewById(R.id.session_abstract);
        if (cardContainer != null && abstractContainer != null) {
            cardContainer.setVisibility(cardShown ? View.VISIBLE : View.GONE);
            abstractContainer.setVisibility(cardShown ? View.GONE : View.VISIBLE);
            abstractContainer.setBackgroundColor(darkEventColor);
        }
    }

    // if this event is live right now, display the "LIVE NOW" icon on top of it
    View liveNowBadge = view.findViewById(R.id.live_now_badge);
    if (liveNowBadge != null) {
        liveNowBadge.setVisibility(happeningNow && hasLivestream ? View.VISIBLE : View.GONE);
    }

    // if this view is clicked, open the event details view
    final View finalPhotoView = photoView;
    eventTargetView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mCallbacks.onEventSelected(eventId, finalPhotoView);
        }
    });

    // animate this card
    if (dataIndex > mMaxDataIndexAnimated) {
        mMaxDataIndexAnimated = dataIndex;
    }
}

From source file:com.google.samples.apps.iosched.ui.SessionsFragment.java

@Override
public void bindCollectionItemView(Context context, View view, int groupId, int indexInGroup, int dataIndex,
        Object tag) {/*from  w  ww .  j av a  2  s. co  m*/
    if (mCursor == null || !mCursor.moveToPosition(dataIndex)) {
        LOGW(TAG, "Can't bind collection view item, dataIndex=" + dataIndex
                + (mCursor == null ? ": cursor is null" : ": bad data index."));
        return;
    }

    final String sessionId = mCursor.getString(SessionsQuery.SESSION_ID);
    if (sessionId == null) {
        return;
    }

    // first, read session info from cursor and put it in convenience variables
    final String sessionTitle = mCursor.getString(SessionsQuery.TITLE);
    final String speakerNames = mCursor.getString(SessionsQuery.SPEAKER_NAMES);
    final String sessionAbstract = mCursor.getString(SessionsQuery.ABSTRACT);
    final long sessionStart = mCursor.getLong(SessionsQuery.SESSION_START);
    final long sessionEnd = mCursor.getLong(SessionsQuery.SESSION_END);
    final String roomName = mCursor.getString(SessionsQuery.ROOM_NAME);
    int sessionColor = mCursor.getInt(SessionsQuery.COLOR);
    sessionColor = sessionColor == 0 ? getResources().getColor(R.color.default_session_color) : sessionColor;
    int darkSessionColor = 0;
    final String snippet = mIsSearchCursor ? mCursor.getString(SessionsQuery.SNIPPET) : null;
    final Spannable styledSnippet = mIsSearchCursor ? buildStyledSnippet(snippet) : null;
    final boolean starred = mCursor.getInt(SessionsQuery.IN_MY_SCHEDULE) != 0;
    final String[] tags = mCursor.getString(SessionsQuery.TAGS).split(",");

    // now let's compute a few pieces of information from the data, which we will use
    // later to decide what to render where
    final boolean hasLivestream = !TextUtils.isEmpty(mCursor.getString(SessionsQuery.LIVESTREAM_URL));
    final long now = UIUtils.getCurrentTime(context);
    final boolean happeningNow = now >= sessionStart && now <= sessionEnd;

    // text that says "LIVE" if session is live, or empty if session is not live
    final String liveNowText = hasLivestream ? " " + UIUtils.getLiveBadgeText(context, sessionStart, sessionEnd)
            : "";

    // get reference to all the views in the layout we will need
    final TextView titleView = (TextView) view.findViewById(R.id.session_title);
    final TextView subtitleView = (TextView) view.findViewById(R.id.session_subtitle);
    final TextView shortSubtitleView = (TextView) view.findViewById(R.id.session_subtitle_short);
    final TextView snippetView = (TextView) view.findViewById(R.id.session_snippet);
    final TextView abstractView = (TextView) view.findViewById(R.id.session_abstract);
    final TextView categoryView = (TextView) view.findViewById(R.id.session_category);
    final View sessionTargetView = view.findViewById(R.id.session_target);

    if (sessionColor == 0) {
        // use default
        sessionColor = mDefaultSessionColor;
    }

    if (mNoTrackBranding) {
        sessionColor = getResources().getColor(R.color.no_track_branding_session_color);
    }

    darkSessionColor = UIUtils.scaleSessionColorToDefaultBG(sessionColor);

    ImageView photoView = (ImageView) view.findViewById(R.id.session_photo_colored);
    if (photoView != null) {
        if (!mPreloader.isDimensSet()) {
            final ImageView finalPhotoView = photoView;
            photoView.post(new Runnable() {
                @Override
                public void run() {
                    mPreloader.setDimens(finalPhotoView.getWidth(), finalPhotoView.getHeight());
                }
            });
        }
        // colored
        photoView
                .setColorFilter(mNoTrackBranding
                        ? new PorterDuffColorFilter(
                                getResources().getColor(R.color.no_track_branding_session_tile_overlay),
                                PorterDuff.Mode.SRC_ATOP)
                        : UIUtils.makeSessionImageScrimColorFilter(darkSessionColor));
    } else {
        photoView = (ImageView) view.findViewById(R.id.session_photo);
    }
    ViewCompat.setTransitionName(photoView, "photo_" + sessionId);

    // when we load a photo, it will fade in from transparent so the
    // background of the container must be the session color to avoid a white flash
    ViewParent parent = photoView.getParent();
    if (parent != null && parent instanceof View) {
        ((View) parent).setBackgroundColor(darkSessionColor);
    } else {
        photoView.setBackgroundColor(darkSessionColor);
    }

    String photo = mCursor.getString(SessionsQuery.PHOTO_URL);
    if (!TextUtils.isEmpty(photo)) {
        mImageLoader.loadImage(photo, photoView, true /*crop*/);
    } else {
        // cleaning the (potentially) recycled photoView, in case this session has no photo:
        photoView.setImageDrawable(null);
    }

    // render title
    titleView.setText(sessionTitle == null ? "?" : sessionTitle);

    // render subtitle into either the subtitle view, or the short subtitle view, as available
    if (subtitleView != null) {
        subtitleView.setText(UIUtils.formatSessionSubtitle(sessionStart, sessionEnd, roomName, mBuffer, context)
                + liveNowText);
    } else if (shortSubtitleView != null) {
        shortSubtitleView.setText(
                UIUtils.formatSessionSubtitle(sessionStart, sessionEnd, roomName, mBuffer, context, true)
                        + liveNowText);
    }

    // render category
    if (categoryView != null) {
        TagMetadata.Tag groupTag = mTagMetadata.getSessionGroupTag(tags);
        if (groupTag != null && !Config.Tags.SESSIONS.equals(groupTag.getId())) {
            categoryView.setText(groupTag.getName());
            categoryView.setVisibility(View.VISIBLE);
        } else {
            categoryView.setVisibility(View.GONE);
        }
    }

    // if a snippet view is available, render the session snippet there.
    if (snippetView != null) {
        if (mIsSearchCursor) {
            // render the search snippet into the snippet view
            snippetView.setText(styledSnippet);
        } else {
            // render speaker names and abstracts into the snippet view
            mBuffer.setLength(0);
            if (!TextUtils.isEmpty(speakerNames)) {
                mBuffer.append(speakerNames).append(". ");
            }
            if (!TextUtils.isEmpty(sessionAbstract)) {
                mBuffer.append(sessionAbstract);
            }
            snippetView.setText(mBuffer.toString());
        }
    }

    if (abstractView != null && !mIsSearchCursor) {
        // render speaker names and abstracts into the abstract view
        mBuffer.setLength(0);
        if (!TextUtils.isEmpty(speakerNames)) {
            mBuffer.append(speakerNames).append("\n\n");
        }
        if (!TextUtils.isEmpty(sessionAbstract)) {
            mBuffer.append(sessionAbstract);
        }
        abstractView.setText(mBuffer.toString());
    }

    // show or hide the "in my schedule" indicator
    view.findViewById(R.id.indicator_in_schedule).setVisibility(starred ? View.VISIBLE : View.INVISIBLE);

    // if we are in condensed mode and this card is the hero card (big card at the top
    // of the screen), set up the message card if necessary.
    if (!useExpandedMode() && groupId == HERO_GROUP_ID) {
        // this is the hero view, so we might want to show a message card
        final boolean cardShown = setupMessageCard(view);

        // if this is the wide hero layout, show or hide the card or the session abstract
        // view, as appropriate (they are mutually exclusive).
        final View cardContainer = view.findViewById(R.id.message_card_container_wide);
        final View abstractContainer = view.findViewById(R.id.session_abstract);
        if (cardContainer != null && abstractContainer != null) {
            cardContainer.setVisibility(cardShown ? View.VISIBLE : View.GONE);
            abstractContainer.setVisibility(cardShown ? View.GONE : View.VISIBLE);
            abstractContainer.setBackgroundColor(darkSessionColor);
        }
    }

    // if this session is live right now, display the "LIVE NOW" icon on top of it
    View liveNowBadge = view.findViewById(R.id.live_now_badge);
    if (liveNowBadge != null) {
        liveNowBadge.setVisibility(happeningNow && hasLivestream ? View.VISIBLE : View.GONE);
    }

    // if this view is clicked, open the session details view
    final View finalPhotoView = photoView;
    sessionTargetView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mCallbacks.onSessionSelected(sessionId, finalPhotoView);
        }
    });

    // animate this card
    if (dataIndex > mMaxDataIndexAnimated) {
        mMaxDataIndexAnimated = dataIndex;
    }
}

From source file:com.ncode.android.apps.schedo.ui.SessionsFragment.java

@Override
public void bindCollectionItemView(Context context, View view, int groupId, int indexInGroup, int dataIndex,
        Object tag) {//from  w  w w .j  av  a 2  s.c o m
    if (mCursor == null || !mCursor.moveToPosition(dataIndex)) {
        LOGW(TAG, "Can't bind collection view item, dataIndex=" + dataIndex
                + (mCursor == null ? ": cursor is null" : ": bad data index."));
        return;
    }

    final String sessionId = mCursor.getString(SessionsQuery.SESSION_ID);
    if (sessionId == null) {
        return;
    }

    // first, read session info from cursor and put it in convenience variables
    final String sessionTitle = mCursor.getString(SessionsQuery.TITLE);
    final String speakerNames = mCursor.getString(SessionsQuery.SPEAKER_NAMES);
    final String sessionAbstract = mCursor.getString(SessionsQuery.ABSTRACT);
    final long sessionStart = mCursor.getLong(SessionsQuery.SESSION_START);
    final long sessionEnd = mCursor.getLong(SessionsQuery.SESSION_END);
    final String roomName = mCursor.getString(SessionsQuery.ROOM_NAME);
    int sessionColor = mCursor.getInt(SessionsQuery.COLOR);
    sessionColor = sessionColor == 0 ? getResources().getColor(R.color.default_session_color) : sessionColor;
    int darkSessionColor = 0;
    final String snippet = mIsSearchCursor ? mCursor.getString(SessionsQuery.SNIPPET) : null;
    final Spannable styledSnippet = mIsSearchCursor ? buildStyledSnippet(snippet) : null;
    final boolean starred = mCursor.getInt(SessionsQuery.IN_MY_SCHEDULE) != 0;
    final String[] tags = mCursor.getString(SessionsQuery.TAGS).split(",");

    // now let's compute a few pieces of information from the data, which we will use
    // later to decide what to render where
    final boolean hasLivestream = !TextUtils.isEmpty(mCursor.getString(SessionsQuery.LIVESTREAM_URL));
    final long now = UIUtils.getCurrentTime(context);
    final boolean happeningNow = now >= sessionStart && now <= sessionEnd;

    // text that says "LIVE" if session is live, or empty if session is not live
    final String liveNowText = hasLivestream ? " " + UIUtils.getLiveBadgeText(context, sessionStart, sessionEnd)
            : "";

    // get reference to all the views in the layout we will need
    final TextView titleView = (TextView) view.findViewById(R.id.session_title);
    final TextView subtitleView = (TextView) view.findViewById(R.id.session_subtitle);
    final TextView shortSubtitleView = (TextView) view.findViewById(R.id.session_subtitle_short);
    final TextView snippetView = (TextView) view.findViewById(R.id.session_snippet);
    final TextView abstractView = (TextView) view.findViewById(R.id.session_abstract);
    final TextView categoryView = (TextView) view.findViewById(R.id.session_category);
    final View sessionTargetView = view.findViewById(R.id.session_target);

    if (sessionColor == 0) {
        // use default
        sessionColor = mDefaultSessionColor;
    }

    if (mNoTrackBranding) {
        sessionColor = getResources().getColor(R.color.no_track_branding_session_color);
    }

    darkSessionColor = UIUtils.scaleSessionColorToDefaultBG(sessionColor);

    ImageView photoView = (ImageView) view.findViewById(R.id.session_photo_colored);
    if (photoView != null) {
        if (!mPreloader.isDimensSet()) {
            final ImageView finalPhotoView = photoView;
            photoView.post(new Runnable() {
                @Override
                public void run() {
                    mPreloader.setDimens(finalPhotoView.getWidth(), finalPhotoView.getHeight());
                }
            });
        }
        // colored
        photoView
                .setColorFilter(mNoTrackBranding
                        ? new PorterDuffColorFilter(
                                getResources().getColor(R.color.no_track_branding_session_tile_overlay),
                                PorterDuff.Mode.SRC_ATOP)
                        : UIUtils.makeSessionImageScrimColorFilter(darkSessionColor));
    } else {
        photoView = (ImageView) view.findViewById(R.id.session_photo);
    }
    ViewCompat.setTransitionName(photoView, "photo_" + sessionId);

    // when we load a photo, it will fade in from transparent so the
    // background of the container must be the session color to avoid a white flash
    ViewParent parent = photoView.getParent();
    if (parent != null && parent instanceof View) {
        ((View) parent).setBackgroundColor(darkSessionColor);
    } else {
        photoView.setBackgroundColor(darkSessionColor);
    }

    String photo = mCursor.getString(SessionsQuery.PHOTO_URL);
    if (!TextUtils.isEmpty(photo)) {
        mImageLoader.loadImage(photo, photoView, true /*crop*/);
    } else {
        // cleaning the (potentially) recycled photoView, in case this session has no photo:
        photoView.setImageDrawable(null);
    }

    // render title
    titleView.setText(sessionTitle == null ? "?" : sessionTitle);

    // render subtitle into either the subtitle view, or the short subtitle view, as available
    if (subtitleView != null) {
        subtitleView.setText(UIUtils.formatSessionSubtitle(sessionStart, sessionEnd, roomName, mBuffer, context)
                + liveNowText);
    } else if (shortSubtitleView != null) {
        shortSubtitleView.setText(
                UIUtils.formatSessionSubtitle(sessionStart, sessionEnd, roomName, mBuffer, context, true)
                        + liveNowText);
    }

    // render category
    if (categoryView != null) {
        TagMetadata.Tag groupTag = mTagMetadata.getGroupTag(tags, Config.Tags.SESSION_GROUPING_TAG_CATEGORY);
        if (groupTag != null && !Config.Tags.SESSIONS.equals(groupTag.getId())) {
            categoryView.setText(groupTag.getName());
            categoryView.setVisibility(View.VISIBLE);
        } else {
            categoryView.setVisibility(View.GONE);
        }
    }

    // if a snippet view is available, render the session snippet there.
    if (snippetView != null) {
        if (mIsSearchCursor) {
            // render the search snippet into the snippet view
            snippetView.setText(styledSnippet);
        } else {
            // render speaker names and abstracts into the snippet view
            mBuffer.setLength(0);
            if (!TextUtils.isEmpty(speakerNames)) {
                mBuffer.append(speakerNames).append(". ");
            }
            if (!TextUtils.isEmpty(sessionAbstract)) {
                mBuffer.append(sessionAbstract);
            }
            snippetView.setText(mBuffer.toString());
        }
    }

    if (abstractView != null && !mIsSearchCursor) {
        // render speaker names and abstracts into the abstract view
        mBuffer.setLength(0);
        if (!TextUtils.isEmpty(speakerNames)) {
            mBuffer.append(speakerNames).append("\n\n");
        }
        if (!TextUtils.isEmpty(sessionAbstract)) {
            mBuffer.append(sessionAbstract);
        }
        abstractView.setText(mBuffer.toString());
    }

    // show or hide the "in my schedule" indicator
    view.findViewById(R.id.indicator_in_schedule).setVisibility(starred ? View.VISIBLE : View.INVISIBLE);

    // if we are in condensed mode and this card is the hero card (big card at the top
    // of the screen), set up the message card if necessary.
    if (!useExpandedMode() && groupId == HERO_GROUP_ID) {
        // this is the hero view, so we might want to show a message card
        final boolean cardShown = setupMessageCard(view);

        // if this is the wide hero layout, show or hide the card or the session abstract
        // view, as appropriate (they are mutually exclusive).
        final View cardContainer = view.findViewById(R.id.message_card_container_wide);
        final View abstractContainer = view.findViewById(R.id.session_abstract);
        if (cardContainer != null && abstractContainer != null) {
            cardContainer.setVisibility(cardShown ? View.VISIBLE : View.GONE);
            abstractContainer.setVisibility(cardShown ? View.GONE : View.VISIBLE);
            abstractContainer.setBackgroundColor(darkSessionColor);
        }
    }

    // if this session is live right now, display the "LIVE NOW" icon on top of it
    View liveNowBadge = view.findViewById(R.id.live_now_badge);
    if (liveNowBadge != null) {
        liveNowBadge.setVisibility(happeningNow && hasLivestream ? View.VISIBLE : View.GONE);
    }

    // if this view is clicked, open the session details view
    final View finalPhotoView = photoView;
    sessionTargetView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mCallbacks.onSessionSelected(sessionId, finalPhotoView);
        }
    });

    // animate this card
    if (dataIndex > mMaxDataIndexAnimated) {
        mMaxDataIndexAnimated = dataIndex;
    }
}

From source file:com.mooc.viewpage_photoview_circleindicator.photoview.PhotoViewAttacher.java

@Override
public void setScale(float scale, float focalX, float focalY, boolean animate) {
    ImageView imageView = getImageView();

    if (null != imageView) {
        // Check to see if the scale is within bounds
        if (scale < mMinScale || scale > mMaxScale) {
            return;
        }//  w  w w  .j  a v a  2 s  .co  m

        if (animate) {
            imageView.post(new AnimatedZoomRunnable(getScale(), scale, focalX, focalY));

        } else {
            mSuppMatrix.setScale(scale, scale, focalX, focalY);
            checkAndDisplayMatrix();
        }
    }
}

From source file:com.zxj.androidmvvm.common.view.photoview.PhotoViewAttacher.java

@Override
public void setScale(float scale, float focalX, float focalY, boolean animate) {
    ImageView imageView = getImageView();

    if (null != imageView) {
        // Check to see if the scale is within bounds
        if (scale < mMinScale || scale > mMaxScale) {
            ILog.i("Scale must be within the range of minScale and maxScale");
            return;
        }/* w ww  .  ja  v  a 2  s .  c om*/

        if (animate) {
            imageView.post(new AnimatedZoomRunnable(getScale(), scale, focalX, focalY));
        } else {
            mSuppMatrix.setScale(scale, scale, focalX, focalY);
            checkAndDisplayMatrix();
        }
    }
}

From source file:com.example.imagegallerydemo.photoview.PhotoViewAttacher.java

@Override
public void setScale(float scale, float focalX, float focalY, boolean animate) {
    ImageView imageView = getImageView();

    if (null != imageView) {
        // Check to see if the scale is within bounds
        if (scale < mMinScale || scale > mMaxScale) {
            Log.i(LOG_TAG, "Scale must be within the range of minScale and maxScale");
            return;
        }//w w w.  j a  va2  s .  c o m

        if (animate) {
            imageView.post(new AnimatedZoomRunnable(getScale(), scale, focalX, focalY));
        } else {
            mSuppMatrix.setScale(scale, scale, focalX, focalY);
            checkAndDisplayMatrix();
        }
    }
}

From source file:com.sflib.CustomView.photoview.PhotoViewAttacher.java

@Override
public void setScale(float scale, float focalX, float focalY, boolean animate) {
    ImageView imageView = getImageView();

    if (null != imageView) {
        // Check to see if the scale is within bounds
        if (scale < mMinScale || scale > mMaxScale) {
            L.info(LOG_TAG, "Scale must be within the range of minScale and maxScale");
            return;
        }/*  www  .  j a v a2s .c  o  m*/

        if (animate) {
            imageView.post(new AnimatedZoomRunnable(getScale(), scale, focalX, focalY));
        } else {
            mSuppMatrix.setScale(scale, scale, focalX, focalY);
            checkAndDisplayMatrix();
        }
    }
}

From source file:uk.co.senab.photoview.PhotoViewAttacher.java

public void setScale(float scale, float focalX, float focalY, boolean animate) {
    ImageView imageView = getImageView();

    if (null != imageView) {
        // Check to see if the scale is within bounds
        if (scale < mMinScale || scale > mMaxScale) {
            LogManager.getLogger().i(LOG_TAG, "Scale must be within the range of minScale and maxScale");
            return;
        }//from  www .j  a v a  2s  .c o  m

        if (animate) {
            imageView.post(new AnimatedZoomRunnable(getScale(), scale, focalX, focalY));
        } else {
            mSuppMatrix.setScale(scale, scale, focalX, focalY);
            checkAndDisplayMatrix();
        }
    }
}

From source file:com.ycl.framework.photoview.PhotoViewAttacher.java

@Override
public void setScale(float scale, float focalX, float focalY, boolean animate) {
    ImageView imageView = getImageView();

    if (null != imageView) {
        imageView.removeCallbacks(mRunColse);
        // Check to see if the scale is within bounds
        if (scale < mMinScale || scale > mMaxScale) {
            LogManager.getLogger().i(LOG_TAG, "Scale must be within the range of minScale and maxScale");
            return;
        }//from w  w w .j  a  v  a2s  . c om

        if (animate) {
            imageView.post(new AnimatedZoomRunnable(getScale(), scale, focalX, focalY));
        } else {
            mSuppMatrix.setScale(scale, scale, focalX, focalY);
            checkAndDisplayMatrix();
        }
    }
}

From source file:xue.myapp.common.photoview.PhotoViewAttacher.java

@Override
public void setScale(float scale, float focalX, float focalY, boolean animate) {
    ImageView imageView = getImageView();

    if (null != imageView) {
        // Check to see if the scale is within bounds
        if (scale < mMinScale || scale > mMaxScale) {

            LogUtil.i(LOG_TAG, "Scale must be within the range of minScale and maxScale");
            return;
        }/*from ww w  .ja  va 2s . c  o  m*/

        if (animate) {
            imageView.post(new AnimatedZoomRunnable(getScale(), scale, focalX, focalY));
        } else {
            mSuppMatrix.setScale(scale, scale, focalX, focalY);
            checkAndDisplayMatrix();
        }
    }
}