Search in sources :

Example 96 with ImageView

use of android.widget.ImageView in project storymaker by StoryMaker.

the class OverlayCameraActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    overlayGroup = getIntent().getIntExtra("group", 0);
    overlayIdx = getIntent().getIntExtra("overlay", 0);
    mStoryMode = getIntent().getIntExtra("mode", -1);
    mOverlayView = new ImageView(this);
    ActivitySwipeDetector swipe = new ActivitySwipeDetector(this);
    mOverlayView.setOnTouchListener(swipe);
    mOverlayView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            closeOverlay();
        }
    });
    mSurfaceView = new SurfaceView(this);
    addContentView(mSurfaceView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    mSurfaceHolder = mSurfaceView.getHolder();
    mSurfaceHolder.addCallback(this);
    mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    addContentView(mOverlayView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
}
Also used : LayoutParams(android.view.WindowManager.LayoutParams) OnClickListener(android.view.View.OnClickListener) ImageView(android.widget.ImageView) ActivitySwipeDetector(org.storymaker.app.ui.ActivitySwipeDetector) SurfaceView(android.view.SurfaceView) ImageView(android.widget.ImageView) View(android.view.View) SurfaceView(android.view.SurfaceView)

Example 97 with ImageView

use of android.widget.ImageView in project material-intro-screen by TangoAgency.

the class SlideFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_slide, container, false);
    titleTextView = (TextView) view.findViewById(R.id.txt_title_slide);
    descriptionTextView = (TextView) view.findViewById(R.id.txt_description_slide);
    imageView = (ImageView) view.findViewById(R.id.image_slide);
    initializeView();
    return view;
}
Also used : ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 98 with ImageView

use of android.widget.ImageView in project NewPipe by TeamNewPipe.

the class VideoItemDetailFragment method updateInfo.

