Search in sources :

Example 1 with ImageView

use of android.widget.ImageView in project UltimateAndroid by cymcsg.

the class TileManager method clear.

public void clear() {
    // suppress and cancel renders
    suppressRender();
    cancelRender();
    // destroy all tiles
    for (Tile m : scheduledToRender) {
        m.destroy();
    }
    scheduledToRender.clear();
    for (Tile m : alreadyRendered) {
        m.destroy();
    }
    alreadyRendered.clear();
    // the above should clear everything, but let's be redundant
    for (ScalingLayout tileGroup : tileGroups.values()) {
        int totalChildren = tileGroup.getChildCount();
        for (int i = 0; i < totalChildren; i++) {
            View child = tileGroup.getChildAt(i);
            if (child instanceof ImageView) {
                ImageView imageView = (ImageView) child;
                imageView.setImageBitmap(null);
            }
        }
        tileGroup.removeAllViews();
    }
    // clear the cache
    if (cache != null) {
        cache.clear();
    }
}
Also used : ScalingLayout(com.marshalchen.common.uimodule.tileView.layouts.ScalingLayout) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View)

Example 2 with ImageView

use of android.widget.ImageView in project UltimateAndroid by cymcsg.

the class TileManager method renderIndividualTile.

// package level access so it can be invoked by the render task
void renderIndividualTile(Tile tile) {
    // if it's already rendered, quit now
    if (alreadyRendered.contains(tile)) {
        return;
    }
    // create the image view if needed, with default settings
    tile.render(getContext());
    // add it to the list of those rendered
    alreadyRendered.add(tile);
    // get reference to the actual image view
    ImageView imageView = tile.getImageView();
    // get layout params from the tile's predefined dimensions
    LayoutParams layoutParams = getLayoutFromTile(tile);
    // add it to the appropriate set (which is already scaled)
    currentTileGroup.addView(imageView, layoutParams);
    // shouldn't be necessary, but is
    postInvalidate();
    // do we want to animate in tiles?
    if (transitionsEnabled) {
        // do we have an appropriate duration?
        if (transitionDuration > 0) {
            // create the animation (will be cleared by tile.destroy).  do this here for the postInvalidate listener
            AlphaAnimation fadeIn = new AlphaAnimation(0f, 1f);
            // set duration
            fadeIn.setDuration(transitionDuration);
            // this listener posts invalidate on complete, again should not be necessary but is
            fadeIn.setAnimationListener(transitionListener);
            // start it up
            imageView.startAnimation(fadeIn);
        }
    }
}
Also used : ImageView(android.widget.ImageView) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 3 with ImageView

use of android.widget.ImageView in project VideoPlayerManager by danylovolokh.

