示例#1
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            ViewHolder holder;
            var        videoInfo = weClipdata[position];

            if (convertView == null)
            {
                convertView                 = activity.LayoutInflater.Inflate(Resource.Layout.WeClipSearchFragmentItem, parent, false);
                holder                      = new ViewHolder();
                holder.ivWeClipPhoto        = convertView.FindViewById <ImageView>(Resource.Id.ivWSFItemPhoto);
                holder.ivWeClipPhoto.Click += delegate
                {
                    var weclipVideo = new WeClipVideo
                    {
                        VideoFileName = videoInfo.Filename,
                        VideoFileUrl  = videoInfo.VideoFileUrl,
                        EventName     = videoInfo.EventName,
                        WeClipTitle   = videoInfo.WeClipTitle,
                        WeClipTag     = videoInfo.WeClipTag
                    };
                    var videoPlayerActivity = new Android.Content.Intent(activity, typeof(VideoPlayerActivity));
                    videoPlayerActivity.PutExtra("VideoUrl", JsonConvert.SerializeObject(weclipVideo));
                    activity.StartActivity(videoPlayerActivity);
                };

                holder.ivWeClipOverImage = convertView.FindViewById <ImageView>(Resource.Id.ivWSFItemPhoto);
                convertView.Tag          = holder;
            }
            else
            {
                holder = convertView.Tag as ViewHolder;
            }

            Picasso.With(activity).Load(weClipdata[position].ImageFileUrl).Placeholder(Resource.Drawable.default_event_back)
            .Transform(new RoundedTransformation())
            .Resize(150, 150).Into(holder.ivWeClipPhoto);
            return(convertView);
        }
示例#2
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            ThemeViewHolder holder;
            var             item = themelist[position];

            if (convertView == null)
            {
                convertView              = activity.LayoutInflater.Inflate(Resource.Layout.ThemeViewItem, parent, false);
                holder                   = new ThemeViewHolder();
                holder.Themename         = convertView.FindViewById <TextView>(Resource.Id.tvThemeViewName);
                holder.Themepicture      = convertView.FindViewById <ImageView>(Resource.Id.ivThemeViewItemPic);
                holder.PlayButton        = convertView.FindViewById <ImageView>(Resource.Id.ivThemeViewPlay);
                holder.PlayButton.Click += delegate
                {
                    var weclipVideo = new WeClipVideo
                    {
                        VideoFileName = item.Filename,
                        VideoFileUrl  = item.FileUrl,
                        EventName     = item.Name
                    };
                    var videoPlayerActivity = new Android.Content.Intent(activity, typeof(VideoPlayerActivity));
                    videoPlayerActivity.PutExtra("VideoUrlFromTheme", JsonConvert.SerializeObject(weclipVideo));
                    activity.StartActivity(videoPlayerActivity);
                };
                convertView.Tag = holder;
            }
            else
            {
                holder = convertView.Tag as ThemeViewHolder;
            }

            holder.Themename.Text = item.Name;
            holder.PlayButton.SetImageResource(Resource.Drawable.play_little);
            Picasso.With(activity).Load(item.Thumb).Placeholder(Resource.Drawable.default_event_back)
            .Resize(80, 80).Into(holder.Themepicture);
            return(convertView);
        }
示例#3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                SetContentView(Resource.Layout.VideoPlayer);
                Toolbar  toolbar       = (Toolbar)FindViewById(Resource.Id.toolbar);
                TextView toolbar_title = (TextView)FindViewById(Resource.Id.toolbar_title);
                pDialog = FindViewById <ProgressBar>(Resource.Id.progessbar);
                SetSupportActionBar(toolbar);

                Window.SetSoftInputMode(SoftInput.StateAlwaysHidden);

                if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
                {
                    Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
                    Window.SetStatusBarColor(new Android.Graphics.Color(Android.Support.V4.Content.ContextCompat.GetColor(this, Resource.Color.primaryDark)));
                }

                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetHomeButtonEnabled(true);

                var url          = Intent.GetStringExtra("VideoUrl") ?? null;
                var urlFromEvent = Intent.GetStringExtra("VideoUrlFromEvent") ?? null;
                urlFromTheme = Intent.GetStringExtra("VideoUrlFromTheme") ?? null;


                if (url != null && url != "")
                {
                    SupportActionBar.Title = "";
                    toolbar_title.Text     = "WeClip";
                    videoInfo     = JsonConvert.DeserializeObject <WeClipVideo>(url);
                    videoUri      = Android.Net.Uri.Parse(videoInfo.VideoFileUrl);
                    EventName     = videoInfo.EventName;
                    EventDate     = videoInfo.EventDate;
                    videoFileName = videoInfo.VideoFileName;
                    videoUrl      = videoInfo.VideoFileUrl;

                    shareTitle = videoInfo.EventName;
                    shareDate  = videoInfo.EventDate != null?videoInfo.EventDate.ToString() : "";

                    sharePath = videoInfo.VideoFileUrl;
                }
                else if (!string.IsNullOrEmpty(urlFromEvent))
                {
                    SupportActionBar.Title = "";
                    toolbar_title.Text     = "Event Video";
                    EventvideoInfo         = JsonConvert.DeserializeObject <EventFiles>(urlFromEvent);
                    videoUri      = Android.Net.Uri.Parse(EventvideoInfo.FileUrl);
                    EventName     = EventvideoInfo.EventName;
                    videoFileName = EventvideoInfo.FileName;
                    videoUrl      = EventvideoInfo.FileUrl;
                    shareTitle    = EventvideoInfo.EventName;
                    shareDate     = "";
                    sharePath     = EventvideoInfo.FileUrl;
                }

                else if (!string.IsNullOrEmpty(urlFromTheme))
                {
                    SupportActionBar.Title = "";
                    videoInfo          = JsonConvert.DeserializeObject <WeClipVideo>(urlFromTheme);
                    toolbar_title.Text = videoInfo.EventName;
                    videoUri           = Android.Net.Uri.Parse(videoInfo.VideoFileUrl);
                    videoFileName      = videoInfo.VideoFileName;
                    videoUrl           = videoInfo.VideoFileUrl;

                    shareTitle = videoInfo.EventName;
                    shareDate  = videoInfo.EventDate != null?videoInfo.EventDate.ToString() : "";

                    sharePath = videoInfo.VideoFileUrl;
                }

                if (videoUri == null)
                {
                    AlertBox.Create("Alert", "Error in WeClip source.", this);
                    return;
                }
                if (getfileFromPath(videoFileName))
                {
                    videoUri = localFileUrl;
                }

                llVideoView   = FindViewById <LinearLayout>(Resource.Id.llVideoView);
                playerSurface = FindViewById <SurfaceView>(Resource.Id.playerSurface);

                vidHolder = playerSurface.Holder;
                vidHolder.AddCallback(this);

                pDialog.Visibility = ViewStates.Visible;

                mediaController = new Android.Widget.MediaController(this);
            }
            catch (System.Exception ex)
            {
            }
        }
示例#4
0
 public onClickListner(FragmentActivity activity, WeClipVideo weclipVideoInfo)
 {
     this.activity        = activity;
     this.weclipVideoInfo = weclipVideoInfo;
 }