private void updateInfo(final StreamInfo info) {
    Activity a = getActivity();
    RelativeLayout textContentLayout = (RelativeLayout) activity.findViewById(R.id.detail_text_content_layout);
    final TextView videoTitleView = (TextView) activity.findViewById(R.id.detail_video_title_view);
    TextView uploaderView = (TextView) activity.findViewById(R.id.detail_uploader_view);
    TextView viewCountView = (TextView) activity.findViewById(R.id.detail_view_count_view);
    TextView thumbsUpView = (TextView) activity.findViewById(R.id.detail_thumbs_up_count_view);
    TextView thumbsDownView = (TextView) activity.findViewById(R.id.detail_thumbs_down_count_view);
    TextView uploadDateView = (TextView) activity.findViewById(R.id.detail_upload_date_view);
    TextView descriptionView = (TextView) activity.findViewById(R.id.detail_description_view);
    RecyclerView nextStreamView = (RecyclerView) activity.findViewById(R.id.detail_next_stream_content);
    RelativeLayout nextVideoRootFrame = (RelativeLayout) activity.findViewById(R.id.detail_next_stream_root_layout);
    TextView similarTitle = (TextView) activity.findViewById(R.id.detail_similar_title);
    Button backgroundButton = (Button) activity.findViewById(R.id.detail_stream_thumbnail_window_background_button);
    View thumbnailView = activity.findViewById(R.id.detail_thumbnail_view);
    View topView = activity.findViewById(R.id.detailTopView);
    Button channelButton = (Button) activity.findViewById(R.id.channel_button);
    // prevents a crash if the activity/fragment was already left when the response came
    if (channelButton != null) {
        progressBar.setVisibility(View.GONE);
        if (info.next_video != null) {
            // todo: activate this function or remove it
            nextStreamView.setVisibility(View.GONE);
        } else {
            nextStreamView.setVisibility(View.GONE);
            activity.findViewById(R.id.detail_similar_title).setVisibility(View.GONE);
        }
        textContentLayout.setVisibility(View.VISIBLE);
        if (android.os.Build.VERSION.SDK_INT < 18) {
            playVideoButton.setVisibility(View.VISIBLE);
        } else {
            ImageView playArrowView = (ImageView) activity.findViewById(R.id.play_arrow_view);
            playArrowView.setVisibility(View.VISIBLE);
        }
        if (!showNextStreamItem) {
            nextVideoRootFrame.setVisibility(View.GONE);
            similarTitle.setVisibility(View.GONE);
        }
        videoTitleView.setText(info.title);
        topView.setOnTouchListener(new View.OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == android.view.MotionEvent.ACTION_UP) {
                    ImageView arrow = (ImageView) activity.findViewById(R.id.toggle_description_view);
                    View extra = activity.findViewById(R.id.detailExtraView);
                    if (extra.getVisibility() == View.VISIBLE) {
                        extra.setVisibility(View.GONE);
                        arrow.setImageResource(R.drawable.arrow_down);
                    } else {
                        extra.setVisibility(View.VISIBLE);
                        arrow.setImageResource(R.drawable.arrow_up);
                    }
                }
                return true;
            }
        });
        // Since newpipe is designed to work even if certain information is not available,
        // the UI has to react on missing information.
        videoTitleView.setText(info.title);
        if (!info.uploader.isEmpty()) {
            uploaderView.setText(info.uploader);
        } else {
            activity.findViewById(R.id.detail_uploader_view).setVisibility(View.GONE);
        }
        if (info.view_count >= 0) {
            viewCountView.setText(Localization.localizeViewCount(info.view_count, a));
        } else {
            viewCountView.setVisibility(View.GONE);
        }
        if (info.dislike_count >= 0) {
            thumbsDownView.setText(Localization.localizeNumber(info.dislike_count, a));
        } else {
            thumbsDownView.setVisibility(View.INVISIBLE);
            activity.findViewById(R.id.detail_thumbs_down_count_view).setVisibility(View.GONE);
        }
        if (info.like_count >= 0) {
            thumbsUpView.setText(Localization.localizeNumber(info.like_count, a));
        } else {
            thumbsUpView.setVisibility(View.GONE);
            activity.findViewById(R.id.detail_thumbs_up_img_view).setVisibility(View.GONE);
            thumbsDownView.setVisibility(View.GONE);
            activity.findViewById(R.id.detail_thumbs_down_img_view).setVisibility(View.GONE);
        }
        if (!info.upload_date.isEmpty()) {
            uploadDateView.setText(Localization.localizeDate(info.upload_date, a));
        } else {
            uploadDateView.setVisibility(View.GONE);
        }
        if (!info.description.isEmpty()) {
            descriptionView.setText(Html.fromHtml(info.description));
        } else {
            descriptionView.setVisibility(View.GONE);
        }
        descriptionView.setMovementMethod(LinkMovementMethod.getInstance());
        // parse streams
        Vector<VideoStream> streamsToUse = new Vector<>();
        for (VideoStream i : info.video_streams) {
            if (useStream(i, streamsToUse)) {
                streamsToUse.add(i);
            }
        }
        textContentLayout.setVisibility(View.VISIBLE);
        if (info.next_video == null) {
            activity.findViewById(R.id.detail_next_stream_title).setVisibility(View.GONE);
        }
        if (info.related_streams != null && !info.related_streams.isEmpty()) {
            initSimilarVideos(info);
        } else {
            activity.findViewById(R.id.detail_similar_title).setVisibility(View.GONE);
            activity.findViewById(R.id.similar_streams_view).setVisibility(View.GONE);
        }
        setupActionBarHandler(info);
        if (autoPlayEnabled) {
            playVideo(info);
        }
        if (android.os.Build.VERSION.SDK_INT < 18) {
            playVideoButton.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    playVideo(info);
                }
            });
        }
        backgroundButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                playVideo(info);
            }
        });
        //todo: make backgroundButton handle this
        thumbnailView.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                playVideo(info);
            }
        });
        if (info.channel_url != null && info.channel_url != "") {
            channelButton.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View view) {
                    NavStack.getInstance().openChannelActivity(getActivity(), info.channel_url, info.service_id);
                }
            });
        } else {
            channelButton.setVisibility(Button.GONE);
        }
        initThumbnailViews(info);
    }
}
Also used : VideoStream(org.schabi.newpipe.extractor.stream_info.VideoStream) ReCaptchaActivity(org.schabi.newpipe.ReCaptchaActivity) ExoPlayerActivity(org.schabi.newpipe.player.ExoPlayerActivity) AppCompatActivity(android.support.v7.app.AppCompatActivity) PlayVideoActivity(org.schabi.newpipe.player.PlayVideoActivity) ErrorActivity(org.schabi.newpipe.report.ErrorActivity) Activity(android.app.Activity) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) MotionEvent(android.view.MotionEvent) Button(android.widget.Button) FloatingActionButton(android.support.design.widget.FloatingActionButton) RelativeLayout(android.widget.RelativeLayout) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) ImageView(android.widget.ImageView) Vector(java.util.Vector)

Example 99 with ImageView

use of android.widget.ImageView in project NewPipe by TeamNewPipe.

the class VideoItemDetailFragment method initThumbnailViews.