the class VideoPlayerManagerFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.video_player_manager_fragment, container, false);
    try {
        mVideoFileDecriptor_sample_1 = getActivity().getAssets().openFd("video_sample_1.mp4");
        mVideoFileDecriptor_sample_2 = getActivity().getAssets().openFd("video_sample_2.mp4");
    } catch (IOException e) {
        e.printStackTrace();
    }
    mVideoPlayer_1 = (VideoPlayerView) root.findViewById(R.id.video_player_1);
    mVideoPlayer_1.addMediaPlayerListener(new SimpleMainThreadMediaPlayerListener() {

        @Override
        public void onVideoPreparedMainThread() {
            // We hide the cover when video is prepared. Playback is about to start
            mVideoCover.setVisibility(View.INVISIBLE);
        }

        @Override
        public void onVideoStoppedMainThread() {
            // We show the cover when video is stopped
            mVideoCover.setVisibility(View.VISIBLE);
        }

        @Override
        public void onVideoCompletionMainThread() {
            // We show the cover when video is completed
            mVideoCover.setVisibility(View.VISIBLE);
        }
    });
    mVideoCover = (ImageView) root.findViewById(R.id.video_cover_1);
    mVideoCover.setOnClickListener(this);
    mVideoPlayer_2 = (VideoPlayerView) root.findViewById(R.id.video_player_2);
    mVideoPlayer_2.addMediaPlayerListener(new SimpleMainThreadMediaPlayerListener() {

        @Override
        public void onVideoPreparedMainThread() {
            // We hide the cover when video is prepared. Playback is about to start
            mVideoCover2.setVisibility(View.INVISIBLE);
        }

        @Override
        public void onVideoStoppedMainThread() {
            // We show the cover when video is stopped
            mVideoCover2.setVisibility(View.VISIBLE);
        }

        @Override
        public void onVideoCompletionMainThread() {
            // We show the cover when video is completed
            mVideoCover2.setVisibility(View.VISIBLE);
        }
    });
    mVideoCover2 = (ImageView) root.findViewById(R.id.video_cover_2);
    mVideoCover2.setOnClickListener(this);
    Picasso.with(getActivity()).load(R.drawable.video_sample_1_pic).into(mVideoCover);
    Picasso.with(getActivity()).load(R.drawable.video_sample_2_pic).into(mVideoCover2);
    return root;
}
Also used : SimpleMainThreadMediaPlayerListener(com.volokh.danylo.video_player_manager.ui.SimpleMainThreadMediaPlayerListener) IOException(java.io.IOException) ImageView(android.widget.ImageView) VideoPlayerView(com.volokh.danylo.video_player_manager.ui.VideoPlayerView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 4 with ImageView

use of android.widget.ImageView in project Meizhi by drakeet.

the class FloatView method setNotification.

public void setNotification(final HeadsUp headsUp) {
    this.headsUp = headsUp;
    mHandle = new Handler() {

        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            if (headsUp.isActivateStatusBar()) {
                HeadsUpManager.getInstant(getContext()).silencerNotify(headsUp);
            }
            HeadsUpManager.getInstant(getContext()).animDismiss(headsUp);
        }
    };
    cutDownTime = new CutDownTime();
    if (!headsUp.isSticky()) {
        cutDownTime.start();
    }
    cutDown = headsUp.getDuration();
    if (headsUp.getCustomView() == null) {
        View defaultView = LayoutInflater.from(getContext()).inflate(R.layout.notification, rootView, false);
        rootView.addView(defaultView);
        ImageView imageView = (ImageView) defaultView.findViewById(R.id.iconIM);
        TextView titleTV = (TextView) defaultView.findViewById(R.id.titleTV);
        TextView timeTV = (TextView) defaultView.findViewById(R.id.timeTV);
        TextView messageTV = (TextView) defaultView.findViewById(R.id.messageTV);
        imageView.setImageResource(headsUp.getIcon());
        titleTV.setText(headsUp.getTitleStr());
        messageTV.setText(headsUp.getMsgStr());
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm");
        timeTV.setText(simpleDateFormat.format(new Date()));
        if (headsUp.isExpand() && headsUp.getActions().size() > 0) {
            defaultView.findViewById(R.id.menuL).setVisibility(VISIBLE);
            defaultView.findViewById(R.id.line).setVisibility(VISIBLE);
            defaultView.findViewById(R.id.menu1).setVisibility(VISIBLE);
            ImageView imageView1 = (ImageView) defaultView.findViewById(R.id.menuIM1);
            ImageView imageView2 = (ImageView) defaultView.findViewById(R.id.menuIM2);
            ImageView imageView3 = (ImageView) defaultView.findViewById(R.id.menuIM3);
            TextView text1 = (TextView) defaultView.findViewById(R.id.menuText1);
            TextView text2 = (TextView) defaultView.findViewById(R.id.menuText2);
            TextView text3 = (TextView) defaultView.findViewById(R.id.menuText3);
            imageView1.setImageResource(headsUp.getActions().get(0).icon);
            text1.setText(headsUp.getActions().get(0).title);
            defaultView.findViewById(R.id.menu1).setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    try {
                        headsUp.getActions().get(0).actionIntent.send();
                        cancel();
                    } catch (PendingIntent.CanceledException e) {
                        e.printStackTrace();
                    }
                }
            });
            if (headsUp.getActions().size() > 1) {
                defaultView.findViewById(R.id.menu2).setVisibility(VISIBLE);
                imageView2.setImageResource(headsUp.getActions().get(1).icon);
                text2.setText(headsUp.getActions().get(1).title);
                defaultView.findViewById(R.id.menu2).setOnClickListener(new OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        try {
                            headsUp.getActions().get(1).actionIntent.send();
                            cancel();
                        } catch (PendingIntent.CanceledException e) {
                            e.printStackTrace();
                        }
                    }
                });
            }
            if (headsUp.getActions().size() > 2) {
                defaultView.findViewById(R.id.menu3).setVisibility(VISIBLE);
                imageView3.setImageResource(headsUp.getActions().get(2).icon);
                text3.setText(headsUp.getActions().get(2).title);
                defaultView.findViewById(R.id.menu3).setOnClickListener(new OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        try {
                            headsUp.getActions().get(2).actionIntent.send();
                            cancel();
                        } catch (PendingIntent.CanceledException e) {
                            e.printStackTrace();
                        }
                    }
                });
            }
        }
    } else {
        setCustomView(headsUp.getCustomView());
    }
}
Also used : Message(android.os.Message) Handler(android.os.Handler) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 5 with ImageView