private void initThumbnailViews(final StreamInfo info) {
    ImageView videoThumbnailView = (ImageView) activity.findViewById(R.id.detail_thumbnail_view);
    ImageView uploaderThumb = (ImageView) activity.findViewById(R.id.detail_uploader_thumbnail_view);
    if (info.thumbnail_url != null && !info.thumbnail_url.isEmpty()) {
        imageLoader.displayImage(info.thumbnail_url, videoThumbnailView, displayImageOptions, new ImageLoadingListener() {

            @Override
            public void onLoadingStarted(String imageUri, View view) {
            }

            @Override
            public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
                ErrorActivity.reportError(getActivity(), failReason.getCause(), null, rootView, ErrorActivity.ErrorInfo.make(ErrorActivity.LOAD_IMAGE, NewPipe.getNameOfService(info.service_id), imageUri, R.string.could_not_load_thumbnails));
            }

            @Override
            public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
                streamThumbnail = loadedImage;
                if (streamThumbnail != null) {
                    // TODO: Change the thumbnail implementation
                    // When the thumbnail is not loaded yet, it not passes to the service in time
                    // so, I can notify the service through a broadcast, but the problem is
                    // when I click in another video, another thumbnail will be load, and will
                    // notify again, so I send the videoUrl and compare with the service's url
                    ActivityCommunicator.getCommunicator().backgroundPlayerThumbnail = streamThumbnail;
                    Intent intent = new Intent(PopupVideoPlayer.InternalListener.ACTION_UPDATE_THUMB);
                    intent.putExtra(PopupVideoPlayer.VIDEO_URL, info.webpage_url);
                    getContext().sendBroadcast(intent);
                }
            }

            @Override
            public void onLoadingCancelled(String imageUri, View view) {
            }
        });
    } else {
        videoThumbnailView.setImageResource(R.drawable.dummy_thumbnail_dark);
    }
    if (info.uploader_thumbnail_url != null && !info.uploader_thumbnail_url.isEmpty()) {
        imageLoader.displayImage(info.uploader_thumbnail_url, uploaderThumb, displayImageOptions, new ImageErrorLoadingListener(activity, rootView, info.service_id));
    }
}
Also used : Bitmap(android.graphics.Bitmap) ImageLoadingListener(com.nostra13.universalimageloader.core.listener.ImageLoadingListener) ImageErrorLoadingListener(org.schabi.newpipe.ImageErrorLoadingListener) Intent(android.content.Intent) ImageView(android.widget.ImageView) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView)

Example 100 with ImageView

use of android.widget.ImageView in project NewPipe by TeamNewPipe.

the class VideoItemDetailFragment method onStart.

@Override
public void onStart() {
    super.onStart();
    Activity a = getActivity();
    infoItemBuilder = new InfoItemBuilder(a, a.findViewById(android.R.id.content));
    if (android.os.Build.VERSION.SDK_INT < 18) {
        playVideoButton = (FloatingActionButton) a.findViewById(R.id.play_video_button);
    }
    thumbnailWindowLayout = a.findViewById(R.id.detail_stream_thumbnail_window_layout);
    Button backgroundButton = (Button) a.findViewById(R.id.detail_stream_thumbnail_window_background_button);
    // Otherwise the applications would crash.
    if (backgroundButton != null) {
        streamingServiceId = getArguments().getInt(NavStack.SERVICE_ID);
        String videoUrl = getArguments().getString(NavStack.URL);
        StreamInfoWorker siw = StreamInfoWorker.getInstance();
        siw.search(streamingServiceId, videoUrl, getActivity());
        autoPlayEnabled = getArguments().getBoolean(AUTO_PLAY);
        if (Build.VERSION.SDK_INT >= 18) {
            ImageView thumbnailView = (ImageView) activity.findViewById(R.id.detail_thumbnail_view);
            thumbnailView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {

                // This is used to synchronize the thumbnailWindowButton and the playVideoButton
                // inside the ScrollView with the actual size of the thumbnail.
                //todo: onLayoutChage sometimes not triggered
                // background buttons area seem to overlap the thumbnail view
                // So although you just clicked slightly beneath the thumbnail the action still
                // gets triggered.
                @Override
                public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
                    RelativeLayout.LayoutParams newWindowLayoutParams = (RelativeLayout.LayoutParams) thumbnailWindowLayout.getLayoutParams();
                    newWindowLayoutParams.height = bottom - top;
                    thumbnailWindowLayout.setLayoutParams(newWindowLayoutParams);
                    //noinspection SuspiciousNameCombination
                    initialThumbnailPos.set(top, left);
                }
            });
        }
    }
}
Also used : Button(android.widget.Button) FloatingActionButton(android.support.design.widget.FloatingActionButton) RelativeLayout(android.widget.RelativeLayout) ReCaptchaActivity(org.schabi.newpipe.ReCaptchaActivity) ExoPlayerActivity(org.schabi.newpipe.player.ExoPlayerActivity) AppCompatActivity(android.support.v7.app.AppCompatActivity) PlayVideoActivity(org.schabi.newpipe.player.PlayVideoActivity) ErrorActivity(org.schabi.newpipe.report.ErrorActivity) Activity(android.app.Activity) InfoItemBuilder(org.schabi.newpipe.info_list.InfoItemBuilder) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) Point(android.graphics.Point)

Aggregations

ImageView (android.widget.ImageView)2176 View (android.view.View)1100 TextView (android.widget.TextView)963 Drawable (android.graphics.drawable.Drawable)192 Intent (android.content.Intent)191 LinearLayout (android.widget.LinearLayout)187 Bitmap (android.graphics.Bitmap)175 ViewGroup (android.view.ViewGroup)161 LayoutInflater (android.view.LayoutInflater)155 OnClickListener (android.view.View.OnClickListener)142 AdapterView (android.widget.AdapterView)108 ListView (android.widget.ListView)101 RecyclerView (android.support.v7.widget.RecyclerView)97 FrameLayout (android.widget.FrameLayout)95 Button (android.widget.Button)80 BitmapDrawable (android.graphics.drawable.BitmapDrawable)75 Bundle (android.os.Bundle)73 Test (org.junit.Test)70 RelativeLayout (android.widget.RelativeLayout)69 Context (android.content.Context)65