use of android.widget.ImageView in project cw-omnibus by commonsguy.

the class AsyncDemoFragment method changeMenuIconAnimation.

// based on https://goo.gl/3IUM8K
private void changeMenuIconAnimation(final FloatingActionMenu menu) {
    AnimatorSet set = new AnimatorSet();
    final ImageView v = menu.getMenuIconView();
    ObjectAnimator scaleOutX = ObjectAnimator.ofFloat(v, "scaleX", 1.0f, 0.2f);
    ObjectAnimator scaleOutY = ObjectAnimator.ofFloat(v, "scaleY", 1.0f, 0.2f);
    ObjectAnimator scaleInX = ObjectAnimator.ofFloat(v, "scaleX", 0.2f, 1.0f);
    ObjectAnimator scaleInY = ObjectAnimator.ofFloat(v, "scaleY", 0.2f, 1.0f);
    scaleOutX.setDuration(50);
    scaleOutY.setDuration(50);
    scaleInX.setDuration(150);
    scaleInY.setDuration(150);
    scaleInX.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            v.setImageResource(menu.isOpened() ? R.drawable.ic_action_settings : R.drawable.ic_close);
        }
    });
    set.play(scaleOutX).with(scaleOutY);
    set.play(scaleInX).with(scaleInY).after(scaleOutX);
    set.setInterpolator(new OvershootInterpolator(2));
    menu.setIconToggleAnimatorSet(set);
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) OvershootInterpolator(android.view.animation.OvershootInterpolator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AnimatorSet(android.animation.AnimatorSet) ImageView(android.widget.ImageView)

Aggregations

ImageView (android.widget.ImageView)4143 View (android.view.View)2203 TextView (android.widget.TextView)2037 LinearLayout (android.widget.LinearLayout)481 Intent (android.content.Intent)434 Drawable (android.graphics.drawable.Drawable)393 LayoutInflater (android.view.LayoutInflater)352 Bitmap (android.graphics.Bitmap)326 ViewGroup (android.view.ViewGroup)311 ListView (android.widget.ListView)241 AdapterView (android.widget.AdapterView)238 OnClickListener (android.view.View.OnClickListener)226 RecyclerView (android.support.v7.widget.RecyclerView)190 Button (android.widget.Button)169 SuppressLint (android.annotation.SuppressLint)165 Bundle (android.os.Bundle)162 Context (android.content.Context)154 FrameLayout (android.widget.FrameLayout)150 DialogInterface (android.content.DialogInterface)139 RelativeLayout (android.widget.RelativeLayout)139